summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
Diffstat (limited to 'editor')
-rw-r--r--editor/animation_editor.h1
-rw-r--r--editor/editor_about.cpp210
-rw-r--r--editor/editor_about.h70
-rw-r--r--editor/editor_file_system.cpp15
-rw-r--r--editor/editor_help.cpp19
-rw-r--r--editor/editor_node.cpp175
-rw-r--r--editor/editor_node.h6
-rw-r--r--editor/editor_plugin.cpp4
-rw-r--r--editor/editor_plugin.h2
-rw-r--r--editor/editor_settings.cpp6
-rw-r--r--editor/editor_themes.cpp3
-rw-r--r--editor/filesystem_dock.cpp6
-rw-r--r--editor/import/resource_importer_obj.cpp4
-rw-r--r--editor/import/resource_importer_scene.cpp107
-rw-r--r--editor/import/resource_importer_scene.h13
-rw-r--r--editor/import_dock.cpp69
-rw-r--r--editor/import_dock.h7
-rw-r--r--editor/plugins/animation_tree_editor_plugin.cpp7
-rw-r--r--editor/plugins/mesh_editor_plugin.cpp165
-rw-r--r--editor/plugins/mesh_editor_plugin.h23
-rw-r--r--editor/plugins/script_editor_plugin.cpp29
-rw-r--r--editor/plugins/script_editor_plugin.h4
-rw-r--r--editor/plugins/spatial_editor_plugin.cpp60
-rw-r--r--editor/project_manager.cpp18
-rw-r--r--editor/scene_tree_dock.cpp7
25 files changed, 646 insertions, 384 deletions
diff --git a/editor/animation_editor.h b/editor/animation_editor.h
index 128481c837..88cc446853 100644
--- a/editor/animation_editor.h
+++ b/editor/animation_editor.h
@@ -45,7 +45,6 @@
#include "scene/animation/animation_cache.h"
#include "scene/resources/animation.h"
#include "scene_tree_editor.h"
-#include "scene_tree_editor.h"
class AnimationKeyEdit;
class AnimationCurveEdit;
diff --git a/editor/editor_about.cpp b/editor/editor_about.cpp
new file mode 100644
index 0000000000..2328a42a07
--- /dev/null
+++ b/editor/editor_about.cpp
@@ -0,0 +1,210 @@
+/*************************************************************************/
+/* editor_about.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* 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 "editor_about.h"
+
+#include "authors.gen.h"
+#include "license.gen.h"
+#include "version.h"
+#include "version_hash.gen.h"
+
+void EditorAbout::_license_tree_selected() {
+
+ TreeItem *selected = _tpl_tree->get_selected();
+ _tpl_text->select(0, 0, 0, 0);
+ _tpl_text->set_text(selected->get_metadata(0));
+}
+
+void EditorAbout::_bind_methods() {
+
+ ClassDB::bind_method(D_METHOD("_license_tree_selected"), &EditorAbout::_license_tree_selected);
+}
+
+TextureRect *EditorAbout::get_logo() const {
+
+ return _logo;
+}
+
+EditorAbout::EditorAbout() {
+
+ set_title(TTR("Thanks from the Godot community!"));
+ get_ok()->set_text(TTR("Thanks!"));
+ set_hide_on_ok(true);
+ set_resizable(true);
+
+ VBoxContainer *vbc = memnew(VBoxContainer);
+ HBoxContainer *hbc = memnew(HBoxContainer);
+ hbc->set_h_size_flags(Control::SIZE_EXPAND_FILL);
+ hbc->set_alignment(BoxContainer::ALIGN_CENTER);
+ hbc->add_constant_override("separation", 30 * EDSCALE);
+ add_child(vbc);
+ vbc->add_child(hbc);
+
+ _logo = memnew(TextureRect);
+ hbc->add_child(_logo);
+
+ String hash = String(VERSION_HASH);
+ if (hash.length() != 0)
+ hash = "." + hash.left(7);
+
+ Label *about_text = memnew(Label);
+ about_text->set_v_size_flags(Control::SIZE_SHRINK_CENTER);
+ about_text->set_text(VERSION_FULL_NAME + hash + String::utf8("\n\u00A9 2007-2017 Juan Linietsky, Ariel Manzur.\n\u00A9 2014-2017 ") +
+ TTR("Godot Engine contributors") + "\n");
+ hbc->add_child(about_text);
+
+ TabContainer *tc = memnew(TabContainer);
+ tc->set_custom_minimum_size(Size2(630, 240) * EDSCALE);
+ tc->set_v_size_flags(Control::SIZE_EXPAND_FILL);
+ vbc->add_child(tc);
+
+ ScrollContainer *dev_base = memnew(ScrollContainer);
+ dev_base->set_name(TTR("Authors"));
+ dev_base->set_v_size_flags(Control::SIZE_EXPAND);
+ tc->add_child(dev_base);
+
+ VBoxContainer *dev_vbc = memnew(VBoxContainer);
+ dev_vbc->set_h_size_flags(Control::SIZE_EXPAND_FILL);
+ dev_base->add_child(dev_vbc);
+
+ List<String> dev_sections;
+ dev_sections.push_back(TTR("Project Founders"));
+ dev_sections.push_back(TTR("Lead Developer"));
+ dev_sections.push_back(TTR("Project Manager"));
+ dev_sections.push_back(TTR("Developers"));
+
+ const char **dev_src[] = { dev_founders, dev_lead, dev_manager, dev_names };
+
+ for (int i = 0; i < dev_sections.size(); i++) {
+
+ Label *lbl = memnew(Label);
+ lbl->set_text(dev_sections[i]);
+ dev_vbc->add_child(lbl);
+
+ ItemList *il = memnew(ItemList);
+ il->set_max_columns(16);
+ il->set_h_size_flags(Control::SIZE_EXPAND_FILL);
+ il->set_fixed_column_width(230 * EDSCALE);
+ il->set_auto_height(true);
+ const char **dev_names_ptr = dev_src[i];
+ while (*dev_names_ptr)
+ il->add_item(String::utf8(*dev_names_ptr++), NULL, false);
+ dev_vbc->add_child(il);
+
+ HSeparator *hs = memnew(HSeparator);
+ hs->set_modulate(Color(0, 0, 0, 0));
+ dev_vbc->add_child(hs);
+ }
+
+ TextEdit *license = memnew(TextEdit);
+ license->set_name(TTR("License"));
+ license->set_h_size_flags(Control::SIZE_EXPAND_FILL);
+ license->set_v_size_flags(Control::SIZE_EXPAND_FILL);
+ license->set_wrap(true);
+ license->set_readonly(true);
+ license->set_text(String::utf8(about_license));
+ tc->add_child(license);
+
+ VBoxContainer *license_thirdparty = memnew(VBoxContainer);
+ license_thirdparty->set_name(TTR("Thirdparty License"));
+ license_thirdparty->set_h_size_flags(Control::SIZE_EXPAND_FILL);
+ tc->add_child(license_thirdparty);
+
+ Label *tpl_label = memnew(Label);
+ tpl_label->set_custom_minimum_size(Size2(0, 64 * EDSCALE));
+ tpl_label->set_h_size_flags(Control::SIZE_EXPAND_FILL);
+ tpl_label->set_autowrap(true);
+ tpl_label->set_text(TTR("Godot Engine relies on a number of thirdparty free and open source libraries, all compatible with the terms of its MIT license. The following is an exhaustive list of all such thirdparty components with their respective copyright statements and license terms."));
+ license_thirdparty->add_child(tpl_label);
+
+ HSplitContainer *tpl_hbc = memnew(HSplitContainer);
+ tpl_hbc->set_h_size_flags(Control::SIZE_EXPAND_FILL);
+ tpl_hbc->set_v_size_flags(Control::SIZE_EXPAND_FILL);
+ tpl_hbc->set_split_offset(240 * EDSCALE);
+ license_thirdparty->add_child(tpl_hbc);
+
+ _tpl_tree = memnew(Tree);
+ _tpl_tree->set_hide_root(true);
+ TreeItem *root = _tpl_tree->create_item();
+ TreeItem *tpl_ti_all = _tpl_tree->create_item(root);
+ tpl_ti_all->set_text(0, TTR("All Components"));
+ TreeItem *tpl_ti_tp = _tpl_tree->create_item(root);
+ tpl_ti_tp->set_text(0, TTR("Components"));
+ tpl_ti_tp->set_selectable(0, false);
+ TreeItem *tpl_ti_lc = _tpl_tree->create_item(root);
+ tpl_ti_lc->set_text(0, TTR("Licenses"));
+ tpl_ti_lc->set_selectable(0, false);
+ int read_idx = 0;
+ String long_text = "";
+ for (int i = 0; i < THIRDPARTY_COUNT; i++) {
+
+ TreeItem *ti = _tpl_tree->create_item(tpl_ti_tp);
+ String thirdparty = String(about_thirdparty[i]);
+ ti->set_text(0, thirdparty);
+ String text = thirdparty + "\n";
+ long_text += "- " + thirdparty + "\n\n";
+ for (int j = 0; j < about_tp_copyright_count[i]; j++) {
+
+ text += "\n Files:\n " + String(about_tp_file[read_idx]).replace("\n", "\n ") + "\n";
+ String copyright = String::utf8(" \u00A9 ") + String::utf8(about_tp_copyright[read_idx]).replace("\n", String::utf8("\n \u00A9 "));
+ text += copyright;
+ long_text += copyright;
+ String license = "\n License: " + String(about_tp_license[read_idx]) + "\n";
+ text += license;
+ long_text += license + "\n";
+ read_idx++;
+ }
+ ti->set_metadata(0, text);
+ }
+ for (int i = 0; i < LICENSE_COUNT; i++) {
+
+ TreeItem *ti = _tpl_tree->create_item(tpl_ti_lc);
+ String licensename = String(about_license_name[i]);
+ ti->set_text(0, licensename);
+ long_text += "- " + licensename + "\n\n";
+ String licensebody = String(about_license_body[i]);
+ ti->set_metadata(0, licensebody);
+ long_text += " " + licensebody.replace("\n", "\n ") + "\n\n";
+ }
+ tpl_ti_all->set_metadata(0, long_text);
+ tpl_hbc->add_child(_tpl_tree);
+
+ _tpl_text = memnew(TextEdit);
+ _tpl_text->set_h_size_flags(Control::SIZE_EXPAND_FILL);
+ _tpl_text->set_v_size_flags(Control::SIZE_EXPAND_FILL);
+ _tpl_text->set_wrap(true);
+ _tpl_text->set_readonly(true);
+ tpl_hbc->add_child(_tpl_text);
+
+ _tpl_tree->connect("item_selected", this, "_license_tree_selected");
+ tpl_ti_all->select(0);
+ _tpl_text->set_text(tpl_ti_all->get_metadata(0));
+}
+
+EditorAbout::~EditorAbout() {}
diff --git a/editor/editor_about.h b/editor/editor_about.h
new file mode 100644
index 0000000000..0bde94531a
--- /dev/null
+++ b/editor/editor_about.h
@@ -0,0 +1,70 @@
+/*************************************************************************/
+/* editor_about.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* 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 EDITOR_ABOUT_H
+#define EDITOR_ABOUT_H
+
+#include "scene/gui/control.h"
+#include "scene/gui/dialogs.h"
+#include "scene/gui/item_list.h"
+#include "scene/gui/scroll_container.h"
+#include "scene/gui/separator.h"
+#include "scene/gui/split_container.h"
+#include "scene/gui/tab_container.h"
+#include "scene/gui/text_edit.h"
+#include "scene/gui/texture_rect.h"
+#include "scene/gui/tree.h"
+
+#include "editor_scale.h"
+/**
+ @author Juan Linietsky <reduzio@gmail.com>
+*/
+
+class EditorAbout : public AcceptDialog {
+
+ GDCLASS(EditorAbout, AcceptDialog);
+
+private:
+ void _license_tree_selected();
+
+ Tree *_tpl_tree;
+ TextEdit *_tpl_text;
+ TextureRect *_logo;
+
+protected:
+ static void _bind_methods();
+
+public:
+ TextureRect *get_logo() const;
+
+ EditorAbout();
+ ~EditorAbout();
+};
+
+#endif
diff --git a/editor/editor_file_system.cpp b/editor/editor_file_system.cpp
index f0f84416bf..ed58116304 100644
--- a/editor/editor_file_system.cpp
+++ b/editor/editor_file_system.cpp
@@ -1239,7 +1239,7 @@ void EditorFileSystem::_reimport_file(const String &p_file) {
String importer_name;
if (FileAccess::exists(p_file + ".import")) {
-
+ //use existing
Ref<ConfigFile> cf;
cf.instance();
Error err = cf->load(p_file + ".import");
@@ -1254,6 +1254,7 @@ void EditorFileSystem::_reimport_file(const String &p_file) {
}
Ref<ResourceImporter> importer;
+ bool load_default = false;
//find the importer
if (importer_name != "") {
importer = ResourceFormatImporter::get_singleton()->get_importer_by_name(importer_name);
@@ -1262,6 +1263,7 @@ void EditorFileSystem::_reimport_file(const String &p_file) {
if (importer.is_null()) {
//not found by name, find by extension
importer = ResourceFormatImporter::get_singleton()->get_importer_by_extension(p_file.get_extension());
+ load_default = true;
if (importer.is_null()) {
ERR_PRINT("BUG: File queued for import, but can't be imported!");
ERR_FAIL();
@@ -1278,6 +1280,17 @@ void EditorFileSystem::_reimport_file(const String &p_file) {
}
}
+ if (load_default && ProjectSettings::get_singleton()->get("importer_defaults/" + importer->get_importer_name())) {
+ //use defaults if exist
+ Dictionary d = ProjectSettings::get_singleton()->get("importer_defaults/" + importer->get_importer_name());
+ List<Variant> v;
+ d.get_key_list(&v);
+
+ for (List<Variant>::Element *E = v.front(); E; E = E->next()) {
+ params[E->get()] = d[E->get()];
+ }
+ }
+
//finally, perform import!!
String base_path = ResourceFormatImporter::get_singleton()->get_import_base_path(p_file);
diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp
index 952c98d0f6..e890082ee1 100644
--- a/editor/editor_help.cpp
+++ b/editor/editor_help.cpp
@@ -36,7 +36,8 @@
#include "os/keyboard.h"
void EditorHelpSearch::popup() {
- popup_centered_ratio(0.6);
+
+ popup_centered(Size2(700, 600) * EDSCALE);
if (search_box->get_text() != "") {
search_box->select_all();
_update_search();
@@ -46,7 +47,7 @@ void EditorHelpSearch::popup() {
void EditorHelpSearch::popup(const String &p_term) {
- popup_centered_ratio(0.6);
+ popup_centered(Size2(700, 600) * EDSCALE);
if (p_term != "") {
search_box->set_text(p_term);
search_box->select_all();
@@ -262,6 +263,8 @@ void EditorHelpSearch::_notification(int p_what) {
if (p_what == NOTIFICATION_ENTER_TREE) {
+ search_box->add_icon_override("right_icon", get_icon("Search", "EditorIcons"));
+
connect("confirmed", this, "_confirmed");
_update_search();
}
@@ -293,12 +296,7 @@ EditorHelpSearch::EditorHelpSearch() {
HBoxContainer *sb_hb = memnew(HBoxContainer);
search_box = memnew(LineEdit);
- sb_hb->add_child(search_box);
- search_box->set_h_size_flags(SIZE_EXPAND_FILL);
- Button *sb = memnew(Button(TTR("Search")));
- sb->connect("pressed", this, "_update_search");
- sb_hb->add_child(sb);
- vbc->add_margin_child(TTR("Search:"), sb_hb);
+ vbc->add_child(search_box);
search_box->connect("text_changed", this, "_text_changed");
search_box->connect("gui_input", this, "_sbox_input");
search_options = memnew(Tree);
@@ -378,7 +376,7 @@ void EditorHelpIndex::select_class(const String &p_class) {
void EditorHelpIndex::popup() {
- popup_centered_ratio(0.6);
+ popup_centered(Size2(500, 600) * EDSCALE);
search_box->set_text("");
_update_class_list();
@@ -388,6 +386,7 @@ void EditorHelpIndex::_notification(int p_what) {
if (p_what == NOTIFICATION_ENTER_TREE) {
+ search_box->add_icon_override("right_icon", get_icon("Search", "EditorIcons"));
_update_class_list();
connect("confirmed", this, "_tree_item_selected");
@@ -478,7 +477,7 @@ EditorHelpIndex::EditorHelpIndex() {
add_child(vbc);
search_box = memnew(LineEdit);
- vbc->add_margin_child(TTR("Search:"), search_box);
+ vbc->add_child(search_box);
search_box->set_h_size_flags(SIZE_EXPAND_FILL);
register_text_enter(search_box);
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index ea4cbd4853..b9a1ae2946 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -30,7 +30,6 @@
#include "editor_node.h"
#include "animation_editor.h"
-#include "authors.gen.h"
#include "bind/core_bind.h"
#include "class_db.h"
#include "core/io/resource_loader.h"
@@ -42,7 +41,6 @@
#include "io/config_file.h"
#include "io/stream_peer_ssl.h"
#include "io/zip_io.h"
-#include "license.gen.h"
#include "main/input_default.h"
#include "message_queue.h"
#include "os/file_access.h"
@@ -2520,8 +2518,7 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
}
}
- if (OS::get_singleton()->is_window_minimized())
- OS::get_singleton()->request_attention();
+ OS::get_singleton()->request_attention();
break;
}
@@ -4960,13 +4957,6 @@ void EditorNode::_check_gui_base_size() {
}
}
-void EditorNode::_license_tree_selected() {
-
- TreeItem *selected = _tpl_tree->get_selected();
- _tpl_text->select(0, 0, 0, 0);
- _tpl_text->set_text(selected->get_metadata(0));
-}
-
void EditorNode::open_export_template_manager() {
export_template_manager->popup_manager();
@@ -5057,8 +5047,6 @@ void EditorNode::_bind_methods() {
ClassDB::bind_method(D_METHOD("_dim_timeout"), &EditorNode::_dim_timeout);
ClassDB::bind_method(D_METHOD("_check_gui_base_size"), &EditorNode::_check_gui_base_size);
- ClassDB::bind_method(D_METHOD("_license_tree_selected"), &EditorNode::_license_tree_selected);
-
ADD_SIGNAL(MethodInfo("play_pressed"));
ADD_SIGNAL(MethodInfo("pause_pressed"));
ADD_SIGNAL(MethodInfo("stop_pressed"));
@@ -5965,160 +5953,9 @@ EditorNode::EditorNode() {
export_template_manager = memnew(ExportTemplateManager);
gui_base->add_child(export_template_manager);
- {
-
- about = memnew(AcceptDialog);
- about->set_title(TTR("Thanks from the Godot community!"));
- about->get_ok()->set_text(TTR("Thanks!"));
- about->set_hide_on_ok(true);
- about->set_resizable(true);
- gui_base->add_child(about);
-
- VBoxContainer *vbc = memnew(VBoxContainer);
- HBoxContainer *hbc = memnew(HBoxContainer);
- hbc->set_h_size_flags(Control::SIZE_EXPAND_FILL);
- hbc->set_alignment(BoxContainer::ALIGN_CENTER);
- hbc->add_constant_override("separation", 30 * EDSCALE);
- about->add_child(vbc);
- vbc->add_child(hbc);
-
- TextureRect *logo = memnew(TextureRect);
- logo->set_texture(gui_base->get_icon("Logo", "EditorIcons"));
- hbc->add_child(logo);
-
- Label *about_text = memnew(Label);
- about_text->set_v_size_flags(Control::SIZE_SHRINK_CENTER);
- about_text->set_text(VERSION_FULL_NAME + String::utf8("\n\u00A9 2007-2017 Juan Linietsky, Ariel Manzur.\n\u00A9 2014-2017 ") +
- TTR("Godot Engine contributors") + "\n");
- hbc->add_child(about_text);
-
- TabContainer *tc = memnew(TabContainer);
- tc->set_custom_minimum_size(Size2(600, 240) * EDSCALE);
- tc->set_v_size_flags(Control::SIZE_EXPAND_FILL);
- vbc->add_child(tc);
-
- ScrollContainer *dev_base = memnew(ScrollContainer);
- dev_base->set_name(TTR("Authors"));
- dev_base->set_v_size_flags(Control::SIZE_EXPAND);
- tc->add_child(dev_base);
-
- VBoxContainer *dev_vbc = memnew(VBoxContainer);
- dev_vbc->set_h_size_flags(Control::SIZE_EXPAND_FILL);
- dev_base->add_child(dev_vbc);
-
- List<String> dev_sections;
- dev_sections.push_back(TTR("Project Founders"));
- dev_sections.push_back(TTR("Lead Developer"));
- dev_sections.push_back(TTR("Project Manager"));
- dev_sections.push_back(TTR("Developers"));
-
- const char **dev_src[] = { dev_founders, dev_lead, dev_manager, dev_names };
-
- for (int i = 0; i < dev_sections.size(); i++) {
-
- Label *lbl = memnew(Label);
- lbl->set_text(dev_sections[i]);
- dev_vbc->add_child(lbl);
-
- ItemList *il = memnew(ItemList);
- il->set_max_columns(32);
- il->set_h_size_flags(Control::SIZE_EXPAND_FILL);
- il->set_custom_minimum_size(Size2(0, i == 3 ? DEV_NAMES_COUNT * 7.6 : 30) * EDSCALE);
- const char **dev_names_ptr = dev_src[i];
- while (*dev_names_ptr)
- il->add_item(String::utf8(*dev_names_ptr++), NULL, false);
- dev_vbc->add_child(il);
- il->set_fixed_column_width(240 * EDSCALE);
-
- HSeparator *hs = memnew(HSeparator);
- hs->set_modulate(Color(0, 0, 0, 0));
- dev_vbc->add_child(hs);
- }
-
- TextEdit *license = memnew(TextEdit);
- license->set_name(TTR("License"));
- license->set_h_size_flags(Control::SIZE_EXPAND_FILL);
- license->set_v_size_flags(Control::SIZE_EXPAND_FILL);
- license->set_wrap(true);
- license->set_readonly(true);
- license->set_text(String::utf8(about_license));
- tc->add_child(license);
-
- VBoxContainer *license_thirdparty = memnew(VBoxContainer);
- license_thirdparty->set_name(TTR("Thirdparty License"));
- license_thirdparty->set_h_size_flags(Control::SIZE_EXPAND_FILL);
- tc->add_child(license_thirdparty);
-
- Label *tpl_label = memnew(Label);
- tpl_label->set_custom_minimum_size(Size2(0, 64 * EDSCALE));
- tpl_label->set_h_size_flags(Control::SIZE_EXPAND_FILL);
- tpl_label->set_autowrap(true);
- tpl_label->set_text(TTR("Godot Engine relies on a number of thirdparty free and open source libraries, all compatible with the terms of its MIT license. The following is an exhaustive list of all such thirdparty components with their respective copyright statements and license terms."));
- license_thirdparty->add_child(tpl_label);
-
- HSplitContainer *tpl_hbc = memnew(HSplitContainer);
- tpl_hbc->set_h_size_flags(Control::SIZE_EXPAND_FILL);
- tpl_hbc->set_v_size_flags(Control::SIZE_EXPAND_FILL);
- tpl_hbc->set_split_offset(240 * EDSCALE);
- license_thirdparty->add_child(tpl_hbc);
-
- _tpl_tree = memnew(Tree);
- _tpl_tree->set_hide_root(true);
- TreeItem *root = _tpl_tree->create_item();
- TreeItem *tpl_ti_all = _tpl_tree->create_item(root);
- tpl_ti_all->set_text(0, TTR("All Components"));
- TreeItem *tpl_ti_tp = _tpl_tree->create_item(root);
- tpl_ti_tp->set_text(0, TTR("Components"));
- tpl_ti_tp->set_selectable(0, false);
- TreeItem *tpl_ti_lc = _tpl_tree->create_item(root);
- tpl_ti_lc->set_text(0, TTR("Licenses"));
- tpl_ti_lc->set_selectable(0, false);
- int read_idx = 0;
- String long_text = "";
- for (int i = 0; i < THIRDPARTY_COUNT; i++) {
-
- TreeItem *ti = _tpl_tree->create_item(tpl_ti_tp);
- String thirdparty = String(about_thirdparty[i]);
- ti->set_text(0, thirdparty);
- String text = thirdparty + "\n";
- long_text += "- " + thirdparty + "\n\n";
- for (int j = 0; j < about_tp_copyright_count[i]; j++) {
-
- text += "\n Files:\n " + String(about_tp_file[read_idx]).replace("\n", "\n ") + "\n";
- String copyright = String::utf8(" \u00A9 ") + String::utf8(about_tp_copyright[read_idx]).replace("\n", String::utf8("\n \u00A9 "));
- text += copyright;
- long_text += copyright;
- String license = "\n License: " + String(about_tp_license[read_idx]) + "\n";
- text += license;
- long_text += license + "\n";
- read_idx++;
- }
- ti->set_metadata(0, text);
- }
- for (int i = 0; i < LICENSE_COUNT; i++) {
-
- TreeItem *ti = _tpl_tree->create_item(tpl_ti_lc);
- String licensename = String(about_license_name[i]);
- ti->set_text(0, licensename);
- long_text += "- " + licensename + "\n\n";
- String licensebody = String(about_license_body[i]);
- ti->set_metadata(0, licensebody);
- long_text += " " + licensebody.replace("\n", "\n ") + "\n\n";
- }
- tpl_ti_all->set_metadata(0, long_text);
- tpl_hbc->add_child(_tpl_tree);
-
- _tpl_text = memnew(TextEdit);
- _tpl_text->set_h_size_flags(Control::SIZE_EXPAND_FILL);
- _tpl_text->set_v_size_flags(Control::SIZE_EXPAND_FILL);
- _tpl_text->set_wrap(true);
- _tpl_text->set_readonly(true);
- tpl_hbc->add_child(_tpl_text);
-
- _tpl_tree->connect("item_selected", this, "_license_tree_selected");
- tpl_ti_all->select(0);
- _tpl_text->set_text(tpl_ti_all->get_metadata(0));
- }
+ about = memnew(EditorAbout);
+ about->get_logo()->set_texture(gui_base->get_icon("Logo", "EditorIcons"));
+ gui_base->add_child(about);
warning = memnew(AcceptDialog);
gui_base->add_child(warning);
@@ -6242,7 +6079,7 @@ EditorNode::EditorNode() {
add_editor_plugin(memnew(TextureEditorPlugin(this)));
add_editor_plugin(memnew(AudioBusesEditorPlugin(audio_bus_editor)));
//add_editor_plugin( memnew( MaterialEditorPlugin(this) ) );
- //add_editor_plugin( memnew( MeshEditorPlugin(this) ) );
+ add_editor_plugin(memnew(MeshEditorPlugin(this)));
for (int i = 0; i < EditorPlugins::get_plugin_count(); i++)
add_editor_plugin(EditorPlugins::create(i, this));
@@ -6373,6 +6210,8 @@ EditorNode::EditorNode() {
editor_data.set_edited_scene(0);
_update_scene_tabs();
+ import_dock->initialize_import_options();
+
{
_initializing_addons = true;
diff --git a/editor/editor_node.h b/editor/editor_node.h
index e5a4cf654a..6553d3eee2 100644
--- a/editor/editor_node.h
+++ b/editor/editor_node.h
@@ -33,6 +33,7 @@
#include "editor/call_dialog.h"
#include "editor/connections_dialog.h"
#include "editor/create_dialog.h"
+#include "editor/editor_about.h"
#include "editor/editor_data.h"
#include "editor/editor_path.h"
#include "editor/editor_run.h"
@@ -299,7 +300,7 @@ private:
ConfirmationDialog *import_confirmation;
ConfirmationDialog *pick_main_scene;
AcceptDialog *accept;
- AcceptDialog *about;
+ EditorAbout *about;
AcceptDialog *warning;
int overridden_default_layout;
@@ -425,9 +426,6 @@ private:
List<String> previous_scenes;
bool opening_prev;
- Tree *_tpl_tree;
- TextEdit *_tpl_text;
-
void _dialog_action(String p_file);
void _edit_current();
diff --git a/editor/editor_plugin.cpp b/editor/editor_plugin.cpp
index 968be43946..c65065db43 100644
--- a/editor/editor_plugin.cpp
+++ b/editor/editor_plugin.cpp
@@ -175,7 +175,7 @@ Node *EditorPlugin::get_edited_scene_root() {
return EditorNode::get_singleton()->get_edited_scene();
}
-Array EditorPlugin::get_opened_scenes_list() const {
+Array EditorPlugin::get_open_scenes() const {
Array ret;
Vector<EditorData::EditedScene> scenes = EditorNode::get_singleton()->get_editor_data().get_edited_scenes();
@@ -440,7 +440,7 @@ void EditorPlugin::_bind_methods() {
ClassDB::bind_method(D_METHOD("add_import_plugin", "importer:EditorImportPlugin"), &EditorPlugin::add_import_plugin);
ClassDB::bind_method(D_METHOD("remove_import_plugin", "importer:EditorImportPlugin"), &EditorPlugin::remove_import_plugin);
ClassDB::bind_method(D_METHOD("set_input_event_forwarding_always_enabled"), &EditorPlugin::set_input_event_forwarding_always_enabled);
- ClassDB::bind_method(D_METHOD("get_opened_scenes_list"), &EditorPlugin::get_opened_scenes_list);
+ ClassDB::bind_method(D_METHOD("get_open_scenes"), &EditorPlugin::get_open_scenes);
ClassDB::bind_method(D_METHOD("get_edited_scene_root:Node"), &EditorPlugin::get_edited_scene_root);
ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::BOOL, "forward_canvas_gui_input", PropertyInfo(Variant::TRANSFORM2D, "canvas_xform"), PropertyInfo(Variant::OBJECT, "event", PROPERTY_HINT_RESOURCE_TYPE, "InputEvent")));
diff --git a/editor/editor_plugin.h b/editor/editor_plugin.h
index 2c920323a1..a0f64fb1ea 100644
--- a/editor/editor_plugin.h
+++ b/editor/editor_plugin.h
@@ -118,7 +118,7 @@ public:
bool is_input_event_forwarding_always_enabled() { return input_event_forwarding_always_enabled; }
Node *get_edited_scene_root();
- Array get_opened_scenes_list() const;
+ Array get_open_scenes() const;
ScriptEditor *get_script_editor();
void notify_main_screen_changed(const String &screen_name);
diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp
index e653502c0e..755ac75180 100644
--- a/editor/editor_settings.cpp
+++ b/editor/editor_settings.cpp
@@ -30,7 +30,6 @@
#include "editor_settings.h"
#include "editor_node.h"
-#include "project_settings.h"
#include "io/compression.h"
#include "io/config_file.h"
#include "io/file_access_memory.h"
@@ -41,6 +40,7 @@
#include "os/file_access.h"
#include "os/keyboard.h"
#include "os/os.h"
+#include "project_settings.h"
#include "scene/main/node.h"
#include "scene/main/scene_tree.h"
#include "scene/main/viewport.h"
@@ -638,6 +638,10 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
set("editors/3d/warped_mouse_panning", true);
set("editors/3d/freelook_base_speed", 1);
+
+ set("editors/3d/freelook_activation_modifier", 0);
+ hints["editors/3d/freelook_activation_modifier"] = PropertyInfo(Variant::INT, "editors/3d/freelook_activation_modifier", PROPERTY_HINT_ENUM, "None,Shift,Alt,Meta,Ctrl");
+
set("editors/3d/freelook_modifier_speed_factor", 5.0);
set("editors/2d/bone_width", 5);
diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp
index 4e8f7029ff..6b985c7b4b 100644
--- a/editor/editor_themes.cpp
+++ b/editor/editor_themes.cpp
@@ -434,7 +434,8 @@ Ref<Theme> create_editor_theme() {
theme->set_icon("close", "WindowDialog", title_hl_close_icon);
theme->set_icon("close_highlight", "WindowDialog", title_hl_close_icon);
theme->set_constant("close_h_ofs", "WindowDialog", 22 * EDSCALE);
- theme->set_constant("close_v_ofs", "WindowDialog", 18 * EDSCALE);
+ theme->set_constant("close_v_ofs", "WindowDialog", 20 * EDSCALE);
+ theme->set_constant("title_height", "WindowDialog", 24 * EDSCALE);
// HScrollBar
Ref<Texture> empty_icon = memnew(ImageTexture);
diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp
index ae3fdede73..eacb1d2cd9 100644
--- a/editor/filesystem_dock.cpp
+++ b/editor/filesystem_dock.cpp
@@ -153,7 +153,7 @@ void FileSystemDock::_notification(int p_what) {
files->connect("item_activated", this, "_select_file");
button_hist_next->connect("pressed", this, "_fw_history");
button_hist_prev->connect("pressed", this, "_bw_history");
- search_icon->set_texture(get_icon("Search", "EditorIcons"));
+ search_box->add_icon_override("right_icon", get_icon("Search", "EditorIcons"));
button_hist_next->set_icon(get_icon("Forward", "EditorIcons"));
button_hist_prev->set_icon(get_icon("Back", "EditorIcons"));
@@ -1749,10 +1749,6 @@ FileSystemDock::FileSystemDock(EditorNode *p_editor) {
path_hb->add_child(search_box);
search_box->connect("text_changed", this, "_search_changed");
- search_icon = memnew(TextureRect);
- search_icon->set_stretch_mode(TextureRect::STRETCH_KEEP_CENTERED);
- path_hb->add_child(search_icon);
-
button_display_mode = memnew(ToolButton);
path_hb->add_child(button_display_mode);
button_display_mode->set_toggle_mode(true);
diff --git a/editor/import/resource_importer_obj.cpp b/editor/import/resource_importer_obj.cpp
index 9bb598ec92..25548f7899 100644
--- a/editor/import/resource_importer_obj.cpp
+++ b/editor/import/resource_importer_obj.cpp
@@ -395,6 +395,10 @@ Node *EditorOBJImporter::import_scene(const String &p_path, uint32_t p_flags, in
if (!material_map.has(current_material_library)) {
Map<String, Ref<SpatialMaterial> > lib;
Error err = _parse_material_library(current_material_library, lib, r_missing_deps);
+ if (err == ERR_CANT_OPEN) {
+ String dir = p_path.get_base_dir();
+ err = _parse_material_library(dir.plus_file(current_material_library), lib, r_missing_deps);
+ }
if (err == OK) {
material_map[current_material_library] = lib;
}
diff --git a/editor/import/resource_importer_scene.cpp b/editor/import/resource_importer_scene.cpp
index dbf7a1bea5..8f7ca7611a 100644
--- a/editor/import/resource_importer_scene.cpp
+++ b/editor/import/resource_importer_scene.cpp
@@ -104,14 +104,27 @@ bool ResourceImporterScene::get_option_visibility(const String &p_option, const
}
}
+ if (p_option == "materials/keep_files" && int(p_options["materials/storage"]) == 0) {
+ return false;
+ }
+
return true;
}
int ResourceImporterScene::get_preset_count() const {
- return 0;
+ return 6;
}
String ResourceImporterScene::get_preset_name(int p_idx) const {
+ switch (p_idx) {
+ case PRESET_SINGLE_SCENE: return TTR("Import as Single Scene");
+ case PRESET_SEPARATE_MATERIALS: return TTR("Import with Separate Materials");
+ case PRESET_SEPARATE_MESHES: return TTR("Import with Separate Objects");
+ case PRESET_SEPARATE_MESHES_AND_MATERIALS: return TTR("Import with Separate Objects+Materials");
+ case PRESET_MULTIPLE_SCENES: return TTR("Import as Multiple Scenes");
+ case PRESET_MULTIPLE_SCENES_AND_MATERIALS: return TTR("Import as Multiple Scenes+Materials");
+ }
+
return "";
}
@@ -969,7 +982,7 @@ static String _make_extname(const String &p_str) {
return ext_name;
}
-void ResourceImporterScene::_make_external_resources(Node *p_node, const String &p_base_path, bool p_make_materials, bool p_make_meshes, Map<Ref<Material>, Ref<Material> > &p_materials, Map<Ref<ArrayMesh>, Ref<ArrayMesh> > &p_meshes) {
+void ResourceImporterScene::_make_external_resources(Node *p_node, const String &p_base_path, bool p_make_materials, bool p_keep_materials, bool p_make_meshes, Map<Ref<Material>, Ref<Material> > &p_materials, Map<Ref<ArrayMesh>, Ref<ArrayMesh> > &p_meshes) {
List<PropertyInfo> pi;
@@ -984,8 +997,8 @@ void ResourceImporterScene::_make_external_resources(Node *p_node, const String
if (!p_materials.has(mat)) {
- String ext_name = p_base_path + "." + _make_extname(mat->get_name()) + ".material";
- if (FileAccess::exists(ext_name)) {
+ String ext_name = p_base_path.plus_file(_make_extname(mat->get_name()) + ".material");
+ if (p_keep_materials && FileAccess::exists(ext_name)) {
//if exists, use it
Ref<Material> existing = ResourceLoader::load(ext_name);
p_materials[mat] = existing;
@@ -1012,17 +1025,12 @@ void ResourceImporterScene::_make_external_resources(Node *p_node, const String
if (!p_meshes.has(mesh)) {
- String ext_name = p_base_path + "." + _make_extname(mesh->get_name()) + ".mesh";
- if (FileAccess::exists(ext_name)) {
- //if exists, use it
- Ref<ArrayMesh> existing = ResourceLoader::load(ext_name);
- p_meshes[mesh] = existing;
- } else {
+ //meshes are always overwritten, keeping them is not practical
+ String ext_name = p_base_path.plus_file(_make_extname(mesh->get_name()) + ".mesh");
- ResourceSaver::save(ext_name, mesh, ResourceSaver::FLAG_CHANGE_PATH);
- p_meshes[mesh] = mesh;
- mesh_just_added = true;
- }
+ ResourceSaver::save(ext_name, mesh, ResourceSaver::FLAG_CHANGE_PATH);
+ p_meshes[mesh] = mesh;
+ mesh_just_added = true;
}
}
@@ -1067,7 +1075,7 @@ void ResourceImporterScene::_make_external_resources(Node *p_node, const String
for (int i = 0; i < p_node->get_child_count(); i++) {
- _make_external_resources(p_node->get_child(i), p_base_path, p_make_materials, p_make_meshes, p_materials, p_meshes);
+ _make_external_resources(p_node->get_child(i), p_base_path, p_make_materials, p_keep_materials, p_make_meshes, p_materials, p_meshes);
}
}
@@ -1087,12 +1095,19 @@ void ResourceImporterScene::get_import_options(List<ImportOption> *r_options, in
script_ext_hint += "*." + E->get();
}
+ bool materials_out = p_preset == PRESET_SEPARATE_MATERIALS || p_preset == PRESET_SEPARATE_MESHES_AND_MATERIALS || p_preset == PRESET_MULTIPLE_SCENES_AND_MATERIALS;
+ bool meshes_out = p_preset == PRESET_SEPARATE_MESHES || p_preset == PRESET_SEPARATE_MESHES_AND_MATERIALS;
+ bool scenes_out = p_preset == PRESET_MULTIPLE_SCENES || p_preset == PRESET_MULTIPLE_SCENES_AND_MATERIALS;
+
r_options->push_back(ImportOption(PropertyInfo(Variant::STRING, "nodes/custom_script", PROPERTY_HINT_FILE, script_ext_hint), ""));
- r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "materials/location", PROPERTY_HINT_ENUM, "Node,Mesh"), 0));
- r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "materials/storage", PROPERTY_HINT_ENUM, "Bult-In,Files"), 0));
+ r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "nodes/storage", PROPERTY_HINT_ENUM, "Single Scene,Instanced Sub-Scenes"), scenes_out ? 1 : 0));
+ r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "materials/location", PROPERTY_HINT_ENUM, "Node,Mesh"), meshes_out ? 1 : 0));
+ r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "materials/storage", PROPERTY_HINT_ENUM, "Bult-In,Files", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED), materials_out ? 1 : 0));
+ r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "materials/keep_files"), materials_out ? true : false));
r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "geometry/compress"), true));
r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "geometry/ensure_tangents"), true));
- r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "geometry/storage", PROPERTY_HINT_ENUM, "Built-In,Files"), 0));
+ r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "geometry/storage", PROPERTY_HINT_ENUM, "Built-In,Files"), meshes_out ? true : false));
+ r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "external_files/store_in_subdir"), true));
r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "animation/import", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED), true));
r_options->push_back(ImportOption(PropertyInfo(Variant::REAL, "animation/fps", PROPERTY_HINT_RANGE, "1,120,1"), 15));
r_options->push_back(ImportOption(PropertyInfo(Variant::STRING, "animation/filter_script", PROPERTY_HINT_MULTILINE_TEXT), ""));
@@ -1110,6 +1125,18 @@ void ResourceImporterScene::get_import_options(List<ImportOption> *r_options, in
}
}
+void ResourceImporterScene::_replace_owner(Node *p_node, Node *p_scene, Node *p_new_owner) {
+
+ if (p_node != p_new_owner && p_node->get_owner() == p_scene) {
+ p_node->set_owner(p_new_owner);
+ }
+
+ for (int i = 0; i < p_node->get_child_count(); i++) {
+ Node *n = p_node->get_child(i);
+ _replace_owner(n, p_scene, p_new_owner);
+ }
+}
+
Error ResourceImporterScene::import(const String &p_source_file, const String &p_save_path, const Map<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files) {
String src_path = p_source_file;
@@ -1224,11 +1251,30 @@ Error ResourceImporterScene::import(const String &p_source_file, const String &p
bool external_materials = p_options["materials/storage"];
bool external_meshes = p_options["geometry/storage"];
+ bool external_scenes = int(p_options["nodes/storage"]) == 1;
+
+ String base_path = p_source_file.get_base_dir();
+
+ if (external_materials || external_meshes || external_scenes) {
+
+ if (bool(p_options["external_files/store_in_subdir"])) {
+ String subdir_name = p_source_file.get_file().get_basename();
+ DirAccess *da = DirAccess::open(base_path);
+ print_line("at path " + da->get_current_dir() + " making " + subdir_name);
+ Error err = da->make_dir(subdir_name);
+ memdelete(da);
+ ERR_FAIL_COND_V(err != OK && err != ERR_ALREADY_EXISTS, err);
+ base_path = base_path.plus_file(subdir_name);
+ }
+ }
if (external_materials || external_meshes) {
Map<Ref<Material>, Ref<Material> > mat_map;
Map<Ref<ArrayMesh>, Ref<ArrayMesh> > mesh_map;
- _make_external_resources(scene, p_source_file.get_basename(), external_materials, external_meshes, mat_map, mesh_map);
+
+ bool keep_materials = bool(p_options["materials/keep_files"]);
+
+ _make_external_resources(scene, base_path, external_materials, keep_materials, external_meshes, mat_map, mesh_map);
}
progress.step(TTR("Running Custom Script.."), 2);
@@ -1263,10 +1309,33 @@ Error ResourceImporterScene::import(const String &p_source_file, const String &p
progress.step(TTR("Saving.."), 104);
+ if (external_scenes) {
+ //save sub-scenes as instances!
+ for (int i = 0; i < scene->get_child_count(); i++) {
+ Node *child = scene->get_child(i);
+ if (child->get_owner() != scene)
+ continue; //not a real child probably created by scene type (ig, a scrollbar)
+ _replace_owner(child, scene, child);
+
+ String cn = String(child->get_name()).strip_edges().replace(".", "_").replace(":", "_");
+ if (cn == String()) {
+ cn = "ChildNode" + itos(i);
+ }
+ String path = base_path.plus_file(cn + ".scn");
+ child->set_filename(path);
+
+ Ref<PackedScene> packer = memnew(PackedScene);
+ packer->pack(child);
+ err = ResourceSaver::save(path, packer); //do not take over, let the changed files reload themselves
+ ERR_FAIL_COND_V(err != OK, err);
+ }
+ }
+
Ref<PackedScene> packer = memnew(PackedScene);
packer->pack(scene);
print_line("SAVING TO: " + p_save_path + ".scn");
err = ResourceSaver::save(p_save_path + ".scn", packer); //do not take over, let the changed files reload themselves
+ ERR_FAIL_COND_V(err != OK, err);
memdelete(scene);
diff --git a/editor/import/resource_importer_scene.h b/editor/import/resource_importer_scene.h
index ede3028b29..f404582d7e 100644
--- a/editor/import/resource_importer_scene.h
+++ b/editor/import/resource_importer_scene.h
@@ -82,6 +82,17 @@ class ResourceImporterScene : public ResourceImporter {
static ResourceImporterScene *singleton;
+ enum Presets {
+ PRESET_SINGLE_SCENE,
+ PRESET_SEPARATE_MATERIALS,
+ PRESET_SEPARATE_MESHES,
+ PRESET_SEPARATE_MESHES_AND_MATERIALS,
+ PRESET_MULTIPLE_SCENES,
+ PRESET_MULTIPLE_SCENES_AND_MATERIALS,
+ };
+
+ void _replace_owner(Node *p_node, Node *p_scene, Node *p_new_owner);
+
public:
static ResourceImporterScene *get_singleton() { return singleton; }
@@ -101,7 +112,7 @@ public:
virtual void get_import_options(List<ImportOption> *r_options, int p_preset = 0) const;
virtual bool get_option_visibility(const String &p_option, const Map<StringName, Variant> &p_options) const;
- void _make_external_resources(Node *p_node, const String &p_base_path, bool p_make_materials, bool p_make_meshes, Map<Ref<Material>, Ref<Material> > &p_materials, Map<Ref<ArrayMesh>, Ref<ArrayMesh> > &p_meshes);
+ void _make_external_resources(Node *p_node, const String &p_base_path, bool p_make_materials, bool p_keep_materials, bool p_make_meshes, Map<Ref<Material>, Ref<Material> > &p_materials, Map<Ref<ArrayMesh>, Ref<ArrayMesh> > &p_meshes);
Node *_fix_node(Node *p_node, Node *p_root, Map<Ref<ArrayMesh>, Ref<Shape> > &collision_map);
diff --git a/editor/import_dock.cpp b/editor/import_dock.cpp
index 24647734ce..a4f744aa84 100644
--- a/editor/import_dock.cpp
+++ b/editor/import_dock.cpp
@@ -134,6 +134,14 @@ void ImportDock::set_edit_path(const String &p_path) {
}
}
+ preset->get_popup()->add_separator();
+ preset->get_popup()->add_item(vformat(TTR("Set as Default for '%s'"), params->importer->get_visible_name()), ITEM_SET_AS_DEFAULT);
+ if (ProjectSettings::get_singleton()->has("importer_defaults/" + params->importer->get_importer_name())) {
+ preset->get_popup()->add_item(TTR("Load Default"), ITEM_LOAD_DEFAULT);
+ preset->get_popup()->add_separator();
+ preset->get_popup()->add_item(vformat(TTR("Clear Default for '%s'"), params->importer->get_visible_name()), ITEM_CLEAR_DEFAULT);
+ }
+
params->paths.clear();
params->paths.push_back(p_path);
import->set_disabled(false);
@@ -256,17 +264,56 @@ void ImportDock::set_edit_multiple_paths(const Vector<String> &p_paths) {
void ImportDock::_preset_selected(int p_idx) {
- print_line("preset selected? " + p_idx);
- List<ResourceImporter::ImportOption> options;
+ switch (p_idx) {
+ case ITEM_SET_AS_DEFAULT: {
+ List<ResourceImporter::ImportOption> options;
- params->importer->get_import_options(&options, p_idx);
+ params->importer->get_import_options(&options, p_idx);
- for (List<ResourceImporter::ImportOption>::Element *E = options.front(); E; E = E->next()) {
+ Dictionary d;
+ for (List<ResourceImporter::ImportOption>::Element *E = options.front(); E; E = E->next()) {
- params->values[E->get().option.name] = E->get().default_value;
- }
+ d[E->get().option.name] = E->get().default_value;
+ }
- params->update();
+ ProjectSettings::get_singleton()->set("importer_defaults/" + params->importer->get_importer_name(), d);
+ ProjectSettings::get_singleton()->save();
+
+ } break;
+ case ITEM_LOAD_DEFAULT: {
+
+ ERR_FAIL_COND(!ProjectSettings::get_singleton()->has("importer_defaults/" + params->importer->get_importer_name()));
+
+ Dictionary d = ProjectSettings::get_singleton()->get("importer_defaults/" + params->importer->get_importer_name());
+ List<Variant> v;
+ d.get_key_list(&v);
+
+ for (List<Variant>::Element *E = v.front(); E; E = E->next()) {
+ params->values[E->get()] = d[E->get()];
+ }
+ params->update();
+
+ } break;
+ case ITEM_CLEAR_DEFAULT: {
+
+ ProjectSettings::get_singleton()->set("importer_defaults/" + params->importer->get_importer_name(), Variant());
+ ProjectSettings::get_singleton()->save();
+
+ } break;
+ default: {
+
+ List<ResourceImporter::ImportOption> options;
+
+ params->importer->get_import_options(&options, p_idx);
+
+ for (List<ResourceImporter::ImportOption>::Element *E = options.front(); E; E = E->next()) {
+
+ params->values[E->get().option.name] = E->get().default_value;
+ }
+
+ params->update();
+ } break;
+ }
}
void ImportDock::clear() {
@@ -309,6 +356,13 @@ void ImportDock::_bind_methods() {
ClassDB::bind_method(D_METHOD("_preset_selected"), &ImportDock::_preset_selected);
}
+void ImportDock::initialize_import_options() const {
+
+ ERR_FAIL_COND(!import_opts || !params);
+
+ import_opts->edit(params);
+}
+
ImportDock::ImportDock() {
imported = memnew(LineEdit);
@@ -339,7 +393,6 @@ ImportDock::ImportDock() {
hb->add_spacer();
params = memnew(ImportDockParameters);
- import_opts->edit(params);
}
ImportDock::~ImportDock() {
diff --git a/editor/import_dock.h b/editor/import_dock.h
index fc99fcc586..4844fc07ea 100644
--- a/editor/import_dock.h
+++ b/editor/import_dock.h
@@ -57,12 +57,19 @@ class ImportDock : public VBoxContainer {
void _reimport();
+ enum {
+ ITEM_SET_AS_DEFAULT = 100,
+ ITEM_LOAD_DEFAULT,
+ ITEM_CLEAR_DEFAULT,
+ };
+
protected:
static void _bind_methods();
public:
void set_edit_path(const String &p_path);
void set_edit_multiple_paths(const Vector<String> &p_paths);
+ void initialize_import_options() const;
void clear();
ImportDock();
diff --git a/editor/plugins/animation_tree_editor_plugin.cpp b/editor/plugins/animation_tree_editor_plugin.cpp
index 58948071fd..156a74144c 100644
--- a/editor/plugins/animation_tree_editor_plugin.cpp
+++ b/editor/plugins/animation_tree_editor_plugin.cpp
@@ -29,8 +29,8 @@
/*************************************************************************/
#include "animation_tree_editor_plugin.h"
-#include "core/project_settings.h"
#include "core/io/resource_loader.h"
+#include "core/project_settings.h"
#include "os/input.h"
#include "os/keyboard.h"
#include "scene/gui/menu_button.h"
@@ -371,6 +371,7 @@ void AnimationTreeEditor::_popup_edit_dialog() {
edit_label[0]->show();
edit_scroll[0]->set_min(0);
edit_scroll[0]->set_max(1);
+ edit_scroll[0]->set_step(0.01);
edit_scroll[0]->set_value(anim_tree->mix_node_get_amount(edited_node));
edit_scroll[0]->set_begin(Point2(15, 25));
edit_scroll[0]->show();
@@ -383,6 +384,7 @@ void AnimationTreeEditor::_popup_edit_dialog() {
edit_label[0]->show();
edit_scroll[0]->set_min(0);
edit_scroll[0]->set_max(1);
+ edit_scroll[0]->set_step(0.01);
edit_scroll[0]->set_value(anim_tree->blend2_node_get_amount(edited_node));
edit_scroll[0]->set_begin(Point2(15, 25));
edit_scroll[0]->show();
@@ -398,6 +400,7 @@ void AnimationTreeEditor::_popup_edit_dialog() {
edit_label[0]->show();
edit_scroll[0]->set_min(-1);
edit_scroll[0]->set_max(1);
+ edit_scroll[0]->set_step(0.01);
edit_scroll[0]->set_value(anim_tree->blend3_node_get_amount(edited_node));
edit_scroll[0]->set_begin(Point2(15, 25));
edit_scroll[0]->show();
@@ -411,6 +414,7 @@ void AnimationTreeEditor::_popup_edit_dialog() {
edit_label[0]->show();
edit_scroll[0]->set_min(0);
edit_scroll[0]->set_max(1);
+ edit_scroll[0]->set_step(0.01);
edit_scroll[0]->set_value(anim_tree->blend4_node_get_amount(edited_node).x);
edit_scroll[0]->set_begin(Point2(15, 25));
edit_scroll[0]->show();
@@ -419,6 +423,7 @@ void AnimationTreeEditor::_popup_edit_dialog() {
edit_label[1]->show();
edit_scroll[1]->set_min(0);
edit_scroll[1]->set_max(1);
+ edit_scroll[1]->set_step(0.01);
edit_scroll[1]->set_value(anim_tree->blend4_node_get_amount(edited_node).y);
edit_scroll[1]->set_begin(Point2(15, 75));
edit_scroll[1]->show();
diff --git a/editor/plugins/mesh_editor_plugin.cpp b/editor/plugins/mesh_editor_plugin.cpp
index f377d3a7cc..23b19e61b9 100644
--- a/editor/plugins/mesh_editor_plugin.cpp
+++ b/editor/plugins/mesh_editor_plugin.cpp
@@ -29,18 +29,17 @@
/*************************************************************************/
#include "mesh_editor_plugin.h"
-#if 0
-void MeshEditor::_gui_input(InputEvent p_event) {
+void MeshEditor::_gui_input(Ref<InputEvent> p_event) {
+ Ref<InputEventMouseMotion> mm = p_event;
+ if (mm.is_valid() && mm->get_button_mask() & BUTTON_MASK_LEFT) {
- if (p_event.type==InputEvent::MOUSE_MOTION && p_event->get_button_mask()&BUTTON_MASK_LEFT) {
-
- rot_x-=p_event->get_relative().y*0.01;
- rot_y-=p_event->get_relative().x*0.01;
- if (rot_x<-Math_PI/2)
- rot_x=-Math_PI/2;
- else if (rot_x>Math_PI/2) {
- rot_x=Math_PI/2;
+ rot_x -= mm->get_relative().y * 0.01;
+ rot_y -= mm->get_relative().x * 0.01;
+ if (rot_x < -Math_PI / 2)
+ rot_x = -Math_PI / 2;
+ else if (rot_x > Math_PI / 2) {
+ rot_x = Math_PI / 2;
}
_update_rotation();
}
@@ -48,35 +47,30 @@ void MeshEditor::_gui_input(InputEvent p_event) {
void MeshEditor::_notification(int p_what) {
- if (p_what==NOTIFICATION_FIXED_PROCESS) {
-
+ if (p_what == NOTIFICATION_FIXED_PROCESS) {
}
-
- if (p_what==NOTIFICATION_READY) {
+ if (p_what == NOTIFICATION_READY) {
//get_scene()->connect("node_removed",this,"_node_removed");
if (first_enter) {
- //it's in propertyeditor so.. could be moved around
+ //it's in propertyeditor so. could be moved around
- light_1_switch->set_normal_texture(get_icon("MaterialPreviewLight1","EditorIcons"));
- light_1_switch->set_pressed_texture(get_icon("MaterialPreviewLight1Off","EditorIcons"));
- light_2_switch->set_normal_texture(get_icon("MaterialPreviewLight2","EditorIcons"));
- light_2_switch->set_pressed_texture(get_icon("MaterialPreviewLight2Off","EditorIcons"));
- first_enter=false;
+ light_1_switch->set_normal_texture(get_icon("MaterialPreviewLight1", "EditorIcons"));
+ light_1_switch->set_pressed_texture(get_icon("MaterialPreviewLight1Off", "EditorIcons"));
+ light_2_switch->set_normal_texture(get_icon("MaterialPreviewLight2", "EditorIcons"));
+ light_2_switch->set_pressed_texture(get_icon("MaterialPreviewLight2Off", "EditorIcons"));
+ first_enter = false;
}
-
}
- if (p_what==NOTIFICATION_DRAW) {
-
+ if (p_what == NOTIFICATION_DRAW) {
- Ref<Texture> checkerboard = get_icon("Checkerboard","EditorIcons");
+ Ref<Texture> checkerboard = get_icon("Checkerboard", "EditorIcons");
Size2 size = get_size();
- draw_texture_rect(checkerboard,Rect2(Point2(),size),true);
-
+ //draw_texture_rect(checkerboard, Rect2(Point2(), size), true);
}
}
@@ -85,125 +79,115 @@ void MeshEditor::_update_rotation() {
Transform t;
t.basis.rotate(Vector3(0, 1, 0), -rot_y);
t.basis.rotate(Vector3(1, 0, 0), -rot_x);
- mesh_instance->set_transform(t);
-
+ rotation->set_transform(t);
}
void MeshEditor::edit(Ref<Mesh> p_mesh) {
- mesh=p_mesh;
+ mesh = p_mesh;
mesh_instance->set_mesh(mesh);
if (mesh.is_null()) {
hide();
} else {
- rot_x=0;
- rot_y=0;
+ rot_x = 0;
+ rot_y = 0;
_update_rotation();
- AABB aabb= mesh->get_aabb();
- Vector3 ofs = aabb.pos + aabb.size*0.5;
- aabb.pos-=ofs;
- float m = MAX(aabb.size.x,aabb.size.y)*0.5;
- if (m!=0) {
- m=1.0/m;
- m*=0.5;
+ Rect3 aabb = mesh->get_aabb();
+ print_line("aabb: " + aabb);
+ Vector3 ofs = aabb.position + aabb.size * 0.5;
+ float m = aabb.get_longest_axis_size();
+ if (m != 0) {
+ m = 1.0 / m;
+ m *= 0.5;
//print_line("scale: "+rtos(m));
Transform xform;
- xform.basis.scale(Vector3(m,m,m));
- xform.origin=-xform.basis.xform(ofs); //-ofs*m;
- xform.origin.z-=aabb.size.z*2;
+ xform.basis.scale(Vector3(m, m, m));
+ xform.origin = -xform.basis.xform(ofs); //-ofs*m;
+ //xform.origin.z -= aabb.get_longest_axis_size() * 2;
mesh_instance->set_transform(xform);
}
-
}
-
}
+void MeshEditor::_button_pressed(Node *p_button) {
-void MeshEditor::_button_pressed(Node* p_button) {
-
- if (p_button==light_1_switch) {
- light1->set_enabled(!light_1_switch->is_pressed());
+ if (p_button == light_1_switch) {
+ light1->set_visible(!light_1_switch->is_pressed());
}
- if (p_button==light_2_switch) {
- light2->set_enabled(!light_2_switch->is_pressed());
+ if (p_button == light_2_switch) {
+ light2->set_visible(!light_2_switch->is_pressed());
}
-
-
}
void MeshEditor::_bind_methods() {
- ClassDB::bind_method(D_METHOD("_gui_input"),&MeshEditor::_gui_input);
- ClassDB::bind_method(D_METHOD("_button_pressed"),&MeshEditor::_button_pressed);
-
+ ClassDB::bind_method(D_METHOD("_gui_input"), &MeshEditor::_gui_input);
+ ClassDB::bind_method(D_METHOD("_button_pressed"), &MeshEditor::_button_pressed);
}
MeshEditor::MeshEditor() {
- viewport = memnew( Viewport );
+ viewport = memnew(Viewport);
Ref<World> world;
world.instance();
viewport->set_world(world); //use own world
add_child(viewport);
viewport->set_disable_input(true);
+ set_stretch(true);
- camera = memnew( Camera );
- camera->set_transform(Transform(Matrix3(),Vector3(0,0,3)));
- camera->set_perspective(45,0.1,10);
+ camera = memnew(Camera);
+ camera->set_transform(Transform(Basis(), Vector3(0, 0, 1.1)));
+ camera->set_perspective(45, 0.1, 10);
viewport->add_child(camera);
- light1 = memnew( DirectionalLight );
- light1->set_transform(Transform().looking_at(Vector3(-1,-1,-1),Vector3(0,1,0)));
+ light1 = memnew(DirectionalLight);
+ light1->set_transform(Transform().looking_at(Vector3(-1, -1, -1), Vector3(0, 1, 0)));
viewport->add_child(light1);
- light2 = memnew( DirectionalLight );
- light2->set_transform(Transform().looking_at(Vector3(0,1,0),Vector3(0,0,1)));
- light2->set_color(Light::COLOR_DIFFUSE,Color(0.7,0.7,0.7));
- light2->set_color(Light::COLOR_SPECULAR,Color(0.7,0.7,0.7));
+ light2 = memnew(DirectionalLight);
+ light2->set_transform(Transform().looking_at(Vector3(0, 1, 0), Vector3(0, 0, 1)));
+ light2->set_color(Color(0.7, 0.7, 0.7));
viewport->add_child(light2);
- mesh_instance = memnew( MeshInstance );
- viewport->add_child(mesh_instance);
-
-
+ rotation = memnew(Spatial);
+ viewport->add_child(rotation);
+ mesh_instance = memnew(MeshInstance);
+ rotation->add_child(mesh_instance);
- set_custom_minimum_size(Size2(1,150)*EDSCALE);
+ set_custom_minimum_size(Size2(1, 150) * EDSCALE);
- HBoxContainer *hb = memnew( HBoxContainer );
+ HBoxContainer *hb = memnew(HBoxContainer);
add_child(hb);
hb->set_area_as_parent_rect(2);
hb->add_spacer();
- VBoxContainer *vb_light = memnew( VBoxContainer );
+ VBoxContainer *vb_light = memnew(VBoxContainer);
hb->add_child(vb_light);
- light_1_switch = memnew( TextureButton );
+ light_1_switch = memnew(TextureButton);
light_1_switch->set_toggle_mode(true);
vb_light->add_child(light_1_switch);
- light_1_switch->connect("pressed",this,"_button_pressed",varray(light_1_switch));
+ light_1_switch->connect("pressed", this, "_button_pressed", varray(light_1_switch));
- light_2_switch = memnew( TextureButton );
+ light_2_switch = memnew(TextureButton);
light_2_switch->set_toggle_mode(true);
vb_light->add_child(light_2_switch);
- light_2_switch->connect("pressed",this,"_button_pressed",varray(light_2_switch));
-
- first_enter=true;
-
- rot_x=0;
- rot_y=0;
+ light_2_switch->connect("pressed", this, "_button_pressed", varray(light_2_switch));
+ first_enter = true;
+ rot_x = 0;
+ rot_y = 0;
}
-
void MeshEditorPlugin::edit(Object *p_object) {
- Mesh * s = p_object->cast_to<Mesh>();
+ Mesh *s = p_object->cast_to<Mesh>();
if (!s)
return;
@@ -212,7 +196,7 @@ void MeshEditorPlugin::edit(Object *p_object) {
bool MeshEditorPlugin::handles(Object *p_object) const {
- return p_object->is_type("Mesh");
+ return p_object->is_class("Mesh");
}
void MeshEditorPlugin::make_visible(bool p_visible) {
@@ -225,22 +209,15 @@ void MeshEditorPlugin::make_visible(bool p_visible) {
mesh_editor->hide();
//mesh_editor->set_process(false);
}
-
}
MeshEditorPlugin::MeshEditorPlugin(EditorNode *p_node) {
- editor=p_node;
- mesh_editor = memnew( MeshEditor );
- add_control_to_container(CONTAINER_PROPERTY_EDITOR_BOTTOM,mesh_editor);
+ editor = p_node;
+ mesh_editor = memnew(MeshEditor);
+ add_control_to_container(CONTAINER_PROPERTY_EDITOR_BOTTOM, mesh_editor);
mesh_editor->hide();
-
-
-
}
-
-MeshEditorPlugin::~MeshEditorPlugin()
-{
+MeshEditorPlugin::~MeshEditorPlugin() {
}
-#endif
diff --git a/editor/plugins/mesh_editor_plugin.h b/editor/plugins/mesh_editor_plugin.h
index 1d89448ed8..72d93c4126 100644
--- a/editor/plugins/mesh_editor_plugin.h
+++ b/editor/plugins/mesh_editor_plugin.h
@@ -30,8 +30,6 @@
#ifndef MESH_EDITOR_PLUGIN_H
#define MESH_EDITOR_PLUGIN_H
-#if 0
-
#include "editor/editor_node.h"
#include "editor/editor_plugin.h"
#include "scene/3d/camera.h"
@@ -39,51 +37,48 @@
#include "scene/3d/mesh_instance.h"
#include "scene/resources/material.h"
-class MeshEditor : public Control {
-
- GDCLASS(MeshEditor, Control);
-
+class MeshEditor : public ViewportContainer {
+ GDCLASS(MeshEditor, ViewportContainer);
float rot_x;
float rot_y;
Viewport *viewport;
MeshInstance *mesh_instance;
+ Spatial *rotation;
DirectionalLight *light1;
DirectionalLight *light2;
Camera *camera;
Ref<Mesh> mesh;
-
TextureButton *light_1_switch;
TextureButton *light_2_switch;
- void _button_pressed(Node* p_button);
+ void _button_pressed(Node *p_button);
bool first_enter;
void _update_rotation();
+
protected:
void _notification(int p_what);
- void _gui_input(InputEvent p_event);
+ void _gui_input(Ref<InputEvent> p_event);
static void _bind_methods();
-public:
+public:
void edit(Ref<Mesh> p_mesh);
MeshEditor();
};
-
class MeshEditorPlugin : public EditorPlugin {
- GDCLASS( MeshEditorPlugin, EditorPlugin );
+ GDCLASS(MeshEditorPlugin, EditorPlugin);
MeshEditor *mesh_editor;
EditorNode *editor;
public:
-
virtual String get_name() const { return "Mesh"; }
bool has_main_screen() const { return false; }
virtual void edit(Object *p_node);
@@ -92,8 +87,6 @@ public:
MeshEditorPlugin(EditorNode *p_node);
~MeshEditorPlugin();
-
};
-#endif // MESH_EDITOR_PLUGIN_H
#endif
diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp
index aeb16f13ee..fef7f07abb 100644
--- a/editor/plugins/script_editor_plugin.cpp
+++ b/editor/plugins/script_editor_plugin.cpp
@@ -32,13 +32,13 @@
#include "editor/editor_node.h"
#include "editor/editor_settings.h"
#include "editor/script_editor_debugger.h"
-#include "project_settings.h"
#include "io/resource_loader.h"
#include "io/resource_saver.h"
#include "os/file_access.h"
#include "os/input.h"
#include "os/keyboard.h"
#include "os/os.h"
+#include "project_settings.h"
#include "scene/main/viewport.h"
/*** SCRIPT EDITOR ****/
@@ -518,6 +518,9 @@ void ScriptEditor::_close_tab(int p_idx, bool p_save) {
_add_recent_script(help->get_class());
}
+ // roll back to previous tab
+ _history_back();
+
//remove from history
history.resize(history_pos + 1);
@@ -793,10 +796,10 @@ Ref<Script> ScriptEditor::_get_current_script() {
}
}
-Array ScriptEditor::_get_opened_script_list() const {
+Array ScriptEditor::_get_open_scripts() const {
Array ret;
- Vector<Ref<Script> > scripts = get_opened_scripts();
+ Vector<Ref<Script> > scripts = get_open_scripts();
int scrits_amount = scripts.size();
for (int idx_script = 0; idx_script < scrits_amount; idx_script++) {
ret.push_back(scripts[idx_script]);
@@ -1159,7 +1162,7 @@ void ScriptEditor::notify_script_close(const Ref<Script> &p_script) {
}
void ScriptEditor::notify_script_changed(const Ref<Script> &p_script) {
- emit_signal("script_changed", p_script);
+ emit_signal("editor_script_changed", p_script);
}
static const Node *_find_node_with_script(const Node *p_node, const RefPtr &p_script) {
@@ -1316,7 +1319,8 @@ void ScriptEditor::ensure_focus_current() {
int cidx = tab_container->get_current_tab();
if (cidx < 0 || cidx >= tab_container->get_tab_count())
- ;
+ return;
+
Control *c = tab_container->get_child(cidx)->cast_to<Control>();
if (!c)
return;
@@ -1406,6 +1410,11 @@ struct _ScriptEditorItemData {
};
void ScriptEditor::_update_members_overview_visibility() {
+
+ int selected = tab_container->get_current_tab();
+ if (selected < 0 || selected >= tab_container->get_child_count())
+ return;
+
Node *current = tab_container->get_child(tab_container->get_current_tab());
ScriptEditorBase *se = current->cast_to<ScriptEditorBase>();
if (!se) {
@@ -1423,6 +1432,10 @@ void ScriptEditor::_update_members_overview_visibility() {
void ScriptEditor::_update_members_overview() {
members_overview->clear();
+ int selected = tab_container->get_current_tab();
+ if (selected < 0 || selected >= tab_container->get_child_count())
+ return;
+
Node *current = tab_container->get_child(tab_container->get_current_tab());
ScriptEditorBase *se = current->cast_to<ScriptEditorBase>();
if (!se) {
@@ -2104,7 +2117,7 @@ void ScriptEditor::_history_back() {
}
}
-Vector<Ref<Script> > ScriptEditor::get_opened_scripts() const {
+Vector<Ref<Script> > ScriptEditor::get_open_scripts() const {
Vector<Ref<Script> > out_scripts = Vector<Ref<Script> >();
@@ -2213,9 +2226,9 @@ void ScriptEditor::_bind_methods() {
ClassDB::bind_method("_unhandled_input", &ScriptEditor::_unhandled_input);
ClassDB::bind_method(D_METHOD("get_current_script"), &ScriptEditor::_get_current_script);
- ClassDB::bind_method(D_METHOD("get_opened_scripts_list"), &ScriptEditor::_get_opened_script_list);
+ ClassDB::bind_method(D_METHOD("get_open_scripts"), &ScriptEditor::_get_open_scripts);
- ADD_SIGNAL(MethodInfo("script_changed", PropertyInfo(Variant::OBJECT, "script:Script")));
+ ADD_SIGNAL(MethodInfo("editor_script_changed", PropertyInfo(Variant::OBJECT, "script:Script")));
ADD_SIGNAL(MethodInfo("script_close", PropertyInfo(Variant::STRING, "script:String")));
}
diff --git a/editor/plugins/script_editor_plugin.h b/editor/plugins/script_editor_plugin.h
index 3d03eb0f49..d8a9415df1 100644
--- a/editor/plugins/script_editor_plugin.h
+++ b/editor/plugins/script_editor_plugin.h
@@ -322,7 +322,7 @@ class ScriptEditor : public PanelContainer {
void _file_dialog_action(String p_file);
Ref<Script> _get_current_script();
- Array _get_opened_script_list() const;
+ Array _get_open_scripts() const;
static void _open_script_request(const String &p_path);
@@ -357,7 +357,7 @@ public:
void get_window_layout(Ref<ConfigFile> p_layout);
void set_scene_root_script(Ref<Script> p_script);
- Vector<Ref<Script> > get_opened_scripts() const;
+ Vector<Ref<Script> > get_open_scripts() const;
bool script_goto_method(Ref<Script> p_script, const String &p_method);
diff --git a/editor/plugins/spatial_editor_plugin.cpp b/editor/plugins/spatial_editor_plugin.cpp
index 8e6e92d48b..ef7ed5f7f6 100644
--- a/editor/plugins/spatial_editor_plugin.cpp
+++ b/editor/plugins/spatial_editor_plugin.cpp
@@ -36,9 +36,9 @@
#include "editor/editor_settings.h"
#include "editor/plugins/animation_player_editor_plugin.h"
#include "editor/spatial_editor_gizmos.h"
-#include "project_settings.h"
#include "os/keyboard.h"
#include "print_string.h"
+#include "project_settings.h"
#include "scene/3d/camera.h"
#include "scene/3d/visual_instance.h"
#include "scene/resources/surface_tool.h"
@@ -518,7 +518,7 @@ void SpatialEditorViewport::_compute_edit(const Point2 &p_point) {
*/
}
-static int _get_key_modifier(const String &p_property) {
+static int _get_key_modifier_setting(const String &p_property) {
switch (EditorSettings::get_singleton()->get(p_property).operator int()) {
@@ -531,6 +531,18 @@ static int _get_key_modifier(const String &p_property) {
return 0;
}
+static int _get_key_modifier(Ref<InputEventWithModifiers> e) {
+ if (e->get_shift())
+ return KEY_SHIFT;
+ if (e->get_alt())
+ return KEY_ALT;
+ if (e->get_control())
+ return KEY_CONTROL;
+ if (e->get_metakey())
+ return KEY_META;
+ return 0;
+}
+
bool SpatialEditorViewport::_gizmo_select(const Vector2 &p_screenpos, bool p_highlight_only) {
if (!spatial_editor->is_gizmo_visible())
@@ -774,7 +786,15 @@ void SpatialEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
set_message(TTR("Transform Aborted."), 3);
}
- freelook_active = b->is_pressed();
+ if (b->is_pressed()) {
+ int mod = _get_key_modifier(b);
+ if (mod == _get_key_modifier_setting("editors/3d/freelook_activation_modifier")) {
+ freelook_active = true;
+ }
+ } else {
+ freelook_active = false;
+ }
+
if (freelook_active && !surface->has_focus()) {
// Focus usually doesn't trigger on right-click, but in case of freelook it should,
// otherwise using keyboard navigation would misbehave
@@ -1297,7 +1317,7 @@ void SpatialEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
if (nav_scheme == NAVIGATION_MAYA && m->get_alt()) {
nav_mode = NAVIGATION_ZOOM;
- } else {
+ } else if (freelook_active) {
nav_mode = NAVIGATION_LOOK;
}
@@ -1305,21 +1325,13 @@ void SpatialEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
if (nav_scheme == NAVIGATION_GODOT) {
- int mod = 0;
- if (m->get_shift())
- mod = KEY_SHIFT;
- if (m->get_alt())
- mod = KEY_ALT;
- if (m->get_control())
- mod = KEY_CONTROL;
- if (m->get_metakey())
- mod = KEY_META;
+ int mod = _get_key_modifier(m);
- if (mod == _get_key_modifier("editors/3d/pan_modifier"))
+ if (mod == _get_key_modifier_setting("editors/3d/pan_modifier"))
nav_mode = NAVIGATION_PAN;
- else if (mod == _get_key_modifier("editors/3d/zoom_modifier"))
+ else if (mod == _get_key_modifier_setting("editors/3d/zoom_modifier"))
nav_mode = NAVIGATION_ZOOM;
- else if (mod == _get_key_modifier("editors/3d/orbit_modifier"))
+ else if (mod == _get_key_modifier_setting("editors/3d/orbit_modifier"))
nav_mode = NAVIGATION_ORBIT;
} else if (nav_scheme == NAVIGATION_MAYA) {
@@ -1329,22 +1341,14 @@ void SpatialEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
} else if (EditorSettings::get_singleton()->get("editors/3d/emulate_3_button_mouse")) {
// Handle trackpad (no external mouse) use case
- int mod = 0;
- if (m->get_shift())
- mod = KEY_SHIFT;
- if (m->get_alt())
- mod = KEY_ALT;
- if (m->get_control())
- mod = KEY_CONTROL;
- if (m->get_metakey())
- mod = KEY_META;
+ int mod = _get_key_modifier(m);
if (mod) {
- if (mod == _get_key_modifier("editors/3d/pan_modifier"))
+ if (mod == _get_key_modifier_setting("editors/3d/pan_modifier"))
nav_mode = NAVIGATION_PAN;
- else if (mod == _get_key_modifier("editors/3d/zoom_modifier"))
+ else if (mod == _get_key_modifier_setting("editors/3d/zoom_modifier"))
nav_mode = NAVIGATION_ZOOM;
- else if (mod == _get_key_modifier("editors/3d/orbit_modifier"))
+ else if (mod == _get_key_modifier_setting("editors/3d/orbit_modifier"))
nav_mode = NAVIGATION_ORBIT;
}
}
diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp
index e3f22c833e..acf5fe02cc 100644
--- a/editor/project_manager.cpp
+++ b/editor/project_manager.cpp
@@ -202,10 +202,10 @@ private:
f->store_line("\n");
f->store_line("[application]");
f->store_line("\n");
- f->store_line("name=\"" + project_name->get_text() + "\"");
- f->store_line("icon=\"res://icon.png\"");
+ f->store_line("config/name=\"" + project_name->get_text() + "\"");
+ f->store_line("config/icon=\"res://icon.png\"");
f->store_line("[rendering]");
- f->store_line("viewport/default_environment=\"res://default_env.tres\"");
+ f->store_line("environment/default_environment=\"res://default_env.tres\"");
memdelete(f);
ResourceSaver::save(dir.plus_file("/icon.png"), get_icon("DefaultProjectIcon", "EditorIcons"));
@@ -811,16 +811,16 @@ void ProjectManager::_load_recent_projects() {
String project_name = TTR("Unnamed Project");
- if (cf->has_section_key("application", "name")) {
- project_name = static_cast<String>(cf->get_value("application", "name")).xml_unescape();
+ if (cf->has_section_key("application", "config/name")) {
+ project_name = static_cast<String>(cf->get_value("application", "config/name")).xml_unescape();
}
if (filter_option == ProjectListFilter::FILTER_NAME && search_term != "" && project_name.findn(search_term) == -1)
continue;
Ref<Texture> icon;
- if (cf->has_section_key("application", "icon")) {
- String appicon = cf->get_value("application", "icon");
+ if (cf->has_section_key("application", "config/icon")) {
+ String appicon = cf->get_value("application", "config/icon");
if (appicon != "") {
Ref<Image> img;
img.instance();
@@ -840,8 +840,8 @@ void ProjectManager::_load_recent_projects() {
}
String main_scene;
- if (cf->has_section_key("application", "main_scene")) {
- main_scene = cf->get_value("application", "main_scene");
+ if (cf->has_section_key("application", "run/main_scene")) {
+ main_scene = cf->get_value("application", "run/main_scene");
}
selected_list_copy.erase(project);
diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp
index a9e998e76a..57ab931827 100644
--- a/editor/scene_tree_dock.cpp
+++ b/editor/scene_tree_dock.cpp
@@ -786,7 +786,7 @@ void SceneTreeDock::_notification(int p_what) {
button_create_script->set_icon(get_icon("ScriptCreate", "EditorIcons"));
button_clear_script->set_icon(get_icon("ScriptRemove", "EditorIcons"));
- filter_icon->set_texture(get_icon("Search", "EditorIcons"));
+ filter->add_icon_override("right_icon", get_icon("Search", "EditorIcons"));
EditorNode::get_singleton()->get_editor_selection()->connect("selection_changed", this, "_selection_changed");
@@ -2021,11 +2021,8 @@ SceneTreeDock::SceneTreeDock(EditorNode *p_editor, Node *p_scene_root, EditorSel
vbc->add_child(filter_hbc);
filter = memnew(LineEdit);
filter->set_h_size_flags(SIZE_EXPAND_FILL);
+ filter->set_placeholder(TTR("Filter nodes"));
filter_hbc->add_child(filter);
- filter_icon = memnew(TextureRect);
- filter_icon->set_custom_minimum_size(Size2(24 * EDSCALE, 0));
- filter_hbc->add_child(filter_icon);
- filter_icon->set_stretch_mode(TextureRect::STRETCH_KEEP_CENTERED);
filter->connect("text_changed", this, "_filter_changed");
tb = memnew(ToolButton);