summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
Diffstat (limited to 'editor')
-rw-r--r--editor/animation_editor.cpp4
-rw-r--r--editor/create_dialog.cpp4
-rw-r--r--editor/doc/doc_data.cpp8
-rw-r--r--editor/editor_autoload_settings.cpp29
-rw-r--r--editor/editor_autoload_settings.h3
-rw-r--r--editor/editor_help.cpp203
-rw-r--r--editor/editor_help.h25
-rw-r--r--editor/editor_node.cpp59
-rw-r--r--editor/editor_plugin.cpp48
-rw-r--r--editor/editor_plugin.h1
-rw-r--r--editor/editor_plugin_settings.cpp2
-rw-r--r--editor/editor_resource_preview.cpp1
-rw-r--r--editor/editor_settings.cpp58
-rw-r--r--editor/editor_settings.h1
-rw-r--r--editor/filesystem_dock.cpp26
-rw-r--r--editor/filesystem_dock.h2
-rw-r--r--editor/import/editor_import_plugin.cpp16
-rw-r--r--editor/import/editor_import_plugin.h2
-rw-r--r--editor/plugins/asset_library_editor_plugin.cpp12
-rw-r--r--editor/plugins/canvas_item_editor_plugin.cpp11
-rw-r--r--editor/plugins/canvas_item_editor_plugin.h1
-rw-r--r--editor/plugins/editor_preview_plugins.cpp68
-rw-r--r--editor/plugins/resource_preloader_editor_plugin.cpp29
-rw-r--r--editor/plugins/resource_preloader_editor_plugin.h5
-rw-r--r--editor/plugins/script_editor_plugin.cpp130
-rw-r--r--editor/plugins/script_editor_plugin.h5
-rw-r--r--editor/plugins/script_text_editor.cpp26
-rw-r--r--editor/plugins/spatial_editor_plugin.cpp8
-rw-r--r--editor/plugins/spatial_editor_plugin.h1
-rw-r--r--editor/plugins/sprite_frames_editor_plugin.cpp2
-rw-r--r--editor/plugins/texture_editor_plugin.cpp3
-rw-r--r--editor/plugins/tile_set_editor_plugin.cpp5
-rw-r--r--editor/project_settings_editor.cpp2
-rw-r--r--editor/project_settings_editor.h2
-rw-r--r--editor/property_editor.cpp32
-rw-r--r--editor/scene_tree_dock.cpp3
-rw-r--r--editor/scene_tree_editor.cpp51
-rw-r--r--editor/scene_tree_editor.h3
-rw-r--r--editor/script_create_dialog.cpp33
-rw-r--r--editor/script_create_dialog.h2
-rw-r--r--editor/script_editor_debugger.cpp20
-rw-r--r--editor/script_editor_debugger.h3
-rw-r--r--editor/spatial_editor_gizmos.cpp14
43 files changed, 635 insertions, 328 deletions
diff --git a/editor/animation_editor.cpp b/editor/animation_editor.cpp
index 91aa189c8f..c064f9cbdf 100644
--- a/editor/animation_editor.cpp
+++ b/editor/animation_editor.cpp
@@ -1359,7 +1359,7 @@ void AnimationKeyEditor::_track_editor_draw() {
Color ncol = color;
if (n && editor_selection->is_selected(n))
ncol = track_select_color;
- te->draw_string(font, Point2(ofs + Point2(left_check_ofs + sep + type_icon[0]->get_width() + sep, y + font->get_ascent() + (sep / 2))).floor(), np, ncol, name_limit - (type_icon[0]->get_width() + sep) - 5);
+ te->draw_string(font, Point2(ofs + Point2(left_check_ofs + sep + type_icon[0]->get_width() + sep, y + font->get_ascent() + (sep / 2))).floor(), np, ncol, name_limit - (left_check_ofs + sep) - (type_icon[0]->get_width() + sep) - 5);
// Draw separator line below track area
if (!obj)
@@ -3362,7 +3362,7 @@ int AnimationKeyEditor::_confirm_insert(InsertData p_id, int p_last_track) {
//wants a new tack
{
- //shitty hack
+ //hack
NodePath np;
animation->add_track(p_id.type);
animation->track_set_path(animation->get_track_count() - 1, p_id.path);
diff --git a/editor/create_dialog.cpp b/editor/create_dialog.cpp
index 48ceb82dc3..fdc58e6292 100644
--- a/editor/create_dialog.cpp
+++ b/editor/create_dialog.cpp
@@ -316,6 +316,10 @@ void CreateDialog::_update_search() {
}
}
+ if (search_box->get_text() == "") {
+ to_select = root;
+ }
+
if (to_select) {
to_select->select(0);
search_options->scroll_to_item(to_select);
diff --git a/editor/doc/doc_data.cpp b/editor/doc/doc_data.cpp
index 58eaab78ed..3a418e5f33 100644
--- a/editor/doc/doc_data.cpp
+++ b/editor/doc/doc_data.cpp
@@ -611,6 +611,14 @@ void DocData::generate(bool p_basic_types) {
ArgumentDoc ad;
argument_doc_from_arginfo(ad, mi.arguments[i]);
+
+ int darg_idx = i - (mi.arguments.size() - mi.default_arguments.size());
+
+ if (darg_idx >= 0) {
+ Variant default_arg = E->get().default_arguments[darg_idx];
+ ad.default_value = default_arg.get_construct_string();
+ }
+
md.arguments.push_back(ad);
}
diff --git a/editor/editor_autoload_settings.cpp b/editor/editor_autoload_settings.cpp
index 393c33c1b0..d3e697ac35 100644
--- a/editor/editor_autoload_settings.cpp
+++ b/editor/editor_autoload_settings.cpp
@@ -246,7 +246,9 @@ void EditorAutoloadSettings::_autoload_button_pressed(Object *p_item, int p_colu
UndoRedo *undo_redo = EditorNode::get_undo_redo();
switch (p_button) {
-
+ case BUTTON_OPEN: {
+ _autoload_open(ti->get_text(1));
+ } break;
case BUTTON_MOVE_UP:
case BUTTON_MOVE_DOWN: {
@@ -305,6 +307,21 @@ void EditorAutoloadSettings::_autoload_button_pressed(Object *p_item, int p_colu
}
}
+void EditorAutoloadSettings::_autoload_activated() {
+ TreeItem *ti = tree->get_selected();
+ if (!ti)
+ return;
+ _autoload_open(ti->get_text(1));
+}
+
+void EditorAutoloadSettings::_autoload_open(const String &fpath) {
+ if (ResourceLoader::get_resource_type(fpath) == "PackedScene") {
+ EditorNode::get_singleton()->open_request(fpath);
+ } else {
+ EditorNode::get_singleton()->load_resource(fpath);
+ }
+ ProjectSettingsEditor::get_singleton()->hide();
+}
void EditorAutoloadSettings::_autoload_file_callback(const String &p_path) {
autoload_add_name->set_text(p_path.get_file().get_basename());
@@ -356,13 +373,13 @@ void EditorAutoloadSettings::update_autoload() {
item->set_editable(0, true);
item->set_text(1, path);
- item->set_selectable(1, false);
+ item->set_selectable(1, true);
item->set_cell_mode(2, TreeItem::CELL_MODE_CHECK);
item->set_editable(2, true);
item->set_text(2, TTR("Enable"));
item->set_checked(2, global);
-
+ item->add_button(3, get_icon("FileList", "EditorIcons"), BUTTON_OPEN);
item->add_button(3, get_icon("MoveUp", "EditorIcons"), BUTTON_MOVE_UP);
item->add_button(3, get_icon("MoveDown", "EditorIcons"), BUTTON_MOVE_DOWN);
item->add_button(3, get_icon("Remove", "EditorIcons"), BUTTON_DELETE);
@@ -529,6 +546,8 @@ void EditorAutoloadSettings::_bind_methods() {
ClassDB::bind_method("_autoload_edited", &EditorAutoloadSettings::_autoload_edited);
ClassDB::bind_method("_autoload_button_pressed", &EditorAutoloadSettings::_autoload_button_pressed);
ClassDB::bind_method("_autoload_file_callback", &EditorAutoloadSettings::_autoload_file_callback);
+ ClassDB::bind_method("_autoload_activated", &EditorAutoloadSettings::_autoload_activated);
+ ClassDB::bind_method("_autoload_open", &EditorAutoloadSettings::_autoload_open);
ClassDB::bind_method("get_drag_data_fw", &EditorAutoloadSettings::get_drag_data_fw);
ClassDB::bind_method("can_drop_data_fw", &EditorAutoloadSettings::can_drop_data_fw);
@@ -595,12 +614,12 @@ EditorAutoloadSettings::EditorAutoloadSettings() {
tree->set_column_min_width(2, 80);
tree->set_column_expand(3, false);
- tree->set_column_min_width(3, 80);
+ tree->set_column_min_width(3, 120);
tree->connect("cell_selected", this, "_autoload_selected");
tree->connect("item_edited", this, "_autoload_edited");
tree->connect("button_pressed", this, "_autoload_button_pressed");
-
+ tree->connect("item_activated", this, "_autoload_activated");
tree->set_v_size_flags(SIZE_EXPAND_FILL);
add_child(tree, true);
diff --git a/editor/editor_autoload_settings.h b/editor/editor_autoload_settings.h
index 39f902179c..2e34a8b17f 100644
--- a/editor/editor_autoload_settings.h
+++ b/editor/editor_autoload_settings.h
@@ -40,6 +40,7 @@ class EditorAutoloadSettings : public VBoxContainer {
GDCLASS(EditorAutoloadSettings, VBoxContainer);
enum {
+ BUTTON_OPEN,
BUTTON_MOVE_UP,
BUTTON_MOVE_DOWN,
BUTTON_DELETE
@@ -72,6 +73,8 @@ class EditorAutoloadSettings : public VBoxContainer {
void _autoload_selected();
void _autoload_edited();
void _autoload_button_pressed(Object *p_item, int p_column, int p_button);
+ void _autoload_activated();
+ void _autoload_open(const String &fpath);
void _autoload_file_callback(const String &p_path);
Variant get_drag_data_fw(const Point2 &p_point, Control *p_control);
diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp
index 198a52fef2..7f76cf1af2 100644
--- a/editor/editor_help.cpp
+++ b/editor/editor_help.cpp
@@ -81,162 +81,147 @@ void EditorHelpSearch::_sbox_input(const Ref<InputEvent> &p_ie) {
}
}
-class EditorHelpSearch::IncrementalSearch : public Reference {
- String term;
- TreeItem *root;
+void EditorHelpSearch::IncrementalSearch::phase1(Map<String, DocData::ClassDoc>::Element *E) {
- EditorHelpSearch *search;
- Tree *search_options;
+ if (E->key().findn(term) != -1) {
- DocData *doc;
- Ref<Texture> def_icon;
-
- int phase;
- Map<String, DocData::ClassDoc>::Element *iterator;
-
- void phase1(Map<String, DocData::ClassDoc>::Element *E) {
-
- if (E->key().findn(term) != -1) {
-
- TreeItem *item = search_options->create_item(root);
- item->set_metadata(0, "class_name:" + E->key());
- item->set_text(0, E->key() + " (Class)");
- if (search->has_icon(E->key(), "EditorIcons"))
- item->set_icon(0, search->get_icon(E->key(), "EditorIcons"));
- else
- item->set_icon(0, def_icon);
- }
+ TreeItem *item = search_options->create_item(root);
+ item->set_metadata(0, "class_name:" + E->key());
+ item->set_text(0, E->key() + " (Class)");
+ if (search->has_icon(E->key(), "EditorIcons"))
+ item->set_icon(0, search->get_icon(E->key(), "EditorIcons"));
+ else
+ item->set_icon(0, def_icon);
}
+}
- void phase2(Map<String, DocData::ClassDoc>::Element *E) {
+void EditorHelpSearch::IncrementalSearch::phase2(Map<String, DocData::ClassDoc>::Element *E) {
- DocData::ClassDoc &c = E->get();
+ DocData::ClassDoc &c = E->get();
- Ref<Texture> cicon;
- if (search->has_icon(E->key(), "EditorIcons"))
- cicon = search->get_icon(E->key(), "EditorIcons");
- else
- cicon = def_icon;
+ Ref<Texture> cicon;
+ if (search->has_icon(E->key(), "EditorIcons"))
+ cicon = search->get_icon(E->key(), "EditorIcons");
+ else
+ cicon = def_icon;
- for (int i = 0; i < c.methods.size(); i++) {
- if ((term.begins_with(".") && c.methods[i].name.begins_with(term.right(1))) || (term.ends_with("(") && c.methods[i].name.ends_with(term.left(term.length() - 1).strip_edges())) || (term.begins_with(".") && term.ends_with("(") && c.methods[i].name == term.substr(1, term.length() - 2).strip_edges()) || c.methods[i].name.findn(term) != -1) {
+ for (int i = 0; i < c.methods.size(); i++) {
+ if ((term.begins_with(".") && c.methods[i].name.begins_with(term.right(1))) || (term.ends_with("(") && c.methods[i].name.ends_with(term.left(term.length() - 1).strip_edges())) || (term.begins_with(".") && term.ends_with("(") && c.methods[i].name == term.substr(1, term.length() - 2).strip_edges()) || c.methods[i].name.findn(term) != -1) {
- TreeItem *item = search_options->create_item(root);
- item->set_metadata(0, "class_method:" + E->key() + ":" + c.methods[i].name);
- item->set_text(0, E->key() + "." + c.methods[i].name + " (Method)");
- item->set_icon(0, cicon);
- }
+ TreeItem *item = search_options->create_item(root);
+ item->set_metadata(0, "class_method:" + E->key() + ":" + c.methods[i].name);
+ item->set_text(0, E->key() + "." + c.methods[i].name + " (Method)");
+ item->set_icon(0, cicon);
}
+ }
- for (int i = 0; i < c.signals.size(); i++) {
+ for (int i = 0; i < c.signals.size(); i++) {
- if (c.signals[i].name.findn(term) != -1) {
+ if (c.signals[i].name.findn(term) != -1) {
- TreeItem *item = search_options->create_item(root);
- item->set_metadata(0, "class_signal:" + E->key() + ":" + c.signals[i].name);
- item->set_text(0, E->key() + "." + c.signals[i].name + " (Signal)");
- item->set_icon(0, cicon);
- }
+ TreeItem *item = search_options->create_item(root);
+ item->set_metadata(0, "class_signal:" + E->key() + ":" + c.signals[i].name);
+ item->set_text(0, E->key() + "." + c.signals[i].name + " (Signal)");
+ item->set_icon(0, cicon);
}
+ }
- for (int i = 0; i < c.constants.size(); i++) {
+ for (int i = 0; i < c.constants.size(); i++) {
- if (c.constants[i].name.findn(term) != -1) {
+ if (c.constants[i].name.findn(term) != -1) {
- TreeItem *item = search_options->create_item(root);
- item->set_metadata(0, "class_constant:" + E->key() + ":" + c.constants[i].name);
- item->set_text(0, E->key() + "." + c.constants[i].name + " (Constant)");
- item->set_icon(0, cicon);
- }
+ TreeItem *item = search_options->create_item(root);
+ item->set_metadata(0, "class_constant:" + E->key() + ":" + c.constants[i].name);
+ item->set_text(0, E->key() + "." + c.constants[i].name + " (Constant)");
+ item->set_icon(0, cicon);
}
+ }
- for (int i = 0; i < c.properties.size(); i++) {
+ for (int i = 0; i < c.properties.size(); i++) {
- if (c.properties[i].name.findn(term) != -1) {
+ if (c.properties[i].name.findn(term) != -1) {
- TreeItem *item = search_options->create_item(root);
- item->set_metadata(0, "class_property:" + E->key() + ":" + c.properties[i].name);
- item->set_text(0, E->key() + "." + c.properties[i].name + " (Property)");
- item->set_icon(0, cicon);
- }
+ TreeItem *item = search_options->create_item(root);
+ item->set_metadata(0, "class_property:" + E->key() + ":" + c.properties[i].name);
+ item->set_text(0, E->key() + "." + c.properties[i].name + " (Property)");
+ item->set_icon(0, cicon);
}
+ }
- for (int i = 0; i < c.theme_properties.size(); i++) {
+ for (int i = 0; i < c.theme_properties.size(); i++) {
- if (c.theme_properties[i].name.findn(term) != -1) {
+ if (c.theme_properties[i].name.findn(term) != -1) {
- TreeItem *item = search_options->create_item(root);
- item->set_metadata(0, "class_theme_item:" + E->key() + ":" + c.theme_properties[i].name);
- item->set_text(0, E->key() + "." + c.theme_properties[i].name + " (Theme Item)");
- item->set_icon(0, cicon);
- }
+ TreeItem *item = search_options->create_item(root);
+ item->set_metadata(0, "class_theme_item:" + E->key() + ":" + c.theme_properties[i].name);
+ item->set_text(0, E->key() + "." + c.theme_properties[i].name + " (Theme Item)");
+ item->set_icon(0, cicon);
}
}
+}
- bool slice() {
+bool EditorHelpSearch::IncrementalSearch::slice() {
- if (phase > 2)
- return true;
+ if (phase > 2)
+ return true;
- if (iterator) {
+ if (iterator) {
- switch (phase) {
+ switch (phase) {
- case 1: {
- phase1(iterator);
- } break;
- case 2: {
- phase2(iterator);
- } break;
- default: {
- WARN_PRINT("illegal phase in IncrementalSearch");
- return true;
- }
+ case 1: {
+ phase1(iterator);
+ } break;
+ case 2: {
+ phase2(iterator);
+ } break;
+ default: {
+ WARN_PRINT("illegal phase in IncrementalSearch");
+ return true;
}
-
- iterator = iterator->next();
- } else {
-
- phase += 1;
- iterator = doc->class_list.front();
}
- return false;
+ iterator = iterator->next();
+ } else {
+
+ phase += 1;
+ iterator = doc->class_list.front();
}
-public:
- IncrementalSearch(EditorHelpSearch *p_search, Tree *p_search_options, const String &p_term) :
- search(p_search),
- search_options(p_search_options) {
+ return false;
+}
- def_icon = search->get_icon("Node", "EditorIcons");
- doc = EditorHelp::get_doc_data();
+EditorHelpSearch::IncrementalSearch::IncrementalSearch(EditorHelpSearch *p_search, Tree *p_search_options, const String &p_term) :
+ search(p_search),
+ search_options(p_search_options) {
- term = p_term;
+ def_icon = search->get_icon("Node", "EditorIcons");
+ doc = EditorHelp::get_doc_data();
- root = search_options->create_item();
- phase = 0;
- iterator = 0;
- }
+ term = p_term;
- bool empty() const {
+ root = search_options->create_item();
+ phase = 0;
+ iterator = 0;
+}
- return root->get_children() == NULL;
- }
+bool EditorHelpSearch::IncrementalSearch::empty() const {
- bool work(uint64_t slot = 1000000 / 10) {
+ return root->get_children() == NULL;
+}
- const uint64_t until = OS::get_singleton()->get_ticks_usec() + slot;
+bool EditorHelpSearch::IncrementalSearch::work(uint64_t slot) {
- while (!slice()) {
+ const uint64_t until = OS::get_singleton()->get_ticks_usec() + slot;
- if (OS::get_singleton()->get_ticks_usec() > until)
- return false;
- }
+ while (!slice()) {
- return true;
+ if (OS::get_singleton()->get_ticks_usec() > until)
+ return false;
}
-};
+
+ return true;
+}
void EditorHelpSearch::_update_search() {
search_options->clear();
diff --git a/editor/editor_help.h b/editor/editor_help.h
index db4c33afb0..aa84aa611f 100644
--- a/editor/editor_help.h
+++ b/editor/editor_help.h
@@ -54,7 +54,30 @@ class EditorHelpSearch : public ConfirmationDialog {
Tree *search_options;
String base_type;
- class IncrementalSearch;
+ class IncrementalSearch : public Reference {
+ String term;
+ TreeItem *root;
+
+ EditorHelpSearch *search;
+ Tree *search_options;
+
+ DocData *doc;
+ Ref<Texture> def_icon;
+
+ int phase;
+ Map<String, DocData::ClassDoc>::Element *iterator;
+
+ void phase1(Map<String, DocData::ClassDoc>::Element *E);
+ void phase2(Map<String, DocData::ClassDoc>::Element *E);
+ bool slice();
+
+ public:
+ IncrementalSearch(EditorHelpSearch *p_search, Tree *p_search_options, const String &p_term);
+
+ bool empty() const;
+ bool work(uint64_t slot = 1000000 / 10);
+ };
+
Ref<IncrementalSearch> search;
void _update_search();
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index 98991cd7c0..29912feb1f 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -217,6 +217,12 @@ void EditorNode::_unhandled_input(const Ref<InputEvent> &p_event) {
} else if (ED_IS_SHORTCUT("editor/editor_prev", p_event)) {
_editor_select_prev();
}
+
+ if (k->get_scancode() == KEY_ESCAPE) {
+ for (int i = 0; i < bottom_panel_items.size(); i++) {
+ _bottom_panel_switch(false, i);
+ }
+ }
}
}
@@ -339,7 +345,7 @@ void EditorNode::_notification(int p_what) {
if (ScriptEditor::get_singleton()->get_debugger()->is_visible())
bottom_panel->add_style_override("panel", gui_base->get_stylebox("BottomPanelDebuggerOverride", "EditorStyles"));
- //_update_icons
+ // update_icons
for (int i = 0; i < singleton->main_editor_buttons.size(); i++) {
Ref<Texture> icon = singleton->main_editor_buttons[i]->get_icon();
@@ -709,7 +715,7 @@ void EditorNode::_dialog_display_load_error(String p_file, Error p_error) {
case ERR_CANT_OPEN: {
- accept->set_text(vformat(TTR("Can't open '%s'."), p_file.get_file()));
+ accept->set_text(vformat(TTR("Can't open '%s'. The file could have been moved or deleted."), p_file.get_file()));
} break;
case ERR_PARSE_ERROR: {
@@ -1110,7 +1116,7 @@ void EditorNode::_dialog_action(String p_file) {
if (res.is_null()) {
current_option = -1;
- accept->get_ok()->set_text("ok :(");
+ accept->get_ok()->set_text("Ugh");
accept->set_text(TTR("Failed to load resource."));
return;
};
@@ -1145,6 +1151,7 @@ void EditorNode::_dialog_action(String p_file) {
_save_default_environment();
_save_scene_with_preview(p_file, scene_idx);
+ _add_to_recent_scenes(p_file);
if (scene_idx != -1)
_discard_changes();
@@ -1919,7 +1926,6 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
if (!scene) {
current_option = -1;
- //confirmation->get_cancel()->hide();
accept->get_ok()->set_text(TTR("I see.."));
accept->set_text(TTR("This operation can't be done without a tree root."));
accept->popup_centered_minsize();
@@ -1937,7 +1943,6 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
file->add_filter("*." + extensions[i] + " ; " + extensions[i].to_upper());
}
- //file->set_current_path(current_path);
if (scene->get_filename() != "") {
file->set_current_path(scene->get_filename());
if (extensions.size()) {
@@ -1987,7 +1992,6 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
if (!editor_data.get_edited_scene_root()) {
current_option = -1;
- //confirmation->get_cancel()->hide();
accept->get_ok()->set_text(TTR("I see.."));
accept->set_text(TTR("This operation can't be done without a scene."));
accept->popup_centered_minsize();
@@ -2036,8 +2040,6 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
} break;
case FILE_IMPORT_SUBSCENE: {
- //import_subscene->popup_centered_ratio();
-
if (!editor_data.get_edited_scene_root()) {
current_option = -1;
@@ -2056,7 +2058,6 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
if (unsaved_cache && !p_confirmed) {
confirmation->get_ok()->set_text(TTR("Open"));
- //confirmation->get_cancel()->show();
confirmation->set_text(TTR("Current scene not saved. Open anyway?"));
confirmation->popup_centered_minsize();
break;
@@ -2843,7 +2844,7 @@ void EditorNode::_remove_scene(int index) {
//Scene to remove is current scene
_remove_edited_scene();
} else {
- // Scene to remove is not active scene
+ //Scene to remove is not active scene
editor_data.remove_scene(index);
}
}
@@ -3240,48 +3241,47 @@ void EditorNode::_show_messages() {
void EditorNode::_add_to_recent_scenes(const String &p_scene) {
- String base = "_" + ProjectSettings::get_singleton()->get_resource_path().replace("\\", "::").replace("/", "::");
- Vector<String> rc = EDITOR_DEF(base + "/_recent_scenes", Array());
- String name = p_scene;
- name = name.replace("res://", "");
- if (rc.find(name) != -1)
- rc.erase(name);
- rc.insert(0, name);
+ Array rc = EditorSettings::get_singleton()->get_project_metadata("recent_files", "scenes", Array());
+ if (rc.find(p_scene) != -1)
+ rc.erase(p_scene);
+ rc.push_front(p_scene);
if (rc.size() > 10)
rc.resize(10);
- EditorSettings::get_singleton()->set(base + "/_recent_scenes", rc);
- EditorSettings::get_singleton()->save();
+ EditorSettings::get_singleton()->set_project_metadata("recent_files", "scenes", rc);
_update_recent_scenes();
}
void EditorNode::_open_recent_scene(int p_idx) {
- String base = "_" + ProjectSettings::get_singleton()->get_resource_path().replace("\\", "::").replace("/", "::");
-
if (p_idx == recent_scenes->get_item_count() - 1) {
- EditorSettings::get_singleton()->erase(base + "/_recent_scenes");
+ EditorSettings::get_singleton()->set_project_metadata("recent_files", "scenes", Array());
call_deferred("_update_recent_scenes");
} else {
- Vector<String> rc = EDITOR_DEF(base + "/_recent_scenes", Array());
+ Array rc = EditorSettings::get_singleton()->get_project_metadata("recent_files", "scenes", Array());
ERR_FAIL_INDEX(p_idx, rc.size());
- String path = "res://" + rc[p_idx];
- load_scene(path);
+ if (load_scene(rc[p_idx]) != OK) {
+
+ rc.remove(p_idx);
+ EditorSettings::get_singleton()->set_project_metadata("recent_files", "scenes", rc);
+ _update_recent_scenes();
+ }
}
}
void EditorNode::_update_recent_scenes() {
- String base = "_" + ProjectSettings::get_singleton()->get_resource_path().replace("\\", "::").replace("/", "::");
- Vector<String> rc = EDITOR_DEF(base + "/_recent_scenes", Array());
+ Array rc = EditorSettings::get_singleton()->get_project_metadata("recent_files", "scenes", Array());
recent_scenes->clear();
+ String path;
for (int i = 0; i < rc.size(); i++) {
- recent_scenes->add_item(rc[i], i);
+ path = rc[i];
+ recent_scenes->add_item(path.replace("res://", ""), i);
}
recent_scenes->add_separator();
@@ -5118,7 +5118,6 @@ EditorNode::EditorNode() {
gui_base->add_child(dependency_fixer);
settings_config_dialog = memnew(EditorSettingsDialog);
- // settings_config_dialog->add_style_override("panel", gui_base->get_stylebox("EditorSettingsDialog", "EditorStyles"));
gui_base->add_child(settings_config_dialog);
project_settings = memnew(ProjectSettingsEditor(&editor_data));
@@ -5192,7 +5191,6 @@ EditorNode::EditorNode() {
p->add_item(TTR("Project Settings"), RUN_SETTINGS);
p->add_separator();
p->connect("id_pressed", this, "_menu_option");
- //p->add_item(TTR("Run Script"), FILE_RUN_SCRIPT, KEY_MASK_SHIFT + KEY_MASK_CMD + KEY_R);
p->add_item(TTR("Export"), FILE_EXPORT_PROJECT);
PopupMenu *tool_menu = memnew(PopupMenu);
@@ -5283,7 +5281,6 @@ EditorNode::EditorNode() {
menu_hb->add_child(play_cc);
play_button_panel = memnew(PanelContainer);
- // play_button_panel->add_style_override("panel", gui_base->get_stylebox("PlayButtonPanel", "EditorStyles"));
play_cc->add_child(play_button_panel);
HBoxContainer *play_hb = memnew(HBoxContainer);
diff --git a/editor/editor_plugin.cpp b/editor/editor_plugin.cpp
index b1a0efaea6..733680645f 100644
--- a/editor/editor_plugin.cpp
+++ b/editor/editor_plugin.cpp
@@ -373,6 +373,53 @@ void EditorPlugin::add_control_to_container(CustomControlContainer p_location, C
}
}
+void EditorPlugin::remove_control_from_container(CustomControlContainer p_location, Control *p_control) {
+
+ switch (p_location) {
+
+ case CONTAINER_TOOLBAR: {
+
+ EditorNode::get_menu_hb()->remove_child(p_control);
+ } break;
+
+ case CONTAINER_SPATIAL_EDITOR_MENU: {
+
+ SpatialEditor::get_singleton()->remove_control_from_menu_panel(p_control);
+
+ } break;
+ case CONTAINER_SPATIAL_EDITOR_SIDE: {
+
+ SpatialEditor::get_singleton()->get_palette_split()->remove_child(p_control);
+
+ } break;
+ case CONTAINER_SPATIAL_EDITOR_BOTTOM: {
+
+ SpatialEditor::get_singleton()->get_shader_split()->remove_child(p_control);
+
+ } break;
+ case CONTAINER_CANVAS_EDITOR_MENU: {
+
+ CanvasItemEditor::get_singleton()->remove_control_from_menu_panel(p_control);
+
+ } break;
+ case CONTAINER_CANVAS_EDITOR_SIDE: {
+
+ CanvasItemEditor::get_singleton()->get_palette_split()->remove_child(p_control);
+
+ } break;
+ case CONTAINER_CANVAS_EDITOR_BOTTOM: {
+
+ CanvasItemEditor::get_singleton()->get_bottom_split()->remove_child(p_control);
+
+ } break;
+ case CONTAINER_PROPERTY_EDITOR_BOTTOM: {
+
+ EditorNode::get_singleton()->get_property_editor_vb()->remove_child(p_control);
+
+ } break;
+ }
+}
+
void EditorPlugin::add_tool_menu_item(const String &p_name, Object *p_handler, const String &p_callback, const Variant &p_ud) {
//EditorNode::get_singleton()->add_tool_menu_item(p_name, p_handler, p_callback, p_ud);
@@ -651,6 +698,7 @@ void EditorPlugin::_bind_methods() {
ClassDB::bind_method(D_METHOD("add_control_to_dock", "slot", "control"), &EditorPlugin::add_control_to_dock);
ClassDB::bind_method(D_METHOD("remove_control_from_docks", "control"), &EditorPlugin::remove_control_from_docks);
ClassDB::bind_method(D_METHOD("remove_control_from_bottom_panel", "control"), &EditorPlugin::remove_control_from_bottom_panel);
+ ClassDB::bind_method(D_METHOD("remove_control_from_container", "container", "control"), &EditorPlugin::remove_control_from_container);
//ClassDB::bind_method(D_METHOD("add_tool_menu_item", "name", "handler", "callback", "ud"),&EditorPlugin::add_tool_menu_item,DEFVAL(Variant()));
ClassDB::bind_method(D_METHOD("add_tool_submenu_item", "name", "submenu"), &EditorPlugin::add_tool_submenu_item);
//ClassDB::bind_method(D_METHOD("remove_tool_menu_item", "name"),&EditorPlugin::remove_tool_menu_item);
diff --git a/editor/editor_plugin.h b/editor/editor_plugin.h
index 3d585120c0..e3e405479c 100644
--- a/editor/editor_plugin.h
+++ b/editor/editor_plugin.h
@@ -148,6 +148,7 @@ public:
//TODO: send a resource for editing to the editor node?
void add_control_to_container(CustomControlContainer p_location, Control *p_control);
+ void remove_control_from_container(CustomControlContainer p_location, Control *p_control);
ToolButton *add_control_to_bottom_panel(Control *p_control, const String &p_title);
void add_control_to_dock(DockSlot p_slot, Control *p_control);
void remove_control_from_docks(Control *p_control);
diff --git a/editor/editor_plugin_settings.cpp b/editor/editor_plugin_settings.cpp
index 8803a03f2d..ea1e0fe99e 100644
--- a/editor/editor_plugin_settings.cpp
+++ b/editor/editor_plugin_settings.cpp
@@ -83,8 +83,6 @@ void EditorPluginSettings::update_plugins() {
plugins.sort();
- Vector<String> active_plugins = ProjectSettings::get_singleton()->get("editor_plugins/enabled");
-
for (int i = 0; i < plugins.size(); i++) {
Ref<ConfigFile> cf;
diff --git a/editor/editor_resource_preview.cpp b/editor/editor_resource_preview.cpp
index 93787a7a4c..aa67ea03d7 100644
--- a/editor/editor_resource_preview.cpp
+++ b/editor/editor_resource_preview.cpp
@@ -253,7 +253,6 @@ void EditorResourcePreview::_thread() {
img.instance();
if (img->load(cache_base + ".png") != OK) {
- //well fuck
cache_valid = false;
} else {
diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp
index 433f501fc8..29363e29c1 100644
--- a/editor/editor_settings.cpp
+++ b/editor/editor_settings.cpp
@@ -256,8 +256,11 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
String best;
- for (int i = 0; i < translations.size(); i++) {
- String locale = translations[i]->get_locale();
+ EditorTranslationList *etl = _editor_translations;
+
+ while (etl->data) {
+
+ const String &locale = etl->lang;
lang_hint += ",";
lang_hint += locale;
@@ -268,6 +271,8 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
if (best == String() && host_lang.begins_with(locale)) {
best = locale;
}
+
+ etl++;
}
if (best == String()) {
@@ -382,8 +387,6 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
_initial_set("text_editor/completion/callhint_tooltip_offset", Vector2());
_initial_set("text_editor/files/restore_scripts_on_load", true);
_initial_set("text_editor/completion/complete_file_paths", true);
- _initial_set("text_editor/files/maximum_recent_files", 20);
- hints["text_editor/files/maximum_recent_files"] = PropertyInfo(Variant::INT, "text_editor/files/maximum_recent_files", PROPERTY_HINT_RANGE, "1, 200, 1");
_initial_set("docks/scene_tree/start_create_dialog_fully_expanded", false);
_initial_set("docks/scene_tree/draw_relationship_lines", false);
@@ -885,11 +888,29 @@ void EditorSettings::setup_language() {
if (lang == "en")
return; //none to do
- for (int i = 0; i < translations.size(); i++) {
- if (translations[i]->get_locale() == lang) {
- TranslationServer::get_singleton()->set_tool_translation(translations[i]);
- break;
+ EditorTranslationList *etl = _editor_translations;
+
+ while (etl->data) {
+
+ if (etl->lang == lang) {
+
+ Vector<uint8_t> data;
+ data.resize(etl->uncomp_size);
+ Compression::decompress(data.ptrw(), etl->uncomp_size, etl->data, etl->comp_size, Compression::MODE_DEFLATE);
+
+ FileAccessMemory *fa = memnew(FileAccessMemory);
+ fa->open_custom(data.ptr(), data.size());
+
+ Ref<Translation> tr = TranslationLoaderPO::load_translation(fa, NULL, "translation_" + String(etl->lang));
+
+ if (tr.is_valid()) {
+ tr->set_locale(etl->lang);
+ TranslationServer::get_singleton()->set_tool_translation(tr);
+ break;
+ }
}
+
+ etl++;
}
}
@@ -1459,27 +1480,6 @@ EditorSettings::EditorSettings() {
optimize_save = true;
save_changed_setting = true;
- EditorTranslationList *etl = _editor_translations;
-
- while (etl->data) {
-
- Vector<uint8_t> data;
- data.resize(etl->uncomp_size);
- Compression::decompress(data.ptrw(), etl->uncomp_size, etl->data, etl->comp_size, Compression::MODE_DEFLATE);
-
- FileAccessMemory *fa = memnew(FileAccessMemory);
- fa->open_custom(data.ptr(), data.size());
-
- Ref<Translation> tr = TranslationLoaderPO::load_translation(fa, NULL, "translation_" + String(etl->lang));
-
- if (tr.is_valid()) {
- tr->set_locale(etl->lang);
- translations.push_back(tr);
- }
-
- etl++;
- }
-
_load_defaults();
}
diff --git a/editor/editor_settings.h b/editor/editor_settings.h
index 8bcb599a67..e196ca506e 100644
--- a/editor/editor_settings.h
+++ b/editor/editor_settings.h
@@ -95,7 +95,6 @@ private:
int last_order;
Ref<Resource> clipboard;
- Vector<Ref<Translation> > translations;
Map<String, Ref<ShortCut> > shortcuts;
String resource_path;
diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp
index 8ead8d3982..e26f4ba449 100644
--- a/editor/filesystem_dock.cpp
+++ b/editor/filesystem_dock.cpp
@@ -30,6 +30,7 @@
#include "filesystem_dock.h"
+#include "core/os/keyboard.h"
#include "editor_node.h"
#include "editor_settings.h"
#include "io/resource_loader.h"
@@ -492,7 +493,7 @@ void FileSystemDock::_update_files(bool p_keep_selection) {
Ref<Texture> folderIcon = (use_thumbnails) ? folder_thumbnail : get_icon("folder", "FileDialog");
if (path != "res://") {
- files->add_item("..", folderIcon, false);
+ files->add_item("..", folderIcon, true);
String bd = path.get_base_dir();
if (bd != "res://" && !bd.ends_with("/"))
@@ -1641,6 +1642,23 @@ void FileSystemDock::_file_multi_selected(int p_index, bool p_selected) {
call_deferred("_update_import_dock");
}
+void FileSystemDock::_files_gui_input(Ref<InputEvent> p_event) {
+
+ if (get_viewport()->get_modal_stack_top())
+ return; //ignore because of modal window
+
+ Ref<InputEventKey> key = p_event;
+ if (key.is_valid() && key->is_pressed() && !key->is_echo()) {
+ if (ED_IS_SHORTCUT("filesystem_dock/duplicate", p_event)) {
+ _file_option(FILE_DUPLICATE);
+ } else if (ED_IS_SHORTCUT("filesystem_dock/copy_path", p_event)) {
+ _file_option(FILE_COPY_PATH);
+ } else if (ED_IS_SHORTCUT("filesystem_dock/delete", p_event)) {
+ _file_option(FILE_REMOVE);
+ }
+ }
+}
+
void FileSystemDock::_file_selected() {
import_dock_needs_update = true;
@@ -1697,6 +1715,7 @@ void FileSystemDock::_update_import_dock() {
void FileSystemDock::_bind_methods() {
+ ClassDB::bind_method(D_METHOD("_files_gui_input"), &FileSystemDock::_files_gui_input);
ClassDB::bind_method(D_METHOD("_update_tree"), &FileSystemDock::_update_tree);
ClassDB::bind_method(D_METHOD("_rescan"), &FileSystemDock::_rescan);
ClassDB::bind_method(D_METHOD("_favorites_pressed"), &FileSystemDock::_favorites_pressed);
@@ -1743,6 +1762,10 @@ FileSystemDock::FileSystemDock(EditorNode *p_editor) {
editor = p_editor;
path = "res://";
+ ED_SHORTCUT("filesystem_dock/copy_path", TTR("Copy Path"), KEY_MASK_CMD | KEY_C);
+ ED_SHORTCUT("filesystem_dock/duplicate", TTR("Duplicate..."), KEY_MASK_CMD | KEY_D);
+ ED_SHORTCUT("filesystem_dock/delete", TTR("Delete"), KEY_DELETE);
+
HBoxContainer *toolbar_hbc = memnew(HBoxContainer);
add_child(toolbar_hbc);
@@ -1849,6 +1872,7 @@ FileSystemDock::FileSystemDock(EditorNode *p_editor) {
files->set_select_mode(ItemList::SELECT_MULTI);
files->set_drag_forwarding(this);
files->connect("item_rmb_selected", this, "_files_list_rmb_select");
+ files->connect("gui_input", this, "_files_gui_input");
files->connect("item_selected", this, "_file_selected");
files->connect("multi_selected", this, "_file_multi_selected");
files->connect("rmb_clicked", this, "_rmb_pressed");
diff --git a/editor/filesystem_dock.h b/editor/filesystem_dock.h
index 2e86b83efc..377316d1ba 100644
--- a/editor/filesystem_dock.h
+++ b/editor/filesystem_dock.h
@@ -159,6 +159,8 @@ private:
bool _create_tree(TreeItem *p_parent, EditorFileSystemDirectory *p_dir, Vector<String> &uncollapsed_paths);
void _update_tree(bool keep_collapse_state, bool p_uncollapse_root = false);
+ void _files_gui_input(Ref<InputEvent> p_event);
+
void _update_files(bool p_keep_selection);
void _update_file_display_toggle_button();
void _change_file_display();
diff --git a/editor/import/editor_import_plugin.cpp b/editor/import/editor_import_plugin.cpp
index 07c77a9df0..3f5dc7c9f4 100644
--- a/editor/import/editor_import_plugin.cpp
+++ b/editor/import/editor_import_plugin.cpp
@@ -72,6 +72,20 @@ String EditorImportPlugin::get_resource_type() const {
return get_script_instance()->call("get_resource_type");
}
+float EditorImportPlugin::get_priority() const {
+ if (!(get_script_instance() && get_script_instance()->has_method("get_priority"))) {
+ return EditorImportPlugin::get_priority();
+ }
+ return get_script_instance()->call("get_priority");
+}
+
+int EditorImportPlugin::get_import_order() const {
+ if (!(get_script_instance() && get_script_instance()->has_method("get_import_order"))) {
+ return EditorImportPlugin::get_import_order();
+ }
+ return get_script_instance()->call("get_import_order");
+}
+
void EditorImportPlugin::get_import_options(List<ResourceImporter::ImportOption> *r_options, int p_preset) const {
ERR_FAIL_COND(!(get_script_instance() && get_script_instance()->has_method("get_import_options")));
@@ -148,6 +162,8 @@ void EditorImportPlugin::_bind_methods() {
ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::ARRAY, "get_import_options", PropertyInfo(Variant::INT, "preset")));
ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::STRING, "get_save_extension"));
ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::STRING, "get_resource_type"));
+ ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::REAL, "get_priority"));
+ ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::INT, "get_import_order"));
ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::BOOL, "get_option_visibility", PropertyInfo(Variant::STRING, "option"), PropertyInfo(Variant::DICTIONARY, "options")));
ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::INT, "import", PropertyInfo(Variant::STRING, "source_file"), PropertyInfo(Variant::STRING, "save_path"), PropertyInfo(Variant::DICTIONARY, "options"), PropertyInfo(Variant::ARRAY, "r_platform_variants"), PropertyInfo(Variant::ARRAY, "r_gen_files")));
}
diff --git a/editor/import/editor_import_plugin.h b/editor/import/editor_import_plugin.h
index 61a0a944f5..92d83158ef 100644
--- a/editor/import/editor_import_plugin.h
+++ b/editor/import/editor_import_plugin.h
@@ -47,6 +47,8 @@ public:
virtual int get_preset_count() const;
virtual String get_save_extension() const;
virtual String get_resource_type() const;
+ virtual float get_priority() const;
+ virtual int get_import_order() const;
virtual void get_import_options(List<ImportOption> *r_options, int p_preset) const;
virtual bool get_option_visibility(const String &p_option, const Map<StringName, Variant> &p_options) const;
virtual Error 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);
diff --git a/editor/plugins/asset_library_editor_plugin.cpp b/editor/plugins/asset_library_editor_plugin.cpp
index 915132c75c..26afc78825 100644
--- a/editor/plugins/asset_library_editor_plugin.cpp
+++ b/editor/plugins/asset_library_editor_plugin.cpp
@@ -308,7 +308,7 @@ EditorAssetLibraryItemDescription::EditorAssetLibraryItemDescription() {
preview_hb->set_v_size_flags(SIZE_EXPAND_FILL);
previews->add_child(preview_hb);
- get_ok()->set_text(TTR("Install"));
+ get_ok()->set_text(TTR("Download"));
get_cancel()->set_text(TTR("Close"));
}
///////////////////////////////////////////////////////////////////////////////////
@@ -316,7 +316,6 @@ EditorAssetLibraryItemDescription::EditorAssetLibraryItemDescription() {
void EditorAssetLibraryItemDownload::_http_download_completed(int p_status, int p_code, const PoolStringArray &headers, const PoolByteArray &p_data) {
String error_text;
- print_line("COMPLETED: " + itos(p_status) + " code: " + itos(p_code) + " data size: " + itos(p_data.size()));
switch (p_status) {
@@ -371,7 +370,6 @@ void EditorAssetLibraryItemDownload::_http_download_completed(int p_status, int
progress->set_max(download->get_body_size());
progress->set_value(download->get_downloaded_bytes());
- print_line("max: " + itos(download->get_body_size()) + " bytes: " + itos(download->get_downloaded_bytes()));
install->set_disabled(false);
progress->set_value(download->get_downloaded_bytes());
@@ -747,8 +745,6 @@ void EditorAssetLibrary::_image_request_completed(int p_status, int p_code, cons
if (p_status == HTTPRequest::RESULT_SUCCESS) {
- print_line("GOT IMAGE YAY!");
-
if (p_code != HTTPClient::RESPONSE_NOT_MODIFIED) {
for (int i = 0; i < headers.size(); i++) {
if (headers[i].findn("ETag:") == 0) { // Save etag
@@ -811,7 +807,6 @@ void EditorAssetLibrary::_update_image_queue() {
}
}
- print_line("REQUEST ICON FOR: " + itos(E->get().asset_id));
Error err = E->get().request->request(E->get().image_url, headers);
if (err != OK) {
to_delete.push_back(E->key());
@@ -855,7 +850,6 @@ void EditorAssetLibrary::_request_image(ObjectID p_for, String p_image_url, Imag
void EditorAssetLibrary::_repository_changed(int p_repository_id) {
host = repository->get_item_metadata(p_repository_id);
- print_line(".." + host);
if (templates_only) {
_api_request("configure", REQUESTING_CONFIG, "?type=project");
} else {
@@ -1066,8 +1060,6 @@ void EditorAssetLibrary::_http_request_completed(int p_status, int p_code, const
return;
}
- print_line("response: " + itos(p_status) + " code: " + itos(p_code));
-
Dictionary d;
{
Variant js;
@@ -1077,8 +1069,6 @@ void EditorAssetLibrary::_http_request_completed(int p_status, int p_code, const
d = js;
}
- print_line(Variant(d).get_construct_string());
-
RequestType requested = requesting;
requesting = REQUESTING_NONE;
diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp
index 7d6025cb03..4a05d401cb 100644
--- a/editor/plugins/canvas_item_editor_plugin.cpp
+++ b/editor/plugins/canvas_item_editor_plugin.cpp
@@ -4002,6 +4002,11 @@ void CanvasItemEditor::add_control_to_menu_panel(Control *p_control) {
hb->add_child(p_control);
}
+void CanvasItemEditor::remove_control_from_menu_panel(Control *p_control) {
+
+ hb->remove_child(p_control);
+}
+
HSplitContainer *CanvasItemEditor::get_palette_split() {
return palette_split;
@@ -4225,9 +4230,9 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) {
p = view_menu->get_popup();
p->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/show_grid", TTR("Show Grid"), KEY_G), SHOW_GRID);
- p->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/show_helpers", TTR("Show helpers"), KEY_H), SHOW_HELPERS);
- p->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/show_rulers", TTR("Show rulers"), KEY_R), SHOW_RULERS);
- p->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/show_guides", TTR("Show guides"), KEY_Y), SHOW_GUIDES);
+ p->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/show_helpers", TTR("Show Helpers"), KEY_H), SHOW_HELPERS);
+ p->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/show_rulers", TTR("Show Rulers"), KEY_R), SHOW_RULERS);
+ p->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/show_guides", TTR("Show Guides"), KEY_Y), SHOW_GUIDES);
p->add_separator();
p->add_shortcut(ED_SHORTCUT("canvas_item_editor/center_selection", TTR("Center Selection"), KEY_F), VIEW_CENTER_TO_SELECTION);
p->add_shortcut(ED_SHORTCUT("canvas_item_editor/frame_selection", TTR("Frame Selection"), KEY_MASK_SHIFT | KEY_F), VIEW_FRAME_TO_SELECTION);
diff --git a/editor/plugins/canvas_item_editor_plugin.h b/editor/plugins/canvas_item_editor_plugin.h
index ace87f9fe2..ee9be86cce 100644
--- a/editor/plugins/canvas_item_editor_plugin.h
+++ b/editor/plugins/canvas_item_editor_plugin.h
@@ -509,6 +509,7 @@ public:
void set_state(const Dictionary &p_state);
void add_control_to_menu_panel(Control *p_control);
+ void remove_control_from_menu_panel(Control *p_control);
HSplitContainer *get_palette_split();
VSplitContainer *get_bottom_split();
diff --git a/editor/plugins/editor_preview_plugins.cpp b/editor/plugins/editor_preview_plugins.cpp
index 215964235e..47d730cdf1 100644
--- a/editor/plugins/editor_preview_plugins.cpp
+++ b/editor/plugins/editor_preview_plugins.cpp
@@ -30,6 +30,7 @@
#include "editor_preview_plugins.h"
+#include "editor/editor_node.h"
#include "editor/editor_scale.h"
#include "editor/editor_settings.h"
#include "io/file_access_memory.h"
@@ -39,6 +40,38 @@
#include "scene/resources/material.h"
#include "scene/resources/mesh.h"
+static void post_process_preview(Ref<Image> p_image) {
+
+ if (p_image->get_format() != Image::FORMAT_RGBA8)
+ p_image->convert(Image::FORMAT_RGBA8);
+
+ p_image->lock();
+
+ const int w = p_image->get_width();
+ const int h = p_image->get_height();
+
+ const int r = MIN(w, h) / 32;
+ const int r2 = r * r;
+ Color transparent = Color(0, 0, 0, 0);
+
+ for (int i = 0; i < r; i++) {
+ for (int j = 0; j < r; j++) {
+ int dx = i - r;
+ int dy = j - r;
+ if (dx * dx + dy * dy > r2) {
+ p_image->set_pixel(i, j, transparent);
+ p_image->set_pixel(w - 1 - i, j, transparent);
+ p_image->set_pixel(w - 1 - i, h - 1 - j, transparent);
+ p_image->set_pixel(i, h - 1 - j, transparent);
+ } else {
+ break;
+ }
+ }
+ }
+
+ p_image->unlock();
+}
+
bool EditorTexturePreviewPlugin::handles(const String &p_type) const {
return ClassDB::is_parent_class(p_type, "Texture");
@@ -90,6 +123,7 @@ Ref<Texture> EditorTexturePreviewPlugin::generate(const RES &p_from) {
}
img->resize(width, height);
+ post_process_preview(img);
Ref<ImageTexture> ptex = Ref<ImageTexture>(memnew(ImageTexture));
@@ -162,6 +196,7 @@ Ref<Texture> EditorBitmapPreviewPlugin::generate(const RES &p_from) {
}
img->resize(width, height);
+ post_process_preview(img);
Ref<ImageTexture> ptex = Ref<ImageTexture>(memnew(ImageTexture));
@@ -203,6 +238,7 @@ Ref<Texture> EditorPackedScenePreviewPlugin::generate_from_path(const String &p_
Ref<ImageTexture> ptex = Ref<ImageTexture>(memnew(ImageTexture));
+ post_process_preview(img);
ptex->create_from_image(img, 0);
return ptex;
@@ -258,6 +294,7 @@ Ref<Texture> EditorMaterialPreviewPlugin::generate(const RES &p_from) {
thumbnail_size *= EDSCALE;
img->convert(Image::FORMAT_RGBA8);
img->resize(thumbnail_size, thumbnail_size);
+ post_process_preview(img);
Ref<ImageTexture> ptex = Ref<ImageTexture>(memnew(ImageTexture));
ptex->create_from_image(img, 0);
return ptex;
@@ -426,19 +463,36 @@ Ref<Texture> EditorScriptPreviewPlugin::generate(const RES &p_from) {
img->create(thumbnail_size, thumbnail_size, 0, Image::FORMAT_RGBA8);
Color bg_color = EditorSettings::get_singleton()->get("text_editor/highlighting/background_color");
- bg_color.a = 1.0;
Color keyword_color = EditorSettings::get_singleton()->get("text_editor/highlighting/keyword_color");
Color text_color = EditorSettings::get_singleton()->get("text_editor/highlighting/text_color");
Color symbol_color = EditorSettings::get_singleton()->get("text_editor/highlighting/symbol_color");
+ if (EditorSettings::get_singleton()->get("text_editor/theme/color_theme") == "Adaptive") {
+ Ref<Theme> tm = EditorNode::get_singleton()->get_theme_base()->get_theme();
+
+ bg_color = tm->get_color("text_editor/highlighting/background_color", "Editor");
+ keyword_color = tm->get_color("text_editor/highlighting/keyword_color", "Editor");
+ text_color = tm->get_color("text_editor/highlighting/text_color", "Editor");
+ symbol_color = tm->get_color("text_editor/highlighting/symbol_color", "Editor");
+ }
+
img->lock();
+ if (bg_color.a == 0)
+ bg_color = Color(0, 0, 0, 0);
+ bg_color.a = MAX(bg_color.a, 0.2); // some background
+
for (int i = 0; i < thumbnail_size; i++) {
for (int j = 0; j < thumbnail_size; j++) {
img->set_pixel(i, j, bg_color);
}
}
+ const int x0 = thumbnail_size / 8;
+ const int y0 = thumbnail_size / 8;
+ const int available_height = thumbnail_size - 2 * y0;
+ col = x0;
+
bool prev_is_text = false;
bool in_keyword = false;
for (int i = 0; i < code.length(); i++) {
@@ -471,8 +525,8 @@ Ref<Texture> EditorScriptPreviewPlugin::generate(const RES &p_from) {
Color ul = color;
ul.a *= 0.5;
- img->set_pixel(col, line * 2, bg_color.blend(ul));
- img->set_pixel(col, line * 2 + 1, color);
+ img->set_pixel(col, y0 + line * 2, bg_color.blend(ul));
+ img->set_pixel(col, y0 + line * 2 + 1, color);
prev_is_text = _is_text_char(c);
}
@@ -482,9 +536,9 @@ Ref<Texture> EditorScriptPreviewPlugin::generate(const RES &p_from) {
in_keyword = false;
if (c == '\n') {
- col = 0;
+ col = x0;
line++;
- if (line >= thumbnail_size / 2)
+ if (line >= available_height / 2)
break;
} else if (c == '\t') {
col += 3;
@@ -495,6 +549,8 @@ Ref<Texture> EditorScriptPreviewPlugin::generate(const RES &p_from) {
img->unlock();
+ post_process_preview(img);
+
Ref<ImageTexture> ptex = Ref<ImageTexture>(memnew(ImageTexture));
ptex->create_from_image(img, 0);
@@ -762,6 +818,7 @@ Ref<Texture> EditorSamplePreviewPlugin::generate(const RES& p_from) {
}
imgdata = PoolVector<uint8_t>::Write();
+ post_process_preview(img);
Ref<ImageTexture> ptex = Ref<ImageTexture>( memnew( ImageTexture));
ptex->create_from_image(Image(w,h,0,Image::FORMAT_RGB8,img),0);
@@ -831,6 +888,7 @@ Ref<Texture> EditorMeshPreviewPlugin::generate(const RES &p_from) {
thumbnail_size *= EDSCALE;
img->convert(Image::FORMAT_RGBA8);
img->resize(thumbnail_size, thumbnail_size);
+ post_process_preview(img);
Ref<ImageTexture> ptex = Ref<ImageTexture>(memnew(ImageTexture));
ptex->create_from_image(img, 0);
diff --git a/editor/plugins/resource_preloader_editor_plugin.cpp b/editor/plugins/resource_preloader_editor_plugin.cpp
index a47cb40240..c6e8ec1a2b 100644
--- a/editor/plugins/resource_preloader_editor_plugin.cpp
+++ b/editor/plugins/resource_preloader_editor_plugin.cpp
@@ -229,17 +229,34 @@ void ResourcePreloaderEditor::_update_library() {
ERR_CONTINUE(r.is_null());
ti->set_tooltip(0, r->get_path());
- String type = r->get_class();
- ti->set_text(1, type);
+ ti->set_text(1, r->get_path());
+ ti->add_button(1, get_icon("InstanceOptions", "EditorIcons"), BUTTON_SUBSCENE, false, TTR("Open in Editor"));
+ ti->set_tooltip(1, TTR("Instance:") + " " + r->get_path() + "\n" + TTR("Type:") + " " + r->get_class());
+ ti->set_editable(1, false);
ti->set_selectable(1, false);
+ String type = r->get_class();
+ ti->set_text(2, type);
+ ti->set_selectable(2, false);
if (has_icon(type, "EditorIcons"))
- ti->set_icon(1, get_icon(type, "EditorIcons"));
+ ti->set_icon(2, get_icon(type, "EditorIcons"));
}
//player->add_resource("default",resource);
}
+void ResourcePreloaderEditor::_cell_button_pressed(Object *p_item, int p_column, int p_id) {
+
+ TreeItem *item = Object::cast_to<TreeItem>(p_item);
+ ERR_FAIL_COND(!item);
+
+ String rpath = item->get_text(p_column);
+
+ if (p_id == BUTTON_SUBSCENE) {
+ EditorInterface::get_singleton()->open_scene_from_path(rpath);
+ }
+}
+
void ResourcePreloaderEditor::edit(ResourcePreloader *p_preloader) {
preloader = p_preloader;
@@ -354,6 +371,7 @@ void ResourcePreloaderEditor::_bind_methods() {
ClassDB::bind_method(D_METHOD("_delete_confirm_pressed"), &ResourcePreloaderEditor::_delete_confirm_pressed);
ClassDB::bind_method(D_METHOD("_files_load_request"), &ResourcePreloaderEditor::_files_load_request);
ClassDB::bind_method(D_METHOD("_update_library"), &ResourcePreloaderEditor::_update_library);
+ ClassDB::bind_method(D_METHOD("_cell_button_pressed"), &ResourcePreloaderEditor::_cell_button_pressed);
ClassDB::bind_method(D_METHOD("get_drag_data_fw"), &ResourcePreloaderEditor::get_drag_data_fw);
ClassDB::bind_method(D_METHOD("can_drop_data_fw"), &ResourcePreloaderEditor::can_drop_data_fw);
@@ -385,11 +403,14 @@ ResourcePreloaderEditor::ResourcePreloaderEditor() {
add_child(file);
tree = memnew(Tree);
- tree->set_columns(2);
+ tree->connect("button_pressed", this, "_cell_button_pressed");
+ tree->set_columns(3);
tree->set_column_min_width(0, 3);
tree->set_column_min_width(1, 1);
+ tree->set_column_min_width(2, 1);
tree->set_column_expand(0, true);
tree->set_column_expand(1, true);
+ tree->set_column_expand(2, true);
tree->set_v_size_flags(SIZE_EXPAND_FILL);
tree->set_drag_forwarding(this);
diff --git a/editor/plugins/resource_preloader_editor_plugin.h b/editor/plugins/resource_preloader_editor_plugin.h
index 6e04c70741..e737157785 100644
--- a/editor/plugins/resource_preloader_editor_plugin.h
+++ b/editor/plugins/resource_preloader_editor_plugin.h
@@ -42,6 +42,10 @@ class ResourcePreloaderEditor : public PanelContainer {
GDCLASS(ResourcePreloaderEditor, PanelContainer);
+ enum {
+ BUTTON_SUBSCENE = 0,
+ };
+
Button *load;
Button *_delete;
Button *paste;
@@ -61,6 +65,7 @@ class ResourcePreloaderEditor : public PanelContainer {
void _delete_pressed();
void _delete_confirm_pressed();
void _update_library();
+ void _cell_button_pressed(Object *p_item, int p_column, int p_id);
void _item_edited();
UndoRedo *undo_redo;
diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp
index d18422c0c0..bd8c502a80 100644
--- a/editor/plugins/script_editor_plugin.cpp
+++ b/editor/plugins/script_editor_plugin.cpp
@@ -148,8 +148,6 @@ public:
}
};
-#define SORT_SCRIPT_LIST
-
void ScriptEditorQuickOpen::popup(const Vector<String> &p_functions, bool p_dontclear) {
popup_centered_ratio(0.6);
@@ -429,36 +427,32 @@ void ScriptEditor::_add_recent_script(String p_path) {
return;
}
- // remove if already stored
- int already_recent = previous_scripts.find(p_path);
- if (already_recent >= 0) {
- previous_scripts.remove(already_recent);
+ Array rc = EditorSettings::get_singleton()->get_project_metadata("recent_files", "scripts", Array());
+ if (rc.find(p_path) != -1) {
+ rc.erase(p_path);
+ }
+ rc.push_front(p_path);
+ if (rc.size() > 10) {
+ rc.resize(10);
}
- // add to list
- previous_scripts.insert(0, p_path);
-
+ EditorSettings::get_singleton()->set_project_metadata("recent_files", "scripts", rc);
_update_recent_scripts();
}
void ScriptEditor::_update_recent_scripts() {
- // make sure we don't exceed max size
- const int max_history = EDITOR_DEF("text_editor/files/maximum_recent_files", 20);
- if (previous_scripts.size() > max_history) {
- previous_scripts.resize(max_history);
- }
-
+ Array rc = EditorSettings::get_singleton()->get_project_metadata("recent_files", "scripts", Array());
recent_scripts->clear();
recent_scripts->add_shortcut(ED_SHORTCUT("script_editor/open_recent", TTR("Open Recent"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_T));
recent_scripts->add_separator();
- const int max_shown = 8;
- for (int i = 0; i < previous_scripts.size() && i <= max_shown; i++) {
- String path = previous_scripts.get(i);
- // just show script name and last dir
- recent_scripts->add_item(path.get_slice("/", path.get_slice_count("/") - 2) + "/" + path.get_file());
+ String path;
+ for (int i = 0; i < rc.size(); i++) {
+
+ path = rc[i];
+ recent_scripts->add_item(path.replace("res://", ""));
}
recent_scripts->add_separator();
@@ -471,7 +465,7 @@ void ScriptEditor::_open_recent_script(int p_idx) {
// clear button
if (p_idx == recent_scripts->get_item_count() - 1) {
- previous_scripts.clear();
+ EditorSettings::get_singleton()->set_project_metadata("recent_files", "scripts", Array());
call_deferred("_update_recent_scripts");
return;
}
@@ -481,22 +475,34 @@ void ScriptEditor::_open_recent_script(int p_idx) {
p_idx -= 2;
}
- if (p_idx < previous_scripts.size() && p_idx >= 0) {
+ Array rc = EditorSettings::get_singleton()->get_project_metadata("recent_files", "scripts", Array());
+ ERR_FAIL_INDEX(p_idx, rc.size());
- String path = previous_scripts.get(p_idx);
- // if its not on disk its a help file or deleted
- if (FileAccess::exists(path)) {
- Ref<Script> script = ResourceLoader::load(path);
- if (script.is_valid()) {
- edit(script, true);
- }
- // if it's a path then its most likely a delted file not help
- } else if (!path.is_resource_file()) {
- _help_class_open(path);
+ String path = rc[p_idx];
+ // if its not on disk its a help file or deleted
+ if (FileAccess::exists(path)) {
+ Ref<Script> script = ResourceLoader::load(path);
+ if (script.is_valid()) {
+ edit(script, true);
+ return;
}
- previous_scripts.remove(p_idx);
- _update_recent_scripts();
+
+ // if it's a path then its most likely a deleted file not help
+ } else if (!path.is_resource_file()) {
+ _help_class_open(path);
+ return;
}
+
+ rc.remove(p_idx);
+ EditorSettings::get_singleton()->set_project_metadata("recent_files", "scripts", rc);
+ _update_recent_scripts();
+ _show_error_dialog(path);
+}
+
+void ScriptEditor::_show_error_dialog(String p_path) {
+
+ error_dialog->set_text(vformat(TTR("Can't open '%s'. The file could have been moved or deleted."), p_path));
+ error_dialog->popup_centered_minsize();
}
void ScriptEditor::_close_tab(int p_idx, bool p_save) {
@@ -508,14 +514,10 @@ void ScriptEditor::_close_tab(int p_idx, bool p_save) {
Node *tselected = tab_container->get_child(selected);
ScriptEditorBase *current = Object::cast_to<ScriptEditorBase>(tab_container->get_child(selected));
if (current) {
- _add_recent_script(current->get_edited_script()->get_path());
if (p_save) {
apply_scripts();
}
notify_script_close(current->get_edited_script());
- } else {
- EditorHelp *help = Object::cast_to<EditorHelp>(tab_container->get_child(selected));
- _add_recent_script(help->get_class());
}
// roll back to previous tab
@@ -1328,11 +1330,12 @@ void ScriptEditor::_members_overview_selected(int p_idx) {
if (!se) {
return;
}
- // Go to the member's line and reset the cursor column. We can't just change scroll_position
- // directly, since code might be folded.
+ // Go to the member's line and reset the cursor column. We can't change scroll_position
+ // directly until we have gone to the line first, since code might be folded.
se->goto_line(members_overview->get_item_metadata(p_idx));
Dictionary state = se->get_edit_state();
state["column"] = 0;
+ state["scroll_position"] = members_overview->get_item_metadata(p_idx);
se->set_edit_state(state);
}
@@ -1690,28 +1693,42 @@ bool ScriptEditor::edit(const Ref<Script> &p_script, int p_line, int p_col, bool
String path = EditorSettings::get_singleton()->get("text_editor/external/exec_path");
String flags = EditorSettings::get_singleton()->get("text_editor/external/exec_flags");
- Dictionary keys;
- keys["project"] = ProjectSettings::get_singleton()->get_resource_path();
- keys["file"] = ProjectSettings::get_singleton()->globalize_path(p_script->get_path());
- keys["line"] = p_line >= 0 ? p_line : 0;
- keys["col"] = p_col;
-
- flags = flags.format(keys).strip_edges().replace("\\\\", "\\");
-
List<String> args;
if (flags.size()) {
- int from = 0, to = 0;
+ String project_path = ProjectSettings::get_singleton()->get_resource_path();
+ String script_path = ProjectSettings::get_singleton()->globalize_path(p_script->get_path());
+
+ flags = flags.replacen("{line}", itos(p_line > 0 ? p_line : 0));
+ flags = flags.replacen("{col}", itos(p_col));
+ flags = flags.strip_edges().replace("\\\\", "\\");
+
+ int from = 0;
+ int num_chars = 0;
bool inside_quotes = false;
+
for (int i = 0; i < flags.size(); i++) {
+
if (flags[i] == '"' && (!i || flags[i - 1] != '\\')) {
+
+ if (!inside_quotes) {
+ from++;
+ }
inside_quotes = !inside_quotes;
+
} else if (flags[i] == '\0' || (!inside_quotes && flags[i] == ' ')) {
- args.push_back(flags.substr(from, to));
+
+ String arg = flags.substr(from, num_chars);
+
+ // do path replacement here, else there will be issues with spaces and quotes
+ arg = arg.replacen("{project}", project_path);
+ arg = arg.replacen("{file}", script_path);
+ args.push_back(arg);
+
from = i + 1;
- to = 0;
+ num_chars = 0;
} else {
- to++;
+ num_chars++;
}
}
}
@@ -1787,6 +1804,7 @@ bool ScriptEditor::edit(const Ref<Script> &p_script, int p_line, int p_col, bool
se->goto_line(p_line - 1);
notify_script_changed(p_script);
+ _add_recent_script(p_script->get_path());
return true;
}
@@ -2304,6 +2322,7 @@ void ScriptEditor::_help_class_open(const String &p_class) {
_go_to_tab(tab_container->get_tab_count() - 1);
eh->go_to_class(p_class, 0);
eh->connect("go_to_help", this, "_help_class_goto");
+ _add_recent_script(p_class);
_update_script_names();
_save_layout();
}
@@ -2332,6 +2351,7 @@ void ScriptEditor::_help_class_goto(const String &p_desc) {
_go_to_tab(tab_container->get_tab_count() - 1);
eh->go_to_help(p_desc);
eh->connect("go_to_help", this, "_help_class_goto");
+ _add_recent_script(eh->get_class());
_update_script_names();
_save_layout();
}
@@ -2586,11 +2606,13 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) {
members_overview = memnew(ItemList);
list_split->add_child(members_overview);
+ members_overview->set_allow_reselect(true);
members_overview->set_custom_minimum_size(Size2(0, 90)); //need to give a bit of limit to avoid it from disappearing
members_overview->set_v_size_flags(SIZE_EXPAND_FILL);
help_overview = memnew(ItemList);
list_split->add_child(help_overview);
+ help_overview->set_allow_reselect(true);
help_overview->set_custom_minimum_size(Size2(0, 90)); //need to give a bit of limit to avoid it from disappearing
help_overview->set_v_size_flags(SIZE_EXPAND_FILL);
@@ -2738,6 +2760,10 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) {
add_child(file_dialog);
file_dialog->connect("file_selected", this, "_file_dialog_action");
+ error_dialog = memnew(AcceptDialog);
+ add_child(error_dialog);
+ error_dialog->get_ok()->set_text(TTR("I see.."));
+
debugger = memnew(ScriptEditorDebugger(editor));
debugger->connect("goto_script_line", this, "_goto_script_line");
debugger->connect("show_debugger", this, "_show_debugger");
diff --git a/editor/plugins/script_editor_plugin.h b/editor/plugins/script_editor_plugin.h
index e60e4cf8c0..e98a4c97a6 100644
--- a/editor/plugins/script_editor_plugin.h
+++ b/editor/plugins/script_editor_plugin.h
@@ -198,6 +198,7 @@ class ScriptEditor : public PanelContainer {
VSplitContainer *list_split;
TabContainer *tab_container;
EditorFileDialog *file_dialog;
+ AcceptDialog *error_dialog;
ConfirmationDialog *erase_tab_confirm;
ScriptCreateDialog *script_create_dialog;
ScriptEditorDebugger *debugger;
@@ -227,8 +228,6 @@ class ScriptEditor : public PanelContainer {
Vector<ScriptHistory> history;
int history_pos;
- Vector<String> previous_scripts;
-
EditorHelpIndex *help_index;
void _tab_changed(int p_which);
@@ -250,6 +249,8 @@ class ScriptEditor : public PanelContainer {
void _update_recent_scripts();
void _open_recent_script(int p_idx);
+ void _show_error_dialog(String p_path);
+
void _close_tab(int p_idx, bool p_save = true);
void _close_current_tab();
diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp
index a3728a1d46..87e92f0807 100644
--- a/editor/plugins/script_text_editor.cpp
+++ b/editor/plugins/script_text_editor.cpp
@@ -519,6 +519,7 @@ void ScriptTextEditor::tag_saved_version() {
void ScriptTextEditor::goto_line(int p_line, bool p_with_error) {
TextEdit *tx = code_editor->get_text_edit();
+ tx->deselect();
tx->unfold_line(p_line);
tx->call_deferred("cursor_set_line", p_line);
}
@@ -1283,12 +1284,9 @@ Variant ScriptTextEditor::get_drag_data_fw(const Point2 &p_point, Control *p_fro
bool ScriptTextEditor::can_drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) const {
Dictionary d = p_data;
- if (d.has("type") &&
- (
-
- String(d["type"]) == "resource" ||
- String(d["type"]) == "files" ||
- String(d["type"]) == "nodes")) {
+ if (d.has("type") && (String(d["type"]) == "resource" ||
+ String(d["type"]) == "files" ||
+ String(d["type"]) == "nodes")) {
return true;
}
@@ -1329,6 +1327,10 @@ void ScriptTextEditor::drop_data_fw(const Point2 &p_point, const Variant &p_data
Dictionary d = p_data;
+ TextEdit *te = code_editor->get_text_edit();
+ int row, col;
+ te->_get_mouse_pos(p_point, row, col);
+
if (d.has("type") && String(d["type"]) == "resource") {
Ref<Resource> res = d["resource"];
@@ -1341,7 +1343,9 @@ void ScriptTextEditor::drop_data_fw(const Point2 &p_point, const Variant &p_data
return;
}
- code_editor->get_text_edit()->insert_text_at_cursor(res->get_path());
+ te->cursor_set_line(row);
+ te->cursor_set_column(col);
+ te->insert_text_at_cursor(res->get_path());
}
if (d.has("type") && String(d["type"]) == "files") {
@@ -1356,7 +1360,9 @@ void ScriptTextEditor::drop_data_fw(const Point2 &p_point, const Variant &p_data
text_to_drop += "\"" + String(files[i]).c_escape() + "\"";
}
- code_editor->get_text_edit()->insert_text_at_cursor(text_to_drop);
+ te->cursor_set_line(row);
+ te->cursor_set_column(col);
+ te->insert_text_at_cursor(text_to_drop);
}
if (d.has("type") && String(d["type"]) == "nodes") {
@@ -1385,7 +1391,9 @@ void ScriptTextEditor::drop_data_fw(const Point2 &p_point, const Variant &p_data
text_to_drop += "\"" + path.c_escape() + "\"";
}
- code_editor->get_text_edit()->insert_text_at_cursor(text_to_drop);
+ te->cursor_set_line(row);
+ te->cursor_set_column(col);
+ te->insert_text_at_cursor(text_to_drop);
}
}
diff --git a/editor/plugins/spatial_editor_plugin.cpp b/editor/plugins/spatial_editor_plugin.cpp
index bd2cdf0dda..63762651d7 100644
--- a/editor/plugins/spatial_editor_plugin.cpp
+++ b/editor/plugins/spatial_editor_plugin.cpp
@@ -318,6 +318,9 @@ void SpatialEditorViewport::_select(Spatial *p_node, bool p_append, bool p_singl
editor_selection->clear();
editor_selection->add_node(p_node);
+ if (Engine::get_singleton()->is_editor_hint())
+ editor->call("edit_node", p_node);
+
} else {
if (editor_selection->is_selected(p_node) && p_single) {
@@ -4775,6 +4778,11 @@ void SpatialEditor::add_control_to_menu_panel(Control *p_control) {
hbc_menu->add_child(p_control);
}
+void SpatialEditor::remove_control_from_menu_panel(Control *p_control) {
+
+ hbc_menu->remove_child(p_control);
+}
+
void SpatialEditor::set_can_preview(Camera *p_preview) {
for (int i = 0; i < 4; i++) {
diff --git a/editor/plugins/spatial_editor_plugin.h b/editor/plugins/spatial_editor_plugin.h
index e12f7affb7..55866cac99 100644
--- a/editor/plugins/spatial_editor_plugin.h
+++ b/editor/plugins/spatial_editor_plugin.h
@@ -605,6 +605,7 @@ public:
UndoRedo *get_undo_redo() { return undo_redo; }
void add_control_to_menu_panel(Control *p_control);
+ void remove_control_from_menu_panel(Control *p_control);
VSplitContainer *get_shader_split();
HSplitContainer *get_palette_split();
diff --git a/editor/plugins/sprite_frames_editor_plugin.cpp b/editor/plugins/sprite_frames_editor_plugin.cpp
index 7a4eee0344..d8d0a6f013 100644
--- a/editor/plugins/sprite_frames_editor_plugin.cpp
+++ b/editor/plugins/sprite_frames_editor_plugin.cpp
@@ -398,8 +398,6 @@ void SpriteFramesEditor::_animation_add() {
animations->grab_focus();
}
void SpriteFramesEditor::_animation_remove() {
-
- //fuck everything
if (updating)
return;
diff --git a/editor/plugins/texture_editor_plugin.cpp b/editor/plugins/texture_editor_plugin.cpp
index 36a578037e..e891850870 100644
--- a/editor/plugins/texture_editor_plugin.cpp
+++ b/editor/plugins/texture_editor_plugin.cpp
@@ -75,6 +75,9 @@ void TextureEditor::_notification(int p_what) {
// In the case of CurveTextures we know they are 1 in height, so fill the preview to see the gradient
ofs_y = 0;
tex_height = size.height;
+ } else if (Object::cast_to<GradientTexture>(*texture)) {
+ ofs_y = size.height / 4.0;
+ tex_height = size.height / 2.0;
}
draw_texture_rect(texture, Rect2(ofs_x, ofs_y, tex_width, tex_height));
diff --git a/editor/plugins/tile_set_editor_plugin.cpp b/editor/plugins/tile_set_editor_plugin.cpp
index dd5127181d..2ff8536b4c 100644
--- a/editor/plugins/tile_set_editor_plugin.cpp
+++ b/editor/plugins/tile_set_editor_plugin.cpp
@@ -1023,6 +1023,9 @@ void AutotileEditor::_on_workspace_input(const Ref<InputEvent> &p_ie) {
}
}
} else if (tools[SHAPE_NEW_POLYGON]->is_pressed()) {
+ if (!tools[TOOL_SELECT]->is_disabled())
+ tools[TOOL_SELECT]->set_disabled(true);
+
if (mb.is_valid()) {
if (mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT) {
Vector2 pos = mb->get_position();
@@ -1089,6 +1092,8 @@ void AutotileEditor::_on_workspace_input(const Ref<InputEvent> &p_ie) {
} else if (mb->is_pressed() && mb->get_button_index() == BUTTON_RIGHT && current_shape.size() > 2) {
if (creating_shape) {
close_shape(shape_anchor);
+ if (tools[TOOL_SELECT]->is_disabled())
+ tools[TOOL_SELECT]->set_disabled(false);
}
}
} else if (mm.is_valid()) {
diff --git a/editor/project_settings_editor.cpp b/editor/project_settings_editor.cpp
index 058f517ae9..9625bc19c0 100644
--- a/editor/project_settings_editor.cpp
+++ b/editor/project_settings_editor.cpp
@@ -1595,7 +1595,7 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) {
hbc->set_h_size_flags(Control::SIZE_EXPAND_FILL);
props_base->add_child(hbc);
- search_button = memnew(ToolButton);
+ search_button = memnew(Button);
search_button->set_toggle_mode(true);
search_button->set_pressed(false);
search_button->set_text(TTR("Search"));
diff --git a/editor/project_settings_editor.h b/editor/project_settings_editor.h
index d6c2c0f5a8..452cf5b060 100644
--- a/editor/project_settings_editor.h
+++ b/editor/project_settings_editor.h
@@ -67,7 +67,7 @@ class ProjectSettingsEditor : public AcceptDialog {
SectionedPropertyEditor *globals_editor;
HBoxContainer *search_bar;
- ToolButton *search_button;
+ Button *search_button;
LineEdit *search_box;
ToolButton *clear_button;
diff --git a/editor/property_editor.cpp b/editor/property_editor.cpp
index 87906c5a93..043add046e 100644
--- a/editor/property_editor.cpp
+++ b/editor/property_editor.cpp
@@ -2695,7 +2695,7 @@ TreeItem *PropertyEditor::get_parent_node(String p_path, HashMap<String, TreeIte
item->set_editable(1, false);
item->set_selectable(1, subsection_selectable);
- if (use_folding) { //
+ if (use_folding) {
if (!obj->editor_is_section_unfolded(p_path)) {
updating_folding = true;
item->set_collapsed(true);
@@ -3015,7 +3015,7 @@ void PropertyEditor::update_tree() {
item->set_tooltip(1, obj->get(p.name) ? "True" : "False");
item->set_checked(1, obj->get(p.name));
if (show_type_icons)
- item->set_icon(0, get_icon("Bool", "EditorIcons"));
+ item->set_icon(0, get_icon("bool", "EditorIcons"));
item->set_editable(1, !read_only);
} break;
@@ -3135,12 +3135,12 @@ void PropertyEditor::update_tree() {
if (p.type == Variant::REAL) {
if (show_type_icons)
- item->set_icon(0, get_icon("Real", "EditorIcons"));
+ item->set_icon(0, get_icon("float", "EditorIcons"));
item->set_range(1, obj->get(p.name));
} else {
if (show_type_icons)
- item->set_icon(0, get_icon("Integer", "EditorIcons"));
+ item->set_icon(0, get_icon("int", "EditorIcons"));
item->set_range(1, obj->get(p.name));
}
@@ -3246,7 +3246,7 @@ void PropertyEditor::update_tree() {
item->set_text(1, type_name + "[]");
if (show_type_icons)
- item->set_icon(0, get_icon("ArrayData", "EditorIcons"));
+ item->set_icon(0, get_icon("PoolByteArray", "EditorIcons"));
} break;
case Variant::DICTIONARY: {
@@ -3258,7 +3258,7 @@ void PropertyEditor::update_tree() {
item->add_button(1, get_icon("EditResource", "EditorIcons"));
if (show_type_icons)
- item->set_icon(0, get_icon("DictionaryData", "EditorIcons"));
+ item->set_icon(0, get_icon("Dictionary", "EditorIcons"));
} break;
@@ -3273,7 +3273,7 @@ void PropertyEditor::update_tree() {
else
item->set_text(1, "IntArray[]");
if (show_type_icons)
- item->set_icon(0, get_icon("ArrayInt", "EditorIcons"));
+ item->set_icon(0, get_icon("PoolIntArray", "EditorIcons"));
} break;
case Variant::POOL_REAL_ARRAY: {
@@ -3287,7 +3287,7 @@ void PropertyEditor::update_tree() {
else
item->set_text(1, "FloatArray[]");
if (show_type_icons)
- item->set_icon(0, get_icon("ArrayReal", "EditorIcons"));
+ item->set_icon(0, get_icon("PoolRealArray", "EditorIcons"));
} break;
case Variant::POOL_STRING_ARRAY: {
@@ -3301,7 +3301,7 @@ void PropertyEditor::update_tree() {
else
item->set_text(1, "String[]");
if (show_type_icons)
- item->set_icon(0, get_icon("ArrayString", "EditorIcons"));
+ item->set_icon(0, get_icon("PoolStringArray", "EditorIcons"));
} break;
case Variant::POOL_BYTE_ARRAY: {
@@ -3315,7 +3315,7 @@ void PropertyEditor::update_tree() {
else
item->set_text(1, "Byte[]");
if (show_type_icons)
- item->set_icon(0, get_icon("ArrayData", "EditorIcons"));
+ item->set_icon(0, get_icon("PoolByteArray", "EditorIcons"));
} break;
case Variant::POOL_VECTOR2_ARRAY: {
@@ -3343,7 +3343,7 @@ void PropertyEditor::update_tree() {
else
item->set_text(1, "Vector3[]");
if (show_type_icons)
- item->set_icon(0, get_icon("Vector", "EditorIcons"));
+ item->set_icon(0, get_icon("Vector3", "EditorIcons"));
} break;
case Variant::POOL_COLOR_ARRAY: {
@@ -3384,7 +3384,7 @@ void PropertyEditor::update_tree() {
item->set_editable(1, true);
item->set_text(1, obj->get(p.name));
if (show_type_icons)
- item->set_icon(0, get_icon("Vector", "EditorIcons"));
+ item->set_icon(0, get_icon("Vector3", "EditorIcons"));
} break;
case Variant::TRANSFORM2D:
@@ -3393,6 +3393,7 @@ void PropertyEditor::update_tree() {
item->set_cell_mode(1, TreeItem::CELL_MODE_CUSTOM);
item->set_editable(1, true);
item->set_text(1, obj->get(p.name));
+
} break;
case Variant::TRANSFORM: {
@@ -3400,7 +3401,7 @@ void PropertyEditor::update_tree() {
item->set_editable(1, true);
item->set_text(1, obj->get(p.name));
if (show_type_icons)
- item->set_icon(0, get_icon("Matrix", "EditorIcons"));
+ item->set_icon(0, get_icon("Transform", "EditorIcons"));
} break;
case Variant::PLANE: {
@@ -3419,6 +3420,7 @@ void PropertyEditor::update_tree() {
item->set_text(1, "AABB");
if (show_type_icons)
item->set_icon(0, get_icon("AABB", "EditorIcons"));
+
} break;
case Variant::QUAT: {
@@ -3446,6 +3448,8 @@ void PropertyEditor::update_tree() {
item->set_editable(1, !read_only);
item->set_text(1, obj->get(p.name));
item->add_button(1, get_icon("CopyNodePath", "EditorIcons"));
+ if (show_type_icons)
+ item->set_icon(0, get_icon("NodePath", "EditorIcons"));
} break;
case Variant::OBJECT: {
@@ -4332,7 +4336,7 @@ PropertyEditor::PropertyEditor() {
use_filter = false;
subsection_selectable = false;
property_selectable = false;
- show_type_icons = false; // maybe one day will return.
+ show_type_icons = EDITOR_DEF("interface/editor/show_type_icons", false);
}
PropertyEditor::~PropertyEditor() {
diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp
index 41ee5ab286..8506c75a68 100644
--- a/editor/scene_tree_dock.cpp
+++ b/editor/scene_tree_dock.cpp
@@ -67,6 +67,9 @@ void SceneTreeDock::_unhandled_key_input(Ref<InputEvent> p_event) {
if (get_viewport()->get_modal_stack_top())
return; //ignore because of modal window
+ if (get_focus_owner() && get_focus_owner()->is_text_field())
+ return;
+
if (!p_event->is_pressed() || p_event->is_echo())
return;
diff --git a/editor/scene_tree_editor.cpp b/editor/scene_tree_editor.cpp
index fd21b83605..0a3e2da5e9 100644
--- a/editor/scene_tree_editor.cpp
+++ b/editor/scene_tree_editor.cpp
@@ -69,24 +69,10 @@ void SceneTreeEditor::_cell_button_pressed(Object *p_item, int p_column, int p_i
emit_signal("open_script", script);
} else if (p_id == BUTTON_VISIBILITY) {
-
- if (n->is_class("Spatial")) {
-
- bool v = bool(n->call("is_visible"));
- undo_redo->create_action(TTR("Toggle Spatial Visible"));
- undo_redo->add_do_method(n, "set_visible", !v);
- undo_redo->add_undo_method(n, "set_visible", v);
- undo_redo->commit_action();
-
- } else if (n->is_class("CanvasItem")) {
-
- bool v = bool(n->call("is_visible"));
- undo_redo->create_action(TTR("Toggle CanvasItem Visible"));
- undo_redo->add_do_method(n, v ? "hide" : "show");
- undo_redo->add_undo_method(n, v ? "show" : "hide");
- undo_redo->commit_action();
- }
-
+ undo_redo->create_action(TTR("Toggle Visible"));
+ undo_redo->add_do_method(this, "toggle_visible", n);
+ undo_redo->add_undo_method(this, "toggle_visible", n);
+ undo_redo->commit_action();
} else if (p_id == BUTTON_LOCK) {
if (n->is_class("CanvasItem") || n->is_class("Spatial")) {
@@ -131,7 +117,34 @@ void SceneTreeEditor::_cell_button_pressed(Object *p_item, int p_column, int p_i
NodeDock::singleton->show_groups();
}
}
+void SceneTreeEditor::_toggle_visible(Node *p_node) {
+ if (p_node->is_class("Spatial")) {
+ bool v = bool(p_node->call("is_visible"));
+ p_node->call("set_visible", !v);
+ } else if (p_node->is_class("CanvasItem")) {
+ bool v = bool(p_node->call("is_visible"));
+ if (v) {
+ p_node->call("hide");
+ } else {
+ p_node->call("show");
+ }
+ }
+}
+void SceneTreeEditor::toggle_visible(Node *p_node) {
+ _toggle_visible(p_node);
+ List<Node *> selection = editor_selection->get_selected_node_list();
+ if (selection.size() > 1) {
+ for (List<Node *>::Element *E = selection.front(); E; E = E->next()) {
+ Node *nv = E->get();
+ ERR_FAIL_COND(!nv);
+ if (nv == p_node) {
+ continue;
+ }
+ _toggle_visible(nv);
+ }
+ }
+}
bool SceneTreeEditor::_add_nodes(Node *p_node, TreeItem *p_parent) {
if (!p_node)
@@ -949,6 +962,8 @@ void SceneTreeEditor::_bind_methods() {
ClassDB::bind_method("_cell_collapsed", &SceneTreeEditor::_cell_collapsed);
ClassDB::bind_method("_rmb_select", &SceneTreeEditor::_rmb_select);
ClassDB::bind_method("_warning_changed", &SceneTreeEditor::_warning_changed);
+ ClassDB::bind_method("_toggle_visible", &SceneTreeEditor::_toggle_visible);
+ ClassDB::bind_method("toggle_visible", &SceneTreeEditor::toggle_visible);
ClassDB::bind_method("_node_script_changed", &SceneTreeEditor::_node_script_changed);
ClassDB::bind_method("_node_visibility_changed", &SceneTreeEditor::_node_visibility_changed);
diff --git a/editor/scene_tree_editor.h b/editor/scene_tree_editor.h
index 45194bb81d..b63eb2a1f0 100644
--- a/editor/scene_tree_editor.h
+++ b/editor/scene_tree_editor.h
@@ -70,6 +70,8 @@ class SceneTreeEditor : public Control {
void _compute_hash(Node *p_node, uint64_t &hash);
+ void toggle_visible(Node *p_node);
+
bool _add_nodes(Node *p_node, TreeItem *p_parent);
void _test_update_tree();
void _update_tree();
@@ -103,6 +105,7 @@ class SceneTreeEditor : public Control {
static void _bind_methods();
void _cell_button_pressed(Object *p_item, int p_column, int p_id);
+ void _toggle_visible(Node *p_node);
void _cell_multi_selected(Object *p_object, int p_cell, bool p_selected);
void _update_selection(TreeItem *item);
void _node_script_changed(Node *p_node);
diff --git a/editor/script_create_dialog.cpp b/editor/script_create_dialog.cpp
index cee356b930..e56a7f2a55 100644
--- a/editor/script_create_dialog.cpp
+++ b/editor/script_create_dialog.cpp
@@ -51,7 +51,9 @@ void ScriptCreateDialog::_notification(int p_what) {
void ScriptCreateDialog::config(const String &p_base_name, const String &p_base_path) {
class_name->set_text("");
+ class_name->deselect();
parent_name->set_text(p_base_name);
+ parent_name->deselect();
if (p_base_path != "") {
initial_bp = p_base_path.get_basename();
file_path->set_text(initial_bp + "." + ScriptServer::get_language(language_menu->get_selected())->get_extension());
@@ -59,8 +61,9 @@ void ScriptCreateDialog::config(const String &p_base_name, const String &p_base_
initial_bp = "";
file_path->set_text("");
}
+ file_path->deselect();
+
_lang_changed(current_language);
- _parent_name_changed(parent_name->get_text());
_class_name_changed("");
_path_changed(file_path->get_text());
}
@@ -290,6 +293,7 @@ void ScriptCreateDialog::_lang_changed(int l) {
_template_changed(template_menu->get_selected());
EditorSettings::get_singleton()->set_project_metadata("script_setup", "last_selected_language", language_menu->get_item_text(language_menu->get_selected()));
+ _parent_name_changed(parent_name->get_text());
_update_dialog();
}
@@ -303,11 +307,19 @@ void ScriptCreateDialog::_built_in_pressed() {
_update_dialog();
}
-void ScriptCreateDialog::_browse_path(bool browse_parent) {
+void ScriptCreateDialog::_browse_path(bool browse_parent, bool p_save) {
is_browsing_parent = browse_parent;
- file_browse->set_mode(EditorFileDialog::MODE_SAVE_FILE);
+ if (p_save) {
+ file_browse->set_mode(EditorFileDialog::MODE_SAVE_FILE);
+ file_browse->set_title(TTR("Open Script/Choose Location"));
+ file_browse->get_ok()->set_text(TTR("Open"));
+ } else {
+ file_browse->set_mode(EditorFileDialog::MODE_OPEN_FILE);
+ file_browse->set_title(TTR("Open Script"));
+ }
+
file_browse->set_disable_overwrite_warning(true);
file_browse->clear_filters();
List<String> extensions;
@@ -380,8 +392,6 @@ void ScriptCreateDialog::_path_changed(const String &p_path) {
is_new_script_created = false;
is_path_valid = true;
_msg_path_valid(true, TTR("File exists, will be reused"));
- } else {
- path_error_label->set_text("");
}
memdelete(f);
_update_dialog();
@@ -533,10 +543,8 @@ void ScriptCreateDialog::_update_dialog() {
internal->set_disabled(!supports_built_in);
if (is_built_in) {
_msg_path_valid(true, TTR("Built-in script (into scene file)"));
- } else {
- if (script_ok) {
- _msg_path_valid(true, TTR("Create new script file"));
- }
+ } else if (is_path_valid) {
+ _msg_path_valid(true, TTR("Create new script file"));
}
} else {
// Script Loaded
@@ -544,7 +552,7 @@ void ScriptCreateDialog::_update_dialog() {
parent_name->set_editable(false);
parent_browse_button->set_disabled(true);
internal->set_disabled(true);
- if (script_ok) {
+ if (is_path_valid) {
_msg_path_valid(true, TTR("Load existing script file"));
}
}
@@ -678,7 +686,7 @@ ScriptCreateDialog::ScriptCreateDialog() {
hb->add_child(parent_name);
parent_browse_button = memnew(Button);
parent_browse_button->set_flat(true);
- parent_browse_button->connect("pressed", this, "_browse_path", varray(true));
+ parent_browse_button->connect("pressed", this, "_browse_path", varray(true, false));
hb->add_child(parent_browse_button);
l = memnew(Label);
l->set_text(TTR("Inherits"));
@@ -730,7 +738,7 @@ ScriptCreateDialog::ScriptCreateDialog() {
hb->add_child(file_path);
path_button = memnew(Button);
path_button->set_flat(true);
- path_button->connect("pressed", this, "_browse_path", varray(false));
+ path_button->connect("pressed", this, "_browse_path", varray(false, true));
hb->add_child(path_button);
l = memnew(Label);
l->set_text(TTR("Path"));
@@ -742,6 +750,7 @@ ScriptCreateDialog::ScriptCreateDialog() {
file_browse = memnew(EditorFileDialog);
file_browse->connect("file_selected", this, "_file_selected");
+ file_browse->set_mode(EditorFileDialog::MODE_OPEN_FILE);
add_child(file_browse);
get_ok()->set_text(TTR("Create"));
alert = memnew(AcceptDialog);
diff --git a/editor/script_create_dialog.h b/editor/script_create_dialog.h
index b5afe2e38e..99e5bc9e6a 100644
--- a/editor/script_create_dialog.h
+++ b/editor/script_create_dialog.h
@@ -81,7 +81,7 @@ class ScriptCreateDialog : public ConfirmationDialog {
void _class_name_changed(const String &p_name);
void _parent_name_changed(const String &p_parent);
void _template_changed(int p_template = 0);
- void _browse_path(bool browse_parent);
+ void _browse_path(bool browse_parent, bool p_save);
void _file_selected(const String &p_file);
virtual void ok_pressed();
void _create_new();
diff --git a/editor/script_editor_debugger.cpp b/editor/script_editor_debugger.cpp
index d0527a13ea..86ab84909e 100644
--- a/editor/script_editor_debugger.cpp
+++ b/editor/script_editor_debugger.cpp
@@ -193,6 +193,12 @@ public:
}
};
+void ScriptEditorDebugger::debug_copy() {
+ String msg = reason->get_text();
+ if (msg == "") return;
+ OS::get_singleton()->set_clipboard(msg);
+}
+
void ScriptEditorDebugger::debug_next() {
ERR_FAIL_COND(!breaked);
@@ -338,6 +344,7 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da
step->set_disabled(!can_continue);
next->set_disabled(!can_continue);
_set_reason_text(error, MESSAGE_ERROR);
+ copy->set_disabled(false);
breaked = true;
dobreak->set_disabled(true);
docontinue->set_disabled(false);
@@ -354,6 +361,7 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da
} else if (p_msg == "debug_exit") {
breaked = false;
+ copy->set_disabled(true);
step->set_disabled(true);
next->set_disabled(true);
reason->set_text("");
@@ -940,6 +948,8 @@ void ScriptEditorDebugger::_notification(int p_what) {
inspector->edit(variables);
+ copy->set_icon(get_icon("Duplicate", "EditorIcons"));
+
step->set_icon(get_icon("DebugStep", "EditorIcons"));
next->set_icon(get_icon("DebugNext", "EditorIcons"));
back->set_icon(get_icon("Back", "EditorIcons"));
@@ -1741,6 +1751,9 @@ void ScriptEditorDebugger::_item_menu_id_pressed(int p_option) {
void ScriptEditorDebugger::_bind_methods() {
ClassDB::bind_method(D_METHOD("_stack_dump_frame_selected"), &ScriptEditorDebugger::_stack_dump_frame_selected);
+
+ ClassDB::bind_method(D_METHOD("debug_copy"), &ScriptEditorDebugger::debug_copy);
+
ClassDB::bind_method(D_METHOD("debug_next"), &ScriptEditorDebugger::debug_next);
ClassDB::bind_method(D_METHOD("debug_step"), &ScriptEditorDebugger::debug_step);
ClassDB::bind_method(D_METHOD("debug_break"), &ScriptEditorDebugger::debug_break);
@@ -1816,6 +1829,13 @@ ScriptEditorDebugger::ScriptEditorDebugger(EditorNode *p_editor) {
hbc->add_child(memnew(VSeparator));
+ copy = memnew(ToolButton);
+ hbc->add_child(copy);
+ copy->set_tooltip(TTR("Copy Error"));
+ copy->connect("pressed", this, "debug_copy");
+
+ hbc->add_child(memnew(VSeparator));
+
step = memnew(ToolButton);
hbc->add_child(step);
step->set_tooltip(TTR("Step Into"));
diff --git a/editor/script_editor_debugger.h b/editor/script_editor_debugger.h
index e86add940a..669d8737fe 100644
--- a/editor/script_editor_debugger.h
+++ b/editor/script_editor_debugger.h
@@ -104,6 +104,7 @@ class ScriptEditorDebugger : public Control {
Label *reason;
+ Button *copy;
Button *step;
Button *next;
Button *back;
@@ -197,6 +198,8 @@ public:
void unpause();
void stop();
+ void debug_copy();
+
void debug_next();
void debug_step();
void debug_break();
diff --git a/editor/spatial_editor_gizmos.cpp b/editor/spatial_editor_gizmos.cpp
index 72c0f050d2..8c90d86b9e 100644
--- a/editor/spatial_editor_gizmos.cpp
+++ b/editor/spatial_editor_gizmos.cpp
@@ -308,15 +308,6 @@ void EditorSpatialGizmo::add_solid_box(Ref<Material> &p_material, Vector3 p_size
m->add_surface_from_arrays(cubem.surface_get_primitive_type(0), cubem.surface_get_arrays(0));
m->surface_set_material(0, p_material);
add_mesh(m);
-
- Instance ins;
- ins.mesh = m;
- if (valid) {
- ins.create_instance(spatial_node);
- VS::get_singleton()->instance_set_transform(ins.instance, spatial_node->get_global_transform());
- }
-
- instances.push_back(ins);
}
void EditorSpatialGizmo::set_spatial_node(Spatial *p_node) {
@@ -1130,7 +1121,7 @@ void CameraSpatialGizmo::set_handle(int p_idx, Camera *p_camera, const Point2 &p
if (camera->get_projection() == Camera::PROJECTION_PERSPECTIVE) {
Transform gt = camera->get_global_transform();
float a = _find_closest_angle_to_half_pi_arc(s[0], s[1], 1.0, gt);
- camera->set("fov", a);
+ camera->set("fov", a * 2.0);
} else {
Vector3 ra, rb;
@@ -1187,7 +1178,8 @@ void CameraSpatialGizmo::redraw() {
case Camera::PROJECTION_PERSPECTIVE: {
- float fov = camera->get_fov();
+ // The real FOV is halved for accurate representation
+ float fov = camera->get_fov() / 2.0;
Vector3 side = Vector3(Math::sin(Math::deg2rad(fov)), 0, -Math::cos(Math::deg2rad(fov)));
Vector3 nside = side;