summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
Diffstat (limited to 'editor')
-rw-r--r--editor/code_editor.cpp73
-rw-r--r--editor/code_editor.h4
-rw-r--r--editor/editor_file_dialog.h1
-rw-r--r--editor/editor_node.cpp27
-rw-r--r--editor/editor_settings.cpp4
-rw-r--r--editor/icons/icon_issue.svg70
-rw-r--r--editor/plugins/mesh_library_editor_plugin.cpp5
-rw-r--r--editor/plugins/script_editor_plugin.cpp17
-rw-r--r--editor/plugins/script_editor_plugin.h2
-rw-r--r--editor/plugins/script_text_editor.cpp110
-rw-r--r--editor/plugins/script_text_editor.h1
-rw-r--r--editor/plugins/shader_editor_plugin.cpp50
-rw-r--r--editor/plugins/spatial_editor_plugin.cpp4
-rw-r--r--editor/project_settings_editor.cpp2
-rw-r--r--editor/scene_tree_dock.cpp17
15 files changed, 226 insertions, 161 deletions
diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp
index 7ee4d5b03b..0b06839ecf 100644
--- a/editor/code_editor.cpp
+++ b/editor/code_editor.cpp
@@ -1085,6 +1085,79 @@ void CodeTextEditor::clone_lines_down() {
text_editor->update();
}
+void CodeTextEditor::toggle_inline_comment(const String &delimiter) {
+ text_editor->begin_complex_operation();
+ if (text_editor->is_selection_active()) {
+ int begin = text_editor->get_selection_from_line();
+ int end = text_editor->get_selection_to_line();
+
+ // End of selection ends on the first column of the last line, ignore it.
+ if (text_editor->get_selection_to_column() == 0)
+ end -= 1;
+
+ int col_to = text_editor->get_selection_to_column();
+ int cursor_pos = text_editor->cursor_get_column();
+
+ // Check if all lines in the selected block are commented
+ bool is_commented = true;
+ for (int i = begin; i <= end; i++) {
+ if (!text_editor->get_line(i).begins_with(delimiter)) {
+ is_commented = false;
+ break;
+ }
+ }
+ for (int i = begin; i <= end; i++) {
+ String line_text = text_editor->get_line(i);
+
+ if (line_text.strip_edges().empty()) {
+ line_text = delimiter;
+ } else {
+ if (is_commented) {
+ line_text = line_text.substr(delimiter.length(), line_text.length());
+ } else {
+ line_text = delimiter + line_text;
+ }
+ }
+ text_editor->set_line(i, line_text);
+ }
+
+ // Adjust selection & cursor position.
+ int offset = (is_commented ? -1 : 1) * delimiter.length();
+ int col_from = text_editor->get_selection_from_column() > 0 ? text_editor->get_selection_from_column() + offset : 0;
+
+ if (is_commented && text_editor->cursor_get_column() == text_editor->get_line(text_editor->cursor_get_line()).length() + 1)
+ cursor_pos += 1;
+
+ if (text_editor->get_selection_to_column() != 0 && col_to != text_editor->get_line(text_editor->get_selection_to_line()).length() + 1)
+ col_to += offset;
+
+ if (text_editor->cursor_get_column() != 0)
+ cursor_pos += offset;
+
+ text_editor->select(begin, col_from, text_editor->get_selection_to_line(), col_to);
+ text_editor->cursor_set_column(cursor_pos);
+
+ } else {
+ int begin = text_editor->cursor_get_line();
+ String line_text = text_editor->get_line(begin);
+ int delimiter_length = delimiter.length();
+
+ int col = text_editor->cursor_get_column();
+ if (line_text.begins_with(delimiter)) {
+ line_text = line_text.substr(delimiter_length, line_text.length());
+ col -= delimiter_length;
+ } else {
+ line_text = delimiter + line_text;
+ col += delimiter_length;
+ }
+
+ text_editor->set_line(begin, line_text);
+ text_editor->cursor_set_column(col);
+ }
+ text_editor->end_complex_operation();
+ text_editor->update();
+}
+
void CodeTextEditor::goto_line(int p_line) {
text_editor->deselect();
text_editor->unfold_line(p_line);
diff --git a/editor/code_editor.h b/editor/code_editor.h
index 67e8fc9d3c..e3dbfe1ce0 100644
--- a/editor/code_editor.h
+++ b/editor/code_editor.h
@@ -211,6 +211,10 @@ public:
void delete_lines();
void clone_lines_down();
+ /// Toggle inline comment on currently selected lines, or on current line if nothing is selected,
+ /// by adding or removing comment delimiter
+ void toggle_inline_comment(const String &delimiter);
+
void goto_line(int p_line);
void goto_line_selection(int p_line, int p_begin, int p_end);
diff --git a/editor/editor_file_dialog.h b/editor/editor_file_dialog.h
index 1b9b5f9812..edaccac51d 100644
--- a/editor/editor_file_dialog.h
+++ b/editor/editor_file_dialog.h
@@ -124,7 +124,6 @@ private:
ToolButton *fav_up;
ToolButton *fav_down;
- ToolButton *fav_rm;
ItemList *favorites;
ItemList *recent;
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index 1e03adc219..6140412a32 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -136,10 +136,10 @@ void EditorNode::_update_scene_tabs() {
Ref<Texture> script_icon = gui_base->get_icon("Script", "EditorIcons");
for (int i = 0; i < editor_data.get_edited_scene_count(); i++) {
- String type = editor_data.get_scene_type(i);
+ Node *type_node = editor_data.get_edited_scene_root(i);
Ref<Texture> icon;
- if (type != String()) {
- icon = get_class_icon(type, "Node");
+ if (type_node) {
+ icon = EditorNode::get_singleton()->get_object_icon(type_node, "Node");
}
int current = editor_data.get_edited_scene();
@@ -4232,7 +4232,13 @@ bool EditorNode::are_bottom_panels_hidden() const {
void EditorNode::hide_bottom_panel() {
- _bottom_panel_switch(false, 0);
+ for (int i = 0; i < bottom_panel_items.size(); i++) {
+
+ if (bottom_panel_items[i].control->is_visible()) {
+ _bottom_panel_switch(false, i);
+ break;
+ }
+ }
}
void EditorNode::make_bottom_panel_item_visible(Control *p_item) {
@@ -4269,7 +4275,7 @@ void EditorNode::remove_bottom_panel_item(Control *p_item) {
if (bottom_panel_items[i].control == p_item) {
if (p_item->is_visible_in_tree()) {
- _bottom_panel_switch(false, 0);
+ _bottom_panel_switch(false, i);
}
bottom_panel_vb->remove_child(bottom_panel_items[i].control);
bottom_panel_hb_editors->remove_child(bottom_panel_items[i].button);
@@ -4289,6 +4295,10 @@ void EditorNode::_bottom_panel_switch(bool p_enable, int p_idx) {
ERR_FAIL_INDEX(p_idx, bottom_panel_items.size());
+ if (bottom_panel_items[p_idx].control->is_visible() == p_enable) {
+ return;
+ }
+
if (p_enable) {
for (int i = 0; i < bottom_panel_items.size(); i++) {
@@ -4309,11 +4319,8 @@ void EditorNode::_bottom_panel_switch(bool p_enable, int p_idx) {
} else {
bottom_panel->add_style_override("panel", gui_base->get_stylebox("panel", "TabContainer"));
- for (int i = 0; i < bottom_panel_items.size(); i++) {
-
- bottom_panel_items[i].button->set_pressed(false);
- bottom_panel_items[i].control->set_visible(false);
- }
+ bottom_panel_items[p_idx].button->set_pressed(false);
+ bottom_panel_items[p_idx].control->set_visible(false);
center_split->set_dragger_visibility(SplitContainer::DRAGGER_HIDDEN);
center_split->set_collapsed(true);
bottom_panel_raise->hide();
diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp
index 8d590e5268..9166db2741 100644
--- a/editor/editor_settings.cpp
+++ b/editor/editor_settings.cpp
@@ -336,9 +336,9 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
_initial_set("interface/theme/icon_and_font_color", 0);
hints["interface/theme/icon_and_font_color"] = PropertyInfo(Variant::INT, "interface/theme/icon_and_font_color", PROPERTY_HINT_ENUM, "Auto,Dark,Light", PROPERTY_USAGE_DEFAULT);
_initial_set("interface/theme/base_color", Color::html("#323b4f"));
- hints["interface/theme/accent_color"] = PropertyInfo(Variant::COLOR, "interface/theme/accent_color", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT);
- _initial_set("interface/theme/accent_color", Color::html("#699ce8"));
hints["interface/theme/base_color"] = PropertyInfo(Variant::COLOR, "interface/theme/base_color", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT);
+ _initial_set("interface/theme/accent_color", Color::html("#699ce8"));
+ hints["interface/theme/accent_color"] = PropertyInfo(Variant::COLOR, "interface/theme/accent_color", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT);
_initial_set("interface/theme/contrast", 0.25);
hints["interface/theme/contrast"] = PropertyInfo(Variant::REAL, "interface/theme/contrast", PROPERTY_HINT_RANGE, "0.01, 1, 0.01");
_initial_set("interface/theme/relationship_line_opacity", 0.1);
diff --git a/editor/icons/icon_issue.svg b/editor/icons/icon_issue.svg
new file mode 100644
index 0000000000..73e21a9b68
--- /dev/null
+++ b/editor/icons/icon_issue.svg
@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="16"
+ height="16"
+ version="1.1"
+ viewBox="0 0 16 16"
+ id="svg6"
+ sodipodi:docname="icon_issue.svg"
+ inkscape:version="0.92.3 (2405546, 2018-03-11)">
+ <metadata
+ id="metadata12">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <defs
+ id="defs10" />
+ <sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="2242"
+ inkscape:window-height="1224"
+ id="namedview8"
+ showgrid="false"
+ inkscape:zoom="29.5"
+ inkscape:cx="0.93716338"
+ inkscape:cy="15.746557"
+ inkscape:window-x="134"
+ inkscape:window-y="55"
+ inkscape:window-maximized="0"
+ inkscape:current-layer="svg6" />
+ <g
+ transform="translate(0 -1036.4)"
+ id="g4" />
+ <g
+ aria-label="!"
+ transform="matrix(1.2172834,0,0,0.60107067,0.478728,1.8392137)"
+ style="font-style:normal;font-weight:normal;font-size:19.68510056px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:0.92273909"
+ id="text3719">
+ <path
+ d="M 5.2902433,14.98657 H 7.241452 v 2.441414 H 5.2902433 Z m 0,-11.909101 H 7.241452 V 9.3732409 L 7.0492147,12.804677 H 5.4920925 L 5.2902433,9.3732409 Z"
+ style="fill:#e0e0e0;fill-opacity:1;stroke-width:0.92273909"
+ id="path10"
+ inkscape:connector-curvature="0" />
+ </g>
+ <path
+ style="fill:#e0e0e0;fill-opacity:1;stroke-width:0.88671917"
+ d="M 8.0503291,1.1522775 A 6.8983747,6.8983747 0 0 0 1.1522775,8.0503291 6.8983747,6.8983747 0 0 0 8.0503291,14.950113 6.8983747,6.8983747 0 0 0 14.950113,8.0503291 6.8983747,6.8983747 0 0 0 8.0503291,1.1522775 Z M 8.0208873,2.2953139 A 5.6659852,5.6659852 0 0 1 13.687577,7.9602717 5.6659852,5.6659852 0 0 1 8.0208873,13.626961 5.6659852,5.6659852 0 0 1 2.3541977,7.9602717 5.6659852,5.6659852 0 0 1 8.0208873,2.2953139 Z"
+ id="path4526"
+ inkscape:connector-curvature="0" />
+</svg>
diff --git a/editor/plugins/mesh_library_editor_plugin.cpp b/editor/plugins/mesh_library_editor_plugin.cpp
index aedac7b45d..89eb253afe 100644
--- a/editor/plugins/mesh_library_editor_plugin.cpp
+++ b/editor/plugins/mesh_library_editor_plugin.cpp
@@ -127,7 +127,7 @@ void MeshLibraryEditor::_import_scene(Node *p_scene, Ref<MeshLibrary> p_library,
continue;
MeshLibrary::ShapeData shape_data;
shape_data.shape = collision;
- shape_data.local_transform = sb->shape_owner_get_transform(E->get());
+ shape_data.local_transform = sb->get_transform() * sb->shape_owner_get_transform(E->get());
collisions.push_back(shape_data);
}
}
@@ -136,17 +136,20 @@ void MeshLibraryEditor::_import_scene(Node *p_scene, Ref<MeshLibrary> p_library,
p_library->set_item_shapes(id, collisions);
Ref<NavigationMesh> navmesh;
+ Transform navmesh_transform;
for (int j = 0; j < mi->get_child_count(); j++) {
Node *child2 = mi->get_child(j);
if (!Object::cast_to<NavigationMeshInstance>(child2))
continue;
NavigationMeshInstance *sb = Object::cast_to<NavigationMeshInstance>(child2);
navmesh = sb->get_navigation_mesh();
+ navmesh_transform = sb->get_transform();
if (!navmesh.is_null())
break;
}
if (!navmesh.is_null()) {
p_library->set_item_navmesh(id, navmesh);
+ p_library->set_item_navmesh_transform(id, navmesh_transform);
}
}
diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp
index e648fa0820..89e3327a3a 100644
--- a/editor/plugins/script_editor_plugin.cpp
+++ b/editor/plugins/script_editor_plugin.cpp
@@ -979,6 +979,10 @@ void ScriptEditor::_menu_option(int p_option) {
OS::get_singleton()->shell_open("https://docs.godotengine.org/");
} break;
+ case REQUEST_DOCS: {
+
+ OS::get_singleton()->shell_open("https://github.com/godotengine/godot-docs/issues/new");
+ } break;
case WINDOW_NEXT: {
@@ -1308,6 +1312,7 @@ void ScriptEditor::_notification(int p_what) {
EditorSettings::get_singleton()->connect("settings_changed", this, "_editor_settings_changed");
help_search->set_icon(get_icon("HelpSearch", "EditorIcons"));
site_search->set_icon(get_icon("Instance", "EditorIcons"));
+ request_docs->set_icon(get_icon("Issue", "EditorIcons"));
script_forward->set_icon(get_icon("Forward", "EditorIcons"));
script_back->set_icon(get_icon("Back", "EditorIcons"));
@@ -1951,8 +1956,9 @@ bool ScriptEditor::edit(const RES &p_resource, int p_line, int p_col, bool p_gra
if (is_visible_in_tree())
se->ensure_focus();
- if (p_line >= 0)
+ if (p_line > 0) {
se->goto_line(p_line - 1);
+ }
}
return true;
}
@@ -2012,8 +2018,9 @@ bool ScriptEditor::edit(const RES &p_resource, int p_line, int p_col, bool p_gra
_test_script_times_on_disk(p_resource);
_update_modified_scripts_for_external_editor(p_resource);
- if (p_line >= 0)
+ if (p_line > 0) {
se->goto_line(p_line - 1);
+ }
notify_script_changed(p_resource);
_add_recent_script(p_resource->get_path());
@@ -3079,6 +3086,12 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) {
menu_hb->add_child(site_search);
site_search->set_tooltip(TTR("Open Godot online documentation"));
+ request_docs = memnew(ToolButton);
+ request_docs->set_text(TTR("Request Docs"));
+ request_docs->connect("pressed", this, "_menu_option", varray(REQUEST_DOCS));
+ menu_hb->add_child(request_docs);
+ request_docs->set_tooltip(TTR("Help improve the Godot documentation by giving feedback"));
+
help_search = memnew(ToolButton);
help_search->set_text(TTR("Search Help"));
help_search->connect("pressed", this, "_menu_option", varray(SEARCH_HELP));
diff --git a/editor/plugins/script_editor_plugin.h b/editor/plugins/script_editor_plugin.h
index 11f4589f00..954b014935 100644
--- a/editor/plugins/script_editor_plugin.h
+++ b/editor/plugins/script_editor_plugin.h
@@ -157,6 +157,7 @@ class ScriptEditor : public PanelContainer {
DEBUG_WITH_EXTERNAL_EDITOR,
SEARCH_HELP,
SEARCH_WEBSITE,
+ REQUEST_DOCS,
HELP_SEARCH_FIND,
HELP_SEARCH_FIND_NEXT,
WINDOW_MOVE_UP,
@@ -200,6 +201,7 @@ class ScriptEditor : public PanelContainer {
Button *help_search;
Button *site_search;
+ Button *request_docs;
EditorHelpSearch *help_search_dialog;
ItemList *script_list;
diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp
index e95b1356bf..8c3f8fd3e8 100644
--- a/editor/plugins/script_text_editor.cpp
+++ b/editor/plugins/script_text_editor.cpp
@@ -620,7 +620,9 @@ void ScriptTextEditor::_lookup_symbol(const String &p_symbol, int p_row, int p_c
}
ScriptLanguage::LookupResult result;
- if (p_symbol.is_resource_file()) {
+ if (ScriptServer::is_global_class(p_symbol)) {
+ EditorNode::get_singleton()->load_resource(ScriptServer::get_global_class_path(p_symbol));
+ } else if (p_symbol.is_resource_file()) {
List<String> scene_extensions;
ResourceLoader::get_recognized_extensions_for_type("PackedScene", &scene_extensions);
@@ -794,92 +796,7 @@ void ScriptTextEditor::_edit_option(int p_op) {
} break;
case EDIT_TOGGLE_COMMENT: {
- Ref<Script> scr = script;
- if (scr.is_null())
- return;
-
- String delimiter = "#";
- List<String> comment_delimiters;
- scr->get_language()->get_comment_delimiters(&comment_delimiters);
-
- for (List<String>::Element *E = comment_delimiters.front(); E; E = E->next()) {
- String script_delimiter = E->get();
- if (script_delimiter.find(" ") == -1) {
- delimiter = script_delimiter;
- break;
- }
- }
-
- tx->begin_complex_operation();
- if (tx->is_selection_active()) {
- int begin = tx->get_selection_from_line();
- int end = tx->get_selection_to_line();
-
- // End of selection ends on the first column of the last line, ignore it.
- if (tx->get_selection_to_column() == 0)
- end -= 1;
-
- int col_to = tx->get_selection_to_column();
- int cursor_pos = tx->cursor_get_column();
-
- // Check if all lines in the selected block are commented
- bool is_commented = true;
- for (int i = begin; i <= end; i++) {
- if (!tx->get_line(i).begins_with(delimiter)) {
- is_commented = false;
- break;
- }
- }
- for (int i = begin; i <= end; i++) {
- String line_text = tx->get_line(i);
-
- if (line_text.strip_edges().empty()) {
- line_text = delimiter;
- } else {
- if (is_commented) {
- line_text = line_text.substr(delimiter.length(), line_text.length());
- } else {
- line_text = delimiter + line_text;
- }
- }
- tx->set_line(i, line_text);
- }
-
- // Adjust selection & cursor position.
- int offset = is_commented ? -1 : 1;
- int col_from = tx->get_selection_from_column() > 0 ? tx->get_selection_from_column() + offset : 0;
-
- if (is_commented && tx->cursor_get_column() == tx->get_line(tx->cursor_get_line()).length() + 1)
- cursor_pos += 1;
-
- if (tx->get_selection_to_column() != 0 && col_to != tx->get_line(tx->get_selection_to_line()).length() + 1)
- col_to += offset;
-
- if (tx->cursor_get_column() != 0)
- cursor_pos += offset;
-
- tx->select(begin, col_from, tx->get_selection_to_line(), col_to);
- tx->cursor_set_column(cursor_pos);
-
- } else {
- int begin = tx->cursor_get_line();
- String line_text = tx->get_line(begin);
-
- int col = tx->cursor_get_column();
- if (line_text.begins_with(delimiter)) {
- line_text = line_text.substr(delimiter.length(), line_text.length());
- col -= 1;
- } else {
- line_text = delimiter + line_text;
- col += 1;
- }
-
- tx->set_line(begin, line_text);
- tx->cursor_set_column(col);
- }
- tx->end_complex_operation();
- tx->update();
-
+ _edit_option_toggle_inline_comment();
} break;
case EDIT_COMPLETE: {
@@ -1066,6 +983,25 @@ void ScriptTextEditor::_edit_option(int p_op) {
}
}
+void ScriptTextEditor::_edit_option_toggle_inline_comment() {
+ if (script.is_null())
+ return;
+
+ String delimiter = "#";
+ List<String> comment_delimiters;
+ script->get_language()->get_comment_delimiters(&comment_delimiters);
+
+ for (List<String>::Element *E = comment_delimiters.front(); E; E = E->next()) {
+ String script_delimiter = E->get();
+ if (script_delimiter.find(" ") == -1) {
+ delimiter = script_delimiter;
+ break;
+ }
+ }
+
+ code_editor->toggle_inline_comment(delimiter);
+}
+
void ScriptTextEditor::add_syntax_highlighter(SyntaxHighlighter *p_highlighter) {
highlighters[p_highlighter->get_name()] = p_highlighter;
highlighter_menu->add_radio_check_item(p_highlighter->get_name());
diff --git a/editor/plugins/script_text_editor.h b/editor/plugins/script_text_editor.h
index f83aadddef..b081a31c18 100644
--- a/editor/plugins/script_text_editor.h
+++ b/editor/plugins/script_text_editor.h
@@ -136,6 +136,7 @@ protected:
void _change_syntax_highlighter(int p_idx);
void _edit_option(int p_op);
+ void _edit_option_toggle_inline_comment();
void _make_context_menu(bool p_selection, bool p_color, bool p_foldable, bool p_open_docs, bool p_goto_definition);
void _text_edit_gui_input(const Ref<InputEvent> &ev);
void _color_changed(const Color &p_color);
diff --git a/editor/plugins/shader_editor_plugin.cpp b/editor/plugins/shader_editor_plugin.cpp
index 2b6ceac8e2..d39e521113 100644
--- a/editor/plugins/shader_editor_plugin.cpp
+++ b/editor/plugins/shader_editor_plugin.cpp
@@ -248,19 +248,19 @@ void ShaderEditor::_menu_option(int p_option) {
} break;
case EDIT_INDENT_LEFT: {
- TextEdit *tx = shader_editor->get_text_edit();
if (shader.is_null())
return;
+ TextEdit *tx = shader_editor->get_text_edit();
tx->indent_left();
} break;
case EDIT_INDENT_RIGHT: {
- TextEdit *tx = shader_editor->get_text_edit();
if (shader.is_null())
return;
+ TextEdit *tx = shader_editor->get_text_edit();
tx->indent_right();
} break;
@@ -272,54 +272,10 @@ void ShaderEditor::_menu_option(int p_option) {
} break;
case EDIT_TOGGLE_COMMENT: {
- TextEdit *tx = shader_editor->get_text_edit();
if (shader.is_null())
return;
- tx->begin_complex_operation();
- if (tx->is_selection_active()) {
- int begin = tx->get_selection_from_line();
- int end = tx->get_selection_to_line();
-
- // End of selection ends on the first column of the last line, ignore it.
- if (tx->get_selection_to_column() == 0)
- end -= 1;
-
- // Check if all lines in the selected block are commented
- bool is_commented = true;
- for (int i = begin; i <= end; i++) {
- if (!tx->get_line(i).begins_with("//")) {
- is_commented = false;
- break;
- }
- }
- for (int i = begin; i <= end; i++) {
- String line_text = tx->get_line(i);
-
- if (line_text.strip_edges().empty()) {
- line_text = "//";
- } else {
- if (is_commented) {
- line_text = line_text.substr(2, line_text.length());
- } else {
- line_text = "//" + line_text;
- }
- }
- tx->set_line(i, line_text);
- }
- } else {
- int begin = tx->cursor_get_line();
- String line_text = tx->get_line(begin);
-
- if (line_text.begins_with("//"))
- line_text = line_text.substr(2, line_text.length());
- else
- line_text = "//" + line_text;
- tx->set_line(begin, line_text);
- }
- tx->end_complex_operation();
- tx->update();
- //tx->deselect();
+ shader_editor->toggle_inline_comment("//");
} break;
case EDIT_COMPLETE: {
diff --git a/editor/plugins/spatial_editor_plugin.cpp b/editor/plugins/spatial_editor_plugin.cpp
index ad945d7916..765d198f79 100644
--- a/editor/plugins/spatial_editor_plugin.cpp
+++ b/editor/plugins/spatial_editor_plugin.cpp
@@ -1021,7 +1021,7 @@ void SpatialEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
}
_edit.mouse_pos = b->get_position();
- _edit.snap = false;
+ _edit.snap = spatial_editor->is_snap_enabled();
_edit.mode = TRANSFORM_NONE;
//gizmo has priority over everything
@@ -1772,7 +1772,7 @@ void SpatialEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
if (ED_IS_SHORTCUT("spatial_editor/snap", p_event)) {
if (_edit.mode != TRANSFORM_NONE) {
- _edit.snap = true;
+ _edit.snap = !_edit.snap;
}
}
if (ED_IS_SHORTCUT("spatial_editor/bottom_view", p_event)) {
diff --git a/editor/project_settings_editor.cpp b/editor/project_settings_editor.cpp
index 1c6359a46b..21ba6efb82 100644
--- a/editor/project_settings_editor.cpp
+++ b/editor/project_settings_editor.cpp
@@ -703,7 +703,7 @@ void ProjectSettingsEditor::_update_actions() {
item->add_button(2, get_icon("Add", "EditorIcons"), 1, false, TTR("Add Event"));
if (!ProjectSettings::get_singleton()->get_input_presets().find(pi.name)) {
item->add_button(2, get_icon("Remove", "EditorIcons"), 2, false, TTR("Remove"));
- item->set_editable(2, true);
+ item->set_editable(0, true);
}
for (int i = 0; i < events.size(); i++) {
diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp
index 66163d7e0a..19b46ef90f 100644
--- a/editor/scene_tree_dock.cpp
+++ b/editor/scene_tree_dock.cpp
@@ -377,7 +377,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
} break;
case TOOL_CLEAR_SCRIPT: {
- List<Node *> selection = editor_selection->get_selected_node_list();
+ Array selection = editor_selection->get_selected_nodes();
if (selection.empty())
return;
@@ -385,13 +385,14 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
editor_data->get_undo_redo().create_action(TTR("Clear Script"));
editor_data->get_undo_redo().add_do_method(editor, "push_item", (Script *)NULL);
- for (List<Node *>::Element *E = selection.front(); E; E = E->next()) {
+ for (int i = 0; i < selection.size(); i++) {
- Ref<Script> existing = E->get()->get_script();
+ Node *n = Object::cast_to<Node>(selection[i]);
+ Ref<Script> existing = n->get_script();
if (existing.is_valid()) {
const RefPtr empty;
- editor_data->get_undo_redo().add_do_method(E->get(), "set_script", empty);
- editor_data->get_undo_redo().add_undo_method(E->get(), "set_script", existing);
+ editor_data->get_undo_redo().add_do_method(n, "set_script", empty);
+ editor_data->get_undo_redo().add_undo_method(n, "set_script", existing);
}
}
@@ -1653,9 +1654,9 @@ void SceneTreeDock::_update_script_button() {
}
} else {
button_create_script->show();
- List<Node *> selection = EditorNode::get_singleton()->get_editor_selection()->get_selected_node_list();
- for (List<Node *>::Element *E = selection.front(); E; E = E->next()) {
- Node *n = E->get();
+ Array selection = editor_selection->get_selected_nodes();
+ for (int i = 0; i < selection.size(); i++) {
+ Node *n = Object::cast_to<Node>(selection[i]);
if (!n->get_script().is_null()) {
button_clear_script->show();
return;