Implement code to unpack anim steps into UObject
This commit is contained in:
@@ -141,11 +141,12 @@ class FlxAnimStepDecoder {
|
||||
private:
|
||||
FlxStringDecoder Decoder;
|
||||
|
||||
static bool ClearProperties(const FString& prefix, UObject* obj);
|
||||
static bool SetProperty(const FString& name, UObject *obj, const FlxAnimField& value);
|
||||
public:
|
||||
// Initialize the FlxAnimStepDecoder from the FlxAnimStep.
|
||||
//
|
||||
FlxAnimStepDecoder(const FlxAnimStep &step) : Decoder(step.Body) {}
|
||||
FlxAnimStepDecoder(const FlxAnimStoredStep& step) : Decoder(step.Body) {}
|
||||
FlxAnimStepDecoder(std::string_view body) : Decoder(body) {}
|
||||
|
||||
// Return true if the parser has reached the end of the string.
|
||||
//
|
||||
@@ -157,7 +158,33 @@ public:
|
||||
|
||||
// Convert an AnimStep to an FString.
|
||||
//
|
||||
static FString DebugString(const FlxAnimStep &step);
|
||||
static FString DebugString(std::string_view body);
|
||||
|
||||
// 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."
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// If pre-clear is true, then all properties of the UObject
|
||||
// starting with the specified prefix are cleared before
|
||||
// unpacking the animation step.
|
||||
//
|
||||
static bool UnpackInto(std::string_view body, const FString &prefix, bool preclear, UObject* obj);
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////
|
||||
|
||||
Reference in New Issue
Block a user