mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-04 14:24:53 +08:00
[ue4] Closes #2234, add SpineWidget::GetBonePosition in the skeleton coordinate system.
This commit is contained in:
parent
0f595e7fbe
commit
39d544ce86
Binary file not shown.
@ -331,6 +331,25 @@ bool USpineWidget::HasBone(const FString BoneName) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FTransform USpineWidget::GetBoneTransform(const FString& BoneName) {
|
||||||
|
CheckState();
|
||||||
|
if (skeleton) {
|
||||||
|
Bone *bone = skeleton->findBone(TCHAR_TO_UTF8(*BoneName));
|
||||||
|
if (!bone) return FTransform();
|
||||||
|
|
||||||
|
FMatrix localTransform;
|
||||||
|
localTransform.SetIdentity();
|
||||||
|
localTransform.SetAxis(2, FVector(bone->getA(), 0, bone->getC()));
|
||||||
|
localTransform.SetAxis(0, FVector(bone->getB(), 0, bone->getD()));
|
||||||
|
localTransform.SetOrigin(FVector(bone->getWorldX(), 0, bone->getWorldY()));
|
||||||
|
|
||||||
|
FTransform result;
|
||||||
|
result.SetFromMatrix(localTransform);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
return FTransform();
|
||||||
|
}
|
||||||
|
|
||||||
void USpineWidget::GetSlots(TArray<FString> &Slots) {
|
void USpineWidget::GetSlots(TArray<FString> &Slots) {
|
||||||
CheckState();
|
CheckState();
|
||||||
if (skeleton) {
|
if (skeleton) {
|
||||||
|
|||||||
@ -132,6 +132,9 @@ public:
|
|||||||
UFUNCTION(BlueprintCallable, Category = "Components|Spine|Skeleton")
|
UFUNCTION(BlueprintCallable, Category = "Components|Spine|Skeleton")
|
||||||
bool HasBone(const FString BoneName);
|
bool HasBone(const FString BoneName);
|
||||||
|
|
||||||
|
UFUNCTION(BlueprintCallable, Category = "Components|Spine|Skeleton")
|
||||||
|
FTransform GetBoneTransform(const FString &BoneName);
|
||||||
|
|
||||||
UFUNCTION(BlueprintPure, Category = "Components|Spine|Skeleton")
|
UFUNCTION(BlueprintPure, Category = "Components|Spine|Skeleton")
|
||||||
void GetSlots(TArray<FString> &Slots);
|
void GetSlots(TArray<FString> &Slots);
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user