GLTF: Allow controlling how external data is handled on export#109449
Open
aaronfranke wants to merge 1 commit intogodotengine:masterfrom
Open
GLTF: Allow controlling how external data is handled on export#109449aaronfranke wants to merge 1 commit intogodotengine:masterfrom
aaronfranke wants to merge 1 commit intogodotengine:masterfrom
Conversation
e6a6197 to
76f5114
Compare
76f5114 to
5f41607
Compare
5f41607 to
13559af
Compare
13559af to
38702c0
Compare
38702c0 to
45b1ed4
Compare
45b1ed4 to
710667e
Compare
710667e to
1570b1d
Compare
1570b1d to
d6e44c9
Compare
d6e44c9 to
66d7c9d
Compare
66d7c9d to
12ba035
Compare
12ba035 to
e2a85b6
Compare
e2a85b6 to
02ca3c5
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In master, Godot gives you 2 options for exporting, determined only by file type:
.glbfile embeds binary data into a self-contained file (so long as it fits in the 4 GiB limit)..gltffile separates out all data into files, such as images into image files, and buffers into.binfiles.However, there are more possibilities available than just those two. Blender offers another option called "glTF Embedded (.gltf)" which embeds all data into a text-based
.gltf. This PR allows doing that with the "Embed Everything" option. Still... there are more possibilities than just those three, so this PR adds a comprehensive enum:The default option is "Automatic", which behaves the same as the current behavior in master.
base_pathis valid. With this option, exporting a.gltffile with a valid [member base_path] will behave like "Separate All Files". If exporting a.glbfile, exporting to an in-memory buffer, or exporting withbase_pathset to an empty string, this will behave like "Embed Everything"..glbfiles, and like Blender's "glTF Separate (.gltf + .bin + textures)" export option for.gltffiles..glbfiles, this will use the binary blob chunk at the end of the file to store the data in buffer 0 (if present). For all other buffers, such as buffers in.gltffiles, the data will be embedded as a base64-encoded string in the JSON of the buffer..glbfiles, and like Blender's "glTF Embedded (.gltf)" export option for.gltffiles..binfiles..binfiles. Resources that can be saved in their own file formats, such as images, are embedded within glTF buffers, and are stored in the.binfiles..binfile next to it.For example, the options would look like this:
Effectively, this enum serves to answer two questions:
Extensions should respect these options by calling
GLTFState.should_separate_resource_files()to determine if they should save their resources in separate files.Test project: gltf_export_external_data_mode.zip
In the test project, each folder contains the same test cube exported with different choices for the enum. The
glb/automatic/andglb/embed_everything/folders are equivalent, and thegltf/automatic/andgltf/separate_all_files/folders are equivalent, but are included for completeness.