mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-20 01:06:00 +08:00
[ue] Add ResetPhysicsConstraints() to SpineSkeletonComponent and SpineWidget, closes #2615
This commit is contained in:
parent
4038bc9ba1
commit
c85000b5f8
@ -88,6 +88,7 @@
|
||||
- **Breaking**: Starting with Unreal Engine 5.3 imported `.skel`/`.json` and `.atlas` files in the same folder must NOT have a common prefix. E.g. `skeleton.json` and `skeleton.atlas` will not work. Make sure to rename at least one of the two files so there is no prefix collision, e.g. `skeleton-data.json` and `skeleton.atlas`.
|
||||
- Added compatibility with UE 5.3
|
||||
- Added more example maps
|
||||
- Added blueprint-callable methods `PhysicsTranslate()`, `PhysicsRotate()` and `ResetPhysicsConstraints()` (which will reset all physics constraints in the skeleton) to `SpineSkeletonComponent` and `SpineWidget`.
|
||||
|
||||
### Godot
|
||||
|
||||
|
||||
Binary file not shown.
@ -287,6 +287,30 @@ float USpineSkeletonComponent::GetAnimationDuration(FString AnimationName) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
void USpineSkeletonComponent::PhysicsTranslate(float x, float y) {
|
||||
CheckState();
|
||||
if (skeleton) {
|
||||
skeleton->physicsTranslate(x, y);
|
||||
}
|
||||
}
|
||||
|
||||
void USpineSkeletonComponent::PhysicsRotate(float x, float y, float degrees) {
|
||||
CheckState();
|
||||
if (skeleton) {
|
||||
skeleton->physicsRotate(x, y, degrees);
|
||||
}
|
||||
}
|
||||
|
||||
void USpineSkeletonComponent::ResetPhysicsConstraints() {
|
||||
CheckState();
|
||||
if (skeleton) {
|
||||
Vector<PhysicsConstraint *> &constraints = skeleton->getPhysicsConstraints();
|
||||
for (int i = 0, n = (int) constraints.size(); i < n; i++) {
|
||||
constraints[i]->reset();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void USpineSkeletonComponent::BeginPlay() {
|
||||
Super::BeginPlay();
|
||||
}
|
||||
|
||||
@ -524,3 +524,27 @@ void USpineWidget::ClearTrack(int trackIndex) {
|
||||
state->clearTrack(trackIndex);
|
||||
}
|
||||
}
|
||||
|
||||
void USpineWidget::PhysicsTranslate(float x, float y) {
|
||||
CheckState();
|
||||
if (skeleton) {
|
||||
skeleton->physicsTranslate(x, y);
|
||||
}
|
||||
}
|
||||
|
||||
void USpineWidget::PhysicsRotate(float x, float y, float degrees) {
|
||||
CheckState();
|
||||
if (skeleton) {
|
||||
skeleton->physicsRotate(x, y, degrees);
|
||||
}
|
||||
}
|
||||
|
||||
void USpineWidget::ResetPhysicsConstraints() {
|
||||
CheckState();
|
||||
if (skeleton) {
|
||||
Vector<PhysicsConstraint *> &constraints = skeleton->getPhysicsConstraints();
|
||||
for (int i = 0, n = (int) constraints.size(); i < n; i++) {
|
||||
constraints[i]->reset();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -127,6 +127,15 @@ public:
|
||||
UFUNCTION(BlueprintCallable, Category = "Components|Spine|Skeleton")
|
||||
float GetAnimationDuration(FString AnimationName);
|
||||
|
||||
UFUNCTION(BlueprintCallable, Category = "Components|Spine|Skeleton")
|
||||
void PhysicsTranslate(float x, float y);
|
||||
|
||||
UFUNCTION(BlueprintCallable, Category = "Components|Spine|Skeleton")
|
||||
void PhysicsRotate(float x, float y, float degrees);
|
||||
|
||||
UFUNCTION(BlueprintCallable, Category = "Components|Spine|Skeleton")
|
||||
void ResetPhysicsConstraints();
|
||||
|
||||
UPROPERTY(BlueprintAssignable, Category = "Components|Spine|Skeleton")
|
||||
FSpineBeforeUpdateWorldTransformDelegate BeforeUpdateWorldTransform;
|
||||
|
||||
|
||||
@ -153,6 +153,15 @@ public:
|
||||
UFUNCTION(BlueprintCallable, Category = "Components|Spine|Skeleton")
|
||||
float GetAnimationDuration(FString AnimationName);
|
||||
|
||||
UFUNCTION(BlueprintCallable, Category = "Components|Spine|Skeleton")
|
||||
void PhysicsTranslate(float x, float y);
|
||||
|
||||
UFUNCTION(BlueprintCallable, Category = "Components|Spine|Skeleton")
|
||||
void PhysicsRotate(float x, float y, float degrees);
|
||||
|
||||
UFUNCTION(BlueprintCallable, Category = "Components|Spine|Skeleton")
|
||||
void ResetPhysicsConstraints();
|
||||
|
||||
UPROPERTY(BlueprintAssignable, Category = "Components|Spine|Skeleton")
|
||||
FSpineWidgetBeforeUpdateWorldTransformDelegate BeforeUpdateWorldTransform;
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user