diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2016-07-08 17:08:36 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2016-07-08 17:09:36 +0200 |
commit | d7dd10a1a2f64d4e77f09e7d63ce55630863616c (patch) | |
tree | f8d632b308b531f9baaffb05427af601fa865f5c | |
parent | 7e3044981ef3ed2a71270e331f2a36f57d5ec0c5 (diff) |
Cleanup: drop ImportSettingsDialog, replaced by contextual actions
Note that it was already commented out.
-rw-r--r-- | tools/editor/editor_node.cpp | 8 | ||||
-rw-r--r-- | tools/editor/editor_node.h | 3 | ||||
-rw-r--r-- | tools/editor/import_settings.cpp | 220 | ||||
-rw-r--r-- | tools/editor/import_settings.h | 82 |
4 files changed, 0 insertions, 313 deletions
diff --git a/tools/editor/editor_node.cpp b/tools/editor/editor_node.cpp index 0233b6e9d6..001a94f251 100644 --- a/tools/editor/editor_node.cpp +++ b/tools/editor/editor_node.cpp @@ -508,8 +508,6 @@ void EditorNode::_rebuild_import_menu() for (int i = 0; i < editor_import_export->get_import_plugin_count(); i++) { p->add_item(editor_import_export->get_import_plugin(i)->get_visible_name(), IMPORT_PLUGIN_BASE + i); } - //p->add_separator(); - //p->add_item(TTR("Re-Import.."), SETTINGS_IMPORT); } void EditorNode::_node_renamed() { @@ -2779,10 +2777,6 @@ void EditorNode::_menu_option_confirm(int p_option,bool p_confirmed) { settings_config_dialog->popup_edit_settings(); } break; - case SETTINGS_IMPORT: { - - import_settings->popup_import_settings(); - } break; case SETTINGS_OPTIMIZED_PRESETS: { //optimized_presets->popup_centered_ratio(); @@ -6289,8 +6283,6 @@ EditorNode::EditorNode() { open_recent_confirmation->connect("confirmed",this,"_open_recent_scene_confirm"); - import_settings= memnew(ImportSettingsDialog(this)); - gui_base->add_child(import_settings); run_settings_dialog = memnew( RunSettingsDialog ); gui_base->add_child( run_settings_dialog ); diff --git a/tools/editor/editor_node.h b/tools/editor/editor_node.h index f694c65db8..c4414d5c36 100644 --- a/tools/editor/editor_node.h +++ b/tools/editor/editor_node.h @@ -74,7 +74,6 @@ #include "tools/editor/editor_sub_scene.h" #include "editor_import_export.h" #include "editor_reimport_dialog.h" -#include "import_settings.h" #include "tools/editor/editor_plugin.h" #include "tools/editor/editor_name_dialog.h" @@ -177,7 +176,6 @@ private: RUN_RELOAD_SCRIPTS, SETTINGS_UPDATE_ALWAYS, SETTINGS_UPDATE_CHANGES, - SETTINGS_IMPORT, SETTINGS_EXPORT_PREFERENCES, SETTINGS_PREFERENCES, SETTINGS_OPTIMIZED_PRESETS, @@ -338,7 +336,6 @@ private: Vector<EditorPlugin*> editor_table; EditorReImportDialog *reimport_dialog; - ImportSettingsDialog *import_settings; ProgressDialog *progress_dialog; BackgroundProgress *progress_hb; diff --git a/tools/editor/import_settings.cpp b/tools/editor/import_settings.cpp deleted file mode 100644 index 53bbd2a878..0000000000 --- a/tools/editor/import_settings.cpp +++ /dev/null @@ -1,220 +0,0 @@ -/*************************************************************************/ -/* import_settings.cpp */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* http://www.godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ -#include "import_settings.h" -#include "os/os.h" -#include "editor_node.h" - -void ImportSettingsDialog::_item_pressed(int p_idx) { - - if (!edited) - return; - - String p=edited->get_metadata(0); -} - -void ImportSettingsDialog::_item_edited() { - - if (updating) - return; - TreeItem *it=tree->get_selected(); - - String p=it->get_metadata(0); -} - - -void ImportSettingsDialog::_button_pressed(Object *p_button, int p_col, int p_id) { - - TreeItem *ti=p_button->cast_to<TreeItem>(); - if (!ti) - return; - String path = ti->get_metadata(0); - print_line("PATH: "+path); - Ref<ResourceImportMetadata> rimd = ResourceLoader::load_import_metadata(path); - ERR_FAIL_COND(rimd.is_null()); - Ref<EditorImportPlugin> rimp = EditorImportExport::get_singleton()->get_import_plugin_by_name(rimd->get_editor()); - ERR_FAIL_COND(!rimp.is_valid()); - rimp->import_dialog(path); - hide(); -} - -bool ImportSettingsDialog::_generate_fs(TreeItem *p_parent,EditorFileSystemDirectory *p_dir) { - - bool valid=false; - - - for(int i=0;i<p_dir->get_subdir_count();i++) { - - EditorFileSystemDirectory *sd=p_dir->get_subdir(i); - TreeItem *ti = tree->create_item(p_parent); - ti->set_text(0,sd->get_name()+"/"); - ti->set_icon(0,get_icon("Folder","EditorIcons")); - - if (!_generate_fs(ti,sd)) { - memdelete(ti); - } else { - valid=true; - } - } - - - for(int i=0;i<p_dir->get_file_count();i++) { - - String path=p_dir->get_file_path(i); - if (!p_dir->get_file_meta(i)) - continue; - - valid=true; - - String f = p_dir->get_file(i); - TreeItem *ti = tree->create_item(p_parent); - String type = p_dir->get_file_type(i); - Ref<Texture> t; - if (has_icon(type,"EditorIcons")) - t = get_icon(type,"EditorIcons"); - else - t = get_icon("Object","EditorIcons"); - - - ti->set_icon(0,t); - ti->set_text(0,f); -// ti->add_button(0,get_icon("Reload","EditorIcons")); - ti->set_metadata(0,p_dir->get_file_path(i)); - String tt = p_dir->get_file_path(i); - - if (p_dir->is_missing_sources(i)) { - ti->set_icon(1,get_icon("ImportFail","EditorIcons")); - Vector<String> missing = p_dir->get_missing_sources(i); - for(int j=0;j<missing.size();j++) { - tt+="\nmissing: "+missing[j]; - } - - } else - ti->set_icon(1,get_icon("ImportCheck","EditorIcons")); - - ti->set_tooltip(0,tt); - ti->set_tooltip(1,tt); - - } - - return valid; -} - -void ImportSettingsDialog::update_tree() { - - updating=true; - tree->clear(); - edited=NULL; - - - TreeItem *root = tree->create_item(); - EditorFileSystemDirectory *fs = EditorFileSystem::get_singleton()->get_filesystem(); - - _generate_fs(root,fs); - updating=false; - - -} - -void ImportSettingsDialog::_notification(int p_what) { - - if (p_what==NOTIFICATION_ENTER_TREE) { - - EditorFileSystem::get_singleton()->connect("filesystem_changed",this,"update_tree"); - } -} - - -void ImportSettingsDialog::_bind_methods() { - - ObjectTypeDB::bind_method("update_tree",&ImportSettingsDialog::update_tree); - ObjectTypeDB::bind_method("_item_edited",&ImportSettingsDialog::_item_edited); - ObjectTypeDB::bind_method("_item_pressed",&ImportSettingsDialog::_item_pressed); - ObjectTypeDB::bind_method("_button_pressed",&ImportSettingsDialog::_button_pressed); - - -} - - -void ImportSettingsDialog::popup_import_settings() { - - update_tree(); - popup_centered_ratio(); -} - -void ImportSettingsDialog::ok_pressed() { - - - TreeItem *ti = tree->get_selected(); - if (!ti) - return; - - String path = ti->get_metadata(0); - print_line("PATH: "+path); - Ref<ResourceImportMetadata> rimd = ResourceLoader::load_import_metadata(path); - ERR_FAIL_COND(rimd.is_null()); - Ref<EditorImportPlugin> rimp = EditorImportExport::get_singleton()->get_import_plugin_by_name(rimd->get_editor()); - ERR_FAIL_COND(!rimp.is_valid()); - rimp->import_dialog(path); - hide(); - - -} - -ImportSettingsDialog::ImportSettingsDialog(EditorNode *p_editor) { - - editor=p_editor; - - get_ok()->set_text(TTR("Close")); - - tree = memnew( Tree ); - add_child(tree); - set_child_rect(tree); - set_title(TTR("Imported Resources")); - -// texformat="Keep,None,Disk,VRAM"; - - tree->set_hide_root(true); - tree->set_columns(2); - tree->set_column_expand(1,false); - tree->set_column_min_width(1,20); - - tree->connect("item_edited",this,"_item_edited"); - tree->connect("button_pressed",this,"_button_pressed"); - -// add_button("Re-Import","reimport"); - get_ok()->set_text(TTR("Re-Import")); - get_cancel()->set_text(TTR("Close")); - - updating=false; - edited=NULL; - set_hide_on_ok(false); - - -} - diff --git a/tools/editor/import_settings.h b/tools/editor/import_settings.h deleted file mode 100644 index 5a383a1a1a..0000000000 --- a/tools/editor/import_settings.h +++ /dev/null @@ -1,82 +0,0 @@ -/*************************************************************************/ -/* import_settings.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* http://www.godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ -#ifndef IMPORT_SETTINGS_H -#define IMPORT_SETTINGS_H - -#include "object.h" -#include "scene/gui/dialogs.h" -#include "scene/gui/tree.h" -#include "scene/gui/label.h" -#include "scene/gui/option_button.h" -#include "scene/gui/line_edit.h" -#include "scene/gui/file_dialog.h" -#include "scene/gui/progress_bar.h" -#include "scene/gui/slider.h" -#include "scene/gui/spin_box.h" -#include "scene/resources/mesh.h" -#include "editor_import_export.h" -#include "editor_file_system.h" -#include "editor_dir_dialog.h" -class EditorNode; - - -class ImportSettingsDialog : public ConfirmationDialog { - - OBJ_TYPE(ImportSettingsDialog,ConfirmationDialog); - - TreeItem *edited; - EditorNode *editor; - Tree *tree; - bool updating; - - void _button_pressed(Object *p_button, int p_col, int p_id); - void _item_pressed(int p_idx); - bool _generate_fs(TreeItem *p_parent,EditorFileSystemDirectory *p_dir); - - String texformat; - - void _item_edited(); - virtual void ok_pressed(); - -protected: - - - void _notification(int p_what); - static void _bind_methods(); -public: - - void update_tree(); - - - void popup_import_settings(); - ImportSettingsDialog(EditorNode *p_editor); - -}; - -#endif // IMPORT_SETTINGS_H |