@@ -79,7 +79,7 @@ class ATTRIBUTES_API UAttributesFunctionLibrary : public UBlueprintFunctionLibra
7979 * @return true if any modifier was removed
8080 */
8181 UFUNCTION (BlueprintCallable, Category = Attributes, meta=(AdvancedDisplay=" Category,bRemoveFromAllCategories" ))
82- static bool RemoveModifier (UPARAM (ref) FFloatAttr& Attribute, const FAttrModifier& Modifier, const FAttrCategory Category, bool bRemoveFromAllCategories = false )
82+ static FORCEINLINE bool RemoveModifier (UPARAM (ref) FFloatAttr& Attribute, const FAttrModifier& Modifier, const FAttrCategory Category, bool bRemoveFromAllCategories = false )
8383 {
8484 return Attribute.RemoveModifier (Modifier, Category, bRemoveFromAllCategories);
8585 }
@@ -89,10 +89,21 @@ class ATTRIBUTES_API UAttributesFunctionLibrary : public UBlueprintFunctionLibra
8989 * @param Attribute to get modifiers from
9090 * @return Modifiers of a category as an Array
9191 */
92+ UFUNCTION (BlueprintPure, Category = Attributes, meta = (AdvancedDisplay = " Category" ))
93+ static void GetModifiers (const FFloatAttr& Attribute, const FAttrCategory Category, TArray<FAttrModifier>& Modifiers)
94+ {
95+ Modifiers = Attribute.GetModifiers (Category);
96+ }
97+
98+ /* *
99+ * Get all categories where the attribute has any modifiers
100+ * @param Attribute to get categories from
101+ * @return Categories of an attribute as an Array
102+ */
92103 UFUNCTION (BlueprintPure, Category = Attributes)
93- static FORCEINLINE TArray<FAttrModifier> GetModifiers (const FFloatAttr& Attribute)
104+ static void GetModifiedCategories (const FFloatAttr& Attribute, TArray<FAttrCategory>& Categories )
94105 {
95- return Attribute.GetModifiers ( );
106+ Attribute.GetModifiedCategories (Categories );
96107 }
97108
98109 /* *
@@ -122,4 +133,27 @@ class ATTRIBUTES_API UAttributesFunctionLibrary : public UBlueprintFunctionLibra
122133 {
123134 Attribute.OnModified .Remove (Event);
124135 }
136+
137+
138+ /* * Stack other modifiers values into this mod.
139+ * Now applying this modifier will be equivalent to applying all the others at the same time
140+ * @param Mods to be stacked together as one
141+ * @return the resulting stacked mod
142+ */
143+ UFUNCTION (BlueprintPure, Category = " Attributes|Modifiers" )
144+ static FORCEINLINE FAttrModifier StackMods (const TArray<FAttrModifier>& Mods) {
145+ FAttrModifier ResultMod{};
146+ ResultMod.StackMods (Mods);
147+ return MoveTemp (ResultMod);
148+ }
149+
150+ /* * Stack other modifier's values into target mod.
151+ * Applying this mod will be equivalent to applying both
152+ * @param TargetMod to be modified
153+ * @param OtherMod to be stacked into TargetMod
154+ */
155+ UFUNCTION (BlueprintCallable, Category = " Attributes|Modifiers" )
156+ static void StackMod (UPARAM (ref) FAttrModifier& TargetMod, const FAttrModifier& OtherMod) {
157+ TargetMod.StackMod (OtherMod);
158+ }
125159};
0 commit comments