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

Remove scene/3d/model_*.h from FBX pull request #88680

Closed
wants to merge 4 commits into from

Conversation

fire
Copy link
Member

@fire fire commented Feb 22, 2024

As mentioned in #81746 (comment) here's the stacked commits.

@fire fire requested review from a team as code owners February 22, 2024 19:36
@fire fire force-pushed the vsk-ufbx-untangle branch 4 times, most recently from e41fee1 to b1fb7c4 Compare February 22, 2024 20:03
@fire fire force-pushed the vsk-ufbx-untangle branch from b1fb7c4 to 0c01996 Compare February 22, 2024 22:35
modules/gltf/config.py Outdated Show resolved Hide resolved
@fire fire force-pushed the vsk-ufbx-untangle branch 2 times, most recently from c8991bf to d0e5cf3 Compare February 22, 2024 23:01
Copy link
Contributor

@lyuma lyuma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly approving topmost commit (Remove scene/3d/model_*.h from FBX commit.)

consolidating ModelDocument back into GLTFDocument (and same for ModelState) drastically simplifies the code and avoids any compatibility breakage.

The only change I would like to request is to have FBXDocument inherit from Resource (really it should be RefCounted but it doesn't matter) instead of GLTFDocument, and re-declare the three public methods rather than relying on inheritance.

Copy link
Contributor

@lyuma lyuma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I missed that some of the common code ended up back in GLTFDocument. I don't want to complicate this change, so I think it's fine to have FBXDocument extend GLTFDocument.

LGTM

fire and others added 2 commits February 23, 2024 06:34
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>
- ModelDocument3D is completely dependent on gltf, so we can't have it in
  `scene`, it breaks the build with gltf disabled, and is super hacky.
  It was even depending on the FBX module, so I copied a helper method to
  work it around.
  * So I moved it back to the gltf module. Needs further work to actually
    make it a proper abstraction, but currently this is not it.
- The gltf module should NOT depend on fbx. Modules are meant to be MODULAR,
  they can't have circular dependencies like this. In theory, the fbx module
  should also not depend on gltf, but I see we're far from that goal, so
  I made the dependency explicit (fbx can't be enabled if gltf is disabled).
- Thus, I renamed and moved the FBX2glTF importer to the fbx module. The
  hack used to find which importer to use, where each importer refers to the
  other one, is really hacky... This also will need to be fixed. But I'm
  aware it's dependent on a bug report, which I linked in a comment.
- Renamed `filesystem/import/fbx/enabled` to `fbx2gltf`, since it doesn't
  control ufbx.
- Please please pay attention to includes, I'm tired of having to clean
  them up. I didn't do a full review but I finally noticed that the forward
  declares of core types in `gltf_defines.h`, combined with your IWYU-style
  IDE plugin that always re-adds all includes, is a very cursed combo.
  So I nuked the forward declares, if you want to always include everything,
  let's not do it twice...
@fire fire force-pushed the vsk-ufbx-untangle branch from d0e5cf3 to 6bd1a34 Compare February 23, 2024 14:37
@fire
Copy link
Member Author

fire commented Feb 23, 2024

Updated to fix merge conflict in misc/extension_api_validation/4.2-stable.expected

Copy link
Contributor

@Mickeon Mickeon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am confused on what exactly this is about but the docs are almost just fine.

modules/fbx/doc_classes/FBXState.xml Outdated Show resolved Hide resolved
Update GLTFDocument inheritance, method names, and parameters. 

Refactor FBXDocument methods for consistency with GLTFDocument.

Update FBX and GLTF importers to use boolean flag for helper nodes.
@fire fire force-pushed the vsk-ufbx-untangle branch from 6bd1a34 to e376762 Compare February 23, 2024 19:47
modules/fbx/doc_classes/FBXState.xml Outdated Show resolved Hide resolved
Co-authored-by: Micky <66727710+Mickeon@users.noreply.github.com>
@akien-mga akien-mga changed the title Remove scene/3d/model_*.h from FBX pull request Remove scene/3d/model_*.h from FBX pull request Feb 23, 2024
Copy link
Member

@akien-mga akien-mga left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. This should be merged back into #81746, and squashed before merge.

ClassDB::bind_method(D_METHOD("write_to_filesystem_from_data", "state", "path"),
&ModelDocument3D::write_to_filesystem_from_data);
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing \n at end of file.

};

#endif // MODEL_DOCUMENT_3D_H
#endif // SKIN_TOOL_H
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here.

Comment on lines +36 to +38
#include "modules/gltf/structures/gltf_node.h"
#include "modules/gltf/structures/gltf_skeleton.h"
#include "modules/gltf/structures/gltf_skin.h"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The module's own includes should be relative paths.

Suggested change
#include "modules/gltf/structures/gltf_node.h"
#include "modules/gltf/structures/gltf_skeleton.h"
#include "modules/gltf/structures/gltf_skin.h"
#include "structures/gltf_node.h"
#include "structures/gltf_skeleton.h"
#include "structures/gltf_skin.h"

Comment on lines 34 to +37
#include "core/io/resource.h"

#include "../gltf_defines.h"

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be changed back, the convention for includes in modules is:

  • Module-scoped includes first
  • Rest of the engine (core, scene, etc.)
  • Thirdparty

@akien-mga akien-mga mentioned this pull request Feb 23, 2024
27 tasks
@akien-mga
Copy link
Member

Merged into #81746 with the edits I listed above.

@akien-mga akien-mga closed this Feb 23, 2024
@AThousandShips AThousandShips removed this from the 4.3 milestone Feb 24, 2024
@fire fire deleted the vsk-ufbx-untangle branch February 26, 2024 18:53
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.

6 participants