Cleanup: drop ImportSettingsDialog, replaced by contextual actions
Note that it was already commented out.
This commit is contained in:
parent
7e3044981e
commit
d7dd10a1a2
4 changed files with 0 additions and 313 deletions
|
@ -508,8 +508,6 @@ void EditorNode::_rebuild_import_menu()
|
||||||
for (int i = 0; i < editor_import_export->get_import_plugin_count(); i++) {
|
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_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() {
|
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();
|
settings_config_dialog->popup_edit_settings();
|
||||||
} break;
|
} break;
|
||||||
case SETTINGS_IMPORT: {
|
|
||||||
|
|
||||||
import_settings->popup_import_settings();
|
|
||||||
} break;
|
|
||||||
case SETTINGS_OPTIMIZED_PRESETS: {
|
case SETTINGS_OPTIMIZED_PRESETS: {
|
||||||
|
|
||||||
//optimized_presets->popup_centered_ratio();
|
//optimized_presets->popup_centered_ratio();
|
||||||
|
@ -6289,8 +6283,6 @@ EditorNode::EditorNode() {
|
||||||
open_recent_confirmation->connect("confirmed",this,"_open_recent_scene_confirm");
|
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 );
|
run_settings_dialog = memnew( RunSettingsDialog );
|
||||||
gui_base->add_child( run_settings_dialog );
|
gui_base->add_child( run_settings_dialog );
|
||||||
|
|
||||||
|
|
|
@ -74,7 +74,6 @@
|
||||||
#include "tools/editor/editor_sub_scene.h"
|
#include "tools/editor/editor_sub_scene.h"
|
||||||
#include "editor_import_export.h"
|
#include "editor_import_export.h"
|
||||||
#include "editor_reimport_dialog.h"
|
#include "editor_reimport_dialog.h"
|
||||||
#include "import_settings.h"
|
|
||||||
#include "tools/editor/editor_plugin.h"
|
#include "tools/editor/editor_plugin.h"
|
||||||
#include "tools/editor/editor_name_dialog.h"
|
#include "tools/editor/editor_name_dialog.h"
|
||||||
|
|
||||||
|
@ -177,7 +176,6 @@ private:
|
||||||
RUN_RELOAD_SCRIPTS,
|
RUN_RELOAD_SCRIPTS,
|
||||||
SETTINGS_UPDATE_ALWAYS,
|
SETTINGS_UPDATE_ALWAYS,
|
||||||
SETTINGS_UPDATE_CHANGES,
|
SETTINGS_UPDATE_CHANGES,
|
||||||
SETTINGS_IMPORT,
|
|
||||||
SETTINGS_EXPORT_PREFERENCES,
|
SETTINGS_EXPORT_PREFERENCES,
|
||||||
SETTINGS_PREFERENCES,
|
SETTINGS_PREFERENCES,
|
||||||
SETTINGS_OPTIMIZED_PRESETS,
|
SETTINGS_OPTIMIZED_PRESETS,
|
||||||
|
@ -338,7 +336,6 @@ private:
|
||||||
Vector<EditorPlugin*> editor_table;
|
Vector<EditorPlugin*> editor_table;
|
||||||
|
|
||||||
EditorReImportDialog *reimport_dialog;
|
EditorReImportDialog *reimport_dialog;
|
||||||
ImportSettingsDialog *import_settings;
|
|
||||||
|
|
||||||
ProgressDialog *progress_dialog;
|
ProgressDialog *progress_dialog;
|
||||||
BackgroundProgress *progress_hb;
|
BackgroundProgress *progress_hb;
|
||||||
|
|
|
@ -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);
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
|
@ -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
|
|
Loading…
Reference in a new issue