-
-
Notifications
You must be signed in to change notification settings - Fork 21.6k
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
gltf: Add GLTFHandleBinary::HANDLE_BINARY_EMBED_AS_UNCOMPRESSED #72440
gltf: Add GLTFHandleBinary::HANDLE_BINARY_EMBED_AS_UNCOMPRESSED #72440
Conversation
1a76afb
to
595f284
Compare
595f284
to
95569f5
Compare
95569f5
to
5213d84
Compare
@@ -87,7 +87,7 @@ Node *EditorSceneFormatImporterGLTF::import_scene(const String &p_path, uint32_t | |||
|
|||
void EditorSceneFormatImporterGLTF::get_import_options(const String &p_path, | |||
List<ResourceImporter::ImportOption> *r_options) { | |||
r_options->push_back(ResourceImporterScene::ImportOption(PropertyInfo(Variant::INT, "meshes/handle_gltf_embedded_images", PROPERTY_HINT_ENUM, "Discard All Textures,Extract Textures,Embed As Basis Universal", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED), GLTFState::HANDLE_BINARY_EXTRACT_TEXTURES)); | |||
r_options->push_back(ResourceImporterScene::ImportOption(PropertyInfo(Variant::INT, "meshes/handle_gltf_embedded_images", PROPERTY_HINT_ENUM, "Discard All Textures,Extract Textures,Embed As Basis Universal,Embed as Uncompressed", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED), GLTFState::HANDLE_BINARY_EXTRACT_TEXTURES)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a GLTF section for this, such as:
gltf/embedded_image_handling
instead of taking over the mesh section. We already do this for Blender files.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed it to use this name
5213d84
to
e66560c
Compare
83d7767
to
0a2a6f7
Compare
Updated the PR to also respect project import defaults. It will reimport them with Detect 3D after the gltf completes, which should be okay since it will run multithreaded, and avoids some hardcoded constants. The original code set "compress/mode" to 2 but wrote remap instead of params, so it didn't actually work. Now that I'm reading the project defaults, there isn't a clean way to override the compression mode without disregarding the user's project settings, so I removed that part. |
0a2a6f7
to
122a40c
Compare
This option allows for a safe fallback for embedded gltf textures in cases where VRAM compression is not needed. Add an is_editor_hint guard around GLTFHandleBinary::HANDLE_BINARY_EXTRACT_TEXTURES, to use EMBED_AS_UNCOMPRESSED by default at runtime. This provides an option for pixel art to be stored losslessly. Additionally, respect project importer defaults for texture import settings. Avoid writing and reimporting extracted textures identical to version on disk.
122a40c
to
bc24d01
Compare
Thanks! |
This option allows for a safe fallback for embedded gltf textures in cases where VRAM compression is not needed.
Add an is_editor_hint guard around GLTFHandleBinary::HANDLE_BINARY_EXTRACT_TEXTURES, to use EMBED_AS_UNCOMPRESSED by default at runtime.
This provides an option for pixel art to be stored losslessly.
Additionally, respect project importer defaults for texture import settings.
Threw in another check to avoid overwriting and reimporting textures which were already extracted & identical to what is on disk.
Fixes #72200
Fixes #72195
Fixes #72467
Fixes #72191