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

Add export settings to the export dialog for GLTF #79316

Merged
merged 1 commit into from
Jan 2, 2024

Conversation

aaronfranke
Copy link
Member

@aaronfranke aaronfranke commented Jul 11, 2023

Implements godotengine/godot-proposals#7259 Draft because this depends on #79267, #79313, and #79314 to be merged first all of those are now merged, now this PR is undrafted.

This PR adds export settings to the GLTF export dialog. This dialog allows users to adjust the copyright and image format settings, more can be added in the future.

Screenshot 2023-07-11 at 3 22 20 PM

Additionally, GLTFDocumentExtensions can add new settings to this menu by using @export var like so:

Screenshot 2023-07-11 at 3 22 47 PM

This feature is inspired by the Blender export menu:

Screenshot 2023-07-11 at 12 50 53 AM

Implementation details:

  • A new class SceneExporterGLTFSettings is added that overrides the get and set methods and the get property list method to provide a simple interface for accessing settings.
  • This new class is edited by EditorInspector which only shows the relevant properties.
  • The existing methods in SceneExporterGLTFPlugin have been renamed, they were very confusing before, and they are reordered to be top-to-bottom following their execution order.

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.

I think it looks good. A couple small comments.

@fire
Copy link
Member

fire commented Dec 16, 2023

Any comments from the production team on next steps?

@lyuma
Copy link
Contributor

lyuma commented Dec 30, 2023

texture format None doesn't work:

ERROR: GLTF: Unknown image format 'None'.
   at: (modules\gltf\gltf_document.cpp:3104)
ERROR: glTF2 save scene error 1.
   at: SceneExporterGLTFPlugin::_export_scene_as_gltf (modules\gltf\editor\editor_scene_exporter_gltf_plugin.cpp:116)

@aaronfranke
Copy link
Member Author

@lyuma I'm not able to reproduce that problem on my end. If I make a cube, give it a material with a texture, and export that with the image format set to None, there is no error printed in the output, the export succeeds, and the file has no images.

@lyuma
Copy link
Contributor

lyuma commented Dec 30, 2023

The difference is probably that my object has normal, roughness and albedo textures.

The check for None only protects the albedo texture, but the if (has_ao || has_roughness || has_metalness) { if statement for the ORM map doesn't check for None.

Also I'm a little worried that other extensions might choose to add their own textures (such as VRM + MToon) and those might also fail for the same reason.

@aaronfranke
Copy link
Member Author

@lyuma Good catch, you are right, it was not working for non-albedo textures. I updated the code to ensure there is a check before every call to the _set_texture internal helper method. I tested exporting an object with normal and emission and now it works while before it was broken.

@akien-mga akien-mga merged commit 0f0106c into godotengine:master Jan 2, 2024
15 checks passed
@akien-mga
Copy link
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging this pull request may close these issues.

6 participants