mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-06 07:14:55 +08:00
[ue4] Only show preview animation and skin in editor viewports.
This commit is contained in:
parent
d55724a1b5
commit
79e4f9ca69
@ -89,23 +89,25 @@ void USpineSkeletonAnimationComponent::BeginPlay() {
|
||||
void USpineSkeletonAnimationComponent::TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) {
|
||||
Super::Super::TickComponent(DeltaTime, TickType, ThisTickFunction);
|
||||
|
||||
InternalTick(DeltaTime);
|
||||
InternalTick(DeltaTime, true, TickType == LEVELTICK_ViewportsOnly);
|
||||
}
|
||||
|
||||
void USpineSkeletonAnimationComponent::InternalTick(float DeltaTime, bool CallDelegates) {
|
||||
void USpineSkeletonAnimationComponent::InternalTick(float DeltaTime, bool CallDelegates, bool Preview) {
|
||||
CheckState();
|
||||
|
||||
if (state && bAutoPlaying) {
|
||||
if (lastPreviewAnimation != PreviewAnimation) {
|
||||
if (PreviewAnimation != "") SetAnimation(0, PreviewAnimation, true);
|
||||
else SetEmptyAnimation(0, 0);
|
||||
lastPreviewAnimation = PreviewAnimation;
|
||||
}
|
||||
if (Preview) {
|
||||
if (lastPreviewAnimation != PreviewAnimation) {
|
||||
if (PreviewAnimation != "") SetAnimation(0, PreviewAnimation, true);
|
||||
else SetEmptyAnimation(0, 0);
|
||||
lastPreviewAnimation = PreviewAnimation;
|
||||
}
|
||||
|
||||
if (lastPreviewSkin != PreviewSkin) {
|
||||
if (PreviewSkin != "") SetSkin(PreviewSkin);
|
||||
else SetSkin("default");
|
||||
lastPreviewSkin = PreviewSkin;
|
||||
if (lastPreviewSkin != PreviewSkin) {
|
||||
if (PreviewSkin != "") SetSkin(PreviewSkin);
|
||||
else SetSkin("default");
|
||||
lastPreviewSkin = PreviewSkin;
|
||||
}
|
||||
}
|
||||
state->update(DeltaTime);
|
||||
state->apply(*skeleton);
|
||||
|
||||
@ -258,7 +258,7 @@ void USpineSkeletonComponent::TickComponent (float DeltaTime, ELevelTick TickTyp
|
||||
InternalTick(DeltaTime);
|
||||
}
|
||||
|
||||
void USpineSkeletonComponent::InternalTick(float DeltaTime, bool CallDelegates) {
|
||||
void USpineSkeletonComponent::InternalTick(float DeltaTime, bool CallDelegates, bool Preview) {
|
||||
CheckState();
|
||||
|
||||
if (skeleton) {
|
||||
|
||||
@ -260,10 +260,10 @@ public:
|
||||
UPROPERTY(BlueprintAssignable, Category="Components|Spine|Animation")
|
||||
FSpineAnimationDisposeDelegate AnimationDispose;
|
||||
|
||||
UPROPERTY(Transient, EditAnywhere, Category=Spine)
|
||||
UPROPERTY(EditAnywhere, Category=Spine)
|
||||
FString PreviewAnimation;
|
||||
|
||||
UPROPERTY(Transient, EditAnywhere, Category=Spine)
|
||||
UPROPERTY(EditAnywhere, Category=Spine)
|
||||
FString PreviewSkin;
|
||||
|
||||
// used in C event callback. Needs to be public as we can't call
|
||||
@ -271,7 +271,7 @@ public:
|
||||
void GCTrackEntry(UTrackEntry* entry) { trackEntries.Remove(entry); }
|
||||
protected:
|
||||
virtual void CheckState () override;
|
||||
virtual void InternalTick(float DeltaTime, bool CallDelegates = true) override;
|
||||
virtual void InternalTick(float DeltaTime, bool CallDelegates = true, bool Preview = false) override;
|
||||
virtual void DisposeState () override;
|
||||
|
||||
spine::AnimationState* state;
|
||||
|
||||
@ -133,7 +133,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void CheckState ();
|
||||
virtual void InternalTick(float DeltaTime, bool CallDelegates = true);
|
||||
virtual void InternalTick(float DeltaTime, bool CallDelegates = true, bool Preview = false);
|
||||
virtual void DisposeState ();
|
||||
|
||||
spine::Skeleton* skeleton;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user