Add Games File
This commit is contained in:
@@ -0,0 +1,129 @@
|
||||
// VRM4U Copyright (c) 2021-2024 Haruyoshi Yamamoto. This software is released under the MIT License.
|
||||
|
||||
#pragma once
|
||||
#include "Engine/LatentActionManager.h"
|
||||
#include "Kismet/BlueprintFunctionLibrary.h"
|
||||
#include "VrmConvert.h"
|
||||
#include "VrmUtil.h"
|
||||
#include "LoaderBPFunctionLibrary.generated.h"
|
||||
|
||||
UENUM(BlueprintType)
|
||||
enum class EPathType : uint8
|
||||
{
|
||||
Absolute,
|
||||
Relative
|
||||
};
|
||||
|
||||
|
||||
USTRUCT(BlueprintType)
|
||||
struct FMeshInfo_VRM4U
|
||||
{
|
||||
GENERATED_USTRUCT_BODY()
|
||||
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "ReturnedData")
|
||||
TArray<FVector> Vertices;
|
||||
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "ReturnedData")
|
||||
TArray<FVector> Normals;
|
||||
|
||||
//UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "ReturnedData")
|
||||
TArray<uint32> Triangles;
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "ReturnedData")
|
||||
TArray<int32> Triangles2;
|
||||
|
||||
|
||||
// UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "ReturnedData")
|
||||
TArray< TArray<FVector2D> > UV0;
|
||||
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "ReturnedData")
|
||||
TArray<FLinearColor> VertexColors;
|
||||
|
||||
// UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "ReturnedData")
|
||||
// TArray<FProcMeshTangent> MeshTangents;
|
||||
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "ReturnedData")
|
||||
TArray<FVector> Tangents;
|
||||
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "ReturnedData")
|
||||
FTransform RelativeTransform;
|
||||
|
||||
TArray<bool> vertexUseFlag;
|
||||
TArray<uint32_t> vertexIndexOptTable;
|
||||
uint32_t useVertexCount = 0;
|
||||
};
|
||||
|
||||
USTRUCT(BlueprintType)
|
||||
struct FReturnedData
|
||||
{
|
||||
GENERATED_USTRUCT_BODY()
|
||||
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "ReturnedData")
|
||||
bool bSuccess = false;
|
||||
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "ReturnedData")
|
||||
int32 NumMeshes = 0;
|
||||
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "ReturnedData")
|
||||
TArray<FMeshInfo_VRM4U> meshInfo;
|
||||
|
||||
//UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "ReturnedData")
|
||||
//TMap<struct aiMesh*, uint32_t> meshToIndex;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
UCLASS()
|
||||
class VRM4ULOADER_API ULoaderBPFunctionLibrary : public UBlueprintFunctionLibrary
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
|
||||
UFUNCTION(BlueprintCallable, Category = "VRM4U")
|
||||
static bool VRMSetLoadMaterialType(EVRMImportMaterialType type);
|
||||
|
||||
UFUNCTION(BlueprintCallable,Category="VRM4U", meta = (DynamicOutputParam = "OutVrmAsset"))
|
||||
static bool LoadVRMFile(const class UVrmAssetListObject *InVrmAsset, class UVrmAssetListObject *&OutVrmAsset, const FString filepath, const FImportOptionData &OptionForRuntimeLoad);
|
||||
|
||||
UFUNCTION(BlueprintCallable, Category = "VRM4U", meta = (Latent, DynamicOutputParam = "OutVrmAsset", WorldContext = "WorldContextObject", LatentInfo = "LatentInfo"))
|
||||
static void LoadVRMFileAsync(const UObject* WorldContextObject, const class UVrmAssetListObject* InVrmAsset, class UVrmAssetListObject*& OutVrmAsset, const FString filepath, const FImportOptionData& OptionForRuntimeLoad, struct FLatentActionInfo LatentInfo);
|
||||
|
||||
|
||||
static bool LoadVRMFileLocal(const class UVrmAssetListObject* InVrmAsset, class UVrmAssetListObject*& OutVrmAsset, const FString filepath);
|
||||
|
||||
static bool LoadVRMFileFromMemoryDefaultOption(UVrmAssetListObject*& OutVrmAsset, const FString filepath, const uint8* pData, size_t dataSize);
|
||||
static bool LoadVRMFileFromMemory(const UVrmAssetListObject* InVrmAsset, UVrmAssetListObject*& OutVrmAsset, const FString filepath, const uint8* pFileData, size_t dataSize);
|
||||
|
||||
static void SetImportMode(bool bImportMode, class UPackage *package);
|
||||
|
||||
//static void SetCopySkeletalMeshAnimation(bool bImportMode, class UPackage *package);
|
||||
|
||||
///
|
||||
UFUNCTION(BlueprintCallable,Category="VRM4U")
|
||||
static bool VRMReTransformHumanoidBone(class USkeletalMeshComponent *targetHumanoidSkeleton, const class UVrmMetaObject *meta, const class USkeletalMeshComponent *displaySkeleton);
|
||||
|
||||
//static void ReTransformHumanoidBone(USkeleton *targetHumanoidSkeleton, const UVrmMetaObject *meta, const USkeleton *displaySkeleton) {
|
||||
|
||||
///
|
||||
UFUNCTION(BlueprintCallable, Category = "VRM4U")
|
||||
static bool CopyPhysicsAsset(USkeletalMesh *dstMesh, const USkeletalMesh *srcMesh, bool bResetCollisionTransform=true);
|
||||
|
||||
UFUNCTION(BlueprintCallable, Category = "VRM4U")
|
||||
static bool CopyVirtualBone(USkeletalMesh *dstMesh, const USkeletalMesh *srcMesh);
|
||||
|
||||
UFUNCTION(BlueprintCallable, Category = "VRM4U")
|
||||
static bool CreateTailBone(USkeletalMesh *skeletalMesh, const TArray<FString> &boneName);
|
||||
|
||||
UFUNCTION(BlueprintCallable, Category = "VRM4U", meta = (DynamicOutputParam = "RigIK"))
|
||||
static void VRMGenerateEpicSkeletonToHumanoidIKRig(USkeletalMesh* srcSkeletalMesh, UObject*& outRigIK, UObject*& outIKRetargeter, UObject* targetRigIK);
|
||||
|
||||
UFUNCTION(BlueprintCallable, Category = "VRM4U", meta = (DynamicOutputParam = "RigIK"))
|
||||
static void VRMGenerateIKRetargeterPose(UObject * IKRetargeter, UObject* targetRigIK, UPoseAsset* targetPose);
|
||||
|
||||
static bool IsValidVRM4UFile(FString filepath);
|
||||
static void GetVRMMeta(FString filepath, UVrmLicenseObject*& a, UVrm1LicenseObject*& b);
|
||||
};
|
||||
@@ -0,0 +1,273 @@
|
||||
// VRM4U Copyright (c) 2021-2024 Haruyoshi Yamamoto. This software is released under the MIT License.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "UObject/ObjectMacros.h"
|
||||
#include "UObject/Object.h"
|
||||
#include "Misc/EngineVersionComparison.h"
|
||||
#include "Engine/SkeletalMesh.h"
|
||||
|
||||
#if UE_VERSION_OLDER_THAN(5,4,0)
|
||||
#else
|
||||
#include "Misc/FieldAccessor.h"
|
||||
#endif
|
||||
|
||||
#include "VrmUtil.h"
|
||||
#include "VrmJson.h"
|
||||
|
||||
#include <assimp/Importer.hpp>
|
||||
#include <assimp/scene.h>
|
||||
#include <assimp/mesh.h>
|
||||
#include <assimp/postprocess.h>
|
||||
#include <assimp/material.h>
|
||||
#include <assimp/GltfMaterial.h>
|
||||
#include <assimp/vrm/vrmmeta.h>
|
||||
|
||||
//#include "VrmConvert.generated.h"
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
struct aiScene;
|
||||
class UTexture2D;
|
||||
class UMaterialInterface;
|
||||
class USkeletalMesh;
|
||||
class UVrmAssetListObject;
|
||||
class UVrmLicenseObject;
|
||||
class UVrm1LicenseObject;
|
||||
class UPackage;
|
||||
|
||||
|
||||
class VRM4ULOADER_API VRMConverter {
|
||||
|
||||
bool InitJSON(const uint8* pData, size_t pFileDataSize);
|
||||
|
||||
public:
|
||||
|
||||
VrmJson jsonData;
|
||||
const aiScene* aiData = nullptr;
|
||||
|
||||
char* GetMatName(int matNo) const;
|
||||
char* GetMatShaderName(int matNo) const;
|
||||
int GetMatNum() const;
|
||||
int GetMatCullMode(int matNo) const;
|
||||
int GetMatZWrite(int matNo) const;
|
||||
|
||||
int GetThumbnailTextureIndex() const;
|
||||
|
||||
bool GetMatParam(VRM::VRMMaterial &m, int matNo) const;
|
||||
|
||||
|
||||
static bool IsImportMode();
|
||||
static void SetImportMode(bool bImportMode);
|
||||
static FString NormalizeFileName(const char *str);
|
||||
static FString NormalizeFileName(const FString &str);
|
||||
|
||||
static bool NormalizeBoneName(const aiScene *mScenePtr);
|
||||
|
||||
bool Init(const uint8* pFileData, size_t dataSize, const aiScene*);
|
||||
bool ValidateSchema();
|
||||
|
||||
bool ConvertTextureAndMaterial(UVrmAssetListObject *vrmAssetList);
|
||||
bool ConvertModel(UVrmAssetListObject *vrmAssetList);
|
||||
bool ConvertMorphTarget(UVrmAssetListObject *vrmAssetList);
|
||||
|
||||
void GetVRMMeta(const aiScene *mScenePtr, UVrmLicenseObject *& a, UVrm1LicenseObject *& b);
|
||||
bool ConvertVrmFirst(UVrmAssetListObject* vrmAssetList, const uint8* pData, size_t dataSize);
|
||||
bool ConvertVrmMeta(UVrmAssetListObject *vrmAssetList, const aiScene *mScenePtr, const uint8* pData, size_t dataSize);
|
||||
bool ConvertVrmMetaPost(UVrmAssetListObject* vrmAssetList, const aiScene* mScenePtr, const uint8* pData, size_t dataSize);
|
||||
|
||||
bool ConvertHumanoid(UVrmAssetListObject *vrmAssetList);
|
||||
bool ConvertRig(UVrmAssetListObject *vrmAssetList);
|
||||
bool ConvertIKRig(UVrmAssetListObject* vrmAssetList);
|
||||
bool ConvertPose(UVrmAssetListObject* vrmAssetList);
|
||||
|
||||
UPackage *CreatePackageFromImportMode(UPackage *p, const FString &name);
|
||||
|
||||
class VRM4ULOADER_API Options {
|
||||
public:
|
||||
static Options & Get();
|
||||
|
||||
const FImportOptionData *ImportOption = nullptr;
|
||||
void SetVrmOption(const FImportOptionData *p) {
|
||||
ImportOption = p;
|
||||
}
|
||||
|
||||
class USkeleton *GetSkeleton();
|
||||
bool IsSimpleRootBone() const;
|
||||
|
||||
bool IsActiveBone() const;
|
||||
|
||||
bool IsSkipPhysics() const;
|
||||
bool IsSkipRetargeter() const;
|
||||
|
||||
bool IsSkipNoMeshBone() const;
|
||||
|
||||
bool IsSkipMorphTarget() const;
|
||||
|
||||
bool IsEnableMorphTargetNormal() const;
|
||||
|
||||
bool IsForceOriginalMorphTargetName() const;
|
||||
|
||||
bool IsRemoveBlendShapeGroupPrefix() const;
|
||||
|
||||
bool IsRemoveRootBoneRotation() const;
|
||||
bool IsRemoveRootBonePosition() const;
|
||||
|
||||
bool IsVRM10RemoveLocalRotation() const;
|
||||
bool IsVRM10BindToRestPose() const;
|
||||
|
||||
bool IsVRM10Bindpose() const;
|
||||
|
||||
bool IsForceOriginalBoneName() const;
|
||||
bool IsGenerateHumanoidRenamedMesh() const;
|
||||
|
||||
bool IsGenerateIKBone() const;
|
||||
bool IsGenerateRigIK() const;
|
||||
|
||||
bool IsDebugIgnoreVRMValidation() const;
|
||||
bool IsDebugOneBone() const;
|
||||
bool IsDebugNoMesh() const;
|
||||
bool IsDebugNoMaterial() const;
|
||||
|
||||
bool IsMobileBone() const;
|
||||
|
||||
int GetBoneWeightInfluenceNum() const;
|
||||
|
||||
bool IsForceOpaque() const;
|
||||
bool IsForceTwoSided() const;
|
||||
|
||||
bool IsSingleUAssetFile() const;
|
||||
|
||||
bool IsDefaultGridTextureMode() const;
|
||||
bool IsBC7Mode() const;
|
||||
bool IsMipmapGenerateMode() const;
|
||||
|
||||
bool IsGenerateOutlineMaterial() const;
|
||||
bool IsMergeMaterial() const;
|
||||
|
||||
bool IsMergePrimitive() const;
|
||||
|
||||
bool IsOptimizeMaterial() const;
|
||||
|
||||
bool IsOptimizeVertex() const;
|
||||
|
||||
bool IsRemoveDegenerateTriangles() const;
|
||||
|
||||
void ClearModelType();
|
||||
|
||||
bool IsUE5Material() const;
|
||||
|
||||
bool IsVRMModel() const;
|
||||
bool IsVRM0Model() const;
|
||||
bool IsVRM10Model() const;
|
||||
|
||||
void SetVRM0Model(bool bVRM);
|
||||
void SetVRM10Model(bool bVRM);
|
||||
|
||||
bool IsVRMAModel() const;
|
||||
void SetVRMAModel(bool bVRMA);
|
||||
|
||||
bool IsBVHModel() const;
|
||||
void SetBVHModel(bool bBVH);
|
||||
|
||||
bool IsPMXModel() const;
|
||||
void SetPMXModel(bool bPMX);
|
||||
|
||||
bool IsNoMesh() const;
|
||||
void SetNoMesh(bool bNoMesh);
|
||||
|
||||
bool IsForceOverride() const;
|
||||
float GetModelScale() const;
|
||||
|
||||
float GetAnimationTranslateScale() const;
|
||||
|
||||
float GetAnimationPlayRateScale() const;
|
||||
|
||||
bool IsAPoseRetarget() const;
|
||||
|
||||
EVRMImportMaterialType GetMaterialType() const;
|
||||
void SetMaterialType(EVRMImportMaterialType type);
|
||||
};
|
||||
};
|
||||
|
||||
class VRM4ULOADER_API VRMLoaderUtil {
|
||||
public:
|
||||
static UTexture2D* CreateTexture(int32 InSizeX, int32 InSizeY, FString name, UPackage* package);
|
||||
static UTexture2D* CreateTextureFromImage(FString name, UPackage* package, const void* Buffer, const size_t Length, bool GenerateMip = false, bool bNormal = false, bool bNormalGreenFlip = false);
|
||||
|
||||
static bool LoadImageFromMemory(const void* Buffer, const size_t Length, VRMUtil::FImportImage& OutImage);
|
||||
};
|
||||
|
||||
|
||||
class VRM4ULOADER_API VrmConvert {
|
||||
public:
|
||||
VrmConvert();
|
||||
~VrmConvert();
|
||||
};
|
||||
|
||||
extern FString VRM4U_GetPackagePath(UPackage* Outer);
|
||||
extern UPackage* VRM4U_CreatePackage(UPackage* Outer, FName Name);
|
||||
|
||||
template< class T >
|
||||
T* VRM4U_NewObject(UObject* Outer, FName Name, EObjectFlags Flags = RF_NoFlags, UObject* Template = nullptr, bool bCopyTransientsFromClassDefaults = false, FObjectInstancingGraph* InInstanceGraph = nullptr) {
|
||||
UPackage* pkg = Cast<UPackage>(Outer);
|
||||
if (VRMConverter::Options::Get().IsSingleUAssetFile() == false) {
|
||||
pkg = VRM4U_CreatePackage(pkg, Name);
|
||||
}
|
||||
decltype(auto) r = NewObject<T>(pkg, Name, Flags, Template, bCopyTransientsFromClassDefaults, InInstanceGraph);
|
||||
r->MarkPackageDirty();
|
||||
return r;
|
||||
}
|
||||
|
||||
template< class T >
|
||||
T* VRM4U_NewObject(UObject* Outer, UClass* Class, FName Name, EObjectFlags Flags = RF_NoFlags, UObject* Template = nullptr, bool bCopyTransientsFromClassDefaults = false, FObjectInstancingGraph* InInstanceGraph = nullptr) {
|
||||
UPackage* pkg = Cast<UPackage>(Outer);
|
||||
if (VRMConverter::Options::Get().IsSingleUAssetFile() == false) {
|
||||
pkg = VRM4U_CreatePackage(pkg, Name);
|
||||
}
|
||||
decltype(auto) r = NewObject<T>(pkg, Class, Name, Flags, Template, bCopyTransientsFromClassDefaults, InInstanceGraph);
|
||||
r->MarkPackageDirty();
|
||||
return r;
|
||||
}
|
||||
|
||||
template< class T >
|
||||
T* VRM4U_DuplicateObject(const T *src, UPackage* Outer, FName Name) {
|
||||
UPackage* pkg = Outer;
|
||||
if (VRMConverter::Options::Get().IsSingleUAssetFile() == false) {
|
||||
pkg = VRM4U_CreatePackage(Outer, Name);
|
||||
}
|
||||
decltype(auto) r = DuplicateObject<T>(src, pkg, Name);
|
||||
r->MarkPackageDirty();
|
||||
return r;
|
||||
}
|
||||
|
||||
#if UE_VERSION_OLDER_THAN(5,4,0)
|
||||
extern UObject* VRM4U_StaticDuplicateObject(UObject const* SourceObject, UObject* DestOuter, const FName DestName = NAME_None, EObjectFlags FlagMask = RF_AllFlags, UClass* DestClass = nullptr, EDuplicateMode::Type DuplicateMode = EDuplicateMode::Normal, EInternalObjectFlags InternalFlagsMask = EInternalObjectFlags::AllFlags);
|
||||
#else
|
||||
extern UObject* VRM4U_StaticDuplicateObject(UObject const* SourceObject, UObject* DestOuter, const FName DestName = NAME_None, EObjectFlags FlagMask = RF_AllFlags, UClass* DestClass = nullptr, EDuplicateMode::Type DuplicateMode = EDuplicateMode::Normal, EInternalObjectFlags InternalFlagsMask = EInternalObjectFlags_AllFlags);
|
||||
#endif
|
||||
|
||||
|
||||
#if UE_VERSION_OLDER_THAN(5,0,0)
|
||||
template<typename T>
|
||||
FTexturePlatformData* GetPlatformData(T* t) {
|
||||
return t->PlatformData;
|
||||
}
|
||||
template<typename T, typename U>
|
||||
void SetPlatformData(T* t, U* u) {
|
||||
t->PlatformData = u;
|
||||
}
|
||||
#else
|
||||
template<typename T>
|
||||
TFieldPtrAccessor<FTexturePlatformData> GetPlatformData(T* t) {
|
||||
return t->GetPlatformData();
|
||||
}
|
||||
template<typename T, typename U>
|
||||
void SetPlatformData(T* t, U* u) {
|
||||
t->SetPlatformData(u);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
// VRM4U Copyright (c) 2021-2024 Haruyoshi Yamamoto. This software is released under the MIT License.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class VRM4ULOADER_API VrmConvertHumanoid
|
||||
{
|
||||
public:
|
||||
VrmConvertHumanoid();
|
||||
~VrmConvertHumanoid();
|
||||
};
|
||||
@@ -0,0 +1,15 @@
|
||||
// VRM4U Copyright (c) 2021-2024 Haruyoshi Yamamoto. This software is released under the MIT License.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class VRM4ULOADER_API VrmConvertIKRig
|
||||
{
|
||||
public:
|
||||
VrmConvertIKRig();
|
||||
~VrmConvertIKRig();
|
||||
};
|
||||
@@ -0,0 +1,15 @@
|
||||
// VRM4U Copyright (c) 2021-2024 Haruyoshi Yamamoto. This software is released under the MIT License.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class VRM4ULOADER_API VrmConvertMetadata
|
||||
{
|
||||
public:
|
||||
VrmConvertMetadata();
|
||||
~VrmConvertMetadata();
|
||||
};
|
||||
@@ -0,0 +1,15 @@
|
||||
// VRM4U Copyright (c) 2021-2024 Haruyoshi Yamamoto. This software is released under the MIT License.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class VRM4ULOADER_API VrmConvertModel
|
||||
{
|
||||
public:
|
||||
VrmConvertModel();
|
||||
~VrmConvertModel();
|
||||
};
|
||||
@@ -0,0 +1,15 @@
|
||||
// VRM4U Copyright (c) 2021-2024 Haruyoshi Yamamoto. This software is released under the MIT License.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class VRM4ULOADER_API VrmConvertMorphTarget
|
||||
{
|
||||
public:
|
||||
VrmConvertMorphTarget();
|
||||
~VrmConvertMorphTarget();
|
||||
};
|
||||
@@ -0,0 +1,15 @@
|
||||
// VRM4U Copyright (c) 2021-2024 Haruyoshi Yamamoto. This software is released under the MIT License.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class VRM4ULOADER_API VrmConvertRig
|
||||
{
|
||||
public:
|
||||
VrmConvertRig();
|
||||
~VrmConvertRig();
|
||||
};
|
||||
@@ -0,0 +1,15 @@
|
||||
// VRM4U Copyright (c) 2021-2024 Haruyoshi Yamamoto. This software is released under the MIT License.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class VRM4ULOADER_API VrmConvertTexture
|
||||
{
|
||||
public:
|
||||
VrmConvertTexture();
|
||||
~VrmConvertTexture();
|
||||
};
|
||||
@@ -0,0 +1,22 @@
|
||||
#pragma once
|
||||
|
||||
#define RAPIDJSON_NAMESPACE vrm4u::local::rapid_json
|
||||
#define RAPIDJSON_NAMESPACE_BEGIN namespace vrm4u { namespace local { namespace rapid_json {
|
||||
#define RAPIDJSON_NAMESPACE_END } } }
|
||||
|
||||
#include <vector>
|
||||
#include "rapidjson/document.h"
|
||||
|
||||
class VrmJson {
|
||||
|
||||
bool bEnable = false;
|
||||
public:
|
||||
RAPIDJSON_NAMESPACE::Document doc;
|
||||
|
||||
bool validateSchema();
|
||||
bool init(const uint8_t* pData, size_t size);
|
||||
|
||||
bool IsEnable() const{
|
||||
return bEnable;
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,87 @@
|
||||
// VRM4U Copyright (c) 2021-2024 Haruyoshi Yamamoto. This software is released under the MIT License.
|
||||
// ApplicationLifecycleComponent.: See FCoreDelegates for details
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "UObject/ObjectMacros.h"
|
||||
#include "Components/ActorComponent.h"
|
||||
#include "Misc/CoreDelegates.h"
|
||||
#include "VrmLoaderComponent.generated.h"
|
||||
|
||||
// A parallel enum to the temperature change severity enum in CoreDelegates
|
||||
// Note if you change this, then you must change the one in CoreDelegates
|
||||
/*
|
||||
UENUM(BlueprintType)
|
||||
enum class ETemperatureSeverityType : uint8
|
||||
{
|
||||
Unknown,
|
||||
Good,
|
||||
Bad,
|
||||
Serious,
|
||||
Critical,
|
||||
|
||||
NumSeverities,
|
||||
};
|
||||
*/
|
||||
//static_assert((int)ETemperatureSeverityType::NumSeverities == (int)FCoreDelegates::ETemperatureSeverity::NumSeverities, "TemperatureSeverity enums are out of sync");
|
||||
|
||||
class UVrmAssetListObject;
|
||||
|
||||
/** Component to handle receiving notifications from the OS about application state (activated, suspended, termination, etc). */
|
||||
UCLASS(ClassGroup=Utility, HideCategories=(Activation, "Components|Activation", Collision), meta=(BlueprintSpawnableComponent))
|
||||
class VRM4ULOADER_API UVrmLoaderComponent : public UActorComponent
|
||||
{
|
||||
GENERATED_UCLASS_BODY()
|
||||
|
||||
//DECLARE_DYNAMIC_MULTICAST_DELEGATE(FApplicationLifetimeDelegate);
|
||||
//DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnTemperatureChangeDelegate , ETemperatureSeverityType, Severity);
|
||||
//DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnLowPowerModeDelegate, bool, bInLowPowerMode);
|
||||
|
||||
//DECLARE_MULTICAST_DELEGATE_OneParam(FStaticOnDropFiles, FString);
|
||||
//static FStaticOnDropFiles StaticOnDropFilesDelegate;
|
||||
|
||||
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnFinishLoad, UVrmAssetListObject*, AssetList);
|
||||
|
||||
UPROPERTY(BlueprintAssignable)
|
||||
FOnFinishLoad OnFinishLoad;
|
||||
|
||||
UPROPERTY()
|
||||
UVrmAssetListObject *AssetList = nullptr;
|
||||
mutable bool bResultQueue = false;
|
||||
|
||||
public:
|
||||
void OnRegister() override;
|
||||
void OnUnregister() override;
|
||||
|
||||
//static const UVrmDropFilesComponent* getLatestActiveComponent() {
|
||||
//return s_LatestActiveComponent;
|
||||
//};
|
||||
|
||||
UFUNCTION(BlueprintCallable, Category = "VRM4U", meta = (DynamicOutputParam = "OutVrmAsset"))
|
||||
bool LoadVRMFile(const UVrmAssetListObject *InVrmAsset, UVrmAssetListObject *&OutVrmAsset, FString filepath);
|
||||
|
||||
UFUNCTION(BlueprintCallable, Category = "VRM4U", meta = (DynamicOutputParam = "OutVrmAsset"))
|
||||
bool LoadVRMFileAsync(const UVrmAssetListObject *InVrmAsset, FString filepath);
|
||||
|
||||
virtual void TickComponent(float DeltaTime, enum ELevelTick TickType, FActorComponentTickFunction *ThisTickFunction) override;
|
||||
|
||||
|
||||
private:
|
||||
/** Native handlers that get registered with the actual FCoreDelegates, and then proceed to broadcast to the delegates above */
|
||||
/*
|
||||
void ApplicationWillDeactivateDelegate_Handler() { ApplicationWillDeactivateDelegate.Broadcast(); }
|
||||
void ApplicationHasReactivatedDelegate_Handler() { ApplicationHasReactivatedDelegate.Broadcast(); }
|
||||
void ApplicationWillEnterBackgroundDelegate_Handler() { ApplicationWillEnterBackgroundDelegate.Broadcast(); }
|
||||
void ApplicationHasEnteredForegroundDelegate_Handler() { ApplicationHasEnteredForegroundDelegate.Broadcast(); }
|
||||
void ApplicationWillTerminateDelegate_Handler() { ApplicationWillTerminateDelegate.Broadcast(); }
|
||||
void ApplicationShouldUnloadResourcesDelegate_Handler() { ApplicationShouldUnloadResourcesDelegate.Broadcast(); }
|
||||
void ApplicationReceivedStartupArgumentsDelegate_Handler(const TArray<FString>& StartupArguments) { ApplicationReceivedStartupArgumentsDelegate.Broadcast(StartupArguments); }
|
||||
void OnTemperatureChangeDelegate_Handler(FCoreDelegates::ETemperatureSeverity Severity) { OnTemperatureChangeDelegate.Broadcast((ETemperatureSeverityType)Severity); }
|
||||
void OnLowPowerModeDelegate_Handler(bool bInLowerPowerMode) { OnLowPowerModeDelegate.Broadcast(bInLowerPowerMode); }
|
||||
*/
|
||||
//void OnDropFilesDelegate_Handler(FString FileName) { OnDropFiles.Broadcast(FileName); }
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
// VRM4U Copyright (c) 2021-2024 Haruyoshi Yamamoto. This software is released under the MIT License.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "Engine/SkeletalMesh.h"
|
||||
#include "VrmSkeletalMesh.generated.h"
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
UCLASS()
|
||||
class VRM4ULOADER_API UVrmSkeletalMesh : public USkeletalMesh
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
|
||||
public:
|
||||
void Proc();
|
||||
|
||||
|
||||
|
||||
};
|
||||
@@ -0,0 +1,18 @@
|
||||
// VRM4U Copyright (c) 2021-2024 Haruyoshi Yamamoto. This software is released under the MIT License.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "Animation/Skeleton.h"
|
||||
#include "Misc/EngineVersionComparison.h"
|
||||
//#include "VrmSkeleton.generated.h"
|
||||
|
||||
class USkeletalMesh;
|
||||
class UVrmAssetListObject;
|
||||
|
||||
class VRM4ULOADER_API VRMSkeleton {
|
||||
public:
|
||||
static void readVrmBone(struct aiScene* scene, int& boneOffset, FReferenceSkeleton& RefSkeleton, UVrmAssetListObject* assetList);
|
||||
|
||||
static void addIKBone(class UVrmAssetListObject* vrmAssetList, USkeletalMesh* sk);
|
||||
};
|
||||
Reference in New Issue
Block a user