-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This update introduces a new import method for FBX files using ufbx. If the fbx2gltf import fails, it will use the most recently cached scene from the ufbx import. The process is sped up by introducing threads to load the ufbx portion. Key changes include: - Support for importing geometry helper nodes in FBX files. - Addition of cameras and lights with updated names. - Removal of the fbx importer manager. - Introduction of ModelDocument3D and updates to its methods. - Changes to FBX import options and visibility. - Updating the documentation and handling some errors. - Store the original non-unique node, mesh and animation names in FBX and glTF. Co-Authored-By: bqqbarbhg <bqqbarbhg@gmail.com>
- Loading branch information
Showing
63 changed files
with
41,640 additions
and
910 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#!/usr/bin/env python | ||
|
||
Import("env") | ||
Import("env_modules") | ||
|
||
env_fbx = env_modules.Clone() | ||
|
||
# Thirdparty source files | ||
|
||
thirdparty_obj = [] | ||
|
||
thirdparty_dir = "#thirdparty/ufbx/" | ||
thirdparty_sources = [thirdparty_dir + "ufbx.c"] | ||
|
||
env_fbx.Prepend(CPPPATH=[thirdparty_dir]) | ||
|
||
env_thirdparty = env_fbx.Clone() | ||
env_thirdparty.disable_warnings() | ||
|
||
env_thirdparty.Append( | ||
CPPDEFINES=[ | ||
"UFBX_NO_SUBDIVISION", | ||
"UFBX_NO_TESSELLATION", | ||
"UFBX_NO_GEOMETRY_CACHE", | ||
"UFBX_NO_SCENE_EVALUATION", | ||
"UFBX_NO_INDEX_GENERATION", | ||
"UFBX_NO_SKINNING_EVALUATION", | ||
"UFBX_NO_FORMAT_OBJ", | ||
] | ||
) | ||
|
||
env_thirdparty.add_source_files(thirdparty_obj, thirdparty_sources) | ||
env.modules_sources += thirdparty_obj | ||
|
||
# Godot source files | ||
|
||
module_obj = [] | ||
|
||
env_fbx.add_source_files(module_obj, "*.cpp") | ||
env_fbx.add_source_files(module_obj, "structures/*.cpp") | ||
|
||
if env.editor_build: | ||
env_fbx.add_source_files(module_obj, "editor/*.cpp") | ||
|
||
env.modules_sources += module_obj | ||
|
||
# Needed to force rebuilding the module files when the thirdparty library is updated. | ||
env.Depends(module_obj, thirdparty_obj) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
def can_build(env, platform): | ||
env.module_add_dependencies("fbx", ["gltf"]) | ||
return not env["disable_3d"] | ||
|
||
|
||
def configure(env): | ||
pass | ||
|
||
|
||
def get_doc_classes(): | ||
return [ | ||
"EditorSceneFormatImporterFBX2GLTF", | ||
"EditorSceneFormatImporterUFBX", | ||
"FBXDocument", | ||
"FBXState", | ||
] | ||
|
||
|
||
def get_doc_path(): | ||
return "doc_classes" |
13 changes: 13 additions & 0 deletions
13
modules/fbx/doc_classes/EditorSceneFormatImporterFBX2GLTF.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<class name="EditorSceneFormatImporterFBX2GLTF" inherits="EditorSceneFormatImporter" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd"> | ||
<brief_description> | ||
Importer for the [code].fbx[/code] scene file format. | ||
</brief_description> | ||
<description> | ||
Imports Autodesk FBX 3D scenes by way of converting them to glTF 2.0 using the FBX2glTF command line tool. | ||
The location of the FBX2glTF binary is set via the [member EditorSettings.filesystem/import/fbx2gltf/fbx2gltf_path] editor setting. | ||
This importer is only used if [member ProjectSettings.filesystem/import/fbx2gltf/enabled] is set to [code]true[/code]. | ||
</description> | ||
<tutorials> | ||
</tutorials> | ||
</class> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<class name="EditorSceneFormatImporterUFBX" inherits="EditorSceneFormatImporter" experimental="" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd"> | ||
<brief_description> | ||
Import FBX files using the ufbx library. | ||
</brief_description> | ||
<description> | ||
EditorSceneFormatImporterUFBX is designed to load FBX files and supports both binary and ASCII FBX files from version 3000 onward. This class supports various 3D object types like meshes, skins, blend shapes, materials, and rigging information. The class aims for feature parity with the official FBX SDK and supports FBX 7.4 specifications. | ||
</description> | ||
<tutorials> | ||
</tutorials> | ||
</class> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<class name="FBXDocument" inherits="GLTFDocument" experimental="" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd"> | ||
<brief_description> | ||
Handles FBX documents. | ||
</brief_description> | ||
<description> | ||
The FBXDocument handles FBX documents. It provides methods to append data from buffers or files, generate scenes, and register/unregister document extensions. | ||
When exporting FBX from Blender, use the "FBX Units Scale" option. The "FBX Units Scale" option sets the correct scale factor and avoids manual adjustments when re-importing into Blender, such as through glTF export. | ||
</description> | ||
<tutorials> | ||
</tutorials> | ||
</class> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<class name="FBXState" inherits="GLTFState" experimental="" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd"> | ||
<brief_description> | ||
</brief_description> | ||
<description> | ||
The FBXState handles the state data imported from FBX files. | ||
</description> | ||
<tutorials> | ||
</tutorials> | ||
<members> | ||
<member name="allow_geometry_helper_nodes" type="bool" setter="set_allow_geometry_helper_nodes" getter="get_allow_geometry_helper_nodes" default="false"> | ||
If [code]true[/code], the import process used auxiliary nodes called geometry helper nodes. These nodes help preserve the pivots and transformations of the original 3D model during import. | ||
</member> | ||
</members> | ||
</class> |
Oops, something went wrong.