Open lyuma opened 1 year ago
From rocket chat: We could make it: images/sounds meshes scenes Or make .obj meshes be treated like scenes for import purposes.
I tried this simple approach:
diff --git a/editor/import/resource_importer_obj.cpp b/editor/import/resource_importer_obj.cpp
index adc21aaa7b..145db2f642 100644
--- a/editor/import/resource_importer_obj.cpp
+++ b/editor/import/resource_importer_obj.cpp
@@ -549,6 +549,10 @@ bool ResourceImporterOBJ::get_option_visibility(const String &p_path, const Stri
return true;
}
+int ResourceImporterOBJ::get_import_order() const {
+ return ResourceImporter::IMPORT_ORDER_SCENE;
+}
+
Error ResourceImporterOBJ::import(const String &p_source_file, const String &p_save_path, const HashMap<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files, Variant *r_metadata) {
List<Ref<Mesh>> meshes;
diff --git a/editor/import/resource_importer_obj.h b/editor/import/resource_importer_obj.h
index faf0f336c0..35d63ef115 100644
--- a/editor/import/resource_importer_obj.h
+++ b/editor/import/resource_importer_obj.h
@@ -60,6 +60,7 @@ public:
virtual void get_import_options(const String &p_path, List<ImportOption> *r_options, int p_preset = 0) const override;
virtual bool get_option_visibility(const String &p_path, const String &p_option, const HashMap<StringName, Variant> &p_options) const override;
+ virtual int get_import_order() const override;
virtual Error import(const String &p_source_file, const String &p_save_path, const HashMap<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files = nullptr, Variant *r_metadata = nullptr) override;
But that doesn't seem to solve the issue, it still complains about textures not being imported yet.
Scenes also seem to fail loading because of missing textures in this project, so there's something else going on that somehow prevents textures from getting imported when they should be.
Godot version
4.1.1
System information
Godot v4.1.stable - Windows 10.0.19045 - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 3090 (NVIDIA; 31.0.15.3713) - Intel(R) Core(TM) i9-9900K CPU @ 3.60GHz (16 Threads)
Issue description
If the .godot/imported directory is cleared, the .obj files (with materials) in a project appear to be getting imported before the .png files that their materials reference. This leads to huge amounts of error spam, as well as missing texture references during the first import.
The issue here is we are importing .obj files too early, when in he import as Mesh workflow. Most other models are imported as Scene which happens afterwards.
A workaround is to delete the obj files from .godot/imported such that they may be reimported in the correct order.
Steps to reproduce
Minimal reproduction project
clone https://github.com/P1X-in/Tanks-of-Freedom-3-D