Files
integration/Plugins/UEWingman/Deprecated/BlendSpace_Create.h

63 lines
1.7 KiB
C
Raw Normal View History

2026-03-08 22:17:14 -04:00
#pragma once
#include "CoreMinimal.h"
2026-03-18 10:17:58 -04:00
#include "WingServer.h"
#include "WingHandler.h"
#include "WingFetcher.h"
#include "WingUtils.h"
#include "WingPackageMaker.h"
2026-03-08 22:17:14 -04:00
#include "Animation/Skeleton.h"
#include "Animation/BlendSpace.h"
2026-03-12 00:44:17 -04:00
#include "BlendSpace_Create.generated.h"
2026-03-08 22:17:14 -04:00
// ---------------------------------------------------------------------------
// ---------------------------------------------------------------------------
// ---------------------------------------------------------------------------
2026-03-15 19:32:09 -04:00
UCLASS()
2026-03-18 10:17:58 -04:00
class UWing_BlendSpace_Create : public UObject, public IWingHandler
2026-03-08 22:17:14 -04:00
{
GENERATED_BODY()
public:
2026-03-12 18:31:55 -04:00
UPROPERTY(meta=(Description="Full asset path for the new Blend Space (e.g. '/Game/BlendSpaces/BS_Locomotion')"))
FString AssetPath;
2026-03-08 22:17:14 -04:00
2026-03-14 00:02:00 -04:00
UPROPERTY(meta=(Description="Skeleton asset package path"))
2026-03-08 22:17:14 -04:00
FString Skeleton;
virtual FString GetDescription() const override
{
return TEXT("Create a new 2D Blend Space asset with a specified skeleton.");
}
virtual void Handle() override
2026-03-08 22:17:14 -04:00
{
2026-03-18 10:17:58 -04:00
WingPackageMaker Maker(AssetPath);
2026-03-12 18:31:55 -04:00
if (!Maker.Ok()) return;
2026-03-08 22:17:14 -04:00
2026-03-10 07:17:42 -04:00
// Resolve skeleton.
2026-03-18 10:17:58 -04:00
WingFetcher SkeletonFetcher;
2026-03-14 00:02:00 -04:00
USkeleton* SkeletonObj = SkeletonFetcher.Asset(Skeleton).Cast<USkeleton>();
if (!SkeletonObj) return;
2026-03-08 22:17:14 -04:00
2026-03-12 18:31:55 -04:00
// Create the package and Blend Space.
if (!Maker.Make()) return;
UBlendSpace* NewBS = NewObject<UBlendSpace>(Maker.Package(), FName(*Maker.Name()), RF_Public | RF_Standalone);
2026-03-08 22:17:14 -04:00
if (!NewBS)
{
2026-03-18 10:17:58 -04:00
UWingServer::Print(TEXT("ERROR: Failed to create Blend Space object\n"));
2026-03-10 07:17:42 -04:00
return;
2026-03-08 22:17:14 -04:00
}
2026-03-10 07:17:42 -04:00
// Set skeleton.
2026-03-08 22:17:14 -04:00
NewBS->SetSkeleton(SkeletonObj);
NewBS->MarkPackageDirty();
2026-03-18 10:17:58 -04:00
UWingServer::Printf(TEXT("Created %s\n"), *NewBS->GetPathName());
UWingServer::Printf(TEXT("Skeleton: %s\n"), *SkeletonObj->GetPathName());
2026-03-08 22:17:14 -04:00
}
};