diff options
author | Andreas Haas <Hinsbart@users.noreply.github.com> | 2017-11-11 21:08:06 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-11-11 21:08:06 +0100 |
commit | b3c08a83266b591cc8442946e94d71eab992ec49 (patch) | |
tree | 10fa3da85eb4e05c00fbcb0ae25c7e1533c6e1d6 /editor | |
parent | b3cef1b61e143f9fb4fe7643a9369cc03771f10a (diff) | |
parent | 21b3d62237959d0703a8f76c26c680e2240a7a4a (diff) |
Merge pull request #12822 from Web-eWorks/importerfixes
Allow changing importers in the import dock.
Diffstat (limited to 'editor')
-rw-r--r-- | editor/import_dock.cpp | 11 | ||||
-rw-r--r-- | editor/import_dock.h | 1 |
2 files changed, 12 insertions, 0 deletions
diff --git a/editor/import_dock.cpp b/editor/import_dock.cpp index e52f3bab72..df4254e2a3 100644 --- a/editor/import_dock.cpp +++ b/editor/import_dock.cpp @@ -263,6 +263,14 @@ void ImportDock::set_edit_multiple_paths(const Vector<String> &p_paths) { imported->set_text(itos(p_paths.size()) + TTR(" Files")); } +void ImportDock::_importer_selected(int i_idx) { + String name = import_as->get_selected_metadata(); + Ref<ResourceImporter> importer = ResourceFormatImporter::get_singleton()->get_importer_by_name(name); + ERR_FAIL_COND(importer.is_null()); + + params->importer = importer; +} + void ImportDock::_preset_selected(int p_idx) { int item_id = preset->get_popup()->get_item_id(p_idx); @@ -336,6 +344,7 @@ void ImportDock::_reimport() { Error err = config->load(params->paths[i] + ".import"); ERR_CONTINUE(err != OK); + config->set_value("remap", "importer", params->importer->get_importer_name()); config->erase_section("params"); for (List<PropertyInfo>::Element *E = params->properties.front(); E; E = E->next()) { @@ -367,6 +376,7 @@ void ImportDock::_bind_methods() { ClassDB::bind_method(D_METHOD("_reimport"), &ImportDock::_reimport); ClassDB::bind_method(D_METHOD("_preset_selected"), &ImportDock::_preset_selected); + ClassDB::bind_method(D_METHOD("_importer_selected"), &ImportDock::_importer_selected); } void ImportDock::initialize_import_options() const { @@ -384,6 +394,7 @@ ImportDock::ImportDock() { HBoxContainer *hb = memnew(HBoxContainer); add_margin_child(TTR("Import As:"), hb); import_as = memnew(OptionButton); + import_as->connect("item_selected", this, "_importer_selected"); hb->add_child(import_as); import_as->set_h_size_flags(SIZE_EXPAND_FILL); preset = memnew(MenuButton); diff --git a/editor/import_dock.h b/editor/import_dock.h index 029c458320..a9bb22e568 100644 --- a/editor/import_dock.h +++ b/editor/import_dock.h @@ -54,6 +54,7 @@ class ImportDock : public VBoxContainer { ImportDockParameters *params; void _preset_selected(int p_idx); + void _importer_selected(int i_idx); void _reimport(); |