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