mirror of
https://github.com/godotengine/godot.git
synced 2024-11-24 13:12:42 +00:00
Merge pull request #98150 from hunterloftis/fix-default-import-threaded
Fix freeze on non-thread-safe custom importers
This commit is contained in:
commit
671d6e3230
@ -148,7 +148,7 @@ public:
|
||||
virtual String get_option_group_file() const { return String(); }
|
||||
|
||||
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) = 0;
|
||||
virtual bool can_import_threaded() const { return true; }
|
||||
virtual bool can_import_threaded() const { return false; }
|
||||
virtual void import_threaded_begin() {}
|
||||
virtual void import_threaded_end() {}
|
||||
|
||||
|
@ -124,7 +124,8 @@
|
||||
<return type="bool" />
|
||||
<description>
|
||||
Tells whether this importer can be run in parallel on threads, or, on the contrary, it's only safe for the editor to call it from the main thread, for one file at a time.
|
||||
If this method is not overridden, it will return [code]true[/code] by default (i.e., safe for parallel importing).
|
||||
If this method is not overridden, it will return [code]false[/code] by default.
|
||||
If this importer's implementation is thread-safe and can be run in parallel, override this with [code]true[/code] to optimize for concurrency.
|
||||
</description>
|
||||
</method>
|
||||
<method name="_get_import_options" qualifiers="virtual const">
|
||||
|
@ -63,9 +63,6 @@ public:
|
||||
|
||||
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;
|
||||
|
||||
// Threaded import can currently cause deadlocks, see GH-48265.
|
||||
virtual bool can_import_threaded() const override { return false; }
|
||||
|
||||
ResourceImporterOBJ();
|
||||
};
|
||||
|
||||
|
@ -304,8 +304,6 @@ public:
|
||||
virtual bool has_advanced_options() const override;
|
||||
virtual void show_advanced_options(const String &p_path) override;
|
||||
|
||||
virtual bool can_import_threaded() const override { return false; }
|
||||
|
||||
ResourceImporterScene(const String &p_scene_import_type = "PackedScene", bool p_singleton = false);
|
||||
~ResourceImporterScene();
|
||||
|
||||
|
@ -50,6 +50,8 @@ public:
|
||||
virtual bool get_option_visibility(const String &p_path, const String &p_option, const HashMap<StringName, Variant> &p_options) 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;
|
||||
|
||||
virtual bool can_import_threaded() const override { return true; }
|
||||
|
||||
ResourceImporterBitMap();
|
||||
~ResourceImporterBitMap();
|
||||
};
|
||||
|
@ -50,6 +50,8 @@ public:
|
||||
|
||||
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;
|
||||
|
||||
virtual bool can_import_threaded() const override { return true; }
|
||||
|
||||
ResourceImporterBMFont();
|
||||
};
|
||||
|
||||
|
@ -51,6 +51,8 @@ public:
|
||||
|
||||
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;
|
||||
|
||||
virtual bool can_import_threaded() const override { return true; }
|
||||
|
||||
ResourceImporterCSVTranslation();
|
||||
};
|
||||
|
||||
|
@ -60,6 +60,8 @@ public:
|
||||
|
||||
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;
|
||||
|
||||
virtual bool can_import_threaded() const override { return true; }
|
||||
|
||||
ResourceImporterDynamicFont();
|
||||
};
|
||||
|
||||
|
@ -52,6 +52,8 @@ public:
|
||||
|
||||
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;
|
||||
|
||||
virtual bool can_import_threaded() const override { return true; }
|
||||
|
||||
ResourceImporterImage();
|
||||
};
|
||||
|
||||
|
@ -50,6 +50,8 @@ public:
|
||||
|
||||
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;
|
||||
|
||||
virtual bool can_import_threaded() const override { return true; }
|
||||
|
||||
ResourceImporterImageFont();
|
||||
};
|
||||
|
||||
|
@ -117,6 +117,8 @@ public:
|
||||
virtual bool are_import_settings_valid(const String &p_path, const Dictionary &p_meta) const override;
|
||||
virtual String get_import_settings_string() const override;
|
||||
|
||||
virtual bool can_import_threaded() const override { return true; }
|
||||
|
||||
void set_mode(Mode p_mode) { mode = p_mode; }
|
||||
|
||||
ResourceImporterLayeredTexture(bool p_singleton = false);
|
||||
|
@ -51,6 +51,8 @@ public:
|
||||
|
||||
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;
|
||||
|
||||
virtual bool can_import_threaded() const override { return true; }
|
||||
|
||||
ResourceImporterShaderFile();
|
||||
};
|
||||
|
||||
|
@ -102,6 +102,8 @@ public:
|
||||
|
||||
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;
|
||||
|
||||
virtual bool can_import_threaded() const override { return true; }
|
||||
|
||||
void update_imports();
|
||||
|
||||
virtual bool are_import_settings_valid(const String &p_path, const Dictionary &p_meta) const override;
|
||||
|
@ -67,6 +67,8 @@ public:
|
||||
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;
|
||||
virtual Error import_group_file(const String &p_group_file, const HashMap<String, HashMap<StringName, Variant>> &p_source_file_options, const HashMap<String, String> &p_base_paths) override;
|
||||
|
||||
virtual bool can_import_threaded() const override { return true; }
|
||||
|
||||
ResourceImporterTextureAtlas();
|
||||
};
|
||||
|
||||
|
@ -142,6 +142,8 @@ public:
|
||||
|
||||
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;
|
||||
|
||||
virtual bool can_import_threaded() const override { return true; }
|
||||
|
||||
ResourceImporterWAV();
|
||||
};
|
||||
|
||||
|
@ -59,6 +59,8 @@ public:
|
||||
|
||||
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;
|
||||
|
||||
virtual bool can_import_threaded() const override { return true; }
|
||||
|
||||
ResourceImporterMP3();
|
||||
};
|
||||
|
||||
|
@ -65,6 +65,8 @@ public:
|
||||
|
||||
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;
|
||||
|
||||
virtual bool can_import_threaded() const override { return true; }
|
||||
|
||||
ResourceImporterOggVorbis();
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user