Checking everything in
This commit is contained in:
BIN
Content/TangibleActor.uasset
LFS
BIN
Content/TangibleActor.uasset
LFS
Binary file not shown.
@@ -91,15 +91,13 @@ void UlxAnimationStepLibrary::UnpackAnimationStep(UObject* into, const FlxAnimat
|
|||||||
step.Unpack(prefix, into, true);
|
step.Unpack(prefix, into, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
static FlxAnimationField FindAnimationField(const FlxAnimationStep& step, const FString& name) {
|
static FlxAnimationField FindAnimationFieldLL(const FlxAnimationStep& step, std::string_view name) {
|
||||||
std::string_view body((const char*)(step.Body.GetData()), step.Body.Num());
|
std::string_view body((const char*)(step.Body.GetData()), step.Body.Num());
|
||||||
FTCHARToUTF8 utf8name(name);
|
|
||||||
std::string_view uname(utf8name.Get(), utf8name.Length());
|
|
||||||
FlxAnimationStepDecoder decoder(body);
|
FlxAnimationStepDecoder decoder(body);
|
||||||
FlxAnimationField result;
|
FlxAnimationField result;
|
||||||
while (!decoder.AtEOF()) {
|
while (!decoder.AtEOF()) {
|
||||||
result = decoder.ReadField();
|
result = decoder.ReadField();
|
||||||
if (result.Name == uname) {
|
if (result.Name == name) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -107,6 +105,34 @@ static FlxAnimationField FindAnimationField(const FlxAnimationStep& step, const
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static FlxAnimationField FindAnimationField(const FlxAnimationStep& step, const FString& name) {
|
||||||
|
FTCHARToUTF8 utf8name(name);
|
||||||
|
std::string_view uname(utf8name.Get(), utf8name.Length());
|
||||||
|
return FindAnimationFieldLL(step, uname);
|
||||||
|
}
|
||||||
|
|
||||||
|
void FlxAnimationStep::AutoUpdateXYZ(AActor *actor) const {
|
||||||
|
FlxAnimationField xyz = FindAnimationFieldLL(*this, "xyz");
|
||||||
|
if (xyz.Type == ElxAnimValueType::XYZ) {
|
||||||
|
actor->SetActorLocation(FVector(xyz.X, xyz.Y, xyz.Z));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void FlxAnimationStep::AutoUpdateFacing(AActor *actor) const {
|
||||||
|
FlxAnimationField facing = FindAnimationFieldLL(*this, "facing");
|
||||||
|
if (facing.Type == ElxAnimValueType::NUMBER) {
|
||||||
|
actor->SetActorRotation(FRotator(0, facing.X, 0));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void FlxAnimationStep::AutoUpdatePlane(FName *planep) const {
|
||||||
|
FlxAnimationField plane = FindAnimationFieldLL(*this, "plane");
|
||||||
|
if (plane.Type == ElxAnimValueType::STRING) {
|
||||||
|
FString pname(plane.S.size(), (const UTF8CHAR*)(plane.S.data()));
|
||||||
|
*planep = FName(pname);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool UlxAnimationStepLibrary::AnimationStepIsIdle(const FlxAnimationStep &step) {
|
bool UlxAnimationStepLibrary::AnimationStepIsIdle(const FlxAnimationStep &step) {
|
||||||
return step.Finished;
|
return step.Finished;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -75,6 +75,19 @@ public:
|
|||||||
// unpacking the animation step.
|
// unpacking the animation step.
|
||||||
//
|
//
|
||||||
bool Unpack(const FString& prefix, UObject* into, bool preclear = true) const;
|
bool Unpack(const FString& prefix, UObject* into, bool preclear = true) const;
|
||||||
|
|
||||||
|
// Auto-Execute
|
||||||
|
//
|
||||||
|
// These functions automatically update certain actor
|
||||||
|
// properties:
|
||||||
|
//
|
||||||
|
// AutoUpdateXYZ(AActor *actor); // uses 'xyz' keyword
|
||||||
|
// AutoUpdateFacing(AActor *actor); // uses 'facing' keyword.
|
||||||
|
// AutoUpdatePlane(FName *plane); // uses 'plane' keyword
|
||||||
|
//
|
||||||
|
void AutoUpdateXYZ(AActor *actor) const;
|
||||||
|
void AutoUpdateFacing(AActor *actor) const;
|
||||||
|
void AutoUpdatePlane(FName *plane) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
////////////////////////////////////////////////
|
////////////////////////////////////////////////
|
||||||
|
|||||||
@@ -115,8 +115,12 @@ void UlxTangible::GetCurrentAnimation(AActor *target, FlxAnimationStep &step) {
|
|||||||
step = GetActorTangible(target)->AnimTracker.GetCurrentAnimation();
|
step = GetActorTangible(target)->AnimTracker.GetCurrentAnimation();
|
||||||
}
|
}
|
||||||
|
|
||||||
void UlxTangible::FinishedAnimation(AActor *target, const FlxAnimationStep &step) {
|
void UlxTangible::FinishedAnimation(AActor *target, const FlxAnimationStep &step, bool autoxyz, bool autofacing, bool autoplane) {
|
||||||
GetActorTangible(target)->AnimTracker.FinishedAnimation(step.Hash);
|
UlxTangible *tan = GetActorTangible(target);
|
||||||
|
if (autoxyz) step.AutoUpdateXYZ(target);
|
||||||
|
if (autofacing) step.AutoUpdateFacing(target);
|
||||||
|
if (autoplane) step.AutoUpdatePlane(&(tan->Plane));
|
||||||
|
tan->AnimTracker.FinishedAnimation(step.Hash);
|
||||||
}
|
}
|
||||||
|
|
||||||
FString UlxTangible::GetTangiblePlane(AActor* target) {
|
FString UlxTangible::GetTangiblePlane(AActor* target) {
|
||||||
|
|||||||
@@ -167,7 +167,8 @@ public:
|
|||||||
static void GetCurrentAnimation(AActor *target, FlxAnimationStep &step);
|
static void GetCurrentAnimation(AActor *target, FlxAnimationStep &step);
|
||||||
|
|
||||||
UFUNCTION(BlueprintCallable, Meta = (DefaultToSelf = "target"), Category = Luprex)
|
UFUNCTION(BlueprintCallable, Meta = (DefaultToSelf = "target"), Category = Luprex)
|
||||||
static void FinishedAnimation(AActor *target, const FlxAnimationStep &step);
|
static void FinishedAnimation(AActor *target, const FlxAnimationStep &step,
|
||||||
|
bool AutoUpdateXYZ = true, bool AutoUpdateFacing = true, bool AutoUpdatePlane = true);
|
||||||
|
|
||||||
UFUNCTION(BlueprintCallable, Meta = (DefaultToSelf = "target"), Category = Luprex)
|
UFUNCTION(BlueprintCallable, Meta = (DefaultToSelf = "target"), Category = Luprex)
|
||||||
static FString GetTangiblePlane(AActor* target);
|
static FString GetTangiblePlane(AActor* target);
|
||||||
|
|||||||
Reference in New Issue
Block a user