From 1f74347e19f5bf10635cec0326b2b7bab9401362 Mon Sep 17 00:00:00 2001 From: BlueRose <378100977@qq.com> Date: Mon, 11 Dec 2023 19:15:43 +0800 Subject: [PATCH] vault backup: 2023-12-11 19:15:43 --- .../Editor/FBXAnimation导入逻辑.md | 11 +++- 08-Assets/FbxInclude 1.h | 56 +++++++++++++++++++ 08-Assets/FbxInclude.h | 56 +++++++++++++++++++ 3 files changed, 122 insertions(+), 1 deletion(-) create mode 100644 08-Assets/FbxInclude 1.h create mode 100644 08-Assets/FbxInclude.h diff --git a/03-UnrealEngine/Editor/FBXAnimation导入逻辑.md b/03-UnrealEngine/Editor/FBXAnimation导入逻辑.md index 45cdd17..9040e4e 100644 --- a/03-UnrealEngine/Editor/FBXAnimation导入逻辑.md +++ b/03-UnrealEngine/Editor/FBXAnimation导入逻辑.md @@ -102,4 +102,13 @@ void UBVHImportFactory::RecursiveReadKeysFromNode(IAnimationDataController& Cont # UE5中使用FBXSDK导入动画逻辑 - UAnimSequence * UEditorEngine::ImportFbxAnimation - - UAnimSequence * UnFbx::FFbxImporter::ImportAnimations \ No newline at end of file + - UAnimSequence * UnFbx::FFbxImporter::ImportAnimations + +UE5中FBXSDK相关函数调用方式: +- bool FFbxImporter::OpenFile(FString Filename) +- bool FFbxImporter::ImportFile(FString Filename, bool bPreventMaterialNameClash /*=false*/) + +# 参考 +1. Interchange\\Runtime\\Source\\Parsers + 1. InterchangeFbxParser.Build.cs + 2. FbxInclude.h:FBXSDK头文件包含问题。 \ No newline at end of file diff --git a/08-Assets/FbxInclude 1.h b/08-Assets/FbxInclude 1.h new file mode 100644 index 0000000..2d74765 --- /dev/null +++ b/08-Assets/FbxInclude 1.h @@ -0,0 +1,56 @@ +// Copyright Epic Games, Inc. All Rights Reserved. + +#pragma once + +#include "CoreMinimal.h" + +// Temporarily disable a few warnings due to virtual function abuse in FBX source files +#pragma warning( push ) + +#pragma warning( disable : 4263 ) // 'function' : member function does not override any base class virtual member function +#pragma warning( disable : 4264 ) // 'virtual_function' : no override available for virtual member function from base 'class'; function is hidden + +// Include the fbx sdk header +// temp undef/redef of _O_RDONLY because kfbxcache.h (included by fbxsdk.h) does +// a weird use of these identifiers inside an enum. +#ifdef _O_RDONLY +#define TMP_UNFBX_BACKUP_O_RDONLY _O_RDONLY +#define TMP_UNFBX_BACKUP_O_WRONLY _O_WRONLY +#undef _O_RDONLY +#undef _O_WRONLY +#endif + +//Robert G. : Packing was only set for the 64bits platform, but we also need it for 32bits. +//This was found while trying to trace a loop that iterate through all character links. +//The memory didn't match what the debugger displayed, obviously since the packing was not right. +#pragma pack(push,8) + +#if PLATFORM_WINDOWS +// _CRT_SECURE_NO_DEPRECATE is defined but is not enough to suppress the deprecation +// warning for vsprintf and stricmp in VS2010. Since FBX is able to properly handle the non-deprecated +// versions on the appropriate platforms, _CRT_SECURE_NO_DEPRECATE is temporarily undefined before +// including the FBX headers + +// The following is a hack to make the FBX header files compile correctly under Visual Studio 2012 and Visual Studio 2013 +#if _MSC_VER >= 1700 +#define FBX_DLL_MSC_VER 1600 +#endif + + +#endif // PLATFORM_WINDOWS + +// FBX casts null pointer to a reference +THIRD_PARTY_INCLUDES_START +#include +THIRD_PARTY_INCLUDES_END + +#pragma pack(pop) + +#ifdef TMP_UNFBX_BACKUP_O_RDONLY +#define _O_RDONLY TMP_FBX_BACKUP_O_RDONLY +#define _O_WRONLY TMP_FBX_BACKUP_O_WRONLY +#undef TMP_UNFBX_BACKUP_O_RDONLY +#undef TMP_UNFBX_BACKUP_O_WRONLY +#endif + +#pragma warning( pop ) diff --git a/08-Assets/FbxInclude.h b/08-Assets/FbxInclude.h new file mode 100644 index 0000000..2d74765 --- /dev/null +++ b/08-Assets/FbxInclude.h @@ -0,0 +1,56 @@ +// Copyright Epic Games, Inc. All Rights Reserved. + +#pragma once + +#include "CoreMinimal.h" + +// Temporarily disable a few warnings due to virtual function abuse in FBX source files +#pragma warning( push ) + +#pragma warning( disable : 4263 ) // 'function' : member function does not override any base class virtual member function +#pragma warning( disable : 4264 ) // 'virtual_function' : no override available for virtual member function from base 'class'; function is hidden + +// Include the fbx sdk header +// temp undef/redef of _O_RDONLY because kfbxcache.h (included by fbxsdk.h) does +// a weird use of these identifiers inside an enum. +#ifdef _O_RDONLY +#define TMP_UNFBX_BACKUP_O_RDONLY _O_RDONLY +#define TMP_UNFBX_BACKUP_O_WRONLY _O_WRONLY +#undef _O_RDONLY +#undef _O_WRONLY +#endif + +//Robert G. : Packing was only set for the 64bits platform, but we also need it for 32bits. +//This was found while trying to trace a loop that iterate through all character links. +//The memory didn't match what the debugger displayed, obviously since the packing was not right. +#pragma pack(push,8) + +#if PLATFORM_WINDOWS +// _CRT_SECURE_NO_DEPRECATE is defined but is not enough to suppress the deprecation +// warning for vsprintf and stricmp in VS2010. Since FBX is able to properly handle the non-deprecated +// versions on the appropriate platforms, _CRT_SECURE_NO_DEPRECATE is temporarily undefined before +// including the FBX headers + +// The following is a hack to make the FBX header files compile correctly under Visual Studio 2012 and Visual Studio 2013 +#if _MSC_VER >= 1700 +#define FBX_DLL_MSC_VER 1600 +#endif + + +#endif // PLATFORM_WINDOWS + +// FBX casts null pointer to a reference +THIRD_PARTY_INCLUDES_START +#include +THIRD_PARTY_INCLUDES_END + +#pragma pack(pop) + +#ifdef TMP_UNFBX_BACKUP_O_RDONLY +#define _O_RDONLY TMP_FBX_BACKUP_O_RDONLY +#define _O_WRONLY TMP_FBX_BACKUP_O_WRONLY +#undef TMP_UNFBX_BACKUP_O_RDONLY +#undef TMP_UNFBX_BACKUP_O_WRONLY +#endif + +#pragma warning( pop )