88#include " momentum/io/fbx/fbx_io.h"
99
1010#include " momentum/character/character.h"
11+ #include " momentum/common/exception.h"
12+ #include " momentum/io/fbx/openfbx_loader.h"
13+
14+ #ifdef MOMENTUM_WITH_FBX_SDK
1115#include " momentum/character/character_state.h"
1216#include " momentum/character/collision_geometry_state.h"
1317#include " momentum/character/marker.h"
1418#include " momentum/character/skin_weights.h"
15- #include " momentum/common/exception.h"
1619#include " momentum/common/filesystem.h"
1720#include " momentum/common/log.h"
1821#include " momentum/io/fbx/fbx_memory_stream.h"
19- #include " momentum/io/fbx/openfbx_loader.h"
2022#include " momentum/io/skeleton/locator_io.h"
2123#include " momentum/io/skeleton/parameter_limits_io.h"
2224#include " momentum/io/skeleton/parameter_transform_io.h"
3739#endif
3840
3941#include < variant>
42+ #endif // MOMENTUM_WITH_FBX_SDK
4043
4144namespace momentum {
4245
46+ #ifdef MOMENTUM_WITH_FBX_SDK
47+
4348namespace {
4449
4550[[nodiscard]] ::fbxsdk::FbxAxisSystem::EUpVector toFbx (const FBXUpVector upVector) {
@@ -736,6 +741,8 @@ void saveFbxCommon(
736741
737742} // namespace
738743
744+ #endif // MOMENTUM_WITH_FBX_SDK
745+
739746Character loadFbxCharacter (
740747 const filesystem::path& inputPath,
741748 KeepLocators keepLocators,
@@ -776,6 +783,12 @@ std::tuple<Character, std::vector<MatrixXf>, float> loadFbxCharacterWithMotion(
776783 inputSpan, keepLocators, permissive, loadBlendShapes, stripNamespaces);
777784}
778785
786+ MarkerSequence loadFbxMarkerSequence (const filesystem::path& filename, bool stripNamespaces) {
787+ return loadOpenFbxMarkerSequence (filename, stripNamespaces);
788+ }
789+
790+ #ifdef MOMENTUM_WITH_FBX_SDK
791+
779792void saveFbx (
780793 const filesystem::path& filename,
781794 const Character& character,
@@ -784,7 +797,7 @@ void saveFbx(
784797 const double framerate,
785798 const bool saveMesh,
786799 const FBXCoordSystemInfo& coordSystemInfo,
787- bool permissive,
800+ const bool permissive,
788801 const std::vector<std::vector<Marker>>& markerSequence,
789802 std::string_view fbxNamespace) {
790803 CharacterParameters params;
@@ -838,7 +851,7 @@ void saveFbxWithJointParams(
838851 const double framerate,
839852 const bool saveMesh,
840853 const FBXCoordSystemInfo& coordSystemInfo,
841- bool permissive,
854+ const bool permissive,
842855 const std::vector<std::vector<Marker>>& markerSequence,
843856 std::string_view fbxNamespace) {
844857 // Call the helper function to save FBX file with joint values.
@@ -864,7 +877,7 @@ void saveFbxWithSkeletonStates(
864877 const double framerate,
865878 const bool saveMesh,
866879 const FBXCoordSystemInfo& coordSystemInfo,
867- bool permissive,
880+ const bool permissive,
868881 const std::vector<std::vector<Marker>>& markerSequence,
869882 std::string_view fbxNamespace) {
870883 const size_t nFrames = skeletonStates.size ();
@@ -909,8 +922,61 @@ void saveFbxModel(
909922 fbxNamespace);
910923}
911924
912- MarkerSequence loadFbxMarkerSequence (const filesystem::path& filename, bool stripNamespaces) {
913- return loadOpenFbxMarkerSequence (filename, stripNamespaces);
925+ #else // !MOMENTUM_WITH_FBX_SDK
926+
927+ void saveFbx (
928+ const filesystem::path& /* filename */ ,
929+ const Character& /* character */ ,
930+ const MatrixXf& /* poses */ ,
931+ const VectorXf& /* identity */ ,
932+ const double /* framerate */ ,
933+ const bool /* saveMesh */ ,
934+ const FBXCoordSystemInfo& /* coordSystemInfo */ ,
935+ const bool /* permissive */ ,
936+ const std::vector<std::vector<Marker>>& /* markerSequence */ ,
937+ std::string_view /* fbxNamespace */ ) {
938+ MT_THROW (
939+ " FBX saving is not supported in OpenFBX-only mode. FBX loading is available via OpenFBX, but saving requires the full Autodesk FBX SDK." );
940+ }
941+
942+ void saveFbxWithJointParams (
943+ const filesystem::path& /* filename */ ,
944+ const Character& /* character */ ,
945+ const MatrixXf& /* jointParams */ ,
946+ const double /* framerate */ ,
947+ const bool /* saveMesh */ ,
948+ const FBXCoordSystemInfo& /* coordSystemInfo */ ,
949+ const bool /* permissive */ ,
950+ const std::vector<std::vector<Marker>>& /* markerSequence */ ,
951+ std::string_view /* fbxNamespace */ ) {
952+ MT_THROW (
953+ " FBX saving is not supported in OpenFBX-only mode. FBX loading is available via OpenFBX, but saving requires the full Autodesk FBX SDK." );
914954}
915955
956+ void saveFbxWithSkeletonStates (
957+ const filesystem::path& /* filename */ ,
958+ const Character& /* character */ ,
959+ std::span<const SkeletonState> /* skeletonStates */ ,
960+ const double /* framerate */ ,
961+ const bool /* saveMesh */ ,
962+ const FBXCoordSystemInfo& /* coordSystemInfo */ ,
963+ const bool /* permissive */ ,
964+ const std::vector<std::vector<Marker>>& /* markerSequence */ ,
965+ std::string_view /* fbxNamespace */ ) {
966+ MT_THROW (
967+ " FBX saving is not supported in OpenFBX-only mode. FBX loading is available via OpenFBX, but saving requires the full Autodesk FBX SDK." );
968+ }
969+
970+ void saveFbxModel (
971+ const filesystem::path& /* filename */ ,
972+ const Character& /* character */ ,
973+ const FBXCoordSystemInfo& /* coordSystemInfo */ ,
974+ bool /* permissive */ ,
975+ std::string_view /* fbxNamespace */ ) {
976+ MT_THROW (
977+ " FBX saving is not supported in OpenFBX-only mode. FBX loading is available via OpenFBX, but saving requires the full Autodesk FBX SDK." );
978+ }
979+
980+ #endif // MOMENTUM_WITH_FBX_SDK
981+
916982} // namespace momentum
0 commit comments