mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-06 07:14:55 +08:00
[ue] SpineUE4 -> SpineUE
This commit is contained in:
parent
76e33d134e
commit
2412341548
@ -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
|
||||
|
||||
@ -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" });
|
||||
}
|
||||
}
|
||||
31
spine-ue/Source/SpineUE/MySceneComponent.cpp
Normal file
31
spine-ue/Source/SpineUE/MySceneComponent.cpp
Normal file
@ -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);
|
||||
|
||||
// ...
|
||||
}
|
||||
27
spine-ue/Source/SpineUE/MySceneComponent.h
Normal file
27
spine-ue/Source/SpineUE/MySceneComponent.h
Normal file
@ -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;
|
||||
};
|
||||
@ -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[] { });
|
||||
}
|
||||
}
|
||||
5
spine-ue/Source/SpineUE/SpineUE.cpp
Normal file
5
spine-ue/Source/SpineUE/SpineUE.cpp
Normal file
@ -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");
|
||||
@ -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"
|
||||
@ -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()
|
||||
};
|
||||
40
spine-ue/Source/SpineUE/SpineboyCppPawn.cpp
Normal file
40
spine-ue/Source/SpineUE/SpineboyCppPawn.cpp
Normal file
@ -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<USpineSkeletonAnimationComponent>();
|
||||
animationComponent->SetAnimation(0, FString("walk"), true);
|
||||
}
|
||||
|
||||
// Called every frame
|
||||
void ASpineboyCppPawn::Tick(float DeltaTime) {
|
||||
Super::Tick(DeltaTime);
|
||||
USpineSkeletonAnimationComponent *animationComponent =
|
||||
FindComponentByClass<USpineSkeletonAnimationComponent>();
|
||||
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);
|
||||
}
|
||||
28
spine-ue/Source/SpineUE/SpineboyCppPawn.h
Normal file
28
spine-ue/Source/SpineUE/SpineboyCppPawn.h
Normal file
@ -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;
|
||||
};
|
||||
@ -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);
|
||||
|
||||
// ...
|
||||
}
|
||||
@ -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;
|
||||
};
|
||||
@ -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");
|
||||
@ -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<USpineSkeletonAnimationComponent>();
|
||||
animationComponent->SetAnimation(0, FString("walk"), true);
|
||||
}
|
||||
|
||||
// Called every frame
|
||||
void ASpineboyCppPawn::Tick(float DeltaTime) {
|
||||
Super::Tick(DeltaTime);
|
||||
USpineSkeletonAnimationComponent *animationComponent = FindComponentByClass<USpineSkeletonAnimationComponent>();
|
||||
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);
|
||||
}
|
||||
@ -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;
|
||||
};
|
||||
@ -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" });
|
||||
}
|
||||
}
|
||||
11
spine-ue/Source/SpineUEEditor.Target.cs
Normal file
11
spine-ue/Source/SpineUEEditor.Target.cs
Normal file
@ -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" });
|
||||
}
|
||||
}
|
||||
@ -5,7 +5,7 @@
|
||||
"Description": "",
|
||||
"Modules": [
|
||||
{
|
||||
"Name": "SpineUE4",
|
||||
"Name": "SpineUE",
|
||||
"Type": "Runtime",
|
||||
"LoadingPhase": "Default",
|
||||
"AdditionalDependencies": [
|
||||
Loading…
x
Reference in New Issue
Block a user