diff options
Diffstat (limited to 'modules/gltf')
23 files changed, 28 insertions, 95 deletions
diff --git a/modules/gltf/doc_classes/GLTFDocumentExtension.xml b/modules/gltf/doc_classes/GLTFDocumentExtension.xml index 87d3d9bcb0..ac638a8962 100644 --- a/modules/gltf/doc_classes/GLTFDocumentExtension.xml +++ b/modules/gltf/doc_classes/GLTFDocumentExtension.xml @@ -45,7 +45,7 @@ <param index="0" name="root" type="Node" /> <description> Part of the export process. This method is run first, before all other parts of the export process. - The return value is used to determine if this GLTFDocumentExtension class should be used for exporting a given GLTF file. If [constant OK], the export will use this GLTFDocumentExtension class. If not overridden, [constant OK] is returned. + The return value is used to determine if this [GLTFDocumentExtension] instance should be used for exporting a given GLTF file. If [constant OK], the export will use this [GLTFDocumentExtension] instance. If not overridden, [constant OK] is returned. </description> </method> <method name="_generate_scene_node" qualifiers="virtual"> @@ -99,7 +99,7 @@ <param index="1" name="extensions" type="PackedStringArray" /> <description> Part of the import process. This method is run first, before all other parts of the import process. - The return value is used to determine if this GLTFDocumentExtension class should be used for importing a given GLTF file. If [constant OK], the import will use this GLTFDocumentExtension class. If not overridden, [constant OK] is returned. + The return value is used to determine if this [GLTFDocumentExtension] instance should be used for importing a given GLTF file. If [constant OK], the import will use this [GLTFDocumentExtension] instance. If not overridden, [constant OK] is returned. </description> </method> <method name="_parse_node_extensions" qualifiers="virtual"> @@ -109,7 +109,7 @@ <param index="2" name="extensions" type="Dictionary" /> <description> Part of the import process. This method is run after [method _get_supported_extensions] and before [method _generate_scene_node]. - Runs when parsing the node extensions of a GLTFNode. This method can be used to process the extension JSON data into a format that can be used by [method _generate_scene_node]. + Runs when parsing the node extensions of a GLTFNode. This method can be used to process the extension JSON data into a format that can be used by [method _generate_scene_node]. The return value should be a member of the [enum Error] enum. </description> </method> </methods> diff --git a/modules/gltf/editor/editor_scene_exporter_gltf_plugin.cpp b/modules/gltf/editor/editor_scene_exporter_gltf_plugin.cpp index 0c0b134bd1..fe63afcc56 100644 --- a/modules/gltf/editor/editor_scene_exporter_gltf_plugin.cpp +++ b/modules/gltf/editor/editor_scene_exporter_gltf_plugin.cpp @@ -33,18 +33,10 @@ #include "editor_scene_exporter_gltf_plugin.h" #include "../gltf_document.h" -#include "../gltf_state.h" -#include "core/config/project_settings.h" -#include "core/error/error_list.h" -#include "core/object/object.h" -#include "core/templates/vector.h" #include "editor/editor_file_dialog.h" #include "editor/editor_file_system.h" #include "editor/editor_node.h" -#include "scene/3d/mesh_instance_3d.h" -#include "scene/gui/check_box.h" -#include "scene/main/node.h" String SceneExporterGLTFPlugin::get_name() const { return "ConvertGLTF2"; diff --git a/modules/gltf/editor/editor_scene_importer_blend.cpp b/modules/gltf/editor/editor_scene_importer_blend.cpp index 7007ea5d13..4dafa746bc 100644 --- a/modules/gltf/editor/editor_scene_importer_blend.cpp +++ b/modules/gltf/editor/editor_scene_importer_blend.cpp @@ -33,7 +33,6 @@ #ifdef TOOLS_ENABLED #include "../gltf_document.h" -#include "../gltf_state.h" #include "core/config/project_settings.h" #include "editor/editor_file_dialog.h" @@ -42,8 +41,6 @@ #include "editor/editor_settings.h" #include "main/main.h" #include "scene/gui/line_edit.h" -#include "scene/main/node.h" -#include "scene/resources/animation.h" #ifdef WINDOWS_ENABLED // Code by Pedro Estebanez (https://github.com/godotengine/godot/pull/59766) diff --git a/modules/gltf/editor/editor_scene_importer_fbx.cpp b/modules/gltf/editor/editor_scene_importer_fbx.cpp index 14f2117413..fb5fb455b8 100644 --- a/modules/gltf/editor/editor_scene_importer_fbx.cpp +++ b/modules/gltf/editor/editor_scene_importer_fbx.cpp @@ -33,12 +33,9 @@ #ifdef TOOLS_ENABLED #include "../gltf_document.h" -#include "../gltf_state.h" #include "core/config/project_settings.h" #include "editor/editor_settings.h" -#include "scene/main/node.h" -#include "scene/resources/animation.h" uint32_t EditorSceneFormatImporterFBX::get_import_flags() const { return ImportFlags::IMPORT_SCENE | ImportFlags::IMPORT_ANIMATION; diff --git a/modules/gltf/editor/editor_scene_importer_gltf.cpp b/modules/gltf/editor/editor_scene_importer_gltf.cpp index 3cf49a3046..b10bb49a8e 100644 --- a/modules/gltf/editor/editor_scene_importer_gltf.cpp +++ b/modules/gltf/editor/editor_scene_importer_gltf.cpp @@ -33,9 +33,6 @@ #include "editor_scene_importer_gltf.h" #include "../gltf_document.h" -#include "../gltf_state.h" - -#include "scene/resources/animation.h" uint32_t EditorSceneFormatImporterGLTF::get_import_flags() const { return ImportFlags::IMPORT_SCENE | ImportFlags::IMPORT_ANIMATION; diff --git a/modules/gltf/extensions/gltf_document_extension_convert_importer_mesh.cpp b/modules/gltf/extensions/gltf_document_extension_convert_importer_mesh.cpp index 49496afb62..cfa498af65 100644 --- a/modules/gltf/extensions/gltf_document_extension_convert_importer_mesh.cpp +++ b/modules/gltf/extensions/gltf_document_extension_convert_importer_mesh.cpp @@ -30,9 +30,7 @@ #include "gltf_document_extension_convert_importer_mesh.h" -#include "../gltf_state.h" - -#include "core/error/error_macros.h" +#include "scene/3d/importer_mesh_instance_3d.h" #include "scene/3d/mesh_instance_3d.h" #include "scene/resources/importer_mesh.h" diff --git a/modules/gltf/extensions/gltf_document_extension_convert_importer_mesh.h b/modules/gltf/extensions/gltf_document_extension_convert_importer_mesh.h index 00e664e73f..4fbfa0e066 100644 --- a/modules/gltf/extensions/gltf_document_extension_convert_importer_mesh.h +++ b/modules/gltf/extensions/gltf_document_extension_convert_importer_mesh.h @@ -33,10 +33,6 @@ #include "gltf_document_extension.h" -#include "scene/3d/importer_mesh_instance_3d.h" -#include "scene/3d/mesh_instance_3d.h" -#include "scene/resources/importer_mesh.h" - class GLTFDocumentExtensionConvertImporterMesh : public GLTFDocumentExtension { GDCLASS(GLTFDocumentExtensionConvertImporterMesh, GLTFDocumentExtension); diff --git a/modules/gltf/extensions/gltf_light.cpp b/modules/gltf/extensions/gltf_light.cpp index d00bead61c..0379c62c9d 100644 --- a/modules/gltf/extensions/gltf_light.cpp +++ b/modules/gltf/extensions/gltf_light.cpp @@ -30,6 +30,8 @@ #include "gltf_light.h" +#include "scene/3d/light_3d.h" + void GLTFLight::_bind_methods() { ClassDB::bind_static_method("GLTFLight", D_METHOD("from_node", "light_node"), &GLTFLight::from_node); ClassDB::bind_method(D_METHOD("to_node"), &GLTFLight::to_node); diff --git a/modules/gltf/extensions/gltf_light.h b/modules/gltf/extensions/gltf_light.h index 04980e144c..85284f1d0e 100644 --- a/modules/gltf/extensions/gltf_light.h +++ b/modules/gltf/extensions/gltf_light.h @@ -31,9 +31,9 @@ #ifndef GLTF_LIGHT_H #define GLTF_LIGHT_H -#include "core/config/engine.h" #include "core/io/resource.h" -#include "scene/3d/light_3d.h" + +class Light3D; // https://github.com/KhronosGroup/glTF/blob/main/extensions/2.0/Khronos/KHR_lights_punctual diff --git a/modules/gltf/extensions/gltf_spec_gloss.cpp b/modules/gltf/extensions/gltf_spec_gloss.cpp index 83af91bfcc..0645f31e01 100644 --- a/modules/gltf/extensions/gltf_spec_gloss.cpp +++ b/modules/gltf/extensions/gltf_spec_gloss.cpp @@ -30,6 +30,8 @@ #include "gltf_spec_gloss.h" +#include "core/io/image.h" + void GLTFSpecGloss::_bind_methods() { ClassDB::bind_method(D_METHOD("get_diffuse_img"), &GLTFSpecGloss::get_diffuse_img); ClassDB::bind_method(D_METHOD("set_diffuse_img", "diffuse_img"), &GLTFSpecGloss::set_diffuse_img); diff --git a/modules/gltf/extensions/gltf_spec_gloss.h b/modules/gltf/extensions/gltf_spec_gloss.h index 2b4d3ee609..56474acd03 100644 --- a/modules/gltf/extensions/gltf_spec_gloss.h +++ b/modules/gltf/extensions/gltf_spec_gloss.h @@ -31,9 +31,10 @@ #ifndef GLTF_SPEC_GLOSS_H #define GLTF_SPEC_GLOSS_H -#include "core/io/image.h" #include "core/io/resource.h" +class Image; + // KHR_materials_pbrSpecularGlossiness is an archived GLTF extension. // This means that it is deprecated and not recommended for new files. // However, it is still supported for loading old files. diff --git a/modules/gltf/gltf_defines.h b/modules/gltf/gltf_defines.h index 23bf33869e..7b990e6573 100644 --- a/modules/gltf/gltf_defines.h +++ b/modules/gltf/gltf_defines.h @@ -36,9 +36,10 @@ // Godot classes used by GLTF headers. class BoneAttachment3D; class CSGShape3D; -class DirectionalLight3D; class GridMap; +class ImporterMeshInstance3D; class Light3D; +class MeshInstance3D; class MultiMeshInstance3D; class Skeleton3D; class Skin; diff --git a/modules/gltf/gltf_document.cpp b/modules/gltf/gltf_document.cpp index 735e35ac1e..7524d37548 100644 --- a/modules/gltf/gltf_document.cpp +++ b/modules/gltf/gltf_document.cpp @@ -31,31 +31,23 @@ #include "gltf_document.h" #include "extensions/gltf_spec_gloss.h" -#include "gltf_state.h" #include "core/crypto/crypto_core.h" -#include "core/error/error_macros.h" #include "core/io/dir_access.h" #include "core/io/file_access.h" #include "core/io/file_access_memory.h" #include "core/io/json.h" #include "core/io/stream_peer.h" #include "core/math/disjoint_set.h" -#include "core/math/vector2.h" -#include "core/variant/dictionary.h" -#include "core/variant/typed_array.h" -#include "core/variant/variant.h" #include "core/version.h" #include "drivers/png/png_driver_common.h" -#include "scene/2d/node_2d.h" +#include "scene/3d/bone_attachment_3d.h" +#include "scene/3d/camera_3d.h" +#include "scene/3d/importer_mesh_instance_3d.h" +#include "scene/3d/light_3d.h" #include "scene/3d/mesh_instance_3d.h" #include "scene/3d/multimesh_instance_3d.h" -#include "scene/3d/node_3d.h" -#include "scene/animation/animation_player.h" -#include "scene/resources/importer_mesh.h" -#include "scene/resources/material.h" -#include "scene/resources/mesh.h" -#include "scene/resources/multimesh.h" +#include "scene/resources/skin.h" #include "scene/resources/surface_tool.h" #include "modules/modules_enabled.gen.h" // For csg, gridmap. diff --git a/modules/gltf/gltf_document.h b/modules/gltf/gltf_document.h index 6eb38354a2..45cb639a19 100644 --- a/modules/gltf/gltf_document.h +++ b/modules/gltf/gltf_document.h @@ -32,13 +32,6 @@ #define GLTF_DOCUMENT_H #include "extensions/gltf_document_extension.h" -#include "structures/gltf_animation.h" - -#include "scene/3d/bone_attachment_3d.h" -#include "scene/3d/importer_mesh_instance_3d.h" -#include "scene/3d/mesh_instance_3d.h" -#include "scene/animation/animation_player.h" -#include "scene/resources/material.h" #include "modules/modules_enabled.gen.h" // For csg, gridmap. diff --git a/modules/gltf/gltf_state.cpp b/modules/gltf/gltf_state.cpp index 6654c9e5d2..9f6cb20935 100644 --- a/modules/gltf/gltf_state.cpp +++ b/modules/gltf/gltf_state.cpp @@ -30,6 +30,8 @@ #include "gltf_state.h" +#include "gltf_template_convert.h" + void GLTFState::_bind_methods() { ClassDB::bind_method(D_METHOD("add_used_extension", "extension_name", "required"), &GLTFState::add_used_extension); ClassDB::bind_method(D_METHOD("get_json"), &GLTFState::get_json); diff --git a/modules/gltf/gltf_state.h b/modules/gltf/gltf_state.h index 1c20520b22..e264da69e0 100644 --- a/modules/gltf/gltf_state.h +++ b/modules/gltf/gltf_state.h @@ -32,7 +32,6 @@ #define GLTF_STATE_H #include "extensions/gltf_light.h" -#include "gltf_template_convert.h" #include "structures/gltf_accessor.h" #include "structures/gltf_animation.h" #include "structures/gltf_buffer_view.h" @@ -44,10 +43,6 @@ #include "structures/gltf_texture.h" #include "structures/gltf_texture_sampler.h" -#include "core/templates/rb_map.h" -#include "scene/animation/animation_player.h" -#include "scene/resources/texture.h" - class GLTFState : public Resource { GDCLASS(GLTFState, Resource); friend class GLTFDocument; @@ -194,21 +189,6 @@ public: Variant get_additional_data(const StringName &p_extension_name); void set_additional_data(const StringName &p_extension_name, Variant p_additional_data); - - //void set_scene_nodes(RBMap<GLTFNodeIndex, Node *> p_scene_nodes) { - // this->scene_nodes = p_scene_nodes; - //} - - //void set_animation_players(Vector<AnimationPlayer *> p_animation_players) { - // this->animation_players = p_animation_players; - //} - - //RBMap<Ref<Material>, GLTFMaterialIndex> get_material_cache() { - // return this->material_cache; - //} - //void set_material_cache(RBMap<Ref<Material>, GLTFMaterialIndex> p_material_cache) { - // this->material_cache = p_material_cache; - //} }; #endif // GLTF_STATE_H diff --git a/modules/gltf/register_types.cpp b/modules/gltf/register_types.cpp index a7abf256ce..cd7a23fbb2 100644 --- a/modules/gltf/register_types.cpp +++ b/modules/gltf/register_types.cpp @@ -30,23 +30,9 @@ #include "register_types.h" -#ifndef _3D_DISABLED - #include "extensions/gltf_document_extension_convert_importer_mesh.h" -#include "extensions/gltf_light.h" #include "extensions/gltf_spec_gloss.h" #include "gltf_document.h" -#include "gltf_state.h" -#include "structures/gltf_accessor.h" -#include "structures/gltf_animation.h" -#include "structures/gltf_buffer_view.h" -#include "structures/gltf_camera.h" -#include "structures/gltf_mesh.h" -#include "structures/gltf_node.h" -#include "structures/gltf_skeleton.h" -#include "structures/gltf_skin.h" -#include "structures/gltf_texture.h" -#include "structures/gltf_texture_sampler.h" #ifdef TOOLS_ENABLED #include "core/config/project_settings.h" @@ -172,5 +158,3 @@ void uninitialize_gltf_module(ModuleInitializationLevel p_level) { } GLTFDocument::unregister_all_gltf_document_extensions(); } - -#endif // _3D_DISABLED diff --git a/modules/gltf/structures/gltf_accessor.h b/modules/gltf/structures/gltf_accessor.h index bfb71d57fe..8e4bb2d3f9 100644 --- a/modules/gltf/structures/gltf_accessor.h +++ b/modules/gltf/structures/gltf_accessor.h @@ -31,9 +31,8 @@ #ifndef GLTF_ACCESSOR_H #define GLTF_ACCESSOR_H -#include "core/io/resource.h" - #include "../gltf_defines.h" +#include "core/io/resource.h" struct GLTFAccessor : public Resource { GDCLASS(GLTFAccessor, Resource); diff --git a/modules/gltf/structures/gltf_animation.h b/modules/gltf/structures/gltf_animation.h index 3777f579f6..fc535631bb 100644 --- a/modules/gltf/structures/gltf_animation.h +++ b/modules/gltf/structures/gltf_animation.h @@ -31,7 +31,7 @@ #ifndef GLTF_ANIMATION_H #define GLTF_ANIMATION_H -#include "core/io/resource.h" +#include "scene/animation/animation_player.h" class GLTFAnimation : public Resource { GDCLASS(GLTFAnimation, Resource); diff --git a/modules/gltf/structures/gltf_camera.cpp b/modules/gltf/structures/gltf_camera.cpp index 212b9b80c8..7a5ab2763c 100644 --- a/modules/gltf/structures/gltf_camera.cpp +++ b/modules/gltf/structures/gltf_camera.cpp @@ -30,6 +30,8 @@ #include "gltf_camera.h" +#include "scene/3d/camera_3d.h" + void GLTFCamera::_bind_methods() { ClassDB::bind_static_method("GLTFCamera", D_METHOD("from_node", "camera_node"), &GLTFCamera::from_node); ClassDB::bind_method(D_METHOD("to_node"), &GLTFCamera::to_node); diff --git a/modules/gltf/structures/gltf_camera.h b/modules/gltf/structures/gltf_camera.h index 50ae10e17a..14b8efdde6 100644 --- a/modules/gltf/structures/gltf_camera.h +++ b/modules/gltf/structures/gltf_camera.h @@ -32,7 +32,8 @@ #define GLTF_CAMERA_H #include "core/io/resource.h" -#include "scene/3d/camera_3d.h" + +class Camera3D; // Reference and test file: // https://github.com/KhronosGroup/glTF-Tutorials/blob/master/gltfTutorial/gltfTutorial_015_SimpleCameras.md diff --git a/modules/gltf/structures/gltf_mesh.h b/modules/gltf/structures/gltf_mesh.h index 2fa37fd727..92722ce75c 100644 --- a/modules/gltf/structures/gltf_mesh.h +++ b/modules/gltf/structures/gltf_mesh.h @@ -31,10 +31,8 @@ #ifndef GLTF_MESH_H #define GLTF_MESH_H -#include "core/io/resource.h" -#include "scene/3d/importer_mesh_instance_3d.h" +#include "../gltf_defines.h" #include "scene/resources/importer_mesh.h" -#include "scene/resources/mesh.h" class GLTFMesh : public Resource { GDCLASS(GLTFMesh, Resource); diff --git a/modules/gltf/structures/gltf_texture_sampler.h b/modules/gltf/structures/gltf_texture_sampler.h index 3fad31bbee..7bb7cd62e3 100644 --- a/modules/gltf/structures/gltf_texture_sampler.h +++ b/modules/gltf/structures/gltf_texture_sampler.h @@ -31,7 +31,6 @@ #ifndef GLTF_TEXTURE_SAMPLER_H #define GLTF_TEXTURE_SAMPLER_H -#include "core/io/resource.h" #include "scene/resources/material.h" class GLTFTextureSampler : public Resource { |