Skip to content

3D scene import: Allow importing files as Mesh or MeshLibrary via ResourceImporterScene #107856

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

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

aaronfranke
Copy link
Member

Alternative to PR #107840 (mutually exclusive: only one can be merged, the other must be closed)

Implements godotengine/godot-proposals#7494 for all 3D scene formats imported to ArrayMesh and MeshLibrary.

Depends on #107838 and #107855 and goes well with #107836 (all of those PRs are good to merge even without this PR).

Screenshot 2025-06-22 at 1 14 53 AM
  • The "Mesh Library" import option imports all meshes in the Godot scene generated from the 3D model file as items in a MeshLibrary, and optionally can save these meshes to a file, and optionally can use node names as mesh names. This is useful for 3D model files intended to be used as a collection of meshes, rather than a single model or scene.
  • The "Single Mesh" import option imports the 3D model file as a single ArrayMesh, which is that exact mesh as-is when importing a file with a single mesh, or imports a merged mesh if the file contains multiple meshes.

This PR is marked as a discussion because this ResourceImporterScene approach is just one of the possible implementations. The other approach is to use ResourceImporter (not Scene) and more directly generate these from the data in specific formats like glTF: #107840 I briefly discussed this with @fire on Discord and he said he prefers ResourceImporterScene but I'm putting both options on the table.

Here's a copy of what I sent on Discord. We basically have 3 options:

  • Support importing any 3D model as Mesh or MeshLibrary by disassembling the generated scene in ResourceImporterScene. (this PR)
    • Advantages: Supports all 3D model formats at once, including glTF, FBX, Blend, Collada, etc. Keeps using the Advanced Import Settings dialog, so it shows the same dialog as when importing as a scene.
    • Disadvantages: More complex, slower since it involves generating a scene, does not support resource-only glTF files, harder to expose mesh-specific import options, not thread safe because physics may exist.
  • Support importing glTF directly as Mesh or MeshLibrary using ResourceImporter. GLTF: Allow importing files as Mesh or MeshLibrary directly #107840
    • Advantages: Simpler, faster to run since it skips scene generation, supports resource-only glTF files (requires PR #107836), easier to expose mesh-specific import options, should be thread safe and Godot may crash when generating physics objects on a thread.
    • Disadvantages: Only gives us glTF, would need duplicate code for FBX, Blend, etc, if desired there. Does not show the Advanced Import Settings dialog, because it bypasses that system, instead double-clicking on the source file will show the imported Resource in the inspector like with other non-scene files.
  • Wait for Add ability to reference subresources and inspect them in filesystem godot-proposals#8750 instead?

Also, @fire mentioned that "It won't support multi meshes" and that mesh merging "is better done in blender since it's pretty tricky", but I managed to support it anyway, so long as we have PR #107838. I think mesh merging functionality should be supported, regardless of how the importer exposes it.

@fire
Copy link
Member

fire commented Jun 23, 2025

Is there specific places we want extra review? How complete is this?

@aaronfranke
Copy link
Member Author

@fire Yes, the specific places to review are the 3 PRs that this depends on.

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.

2 participants