[ue4] Added USpineSkeletonComponent::SetSlotColor(). Closes #1904.

This commit is contained in:
badlogic 2021-06-19 15:06:00 +02:00
parent f567c18cfa
commit 50de8ea77c
4 changed files with 25 additions and 3 deletions

View File

@ -35,6 +35,7 @@
* Materials on `SkeletonRendererComponent` are now blueprint read and writeable. This allows setting dynamic material instances at runtime.
* Added `InitialSkin` property to `USpineWidget`. This allows previewing different skins in the UMG Designer. Initial skins can still be overridden via blueprint events such as `On Initialized`.
* **Breaking changes**: `SpineWidget` no longer has the `Scale` property. Instead the size x/y properties can be used.
* Added `SetSlotColor` on `USpineSkeletonComponent` to easily set the color of a slot via blueprints.
## C# ##
* **Breaking changes**

View File

@ -60,3 +60,13 @@ PhysXTreeRebuildRate=10
DefaultBroadphaseSettings=(bUseMBPOnClient=False,bUseMBPOnServer=False,MBPBounds=(Min=(X=0.000000,Y=0.000000,Z=0.000000),Max=(X=0.000000,Y=0.000000,Z=0.000000),IsValid=0),MBPNumSubdivs=2)
[/Script/Engine.RendererSettings]
r.DefaultFeature.Bloom=False
r.DefaultFeature.AmbientOcclusion=False
r.DefaultFeature.AmbientOcclusionStaticFraction=False
r.DefaultFeature.AutoExposure=False
r.UsePreExposure=False
r.DefaultFeature.MotionBlur=False

View File

@ -105,8 +105,7 @@ FTransform USpineSkeletonComponent::GetBoneWorldTransform (const FString& BoneNa
CheckState();
if (skeleton) {
Bone* bone = skeleton->findBone(TCHAR_TO_UTF8(*BoneName));
if (!bone) return FTransform();
if (!bone->isAppliedValid()) this->InternalTick(0, false);
if (!bone) return FTransform();
// Need to fetch the renderer component to get world transform of actor plus
// offset by renderer component and its parent component(s). If no renderer
@ -139,7 +138,6 @@ void USpineSkeletonComponent::SetBoneWorldPosition (const FString& BoneName, con
if (skeleton) {
Bone* bone = skeleton->findBone(TCHAR_TO_UTF8(*BoneName));
if (!bone) return;
if (!bone->isAppliedValid()) this->InternalTick(0, false);
// Need to fetch the renderer component to get world transform of actor plus
// offset by renderer component and its parent component(s). If no renderer
@ -243,6 +241,16 @@ bool USpineSkeletonComponent::HasSlot (const FString SlotName) {
return false;
}
void USpineSkeletonComponent::SetSlotColor(const FString SlotName, const FColor color) {
CheckState();
if (skeleton) {
Slot *slot = skeleton->findSlot(TCHAR_TO_UTF8(*SlotName));
if (slot) {
slot->getColor().set(color.R, color.B, color.G, color.A);
}
}
}
void USpineSkeletonComponent::GetAnimations(TArray<FString> &Animations) {
CheckState();
if (skeleton) {

View File

@ -110,6 +110,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 color);
UFUNCTION(BlueprintPure, Category = "Components|Spine|Skeleton")
void GetAnimations(TArray<FString> &Animations);