diff --git a/Mods/SML/Source/SML/Public/Patching/BlueprintHookHelper.h b/Mods/SML/Source/SML/Public/Patching/BlueprintHookHelper.h index 47324bc89b..07715a136c 100644 --- a/Mods/SML/Source/SML/Public/Patching/BlueprintHookHelper.h +++ b/Mods/SML/Source/SML/Public/Patching/BlueprintHookHelper.h @@ -68,6 +68,24 @@ class SML_API FBlueprintHookHelper { T* Property = GetContextVarProperty(VariableName); return Property->GetPropertyValuePtr_InContainer(GetContext(), ArrayIndex); } + + /** + * Writes the value of a named struct blueprint member variable on the Context to the location the passed pointer references. + * Member variables are viewable in Unreal Editor under the Variables accordion in the My Blueprint tab of the Graph view of the blueprint. + * This method won't work on bool or enum variables; use the corresponding helper methods instead. + * + * Example usage: + * FLinearColor MyColorValue; + * helper.GetContextVarStruct( TEXT("MyColor"), &MyColorValue ); + * + * @param VariableName - The name of the member variable to access. Will assert if the variable is not found or is not the expected type. + * @param OutValuePtr - The name of the member variable to access. Will assert if the variable is not found or is not the expected type. + */ + template + void GetContextVarStruct(const TCHAR* VariableName, T* OutValuePtr) const { + FStructProperty* Property = GetContextVarProperty(VariableName); + Property->GetValue_InContainer(GetContext(), OutValuePtr); + } /** * Gets a pointer to the value of a named enum blueprint member variable on the Context. @@ -92,6 +110,7 @@ class SML_API FBlueprintHookHelper { * * @param VariableName - The name of the member variable to access. Will assert if the variable is not found or is not the expected type. * @param ArrayIndex - If the variable represents a statically sized array, returns the value at the specified index. + * @returns The boolean value of the member variable */ bool GetContextVarBool(const TCHAR* VariableName, int32 ArrayIndex = 0) const { FBoolProperty* Property = GetContextVarProperty(VariableName);