More refactoring on Animation Queue Changed

This commit is contained in:
2024-09-30 13:59:17 -04:00
parent 1f1f383da0
commit c1f5813f1d
7 changed files with 92 additions and 64 deletions

View File

@@ -36,34 +36,6 @@ public:
FlxAnimationStep() : Finished(false), Hash(0), Body(), Blueprint() {}
FlxAnimationStep(uint64 h, std::string_view b);
// Unpack an AnimStep into a UObject
//
// Stores the key-value pairs of the animation step into
// properties of a UObject. For example, if the key-value
// pair "color=blue" is present in the AnimStep, then this
// routine tries to find a string property "color" in the
// UObject, and then it sets that property to "blue."
//
// The prefix is prepended to the key names. For example,
// if one of the key-value pairs is "color=blue", and the
// prefix is "aq", then the property "aqColor=blue" will be
// stored in the UObject.
//
// All properties of the UObject starting with the specified
// prefix are cleared before unpacking the animation step.
//
// Returns true if all of the key-value pairs in the
// animation step could be unpacked into fields of the UObject.
// This could fail, for instance, if the UObject just doesn't
// contain one of the necessary properties. It can also
// fail if there's a type mismatch. For example, "color=blue"
// cannot be stored in a property "color" of type int.
//
// Automatically injects a boolean property "idle" representing
// whether the property's finished flag is set.
//
bool Unpack(const FString& prefix, UObject* into) const;
// Auto-Execute
//
// These functions automatically update certain actor
@@ -95,8 +67,29 @@ public:
UFUNCTION(BlueprintCallable, BlueprintPure, Category = "Luprex|Animation Step")
static FString AnimationStepDebugString(const FlxAnimationStep& step);
UFUNCTION(BlueprintCallable, Meta = (DefaultToSelf = "into"), Category = "Luprex|Animation Step")
static void UnpackAnimationStep(UObject* into, const FlxAnimationStep& step, const FString& VariableNamePrefix = TEXT("aq"));
// Stores the key-value pairs in properties of the target object.
//
// The animation step contains key-value pairs. The goal of this function
// is to store these in properties of the target. The prefix parameter
// is prepended to the property names.
//
// For example, suppose the key-value pairs are "color=blue, speed=20",
// and suppose the prefix is "aq". In that case, two properties would
// be written: "aq Color" would be set to "blue", and "aq Speed" would be
// set to 20. In addition, a property "aq Animation Step" would
// be written, containing the entire animation step.
//
// If the step contains a key-value pair, but there is no corresponding
// property in the target, then the key-value pair is silently
// ignored. If the target contains properties that begin with the prefix,
// but which don't have any corresponding key-value pair, those properties
// are cleared.
//
// Returns 'Changed' if the hash-value of the "aq Animation Step" property
// has changed. Returns 'Action' string from the action=xxx property.
//
UFUNCTION(BlueprintCallable, Meta = (DefaultToSelf = "target"), Category = "Luprex|Animation Step")
static void UnpackAnimationStep(bool &bChanged, FString &Action, const FlxAnimationStep& step, UObject* target, const FString& VariableNamePrefix = TEXT("aq"));
UFUNCTION(BlueprintCallable, BlueprintPure, Category = "Luprex|Animation Step")
static bool AnimationStepEqual(const FlxAnimationStep &StepA, const FlxAnimationStep &StepB);