summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
Diffstat (limited to 'editor')
-rw-r--r--editor/code_editor.cpp39
-rw-r--r--editor/code_editor.h1
-rw-r--r--editor/editor_inspector.cpp4
-rw-r--r--editor/editor_themes.cpp31
-rw-r--r--editor/icons/WorldMarginShape2D.svg (renamed from editor/icons/LineShape2D.svg)0
-rw-r--r--editor/plugins/collision_shape_2d_editor_plugin.cpp22
-rw-r--r--editor/plugins/collision_shape_2d_editor_plugin.h2
-rw-r--r--editor/plugins/script_text_editor.cpp15
8 files changed, 57 insertions, 57 deletions
diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp
index 4a3be1d29c..a5943c952b 100644
--- a/editor/code_editor.cpp
+++ b/editor/code_editor.cpp
@@ -1520,40 +1520,12 @@ void CodeTextEditor::goto_error() {
}
void CodeTextEditor::_update_text_editor_theme() {
- text_editor->add_theme_color_override("background_color", EDITOR_GET("text_editor/highlighting/background_color"));
- text_editor->add_theme_color_override("completion_background_color", EDITOR_GET("text_editor/highlighting/completion_background_color"));
- text_editor->add_theme_color_override("completion_selected_color", EDITOR_GET("text_editor/highlighting/completion_selected_color"));
- text_editor->add_theme_color_override("completion_existing_color", EDITOR_GET("text_editor/highlighting/completion_existing_color"));
- text_editor->add_theme_color_override("completion_scroll_color", EDITOR_GET("text_editor/highlighting/completion_scroll_color"));
- text_editor->add_theme_color_override("completion_font_color", EDITOR_GET("text_editor/highlighting/completion_font_color"));
- text_editor->add_theme_color_override("font_color", EDITOR_GET("text_editor/highlighting/text_color"));
- text_editor->add_theme_color_override("line_number_color", EDITOR_GET("text_editor/highlighting/line_number_color"));
- text_editor->add_theme_color_override("caret_color", EDITOR_GET("text_editor/highlighting/caret_color"));
- text_editor->add_theme_color_override("caret_background_color", EDITOR_GET("text_editor/highlighting/caret_background_color"));
- text_editor->add_theme_color_override("font_selected_color", EDITOR_GET("text_editor/highlighting/text_selected_color"));
- text_editor->add_theme_color_override("selection_color", EDITOR_GET("text_editor/highlighting/selection_color"));
- text_editor->add_theme_color_override("brace_mismatch_color", EDITOR_GET("text_editor/highlighting/brace_mismatch_color"));
- text_editor->add_theme_color_override("current_line_color", EDITOR_GET("text_editor/highlighting/current_line_color"));
- text_editor->add_theme_color_override("line_length_guideline_color", EDITOR_GET("text_editor/highlighting/line_length_guideline_color"));
- text_editor->add_theme_color_override("word_highlighted_color", EDITOR_GET("text_editor/highlighting/word_highlighted_color"));
- text_editor->add_theme_color_override("bookmark_color", EDITOR_GET("text_editor/highlighting/bookmark_color"));
- text_editor->add_theme_color_override("breakpoint_color", EDITOR_GET("text_editor/highlighting/breakpoint_color"));
- text_editor->add_theme_color_override("executing_line_color", EDITOR_GET("text_editor/highlighting/executing_line_color"));
- text_editor->add_theme_color_override("code_folding_color", EDITOR_GET("text_editor/highlighting/code_folding_color"));
- text_editor->add_theme_color_override("search_result_color", EDITOR_GET("text_editor/highlighting/search_result_color"));
- text_editor->add_theme_color_override("search_result_border_color", EDITOR_GET("text_editor/highlighting/search_result_border_color"));
- text_editor->add_theme_constant_override("line_spacing", EDITOR_DEF("text_editor/theme/line_spacing", 6));
emit_signal(SNAME("load_theme_settings"));
- _load_theme_settings();
-}
-
-void CodeTextEditor::_update_font() {
- text_editor->add_theme_font_override("font", get_theme_font(SNAME("source"), SNAME("EditorFonts")));
- text_editor->add_theme_font_size_override("font_size", get_theme_font_size(SNAME("source_size"), SNAME("EditorFonts")));
- error->add_theme_font_override("font", get_theme_font(SNAME("status_source"), SNAME("EditorFonts")));
- error->add_theme_font_size_override("font_size", get_theme_font_size(SNAME("status_source_size"), SNAME("EditorFonts")));
- error->add_theme_color_override("font_color", get_theme_color(SNAME("error_color"), SNAME("Editor")));
+ error->begin_bulk_theme_override();
+ error->add_theme_font_override(SNAME("font"), get_theme_font(SNAME("status_source"), SNAME("EditorFonts")));
+ error->add_theme_font_size_override(SNAME("font_size"), get_theme_font_size(SNAME("status_source_size"), SNAME("EditorFonts")));
+ error->add_theme_color_override(SNAME("font_color"), get_theme_color(SNAME("error_color"), SNAME("Editor")));
Ref<Font> status_bar_font = get_theme_font(SNAME("status_source"), SNAME("EditorFonts"));
int status_bar_font_size = get_theme_font_size(SNAME("status_source_size"), SNAME("EditorFonts"));
@@ -1567,6 +1539,7 @@ void CodeTextEditor::_update_font() {
n->add_theme_font_size_override("font_size", status_bar_font_size);
}
}
+ error->end_bulk_theme_override();
}
void CodeTextEditor::_on_settings_change() {
@@ -1582,7 +1555,6 @@ void CodeTextEditor::_apply_settings_change() {
settings_changed = false;
_update_text_editor_theme();
- _update_font();
font_size = EditorSettings::get_singleton()->get("interface/editor/code_font_size");
@@ -1668,7 +1640,6 @@ void CodeTextEditor::_notification(int p_what) {
update_toggle_scripts_button();
}
_update_text_editor_theme();
- _update_font();
} break;
case NOTIFICATION_ENTER_TREE: {
error_button->set_icon(get_theme_icon(SNAME("StatusError"), SNAME("EditorIcons")));
diff --git a/editor/code_editor.h b/editor/code_editor.h
index 4cd4880df0..ee8f4366dd 100644
--- a/editor/code_editor.h
+++ b/editor/code_editor.h
@@ -168,7 +168,6 @@ class CodeTextEditor : public VBoxContainer {
void _apply_settings_change();
void _update_text_editor_theme();
- void _update_font();
void _complete_request();
Ref<Texture2D> _get_completion_icon(const ScriptCodeCompletionOption &p_option);
void _font_resize_timeout();
diff --git a/editor/editor_inspector.cpp b/editor/editor_inspector.cpp
index 679f2e8ce4..9de8b0451a 100644
--- a/editor/editor_inspector.cpp
+++ b/editor/editor_inspector.cpp
@@ -887,7 +887,7 @@ Control *EditorProperty::make_custom_tooltip(const String &p_text) const {
text += "\n" + property_doc;
}
}
- help_bit->set_text(text);
+ help_bit->call_deferred(SNAME("set_text"), text); //hack so it uses proper theme once inside scene
}
return help_bit;
@@ -1102,7 +1102,7 @@ Control *EditorInspectorCategory::make_custom_tooltip(const String &p_text) cons
text += "\n" + property_doc;
}
}
- help_bit->set_text(text); //hack so it uses proper theme once inside scene
+ help_bit->call_deferred(SNAME("set_text"), text); //hack so it uses proper theme once inside scene
}
return help_bit;
diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp
index fe6c081922..e93c8a1a05 100644
--- a/editor/editor_themes.cpp
+++ b/editor/editor_themes.cpp
@@ -1051,19 +1051,17 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
theme->set_constant("line_spacing", "TextEdit", 4 * EDSCALE);
// CodeEdit
+ theme->set_font("font", "CodeEdit", theme->get_font("source", "EditorFonts"));
+ theme->set_font_size("font_size", "CodeEdit", theme->get_font_size("source_size", "EditorFonts"));
theme->set_stylebox("normal", "CodeEdit", style_widget);
theme->set_stylebox("focus", "CodeEdit", style_widget_hover);
theme->set_stylebox("read_only", "CodeEdit", style_widget_disabled);
- theme->set_constant("side_margin", "TabContainer", 0);
theme->set_icon("tab", "CodeEdit", theme->get_icon("GuiTab", "EditorIcons"));
theme->set_icon("space", "CodeEdit", theme->get_icon("GuiSpace", "EditorIcons"));
theme->set_icon("folded", "CodeEdit", theme->get_icon("GuiTreeArrowRight", "EditorIcons"));
theme->set_icon("can_fold", "CodeEdit", theme->get_icon("GuiTreeArrowDown", "EditorIcons"));
theme->set_icon("executing_line", "CodeEdit", theme->get_icon("MainPlay", "EditorIcons"));
- theme->set_color("font_color", "CodeEdit", font_color);
- theme->set_color("caret_color", "CodeEdit", font_color);
- theme->set_color("selection_color", "CodeEdit", selection_color);
- theme->set_constant("line_spacing", "CodeEdit", 4 * EDSCALE);
+ theme->set_constant("line_spacing", "CodeEdit", EDITOR_DEF("text_editor/theme/line_spacing", 6));
// H/VSplitContainer
theme->set_stylebox("bg", "VSplitContainer", make_stylebox(theme->get_icon("GuiVsplitBg", "EditorIcons"), 1, 1, 1, 1));
@@ -1474,6 +1472,29 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
setting->load_text_editor_theme();
}
+ // Now theme is loaded, apply it to CodeEdit.
+ theme->set_color("background_color", "CodeEdit", EDITOR_GET("text_editor/highlighting/background_color"));
+ theme->set_color("completion_background_color", "CodeEdit", EDITOR_GET("text_editor/highlighting/completion_background_color"));
+ theme->set_color("completion_selected_color", "CodeEdit", EDITOR_GET("text_editor/highlighting/completion_selected_color"));
+ theme->set_color("completion_existing_color", "CodeEdit", EDITOR_GET("text_editor/highlighting/completion_existing_color"));
+ theme->set_color("completion_scroll_color", "CodeEdit", EDITOR_GET("text_editor/highlighting/completion_scroll_color"));
+ theme->set_color("completion_font_color", "CodeEdit", EDITOR_GET("text_editor/highlighting/completion_font_color"));
+ theme->set_color("font_color", "CodeEdit", EDITOR_GET("text_editor/highlighting/text_color"));
+ theme->set_color("line_number_color", "CodeEdit", EDITOR_GET("text_editor/highlighting/line_number_color"));
+ theme->set_color("caret_color", "CodeEdit", EDITOR_GET("text_editor/highlighting/caret_color"));
+ theme->set_color("font_selected_color", "CodeEdit", EDITOR_GET("text_editor/highlighting/text_selected_color"));
+ theme->set_color("selection_color", "CodeEdit", EDITOR_GET("text_editor/highlighting/selection_color"));
+ theme->set_color("brace_mismatch_color", "CodeEdit", EDITOR_GET("text_editor/highlighting/brace_mismatch_color"));
+ theme->set_color("current_line_color", "CodeEdit", EDITOR_GET("text_editor/highlighting/current_line_color"));
+ theme->set_color("line_length_guideline_color", "CodeEdit", EDITOR_GET("text_editor/highlighting/line_length_guideline_color"));
+ theme->set_color("word_highlighted_color", "CodeEdit", EDITOR_GET("text_editor/highlighting/word_highlighted_color"));
+ theme->set_color("bookmark_color", "CodeEdit", EDITOR_GET("text_editor/highlighting/bookmark_color"));
+ theme->set_color("breakpoint_color", "CodeEdit", EDITOR_GET("text_editor/highlighting/breakpoint_color"));
+ theme->set_color("executing_line_color", "CodeEdit", EDITOR_GET("text_editor/highlighting/executing_line_color"));
+ theme->set_color("code_folding_color", "CodeEdit", EDITOR_GET("text_editor/highlighting/code_folding_color"));
+ theme->set_color("search_result_color", "CodeEdit", EDITOR_GET("text_editor/highlighting/search_result_color"));
+ theme->set_color("search_result_border_color", "CodeEdit", EDITOR_GET("text_editor/highlighting/search_result_border_color"));
+
return theme;
}
diff --git a/editor/icons/LineShape2D.svg b/editor/icons/WorldMarginShape2D.svg
index f1dbe97c6f..f1dbe97c6f 100644
--- a/editor/icons/LineShape2D.svg
+++ b/editor/icons/WorldMarginShape2D.svg
diff --git a/editor/plugins/collision_shape_2d_editor_plugin.cpp b/editor/plugins/collision_shape_2d_editor_plugin.cpp
index 4266e0f676..486f947e43 100644
--- a/editor/plugins/collision_shape_2d_editor_plugin.cpp
+++ b/editor/plugins/collision_shape_2d_editor_plugin.cpp
@@ -36,9 +36,9 @@
#include "scene/resources/circle_shape_2d.h"
#include "scene/resources/concave_polygon_shape_2d.h"
#include "scene/resources/convex_polygon_shape_2d.h"
-#include "scene/resources/line_shape_2d.h"
#include "scene/resources/rectangle_shape_2d.h"
#include "scene/resources/segment_shape_2d.h"
+#include "scene/resources/world_margin_shape_2d.h"
void CollisionShape2DEditor::_node_removed(Node *p_node) {
if (p_node == node) {
@@ -74,8 +74,8 @@ Variant CollisionShape2DEditor::get_handle_value(int idx) const {
case CONVEX_POLYGON_SHAPE: {
} break;
- case LINE_SHAPE: {
- Ref<LineShape2D> line = node->get_shape();
+ case WORLD_MARGIN_SHAPE: {
+ Ref<WorldMarginShape2D> line = node->get_shape();
if (idx == 0) {
return line->get_distance();
@@ -142,9 +142,9 @@ void CollisionShape2DEditor::set_handle(int idx, Point2 &p_point) {
case CONVEX_POLYGON_SHAPE: {
} break;
- case LINE_SHAPE: {
+ case WORLD_MARGIN_SHAPE: {
if (idx < 2) {
- Ref<LineShape2D> line = node->get_shape();
+ Ref<WorldMarginShape2D> line = node->get_shape();
if (idx == 0) {
line->set_distance(p_point.length());
@@ -241,8 +241,8 @@ void CollisionShape2DEditor::commit_handle(int idx, Variant &p_org) {
// Cannot be edited directly, use CollisionPolygon2D instead.
} break;
- case LINE_SHAPE: {
- Ref<LineShape2D> line = node->get_shape();
+ case WORLD_MARGIN_SHAPE: {
+ Ref<WorldMarginShape2D> line = node->get_shape();
if (idx == 0) {
undo_redo->add_do_method(line.ptr(), "set_distance", line->get_distance());
@@ -397,8 +397,8 @@ void CollisionShape2DEditor::_get_current_shape_type() {
shape_type = CONCAVE_POLYGON_SHAPE;
} else if (Object::cast_to<ConvexPolygonShape2D>(*s)) {
shape_type = CONVEX_POLYGON_SHAPE;
- } else if (Object::cast_to<LineShape2D>(*s)) {
- shape_type = LINE_SHAPE;
+ } else if (Object::cast_to<WorldMarginShape2D>(*s)) {
+ shape_type = WORLD_MARGIN_SHAPE;
} else if (Object::cast_to<RectangleShape2D>(*s)) {
shape_type = RECTANGLE_SHAPE;
} else if (Object::cast_to<SegmentShape2D>(*s)) {
@@ -464,8 +464,8 @@ void CollisionShape2DEditor::forward_canvas_draw_over_viewport(Control *p_overla
case CONVEX_POLYGON_SHAPE: {
} break;
- case LINE_SHAPE: {
- Ref<LineShape2D> shape = node->get_shape();
+ case WORLD_MARGIN_SHAPE: {
+ Ref<WorldMarginShape2D> shape = node->get_shape();
handles.resize(2);
handles.write[0] = shape->get_normal() * shape->get_distance();
diff --git a/editor/plugins/collision_shape_2d_editor_plugin.h b/editor/plugins/collision_shape_2d_editor_plugin.h
index 130ec708cf..056e1b5b7d 100644
--- a/editor/plugins/collision_shape_2d_editor_plugin.h
+++ b/editor/plugins/collision_shape_2d_editor_plugin.h
@@ -46,7 +46,7 @@ class CollisionShape2DEditor : public Control {
CIRCLE_SHAPE,
CONCAVE_POLYGON_SHAPE,
CONVEX_POLYGON_SHAPE,
- LINE_SHAPE,
+ WORLD_MARGIN_SHAPE,
RECTANGLE_SHAPE,
SEGMENT_SHAPE
};
diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp
index 8cd746304c..1d7592d2c3 100644
--- a/editor/plugins/script_text_editor.cpp
+++ b/editor/plugins/script_text_editor.cpp
@@ -1390,6 +1390,7 @@ bool ScriptTextEditor::can_drop_data_fw(const Point2 &p_point, const Variant &p_
if (d.has("type") && (String(d["type"]) == "resource" ||
String(d["type"]) == "files" ||
String(d["type"]) == "nodes" ||
+ String(d["type"]) == "obj_property" ||
String(d["type"]) == "files_and_dirs")) {
return true;
}
@@ -1419,10 +1420,11 @@ static Node *_find_script_node(Node *p_edited_scene, Node *p_current_node, const
}
void ScriptTextEditor::drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) {
+ const String quote_style = EDITOR_GET("text_editor/completion/use_single_quotes") ? "'" : "\"";
+
Dictionary d = p_data;
CodeEdit *te = code_editor->get_text_editor();
-
Point2i pos = te->get_line_column_at_pos(p_point);
int row = pos.y;
int col = pos.x;
@@ -1444,7 +1446,6 @@ void ScriptTextEditor::drop_data_fw(const Point2 &p_point, const Variant &p_data
}
if (d.has("type") && (String(d["type"]) == "files" || String(d["type"]) == "files_and_dirs")) {
- const String quote_style = EDITOR_DEF("text_editor/completion/use_single_quotes", false) ? "'" : "\"";
Array files = d["files"];
String text_to_drop;
@@ -1488,13 +1489,21 @@ void ScriptTextEditor::drop_data_fw(const Point2 &p_point, const Variant &p_data
}
String path = sn->get_path_to(node);
- text_to_drop += "\"" + path.c_escape() + "\"";
+ text_to_drop += path.c_escape().quote(quote_style);
}
te->set_caret_line(row);
te->set_caret_column(col);
te->insert_text_at_caret(text_to_drop);
}
+
+ if (d.has("type") && String(d["type"]) == "obj_property") {
+ const String text_to_drop = String(d["property"]).c_escape().quote(quote_style);
+
+ te->set_caret_line(row);
+ te->set_caret_column(col);
+ te->insert_text_at_caret(text_to_drop);
+ }
}
void ScriptTextEditor::_text_edit_gui_input(const Ref<InputEvent> &ev) {