diff --git a/spine-ue/README.md b/spine-ue/README.md index 62810b00b..d89b5b199 100644 --- a/spine-ue/README.md +++ b/spine-ue/README.md @@ -40,4 +40,4 @@ See the [Spine Runtimes documentation](http://esotericsoftware.com/spine-documen The Spine UE4 example works on all platforms supported by Unreal Engine. The samples require Unreal Engine 4.27-5.3. 1. Copy the `spine-cpp` folder from this repositories root directory to your `Plugins/SpinePlugin/Sources/SpinePlugin/Public/` directory. You can run the `setup.bat` or `setup.sh` scripts to accomplish this. -2. Open the SpineUE4.uproject file with Unreal Editor +2. Open the SpineUE.uproject file with Unreal Editor diff --git a/spine-ue/Source/SpineUE4.Target.cs b/spine-ue/Source/SpineUE.Target.cs similarity index 58% rename from spine-ue/Source/SpineUE4.Target.cs rename to spine-ue/Source/SpineUE.Target.cs index 63e37fd51..4dc6b62e9 100644 --- a/spine-ue/Source/SpineUE4.Target.cs +++ b/spine-ue/Source/SpineUE.Target.cs @@ -3,12 +3,12 @@ using UnrealBuildTool; using System.Collections.Generic; -public class SpineUE4Target : TargetRules +public class SpineUETarget : TargetRules { - public SpineUE4Target(TargetInfo Target) : base(Target) + public SpineUETarget(TargetInfo Target) : base(Target) { DefaultBuildSettings = BuildSettingsVersion.V2; Type = TargetType.Game; - ExtraModuleNames.AddRange(new string[] { "SpineUE4" }); + ExtraModuleNames.AddRange(new string[] { "SpineUE" }); } } diff --git a/spine-ue/Source/SpineUE/MySceneComponent.cpp b/spine-ue/Source/SpineUE/MySceneComponent.cpp new file mode 100644 index 000000000..365e43fbd --- /dev/null +++ b/spine-ue/Source/SpineUE/MySceneComponent.cpp @@ -0,0 +1,31 @@ +// Fill out your copyright notice in the Description page of Project Settings. + +#include "MySceneComponent.h" +#include "SpineUE.h" +#include "spine/spine.h" + +// Sets default values for this component's properties +UMySceneComponent::UMySceneComponent( + const FObjectInitializer &ObjectInitializer) + : USpineSkeletonRendererComponent(ObjectInitializer) { + // Set this component to be initialized when the game starts, and to be ticked + // every frame. You can turn these features off to improve performance if you + // don't need them. + PrimaryComponentTick.bCanEverTick = true; +} + +// Called when the game starts +void UMySceneComponent::BeginPlay() { + Super::BeginPlay(); + + // ... +} + +// Called every frame +void UMySceneComponent::TickComponent( + float DeltaTime, ELevelTick TickType, + FActorComponentTickFunction *ThisTickFunction) { + Super::TickComponent(DeltaTime, TickType, ThisTickFunction); + + // ... +} diff --git a/spine-ue/Source/SpineUE/MySceneComponent.h b/spine-ue/Source/SpineUE/MySceneComponent.h new file mode 100644 index 000000000..2905da8f4 --- /dev/null +++ b/spine-ue/Source/SpineUE/MySceneComponent.h @@ -0,0 +1,27 @@ +// Fill out your copyright notice in the Description page of Project Settings. + +#pragma once + +#include "Components/SceneComponent.h" +#include "CoreMinimal.h" +#include "MySceneComponent.generated.h" +#include "SpineSkeletonRendererComponent.h" + +UCLASS(ClassGroup = (Custom), meta = (BlueprintSpawnableComponent)) +class SPINEUE_API UMySceneComponent : public USpineSkeletonRendererComponent { + GENERATED_BODY() + +public: + // Sets default values for this component's properties + UMySceneComponent(const FObjectInitializer &ObjectInitializer); + +protected: + // Called when the game starts + virtual void BeginPlay() override; + +public: + // Called every frame + virtual void + TickComponent(float DeltaTime, ELevelTick TickType, + FActorComponentTickFunction *ThisTickFunction) override; +}; diff --git a/spine-ue/Source/SpineUE4/SpineUE4.Build.cs b/spine-ue/Source/SpineUE/SpineUE.Build.cs similarity index 83% rename from spine-ue/Source/SpineUE4/SpineUE4.Build.cs rename to spine-ue/Source/SpineUE/SpineUE.Build.cs index 93c1df224..1bb874464 100644 --- a/spine-ue/Source/SpineUE4/SpineUE4.Build.cs +++ b/spine-ue/Source/SpineUE/SpineUE.Build.cs @@ -29,12 +29,12 @@ using UnrealBuildTool; -public class SpineUE4 : ModuleRules +public class SpineUE : ModuleRules { - public SpineUE4(ReadOnlyTargetRules Target) : base(Target) + public SpineUE(ReadOnlyTargetRules Target) : base(Target) { - PrivatePCHHeaderFile = "SpineUE4.h"; - PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "SpinePlugin", "ProceduralMeshComponent" }); - PrivateDependencyModuleNames.AddRange(new string[] { }); + PrivatePCHHeaderFile = "SpineUE.h"; + PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "SpinePlugin", "ProceduralMeshComponent" }); + PrivateDependencyModuleNames.AddRange(new string[] { }); } } diff --git a/spine-ue/Source/SpineUE/SpineUE.cpp b/spine-ue/Source/SpineUE/SpineUE.cpp new file mode 100644 index 000000000..a43ce1ffe --- /dev/null +++ b/spine-ue/Source/SpineUE/SpineUE.cpp @@ -0,0 +1,5 @@ +// Fill out your copyright notice in the Description page of Project Settings. + +#include "SpineUE.h" + +IMPLEMENT_PRIMARY_GAME_MODULE(FDefaultGameModuleImpl, SpineUE, "SpineUE"); diff --git a/spine-ue/Source/SpineUE4/SpineUE4.h b/spine-ue/Source/SpineUE/SpineUE.h similarity index 100% rename from spine-ue/Source/SpineUE4/SpineUE4.h rename to spine-ue/Source/SpineUE/SpineUE.h diff --git a/spine-ue/Source/SpineUE4/SpineUE4GameMode.cpp b/spine-ue/Source/SpineUE/SpineUEGameMode.cpp similarity index 60% rename from spine-ue/Source/SpineUE4/SpineUE4GameMode.cpp rename to spine-ue/Source/SpineUE/SpineUEGameMode.cpp index 37e0a96e2..9163ec662 100644 --- a/spine-ue/Source/SpineUE4/SpineUE4GameMode.cpp +++ b/spine-ue/Source/SpineUE/SpineUEGameMode.cpp @@ -1,4 +1,4 @@ // Fill out your copyright notice in the Description page of Project Settings. -#include "SpineUE4GameMode.h" -#include "SpineUE4.h" +#include "SpineUE.h" +#include "SpineUEGameMode.h" diff --git a/spine-ue/Source/SpineUE4/SpineUE4GameMode.h b/spine-ue/Source/SpineUE/SpineUEGameMode.h similarity index 55% rename from spine-ue/Source/SpineUE4/SpineUE4GameMode.h rename to spine-ue/Source/SpineUE/SpineUEGameMode.h index 43ef134f5..4a7321ea9 100644 --- a/spine-ue/Source/SpineUE4/SpineUE4GameMode.h +++ b/spine-ue/Source/SpineUE/SpineUEGameMode.h @@ -3,12 +3,12 @@ #pragma once #include "GameFramework/GameMode.h" -#include "SpineUE4GameMode.generated.h" +#include "SpineUEGameMode.generated.h" /** - * + * */ UCLASS() -class SPINEUE4_API ASpineUE4GameMode : public AGameMode { - GENERATED_BODY() +class SPINEUE_API ASpineUEGameMode : public AGameMode { + GENERATED_BODY() }; diff --git a/spine-ue/Source/SpineUE/SpineboyCppPawn.cpp b/spine-ue/Source/SpineUE/SpineboyCppPawn.cpp new file mode 100644 index 000000000..448fdc3ca --- /dev/null +++ b/spine-ue/Source/SpineUE/SpineboyCppPawn.cpp @@ -0,0 +1,40 @@ +// Fill out your copyright notice in the Description page of Project Settings. + +#include "SpineboyCppPawn.h" +#include "SpineSkeletonAnimationComponent.h" +#include "SpineUE.h" + +// Sets default values +ASpineboyCppPawn::ASpineboyCppPawn() { + // Set this pawn to call Tick() every frame. You can turn this off to improve + // performance if you don't need it. + PrimaryActorTick.bCanEverTick = true; +} + +// Called when the game starts or when spawned +void ASpineboyCppPawn::BeginPlay() { + Super::BeginPlay(); + USpineSkeletonAnimationComponent *animationComponent = + FindComponentByClass(); + animationComponent->SetAnimation(0, FString("walk"), true); +} + +// Called every frame +void ASpineboyCppPawn::Tick(float DeltaTime) { + Super::Tick(DeltaTime); + USpineSkeletonAnimationComponent *animationComponent = + FindComponentByClass(); + spine::AnimationState *state = animationComponent->GetAnimationState(); + spine::TrackEntry *entry = state->getCurrent(0); + if (entry) { + GEngine->AddOnScreenDebugMessage( + -1, 0.5f, FColor::Yellow, + FString(entry->getAnimation()->getName().buffer())); + } +} + +// Called to bind functionality to input +void ASpineboyCppPawn::SetupPlayerInputComponent( + UInputComponent *PlayerInputComponent) { + Super::SetupPlayerInputComponent(PlayerInputComponent); +} diff --git a/spine-ue/Source/SpineUE/SpineboyCppPawn.h b/spine-ue/Source/SpineUE/SpineboyCppPawn.h new file mode 100644 index 000000000..fac8f08be --- /dev/null +++ b/spine-ue/Source/SpineUE/SpineboyCppPawn.h @@ -0,0 +1,28 @@ +// Fill out your copyright notice in the Description page of Project Settings. + +#pragma once + +#include "CoreMinimal.h" +#include "GameFramework/Pawn.h" +#include "SpineboyCppPawn.generated.h" + +UCLASS() +class SPINEUE_API ASpineboyCppPawn : public APawn { + GENERATED_BODY() + +public: + // Sets default values for this pawn's properties + ASpineboyCppPawn(); + +protected: + // Called when the game starts or when spawned + virtual void BeginPlay() override; + +public: + // Called every frame + virtual void Tick(float DeltaTime) override; + + // Called to bind functionality to input + virtual void SetupPlayerInputComponent( + class UInputComponent *PlayerInputComponent) override; +}; diff --git a/spine-ue/Source/SpineUE4/MySceneComponent.cpp b/spine-ue/Source/SpineUE4/MySceneComponent.cpp deleted file mode 100644 index 6805073a4..000000000 --- a/spine-ue/Source/SpineUE4/MySceneComponent.cpp +++ /dev/null @@ -1,29 +0,0 @@ -// Fill out your copyright notice in the Description page of Project Settings. - -#include "MySceneComponent.h" -#include "SpineUE4.h" -#include "spine/spine.h" - - -// Sets default values for this component's properties -UMySceneComponent::UMySceneComponent(const FObjectInitializer &ObjectInitializer) : USpineSkeletonRendererComponent(ObjectInitializer) { - // Set this component to be initialized when the game starts, and to be ticked every frame. You can turn these features - // off to improve performance if you don't need them. - PrimaryComponentTick.bCanEverTick = true; -} - - -// Called when the game starts -void UMySceneComponent::BeginPlay() { - Super::BeginPlay(); - - // ... -} - - -// Called every frame -void UMySceneComponent::TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction *ThisTickFunction) { - Super::TickComponent(DeltaTime, TickType, ThisTickFunction); - - // ... -} diff --git a/spine-ue/Source/SpineUE4/MySceneComponent.h b/spine-ue/Source/SpineUE4/MySceneComponent.h deleted file mode 100644 index 3ff172988..000000000 --- a/spine-ue/Source/SpineUE4/MySceneComponent.h +++ /dev/null @@ -1,25 +0,0 @@ -// Fill out your copyright notice in the Description page of Project Settings. - -#pragma once - -#include "Components/SceneComponent.h" -#include "CoreMinimal.h" -#include "SpineSkeletonRendererComponent.h" -#include "MySceneComponent.generated.h" - -UCLASS(ClassGroup = (Custom), meta = (BlueprintSpawnableComponent)) -class SPINEUE4_API UMySceneComponent : public USpineSkeletonRendererComponent { - GENERATED_BODY() - -public: - // Sets default values for this component's properties - UMySceneComponent(const FObjectInitializer &ObjectInitializer); - -protected: - // Called when the game starts - virtual void BeginPlay() override; - -public: - // Called every frame - virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction *ThisTickFunction) override; -}; diff --git a/spine-ue/Source/SpineUE4/SpineUE4.cpp b/spine-ue/Source/SpineUE4/SpineUE4.cpp deleted file mode 100644 index 932c6a2f4..000000000 --- a/spine-ue/Source/SpineUE4/SpineUE4.cpp +++ /dev/null @@ -1,5 +0,0 @@ -// Fill out your copyright notice in the Description page of Project Settings. - -#include "SpineUE4.h" - -IMPLEMENT_PRIMARY_GAME_MODULE(FDefaultGameModuleImpl, SpineUE4, "SpineUE4"); diff --git a/spine-ue/Source/SpineUE4/SpineboyCppPawn.cpp b/spine-ue/Source/SpineUE4/SpineboyCppPawn.cpp deleted file mode 100644 index 4fd635be0..000000000 --- a/spine-ue/Source/SpineUE4/SpineboyCppPawn.cpp +++ /dev/null @@ -1,35 +0,0 @@ -// Fill out your copyright notice in the Description page of Project Settings. - -#include "SpineboyCppPawn.h" -#include "SpineSkeletonAnimationComponent.h" -#include "SpineUE4.h" - - -// Sets default values -ASpineboyCppPawn::ASpineboyCppPawn() { - // Set this pawn to call Tick() every frame. You can turn this off to improve performance if you don't need it. - PrimaryActorTick.bCanEverTick = true; -} - -// Called when the game starts or when spawned -void ASpineboyCppPawn::BeginPlay() { - Super::BeginPlay(); - USpineSkeletonAnimationComponent *animationComponent = FindComponentByClass(); - animationComponent->SetAnimation(0, FString("walk"), true); -} - -// Called every frame -void ASpineboyCppPawn::Tick(float DeltaTime) { - Super::Tick(DeltaTime); - USpineSkeletonAnimationComponent *animationComponent = FindComponentByClass(); - spine::AnimationState *state = animationComponent->GetAnimationState(); - spine::TrackEntry *entry = state->getCurrent(0); - if (entry) { - GEngine->AddOnScreenDebugMessage(-1, 0.5f, FColor::Yellow, FString(entry->getAnimation()->getName().buffer())); - } -} - -// Called to bind functionality to input -void ASpineboyCppPawn::SetupPlayerInputComponent(UInputComponent *PlayerInputComponent) { - Super::SetupPlayerInputComponent(PlayerInputComponent); -} diff --git a/spine-ue/Source/SpineUE4/SpineboyCppPawn.h b/spine-ue/Source/SpineUE4/SpineboyCppPawn.h deleted file mode 100644 index f0c3ceb72..000000000 --- a/spine-ue/Source/SpineUE4/SpineboyCppPawn.h +++ /dev/null @@ -1,27 +0,0 @@ -// Fill out your copyright notice in the Description page of Project Settings. - -#pragma once - -#include "CoreMinimal.h" -#include "GameFramework/Pawn.h" -#include "SpineboyCppPawn.generated.h" - -UCLASS() -class SPINEUE4_API ASpineboyCppPawn : public APawn { - GENERATED_BODY() - -public: - // Sets default values for this pawn's properties - ASpineboyCppPawn(); - -protected: - // Called when the game starts or when spawned - virtual void BeginPlay() override; - -public: - // Called every frame - virtual void Tick(float DeltaTime) override; - - // Called to bind functionality to input - virtual void SetupPlayerInputComponent(class UInputComponent *PlayerInputComponent) override; -}; diff --git a/spine-ue/Source/SpineUE4Editor.Target.cs b/spine-ue/Source/SpineUE4Editor.Target.cs deleted file mode 100644 index 1c94b6d86..000000000 --- a/spine-ue/Source/SpineUE4Editor.Target.cs +++ /dev/null @@ -1,11 +0,0 @@ -using UnrealBuildTool; - -public class SpineUE4EditorTarget : TargetRules -{ - public SpineUE4EditorTarget(TargetInfo target) : base(target) - { - DefaultBuildSettings = BuildSettingsVersion.V2; - Type = TargetType.Editor; - ExtraModuleNames.AddRange(new string[] { "SpineUE4" }); - } -} diff --git a/spine-ue/Source/SpineUEEditor.Target.cs b/spine-ue/Source/SpineUEEditor.Target.cs new file mode 100644 index 000000000..736d24656 --- /dev/null +++ b/spine-ue/Source/SpineUEEditor.Target.cs @@ -0,0 +1,11 @@ +using UnrealBuildTool; + +public class SpineUEEditorTarget : TargetRules +{ + public SpineUEEditorTarget(TargetInfo target) : base(target) + { + DefaultBuildSettings = BuildSettingsVersion.V2; + Type = TargetType.Editor; + ExtraModuleNames.AddRange(new string[] { "SpineUE" }); + } +} diff --git a/spine-ue/SpineUE4.uproject b/spine-ue/SpineUE.uproject similarity index 90% rename from spine-ue/SpineUE4.uproject rename to spine-ue/SpineUE.uproject index 1a871bfec..2269cbac0 100644 --- a/spine-ue/SpineUE4.uproject +++ b/spine-ue/SpineUE.uproject @@ -5,7 +5,7 @@ "Description": "", "Modules": [ { - "Name": "SpineUE4", + "Name": "SpineUE", "Type": "Runtime", "LoadingPhase": "Default", "AdditionalDependencies": [