mirror of
https://github.com/godotengine/godot.git
synced 2026-01-03 18:11:19 +03:00
Add path to functions that return iporter options
-Allows displaying custom options for specific file format variants -Added support for scene format import to retrieve custom options This PR is necessary for #54886 to be implemented properly.
This commit is contained in:
@@ -110,12 +110,12 @@ int EditorImportPlugin::get_import_order() const {
|
||||
ERR_FAIL_V_MSG(-1, "Unimplemented _get_import_order in add-on.");
|
||||
}
|
||||
|
||||
void EditorImportPlugin::get_import_options(List<ResourceImporter::ImportOption> *r_options, int p_preset) const {
|
||||
void EditorImportPlugin::get_import_options(const String &p_path, List<ResourceImporter::ImportOption> *r_options, int p_preset) const {
|
||||
Array needed;
|
||||
needed.push_back("name");
|
||||
needed.push_back("default_value");
|
||||
Array options;
|
||||
if (GDVIRTUAL_CALL(_get_import_options, p_preset, options)) {
|
||||
if (GDVIRTUAL_CALL(_get_import_options, p_path, p_preset, options)) {
|
||||
for (int i = 0; i < options.size(); i++) {
|
||||
Dictionary d = options[i];
|
||||
ERR_FAIL_COND(!d.has_all(needed));
|
||||
@@ -146,7 +146,7 @@ void EditorImportPlugin::get_import_options(List<ResourceImporter::ImportOption>
|
||||
ERR_FAIL_MSG("Unimplemented _get_import_options in add-on.");
|
||||
}
|
||||
|
||||
bool EditorImportPlugin::get_option_visibility(const String &p_option, const Map<StringName, Variant> &p_options) const {
|
||||
bool EditorImportPlugin::get_option_visibility(const String &p_path, const String &p_option, const Map<StringName, Variant> &p_options) const {
|
||||
Dictionary d;
|
||||
Map<StringName, Variant>::Element *E = p_options.front();
|
||||
while (E) {
|
||||
@@ -154,7 +154,7 @@ bool EditorImportPlugin::get_option_visibility(const String &p_option, const Map
|
||||
E = E->next();
|
||||
}
|
||||
bool visible;
|
||||
if (GDVIRTUAL_CALL(_get_option_visibility, p_option, d, visible)) {
|
||||
if (GDVIRTUAL_CALL(_get_option_visibility, p_path, p_option, d, visible)) {
|
||||
return visible;
|
||||
}
|
||||
|
||||
@@ -192,11 +192,11 @@ void EditorImportPlugin::_bind_methods() {
|
||||
GDVIRTUAL_BIND(_get_preset_count)
|
||||
GDVIRTUAL_BIND(_get_preset_name, "preset_index")
|
||||
GDVIRTUAL_BIND(_get_recognized_extensions)
|
||||
GDVIRTUAL_BIND(_get_import_options, "preset_index")
|
||||
GDVIRTUAL_BIND(_get_import_options, "path", "preset_index")
|
||||
GDVIRTUAL_BIND(_get_save_extension)
|
||||
GDVIRTUAL_BIND(_get_resource_type)
|
||||
GDVIRTUAL_BIND(_get_priority)
|
||||
GDVIRTUAL_BIND(_get_import_order)
|
||||
GDVIRTUAL_BIND(_get_option_visibility, "option_name", "options")
|
||||
GDVIRTUAL_BIND(_get_option_visibility, "path", "option_name", "options")
|
||||
GDVIRTUAL_BIND(_import, "source_file", "save_path", "options", "platform_variants", "gen_files");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user