Переглянути джерело

[ue] Closes #2594, add SetSlotColor to SpineWidget.

Mario Zechner 1 рік тому
батько
коміт
85a4f71162

BIN
spine-ue/Content/GettingStarted/Blueprints/UmgRaptor.uasset


+ 10 - 0
spine-ue/Plugins/SpinePlugin/Source/SpinePlugin/Private/SpineWidget.cpp

@@ -368,6 +368,16 @@ bool USpineWidget::HasSlot(const FString SlotName) {
 	return false;
 }
 
+void USpineWidget::SetSlotColor(const FString SlotName, const FColor SlotColor) {
+	CheckState();
+	if (skeleton) {
+		spine::Slot *slot = skeleton->findSlot(TCHAR_TO_UTF8(*SlotName));
+		if (slot) {
+			slot->getColor().set(SlotColor.R / 255.f, SlotColor.G / 255.f, SlotColor.B / 255.f, SlotColor.A / 255.f);
+		}
+	}
+}
+
 void USpineWidget::GetAnimations(TArray<FString> &Animations) {
 	CheckState();
 	if (skeleton) {

+ 3 - 0
spine-ue/Plugins/SpinePlugin/Source/SpinePlugin/Public/SpineWidget.h

@@ -141,6 +141,9 @@ public:
 	UFUNCTION(BlueprintCallable, Category = "Components|Spine|Skeleton")
 	bool HasSlot(const FString SlotName);
 
+	UFUNCTION(BlueprintCallable, Category = "Components|Spine|Skeleton")
+	void SetSlotColor(const FString SlotName, const FColor SlotColor);
+
 	UFUNCTION(BlueprintPure, Category = "Components|Spine|Skeleton")
 	void GetAnimations(TArray<FString> &Animations);