mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-20 09:16:01 +08:00
[ue] Update to UE 5.5, closes #2727
This commit is contained in:
parent
33cf98b467
commit
811ec28e54
@ -75,6 +75,7 @@ USpineSkeletonAnimationComponent::USpineSkeletonAnimationComponent() {
|
||||
bTickInEditor = true;
|
||||
bAutoActivate = true;
|
||||
bAutoPlaying = true;
|
||||
physicsTimeScale = 1;
|
||||
}
|
||||
|
||||
void USpineSkeletonAnimationComponent::BeginPlay() {
|
||||
@ -114,7 +115,7 @@ void USpineSkeletonAnimationComponent::InternalTick(float DeltaTime, bool CallDe
|
||||
state->update(DeltaTime);
|
||||
state->apply(*skeleton);
|
||||
if (CallDelegates) BeforeUpdateWorldTransform.Broadcast(this);
|
||||
skeleton->update(DeltaTime);
|
||||
skeleton->update(physicsTimeScale * DeltaTime);
|
||||
skeleton->updateWorldTransform(Physics_Update);
|
||||
if (CallDelegates) AfterUpdateWorldTransform.Broadcast(this);
|
||||
}
|
||||
@ -296,4 +297,12 @@ void USpineSkeletonAnimationComponent::ClearTrack(int trackIndex) {
|
||||
}
|
||||
}
|
||||
|
||||
void USpineSkeletonAnimationComponent::SetPhysicsTimeScale(float scale) {
|
||||
physicsTimeScale = scale;
|
||||
}
|
||||
|
||||
float USpineSkeletonAnimationComponent::GetPhysicsTimeScale() {
|
||||
return physicsTimeScale;
|
||||
}
|
||||
|
||||
#undef LOCTEXT_NAMESPACE
|
||||
|
||||
@ -82,6 +82,7 @@ USpineWidget::USpineWidget(const FObjectInitializer &ObjectInitializer) : Super(
|
||||
|
||||
TextureParameterName = FName(TEXT("SpriteTexture"));
|
||||
|
||||
physicsTimeScale = 1.0f;
|
||||
worldVertices.ensureCapacity(1024 * 2);
|
||||
|
||||
bAutoPlaying = true;
|
||||
@ -134,7 +135,7 @@ void USpineWidget::Tick(float DeltaTime, bool CallDelegates) {
|
||||
state->update(DeltaTime);
|
||||
state->apply(*skeleton);
|
||||
if (CallDelegates) BeforeUpdateWorldTransform.Broadcast(this);
|
||||
skeleton->update(DeltaTime);
|
||||
skeleton->update(physicsTimeScale * DeltaTime);
|
||||
skeleton->updateWorldTransform(Physics_Update);
|
||||
if (CallDelegates) AfterUpdateWorldTransform.Broadcast(this);
|
||||
}
|
||||
@ -548,3 +549,12 @@ void USpineWidget::ResetPhysicsConstraints() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void USpineWidget::SetPhysicsTimeScale(float scale) {
|
||||
physicsTimeScale = scale;
|
||||
}
|
||||
|
||||
float USpineWidget::GetPhysicsTimeScale() {
|
||||
return physicsTimeScale;
|
||||
}
|
||||
|
||||
|
||||
@ -303,6 +303,12 @@ public:
|
||||
UPROPERTY(EditAnywhere, Category = Spine)
|
||||
FString PreviewSkin;
|
||||
|
||||
UFUNCTION(BlueprintCallable, Category = "Components|Spine|Skeleton")
|
||||
void SetPhysicsTimeScale(float scale);
|
||||
|
||||
UFUNCTION(BlueprintCallable, Category = "Components|Spine|Skeleton")
|
||||
float GetPhysicsTimeScale();
|
||||
|
||||
// used in C event callback. Needs to be public as we can't call
|
||||
// protected methods from plain old C function.
|
||||
void GCTrackEntry(UTrackEntry *entry) { trackEntries.Remove(entry); }
|
||||
@ -319,6 +325,8 @@ protected:
|
||||
UPROPERTY()
|
||||
TSet<UTrackEntry *> trackEntries;
|
||||
|
||||
float physicsTimeScale;
|
||||
|
||||
private:
|
||||
/* If the animation should update automatically. */
|
||||
UPROPERTY()
|
||||
|
||||
@ -162,6 +162,12 @@ public:
|
||||
UFUNCTION(BlueprintCallable, Category = "Components|Spine|Skeleton")
|
||||
void ResetPhysicsConstraints();
|
||||
|
||||
UFUNCTION(BlueprintCallable, Category = "Components|Spine|Skeleton")
|
||||
void SetPhysicsTimeScale(float scale);
|
||||
|
||||
UFUNCTION(BlueprintCallable, Category = "Components|Spine|Skeleton")
|
||||
float GetPhysicsTimeScale();
|
||||
|
||||
UPROPERTY(BlueprintAssignable, Category = "Components|Spine|Skeleton")
|
||||
FSpineWidgetBeforeUpdateWorldTransformDelegate BeforeUpdateWorldTransform;
|
||||
|
||||
@ -246,6 +252,7 @@ protected:
|
||||
spine::Atlas *lastSpineAtlas = nullptr;
|
||||
USpineSkeletonDataAsset *lastData = nullptr;
|
||||
spine::Skin *customSkin = nullptr;
|
||||
float physicsTimeScale;
|
||||
|
||||
// Need to hold on to the dynamic instances, or the GC will kill us while updating them
|
||||
UPROPERTY()
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"FileVersion": 3,
|
||||
"EngineAssociation": "5.4",
|
||||
"EngineAssociation": "5.5",
|
||||
"Category": "",
|
||||
"Description": "",
|
||||
"Modules": [
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user