2014-02-10 02:10:30 +01:00
|
|
|
/*************************************************************************/
|
|
|
|
/* resources_dock.cpp */
|
|
|
|
/*************************************************************************/
|
|
|
|
/* This file is part of: */
|
|
|
|
/* GODOT ENGINE */
|
|
|
|
/* http://www.godotengine.org */
|
|
|
|
/*************************************************************************/
|
2017-01-01 22:01:57 +01:00
|
|
|
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
|
2017-04-08 00:11:42 +02:00
|
|
|
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
|
2014-02-10 02:10:30 +01:00
|
|
|
/* */
|
|
|
|
/* 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 "resources_dock.h"
|
2017-01-16 08:04:19 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
#include "editor_file_system.h"
|
2014-02-10 02:10:30 +01:00
|
|
|
#include "editor_node.h"
|
2017-03-05 16:44:50 +01:00
|
|
|
#include "editor_settings.h"
|
2014-02-10 02:10:30 +01:00
|
|
|
#include "io/resource_loader.h"
|
|
|
|
#include "io/resource_saver.h"
|
|
|
|
#include "project_settings.h"
|
2017-07-19 22:00:46 +02:00
|
|
|
#include "project_settings_editor.h"
|
2014-02-10 02:10:30 +01:00
|
|
|
|
|
|
|
void ResourcesDock::_tool_selected(int p_tool) {
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
current_action = p_tool;
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
switch (p_tool) {
|
2014-02-10 02:10:30 +01:00
|
|
|
|
|
|
|
case TOOL_NEW: {
|
|
|
|
|
|
|
|
create_dialog->popup_centered_ratio();
|
|
|
|
} break;
|
|
|
|
case TOOL_OPEN: {
|
|
|
|
editor->open_resource();
|
|
|
|
|
|
|
|
} break;
|
|
|
|
case TOOL_SAVE: {
|
|
|
|
|
|
|
|
TreeItem *ti = resources->get_selected();
|
|
|
|
if (!ti)
|
|
|
|
break;
|
|
|
|
Ref<Resource> current_res = ti->get_metadata(0);
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
if (current_res->get_path() != "" && current_res->get_path().find("::") == -1) {
|
2014-02-10 02:10:30 +01:00
|
|
|
_file_action(current_res->get_path());
|
|
|
|
break;
|
|
|
|
};
|
|
|
|
|
|
|
|
}; /* fallthrough */
|
|
|
|
case TOOL_SAVE_AS: {
|
|
|
|
|
|
|
|
TreeItem *ti = resources->get_selected();
|
|
|
|
if (!ti)
|
|
|
|
break;
|
|
|
|
|
2014-09-23 01:12:44 +02:00
|
|
|
save_resource_as(ti->get_metadata(0));
|
2014-02-10 02:10:30 +01:00
|
|
|
|
|
|
|
} break;
|
|
|
|
case TOOL_MAKE_LOCAL: {
|
|
|
|
|
|
|
|
TreeItem *ti = resources->get_selected();
|
|
|
|
if (!ti)
|
|
|
|
break;
|
|
|
|
Ref<Resource> current_res = ti->get_metadata(0);
|
|
|
|
current_res->set_path("");
|
|
|
|
_update_name(ti);
|
|
|
|
} break;
|
|
|
|
case TOOL_COPY: {
|
|
|
|
|
|
|
|
TreeItem *ti = resources->get_selected();
|
|
|
|
if (!ti)
|
|
|
|
break;
|
|
|
|
Ref<Resource> current_res = ti->get_metadata(0);
|
|
|
|
EditorSettings::get_singleton()->set_resource_clipboard(current_res);
|
|
|
|
|
|
|
|
} break;
|
|
|
|
case TOOL_PASTE: {
|
|
|
|
|
|
|
|
add_resource(EditorSettings::get_singleton()->get_resource_clipboard());
|
|
|
|
} break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void ResourcesDock::_notification(int p_what) {
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
switch (p_what) {
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2014-11-06 01:20:42 +01:00
|
|
|
case NOTIFICATION_ENTER_TREE: {
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
button_new->set_icon(get_icon("New", "EditorIcons"));
|
|
|
|
button_open->set_icon(get_icon("Folder", "EditorIcons"));
|
|
|
|
button_save->set_icon(get_icon("Save", "EditorIcons"));
|
|
|
|
button_tools->set_icon(get_icon("Tools", "EditorIcons"));
|
2014-02-10 02:10:30 +01:00
|
|
|
|
|
|
|
} break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
void ResourcesDock::save_resource(const String &p_path, const Ref<Resource> &p_resource) {
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2017-01-14 18:03:38 +01:00
|
|
|
editor->get_editor_data().apply_changes_in_editors();
|
2017-03-05 16:44:50 +01:00
|
|
|
int flg = 0;
|
2014-02-10 02:10:30 +01:00
|
|
|
if (EditorSettings::get_singleton()->get("on_save/compress_binary_resources"))
|
2017-03-05 16:44:50 +01:00
|
|
|
flg |= ResourceSaver::FLAG_COMPRESS;
|
2017-01-14 12:26:56 +01:00
|
|
|
/*
|
|
|
|
if (EditorSettings::get_singleton()->get("on_save/save_paths_as_relative"))
|
|
|
|
flg|=ResourceSaver::FLAG_RELATIVE_PATHS;
|
|
|
|
*/
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2017-07-19 22:00:46 +02:00
|
|
|
String path = ProjectSettings::get_singleton()->localize_path(p_path);
|
2017-03-05 16:44:50 +01:00
|
|
|
Error err = ResourceSaver::save(path, p_resource, flg | ResourceSaver::FLAG_REPLACE_SUBRESOURCE_PATHS);
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
if (err != OK) {
|
2016-05-04 03:25:37 +02:00
|
|
|
accept->set_text(TTR("Error saving resource!"));
|
2015-04-08 19:02:13 +02:00
|
|
|
accept->popup_centered_minsize();
|
2017-03-05 16:44:50 +01:00
|
|
|
return;
|
2014-02-10 02:10:30 +01:00
|
|
|
}
|
2017-01-14 12:26:56 +01:00
|
|
|
//EditorFileSystem::get_singleton()->update_file(path,p_resource->get_type());
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
((Resource *)p_resource.ptr())->set_path(path);
|
|
|
|
editor->emit_signal("resource_saved", p_resource);
|
2014-02-10 02:10:30 +01:00
|
|
|
}
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
void ResourcesDock::save_resource_as(const Ref<Resource> &p_resource) {
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
current_action = TOOL_SAVE_AS;
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2014-09-23 01:12:44 +02:00
|
|
|
RES res(p_resource);
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2014-09-23 01:12:44 +02:00
|
|
|
List<String> extensions;
|
2017-03-05 16:44:50 +01:00
|
|
|
ResourceSaver::get_recognized_extensions(res, &extensions);
|
2015-05-31 06:59:42 +02:00
|
|
|
file->set_mode(EditorFileDialog::MODE_SAVE_FILE);
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
if (p_resource->get_path() != "" && p_resource->get_path().find("::") == -1) {
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2014-09-23 01:12:44 +02:00
|
|
|
file->set_current_path(p_resource->get_path());
|
|
|
|
} else {
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2014-09-23 01:12:44 +02:00
|
|
|
String existing;
|
|
|
|
if (extensions.size()) {
|
2017-03-05 16:44:50 +01:00
|
|
|
existing = "new_" + res->get_class().to_lower() + "." + extensions.front()->get().to_lower();
|
2014-09-23 01:12:44 +02:00
|
|
|
}
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2014-09-23 01:12:44 +02:00
|
|
|
file->set_current_file(existing);
|
|
|
|
}
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2014-09-23 01:12:44 +02:00
|
|
|
file->clear_filters();
|
2017-03-05 16:44:50 +01:00
|
|
|
for (int i = 0; i < extensions.size(); i++) {
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
file->add_filter("*." + extensions[i] + " ; " + extensions[i].to_upper());
|
2014-09-23 01:12:44 +02:00
|
|
|
}
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2014-09-23 01:12:44 +02:00
|
|
|
file->popup_centered_ratio();
|
2014-02-10 02:10:30 +01:00
|
|
|
}
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
void ResourcesDock::_file_action(const String &p_path) {
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
switch (current_action) {
|
2014-02-10 02:10:30 +01:00
|
|
|
|
|
|
|
case TOOL_OPEN: {
|
|
|
|
|
|
|
|
} break;
|
|
|
|
case TOOL_SAVE:
|
|
|
|
case TOOL_SAVE_AS: {
|
|
|
|
|
|
|
|
TreeItem *ti = resources->get_selected();
|
|
|
|
if (!ti)
|
|
|
|
break;
|
|
|
|
Ref<Resource> current_res = ti->get_metadata(0);
|
|
|
|
|
|
|
|
RES res(current_res);
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
save_resource(p_path, res);
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2014-06-22 19:52:54 +02:00
|
|
|
_update_name(ti);
|
2014-02-10 02:10:30 +01:00
|
|
|
|
|
|
|
} break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void ResourcesDock::_update_name(TreeItem *item) {
|
|
|
|
|
|
|
|
Ref<Resource> res = item->get_metadata(0);
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
if (res->get_name() != "")
|
|
|
|
item->set_text(0, res->get_name());
|
|
|
|
else if (res->get_path() != "" && res->get_path().find("::") == -1)
|
|
|
|
item->set_text(0, res->get_path().get_file());
|
2014-02-10 02:10:30 +01:00
|
|
|
else
|
2017-08-07 12:17:31 +02:00
|
|
|
item->set_text(0, res->get_class() + " (" + itos(res->get_instance_id()) + ")");
|
2014-02-10 02:10:30 +01:00
|
|
|
}
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
void ResourcesDock::remove_resource(const Ref<Resource> &p_resource) {
|
2014-02-10 02:10:30 +01:00
|
|
|
|
|
|
|
TreeItem *root = resources->get_root();
|
|
|
|
ERR_FAIL_COND(!root);
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
TreeItem *existing = root->get_children();
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
while (existing) {
|
2014-02-10 02:10:30 +01:00
|
|
|
|
|
|
|
Ref<Resource> r = existing->get_metadata(0);
|
2017-03-05 16:44:50 +01:00
|
|
|
if (r == p_resource) {
|
2014-02-10 02:10:30 +01:00
|
|
|
//existing->move_to_top();
|
|
|
|
memdelete(existing);
|
|
|
|
return;
|
|
|
|
}
|
2017-03-05 16:44:50 +01:00
|
|
|
existing = existing->get_next();
|
2014-02-10 02:10:30 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
void ResourcesDock::add_resource(const Ref<Resource> &p_resource) {
|
2014-02-10 02:10:30 +01:00
|
|
|
|
|
|
|
if (block_add)
|
|
|
|
return;
|
|
|
|
if (!p_resource.is_valid())
|
|
|
|
return;
|
|
|
|
|
|
|
|
TreeItem *root = resources->get_root();
|
|
|
|
ERR_FAIL_COND(!root);
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
TreeItem *existing = root->get_children();
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
while (existing) {
|
2014-02-10 02:10:30 +01:00
|
|
|
|
|
|
|
Ref<Resource> r = existing->get_metadata(0);
|
2017-03-05 16:44:50 +01:00
|
|
|
if (r == p_resource) {
|
2014-02-10 02:10:30 +01:00
|
|
|
//existing->move_to_top();
|
|
|
|
existing->select(0);
|
|
|
|
resources->ensure_cursor_is_visible();
|
|
|
|
return; // existing
|
|
|
|
}
|
2017-03-05 16:44:50 +01:00
|
|
|
existing = existing->get_next();
|
2014-02-10 02:10:30 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TreeItem *res = resources->create_item(root);
|
2017-03-05 16:44:50 +01:00
|
|
|
res->set_metadata(0, p_resource);
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
if (has_icon(p_resource->get_class(), "EditorIcons")) {
|
|
|
|
res->set_icon(0, get_icon(p_resource->get_class(), "EditorIcons"));
|
2014-02-10 02:10:30 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
_update_name(res);
|
2017-03-05 16:44:50 +01:00
|
|
|
res->add_button(0, get_icon("Del", "EditorIcons"));
|
2014-02-10 02:10:30 +01:00
|
|
|
res->move_to_top();
|
|
|
|
res->select(0);
|
|
|
|
resources->ensure_cursor_is_visible();
|
|
|
|
}
|
|
|
|
|
|
|
|
void ResourcesDock::_resource_selected() {
|
|
|
|
|
|
|
|
TreeItem *sel = resources->get_selected();
|
|
|
|
ERR_FAIL_COND(!sel);
|
|
|
|
|
|
|
|
Ref<Resource> r = sel->get_metadata(0);
|
|
|
|
if (r.is_null())
|
|
|
|
return;
|
2017-03-05 16:44:50 +01:00
|
|
|
block_add = true;
|
2014-02-10 02:10:30 +01:00
|
|
|
editor->push_item(r.ptr());
|
2017-03-05 16:44:50 +01:00
|
|
|
block_add = false;
|
2014-02-10 02:10:30 +01:00
|
|
|
}
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
void ResourcesDock::_delete(Object *p_item, int p_column, int p_id) {
|
2014-02-10 02:10:30 +01:00
|
|
|
|
|
|
|
TreeItem *ti = p_item->cast_to<TreeItem>();
|
|
|
|
ERR_FAIL_COND(!ti);
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
call_deferred("remove_resource", ti->get_metadata(0));
|
2014-02-10 02:10:30 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void ResourcesDock::_create() {
|
|
|
|
|
|
|
|
Object *c = create_dialog->instance_selected();
|
|
|
|
|
|
|
|
ERR_FAIL_COND(!c);
|
|
|
|
Resource *r = c->cast_to<Resource>();
|
|
|
|
ERR_FAIL_COND(!r);
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
REF res(r);
|
2014-02-10 02:10:30 +01:00
|
|
|
|
|
|
|
editor->push_item(c);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ResourcesDock::_bind_methods() {
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
ClassDB::bind_method(D_METHOD("_tool_selected"), &ResourcesDock::_tool_selected);
|
|
|
|
ClassDB::bind_method(D_METHOD("_create"), &ResourcesDock::_create);
|
|
|
|
ClassDB::bind_method(D_METHOD("_resource_selected"), &ResourcesDock::_resource_selected);
|
|
|
|
ClassDB::bind_method(D_METHOD("_delete"), &ResourcesDock::_delete);
|
|
|
|
ClassDB::bind_method(D_METHOD("remove_resource"), &ResourcesDock::remove_resource);
|
|
|
|
ClassDB::bind_method(D_METHOD("_file_action"), &ResourcesDock::_file_action);
|
2014-02-10 02:10:30 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void ResourcesDock::cleanup() {
|
|
|
|
|
|
|
|
resources->clear();
|
|
|
|
resources->create_item(); //root
|
|
|
|
}
|
|
|
|
|
|
|
|
ResourcesDock::ResourcesDock(EditorNode *p_editor) {
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
editor = p_editor;
|
2014-02-10 02:10:30 +01:00
|
|
|
|
|
|
|
VBoxContainer *vbc = this;
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
HBoxContainer *hbc = memnew(HBoxContainer);
|
2014-02-10 02:10:30 +01:00
|
|
|
vbc->add_child(hbc);
|
|
|
|
|
|
|
|
Button *b;
|
2017-03-05 16:44:50 +01:00
|
|
|
b = memnew(ToolButton);
|
2016-05-04 03:25:37 +02:00
|
|
|
b->set_tooltip(TTR("Create New Resource"));
|
2017-03-05 16:44:50 +01:00
|
|
|
b->connect("pressed", this, "_tool_selected", make_binds(TOOL_NEW));
|
|
|
|
hbc->add_child(b);
|
|
|
|
button_new = b;
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
b = memnew(ToolButton);
|
2016-05-04 03:25:37 +02:00
|
|
|
b->set_tooltip(TTR("Open Resource"));
|
2017-03-05 16:44:50 +01:00
|
|
|
b->connect("pressed", this, "_tool_selected", make_binds(TOOL_OPEN));
|
|
|
|
hbc->add_child(b);
|
|
|
|
button_open = b;
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
MenuButton *mb = memnew(MenuButton);
|
2016-05-04 03:25:37 +02:00
|
|
|
mb->set_tooltip(TTR("Save Resource"));
|
2017-03-05 16:44:50 +01:00
|
|
|
mb->get_popup()->add_item(TTR("Save Resource"), TOOL_SAVE);
|
|
|
|
mb->get_popup()->add_item(TTR("Save Resource As.."), TOOL_SAVE_AS);
|
|
|
|
mb->get_popup()->connect("id_pressed", this, "_tool_selected");
|
|
|
|
hbc->add_child(mb);
|
|
|
|
button_save = mb;
|
2014-02-10 02:10:30 +01:00
|
|
|
|
|
|
|
hbc->add_spacer();
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
mb = memnew(MenuButton);
|
2016-05-04 03:25:37 +02:00
|
|
|
mb->set_tooltip(TTR("Resource Tools"));
|
2017-03-05 16:44:50 +01:00
|
|
|
mb->get_popup()->add_item(TTR("Make Local"), TOOL_MAKE_LOCAL);
|
|
|
|
mb->get_popup()->add_item(TTR("Copy"), TOOL_COPY);
|
|
|
|
mb->get_popup()->add_item(TTR("Paste"), TOOL_PASTE);
|
|
|
|
mb->get_popup()->connect("id_pressed", this, "_tool_selected");
|
|
|
|
hbc->add_child(mb);
|
|
|
|
button_tools = mb;
|
|
|
|
|
|
|
|
resources = memnew(Tree);
|
2014-02-10 02:10:30 +01:00
|
|
|
vbc->add_child(resources);
|
|
|
|
resources->set_v_size_flags(SIZE_EXPAND_FILL);
|
|
|
|
resources->create_item(); //root
|
|
|
|
resources->set_hide_root(true);
|
2017-03-05 16:44:50 +01:00
|
|
|
resources->connect("cell_selected", this, "_resource_selected");
|
|
|
|
resources->connect("button_pressed", this, "_delete");
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
create_dialog = memnew(CreateDialog);
|
2014-02-10 02:10:30 +01:00
|
|
|
add_child(create_dialog);
|
|
|
|
create_dialog->set_base_type("Resource");
|
2017-03-05 16:44:50 +01:00
|
|
|
create_dialog->connect("create", this, "_create");
|
|
|
|
accept = memnew(AcceptDialog);
|
2014-02-10 02:10:30 +01:00
|
|
|
add_child(accept);
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
file = memnew(EditorFileDialog);
|
2014-02-10 02:10:30 +01:00
|
|
|
add_child(file);
|
2017-03-05 16:44:50 +01:00
|
|
|
file->connect("file_selected", this, "_file_action");
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
block_add = false;
|
2014-02-10 02:10:30 +01:00
|
|
|
}
|