Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FBX Importer Rewrite [3.2] #41979

Conversation

RevoluPowered
Copy link
Contributor

Co-authored-by: Gordon MacPherson [email protected]
Co-authored-by: Andrea Catania [email protected]
Co-authored-by: K. S. Ernest (iFire) Lee [email protected]

This is a complete rewrite of the importer. It will give more deterministic behaviour and has been sponsored by IMVU inc, over 1 year has gone into the development of this importer to remove the burden of the FBX SDK.

This was my project for 1 entire year and I really enjoyed the opportunity to add to Godot.

Along the road of implementing fixes we implemented FBX pivots, animations and inheritance type handling, which in most cases works properly.

We have implemented animation and mesh skinning too this should work out of the box, if there are issues let us know.

It's designed so that you can expand this with ease, and fix bugs easily too.

It can import from Autodesk Maya and import into Godot, with pivots.

There are bits we could polish but for now this is good enough.

This was sponsored by IMVU, and a special thanks to everyone who supported this project.

Signed-off-by: Gordon MacPherson [email protected]

Additional fixes made before upstreaming:

  • fixed memory leak
  • ensure consistent ordering on mac linux and windows for fbx tree. (very important for material import to be deterministic)
  • disabled incorrect warnings for fbx_material
  • added compatibility code for /RootNode/ so compat is not broken
  • Optimise FBX - directly import triangles
  • remove debug messages
  • add messages for mesh id, mesh re-import is sometimes slow and we need to know what mesh is being worked on
  • Document no longer uses unordered maps
  • Removed some usages of &GetRequiredToken replaced with safe *GetRequiredToken() function
  • Added parser debugging
  • Added ERR_FAIL_CONDS for unsupported mesh formats (we can add these later super easy to do now)
  • Add memory debugging for the Tokens and the TokenParser to make it safe
  • Add memory initialisation to mesh.cpp surface_tool.h and mesh.h
  • Initialise boolean flags properly
  • Refactored to correct naming for the fbx_mesh_data.h so you know what data you are working on
  • Disabled corruption caused by the FIXME:
  • Fixed document reading indexes and index_to_direct vs indexes mode
  • Fixed UV1 and UV2 coordinates
  • Fixed importer failing to import version 7700 files
  • Replaced memory handling in the FBX Document with pointers, before it was dereferencing invalid memory.
  • Fixed typed properties
  • Improved Document API
  • Fixed bug with ProcessDOMConnection() not working with the bool flag set to true.
  • Fixed FBX skinning not deforming for more than one single mesh
  • Fixed FBX skeleton mapping and skin mapping not being applied properly (now retrieved from document skin list)
  • Fixed set_bone_pose being used in final version()
  • Fixed material properties exceeding 1.0.
  • FBX Document parser revamped to use safe memory practices, and with graceful error messages.
  • ScopePtr, TokenPtr and various internal types have been fleshed out to use proper typedefs across the codebase.
  • Fixed memory leaks caused by token cleanup failing (now explicit cleanup step, no shared_ptr, etc)
  • Fixed bug with PropertyTable not reading all properties and not cleaning up properly.

Co-authored-by: Gordon MacPherson <[email protected]>
Co-authored-by: Andrea Catania <[email protected]>
Co-authored-by: K. S. Ernest (iFire) Lee <[email protected]>

This is a complete rewrite of the importer. It will give more deterministic behaviour and has been sponsored by IMVU inc, over 1 year has gone into the development of this importer to remove the burden of the FBX SDK.

This was my project for 1 entire year and I really enjoyed the opportunity to add to Godot.

Along the road of implementing fixes we implemented fbx pivots, animations and inheritance type handling, which in most cases works properly.

We have implemented animation and mesh skinning too this should work out of the box, if there are issues let us know.

It's designed so that you can expand this with ease, and fix bugs easily too.

It can import from Autodesk Maya and import into Godot, with pivots.

There are bits we could polish but for now this is good enough.

This was sponsored by IMVU, and a special thanks to everyone who supported this project.

Signed-off-by: Gordon MacPherson <[email protected]>

Additional fixes made before upstreaming:
- fixed memory leak
- ensure consistent ordering on mac linux and windows for fbx tree. (very important for material import to be deterministic)
- disabled incorrect warnings for fbx_material
- added compatibility code for /RootNode/ so compat is not broken
- Optimise FBX - directly import triangles
- remove debug messages
- add messages for mesh id, mesh re-import is sometimes slow and we need to know what mesh is being worked on
- correct culling settings on materials

fix importer failing to import 7700 files, and correct args for version

also fixed some cleanup notes
working uv2?

Fix UV2 coordinates and various problems with FBX
- Document no longer uses unordered maps
- Removed some usages of &GetRequiredToken replaced with safe *GetRequiredToken() function
- Added parser debugging
- Added ERR_FAIL_CONDS for unsupported mesh formats (we can add these later super easy to do now)
- Add memory debugging for the Tokens and the TokenParser to make it safe
- Add memory initialisation to mesh.cpp surface_tool.h and mesh.h
- Initialize boolean flags properly
- Refactored to correct naming for the fbx_mesh_data.h so you know what data you are working on
- Disabled corruption caused by the FIXME:
- Fixed document reading indexes and index_to_direct vs indexes mode
- Fixed UV1 and UV2 coordinates
- Fixed importer failing to import version 7700 files
- Replaced memory handling in the FBX Document with pointers, before it was dereferencing invalid memory.
- Fixed typed properties
- Improved Document API
- Fixed bug with ProcessDOMConnection() not working with the bool flag set to true.
- Fixed FBX skinning not deforming for more than one single mesh
- Fixed FBX skeleton mapping and skin mapping not being applied properly (now retrieved from document skin list)
- Fixed set_bone_pose being used in final version()
- Fixed material properties exceeding 1.0.
- FBX Document parser revamped to use safe memory practices, and with graceful error messages.
- ScopePtr, TokenPtr and various internal types have been fleshed out to use proper typedefs across the codebase.
- Fixed memory leaks caused by token cleanup failing (now explicit cleanup step, no shared_ptr, etc)
- Fixed bug with PropertyTable not reading all properties and not cleaning up properly.
@RevoluPowered
Copy link
Contributor Author

Superseded by #42941

@akien-mga akien-mga modified the milestones: 3.2, 3.3 Apr 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants