summaryrefslogtreecommitdiff
path: root/modules/gltf/editor
diff options
context:
space:
mode:
Diffstat (limited to 'modules/gltf/editor')
-rw-r--r--modules/gltf/editor/editor_scene_importer_blend.cpp6
-rw-r--r--modules/gltf/editor/editor_scene_importer_gltf.cpp10
-rw-r--r--modules/gltf/editor/editor_scene_importer_gltf.h2
3 files changed, 14 insertions, 4 deletions
diff --git a/modules/gltf/editor/editor_scene_importer_blend.cpp b/modules/gltf/editor/editor_scene_importer_blend.cpp
index 2b8c057ee5..0075558dfc 100644
--- a/modules/gltf/editor/editor_scene_importer_blend.cpp
+++ b/modules/gltf/editor/editor_scene_importer_blend.cpp
@@ -32,6 +32,7 @@
#ifdef TOOLS_ENABLED
+#include "../gltf_defines.h"
#include "../gltf_document.h"
#include "core/config/project_settings.h"
@@ -43,7 +44,6 @@
#include "scene/gui/line_edit.h"
#ifdef WINDOWS_ENABLED
-// Code by Pedro Estebanez (https://github.com/godotengine/godot/pull/59766)
#include <shlwapi.h>
#endif
@@ -221,6 +221,7 @@ Node *EditorSceneFormatImporterBlend::import_scene(const String &p_path, uint32_
gltf.instantiate();
Ref<GLTFState> state;
state.instantiate();
+
String base_dir;
if (p_options.has(SNAME("blender/materials/unpack_enabled")) && p_options[SNAME("blender/materials/unpack_enabled")]) {
base_dir = sink.get_base_dir();
@@ -274,9 +275,6 @@ void EditorSceneFormatImporterBlend::get_import_options(const String &p_path, Li
ADD_OPTION_BOOL("blender/animation/limit_playback", true);
ADD_OPTION_BOOL("blender/animation/always_sample", true);
ADD_OPTION_BOOL("blender/animation/group_tracks", true);
-
-#undef ADD_OPTION_BOOL
-#undef ADD_OPTION_ENUM
}
///////////////////////////
diff --git a/modules/gltf/editor/editor_scene_importer_gltf.cpp b/modules/gltf/editor/editor_scene_importer_gltf.cpp
index 39956a6ff6..7c40afc8e7 100644
--- a/modules/gltf/editor/editor_scene_importer_gltf.cpp
+++ b/modules/gltf/editor/editor_scene_importer_gltf.cpp
@@ -32,6 +32,7 @@
#include "editor_scene_importer_gltf.h"
+#include "../gltf_defines.h"
#include "../gltf_document.h"
uint32_t EditorSceneFormatImporterGLTF::get_import_flags() const {
@@ -50,6 +51,10 @@ Node *EditorSceneFormatImporterGLTF::import_scene(const String &p_path, uint32_t
doc.instantiate();
Ref<GLTFState> state;
state.instantiate();
+ if (p_options.has("meshes/handle_gltf_embedded_images")) {
+ int32_t enum_option = p_options["meshes/handle_gltf_embedded_images"];
+ state->set_handle_binary_image(enum_option);
+ }
Error err = doc->append_from_file(p_path, state, p_flags);
if (err != OK) {
if (r_err) {
@@ -68,4 +73,9 @@ 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));
+}
+
#endif // TOOLS_ENABLED
diff --git a/modules/gltf/editor/editor_scene_importer_gltf.h b/modules/gltf/editor/editor_scene_importer_gltf.h
index c2a4bf046d..ed57ec8cdb 100644
--- a/modules/gltf/editor/editor_scene_importer_gltf.h
+++ b/modules/gltf/editor/editor_scene_importer_gltf.h
@@ -47,6 +47,8 @@ public:
virtual Node *import_scene(const String &p_path, uint32_t p_flags,
const HashMap<StringName, Variant> &p_options,
List<String> *r_missing_deps, Error *r_err = nullptr) override;
+ virtual void get_import_options(const String &p_path,
+ List<ResourceImporter::ImportOption> *r_options) override;
};
#endif // TOOLS_ENABLED