Closed fire closed 1 year ago
Godot Engine and a 3D VR game
The GLTFDocument is starting to get large and it's difficult to add functionality.
See also moving GLTFDocument to core https://github.com/godotengine/godot-proposals/issues/3273
I propose adding a Ref\ system so we can start moving code from Ref\ to extensions.
Worked with @humbletim and @lyuma.
Reference https://github.com/KhronosGroup/glTF-Blender-IO/blob/b8767c9b122cc504c6828edc3f84130469e89392/example-addons/example_gltf_extension/readme.md
virtual Error import_preflight(Ref<GLTFState> p_state); virtual Error import_post_parse(Ref<GLTFState> p_state); virtual Error export_post(Ref<GLTFState> p_state); virtual Error import_post(Ref<GLTFState> p_state, Node *p_node); virtual Error export_preflight(Node *p_state); virtual Error import_node(Ref<GLTFState> p_state, Ref<GLTFNode> p_gltf_node, Dictionary &r_json, Node *p_node); virtual Error export_node(Ref<GLTFState> p_state, Ref<GLTFNode> p_gltf_node, Dictionary &r_json, Node *p_node); // Error import_animation(gltf2_animation, Ref<Animation>, Node *,Dictionary p_export_settings) { return OK; } // Error import_animation_channel(gltf2_animation_channel, channels, Node *, bake_bone, bake_channel, bake_range_start, import_bake_range_end, action_name,Dictionary p_export_settings) {} // Error import_animation_channel_target(gltf2_animation_channel_target, channels, Node *, bake_bone, bake_channel,Dictionary p_export_settings) {} // Error import_animation_sampler(gltf2_sampler, Node *, channels, bake_bone, bake_channel, bake_range_start, bake_range_end, action_name,Dictionary p_export_settings) {} // Error import_asset(gltf2_asset, p_export_settings) {} // Error import_camera(gltf2_camera, Camera3D *, p_export_settings) {} // Error import_gltf(gltf2_plan, p_export_settings) {} // Error import_image(gltf2_image, p_export_settings) {} // Error import_joint(gltf2_node, Skeleton3D *, BoneId, p_export_settings) {} // Error import_material(gltf2_material, Ref<Material>, p_export_settings) {} // Error import_material_pbr_metallic_roughness(gltf2_material, Ref<BaseMaterial3D>, orm_texture, p_export_settings) {} // Error import_material_unlit(gltf2_material, Ref<Material>, p_export_settings) {} // Error import_mesh(gltf2_mesh,Ref<ArrayMesh>, vertex_groups, modifiers, skip_filter, material_names, p_export_settings) {} // Error import_sampler(self, gltf2_sampler, Ref<Material>, p_export_settings) {} // Error import_node(gltf2_node, Node *, p_export_settings) {} // Error import_scene(gltf2_scene, Node *, p_export_settings) {} // Error import_skin(gltf2_skin, Ref<Skin>, p_export_settings) {} // Error import_texture(gltf2_texture, p_export_settings) {} // Error import_texture_info(gltf2_texture_info, p_export_settings) {}
GLTF2 support can be difficult and making hooks can help others. GLTF Extensions is not a few lines.
GLTFDocument is in core so it can't be easily modified by an addon.
@aaronfranke I think your pr implements this fully https://github.com/godotengine/godot/pull/68981. Thoughts?
Describe the project you are working on
Godot Engine and a 3D VR game
Describe the problem or limitation you are having in your project
The GLTFDocument is starting to get large and it's difficult to add functionality.
See also moving GLTFDocument to core https://github.com/godotengine/godot-proposals/issues/3273
Describe the feature / enhancement and how it helps to overcome the problem or limitation
I propose adding a Ref\ system so we can start moving code from Ref\ to extensions.
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
Worked with @humbletim and @lyuma.
Reference https://github.com/KhronosGroup/glTF-Blender-IO/blob/b8767c9b122cc504c6828edc3f84130469e89392/example-addons/example_gltf_extension/readme.md
GLTFDocumentExtensions
Add hook functions.
If this enhancement will not be used often, can it be worked around with a few lines of script?
GLTF2 support can be difficult and making hooks can help others. GLTF Extensions is not a few lines.
Is there a reason why this should be core and not an add-on in the asset library?
GLTFDocument is in core so it can't be easily modified by an addon.