summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
Diffstat (limited to 'editor')
-rw-r--r--editor/code_editor.cpp1
-rw-r--r--editor/editor_node.cpp10
-rw-r--r--editor/editor_settings.cpp1
-rw-r--r--editor/plugins/shader_editor_plugin.cpp1
-rw-r--r--editor/plugins/tile_map_editor_plugin.cpp45
-rw-r--r--editor/script_editor_debugger.cpp63
-rw-r--r--editor/script_editor_debugger.h2
7 files changed, 89 insertions, 34 deletions
diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp
index ee1faf5a55..0100c221c4 100644
--- a/editor/code_editor.cpp
+++ b/editor/code_editor.cpp
@@ -1089,6 +1089,7 @@ void CodeTextEditor::update_editor_settings() {
text_editor->set_line_length_guideline_column(EditorSettings::get_singleton()->get("text_editor/line_numbers/line_length_guideline_column"));
text_editor->set_syntax_coloring(EditorSettings::get_singleton()->get("text_editor/highlighting/syntax_highlighting"));
text_editor->set_highlight_all_occurrences(EditorSettings::get_singleton()->get("text_editor/highlighting/highlight_all_occurrences"));
+ text_editor->set_highlight_current_line(EditorSettings::get_singleton()->get("text_editor/highlighting/highlight_current_line"));
text_editor->cursor_set_blink_enabled(EditorSettings::get_singleton()->get("text_editor/cursor/caret_blink"));
text_editor->cursor_set_blink_speed(EditorSettings::get_singleton()->get("text_editor/cursor/caret_blink_speed"));
text_editor->set_draw_breakpoint_gutter(EditorSettings::get_singleton()->get("text_editor/line_numbers/show_breakpoint_gutter"));
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index b77525c0ba..3513126a9b 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -2670,12 +2670,12 @@ void EditorNode::set_addon_plugin_enabled(const String &p_addon, bool p_enabled)
String addon_path = "res://addons/" + p_addon + "/plugin.cfg";
Error err = cf->load(addon_path);
if (err != OK) {
- show_warning(TTR("Unable to enable addon plugin at: '") + addon_path + TTR("' parsing of config failed."));
+ show_warning(vformat(TTR("Unable to enable addon plugin at: '%s' parsing of config failed."), addon_path));
return;
}
if (!cf->has_section_key("plugin", "script")) {
- show_warning(TTR("Unable to find script field for addon plugin at: 'res://addons/") + p_addon + "''.");
+ show_warning(vformat(TTR("Unable to find script field for addon plugin at: 'res://addons/%s'."), p_addon));
return;
}
@@ -2685,18 +2685,18 @@ void EditorNode::set_addon_plugin_enabled(const String &p_addon, bool p_enabled)
Ref<Script> script = ResourceLoader::load(path);
if (script.is_null()) {
- show_warning(TTR("Unable to load addon script from path: '") + path + "'.");
+ show_warning(vformat(TTR("Unable to load addon script from path: '%s'."), path));
return;
}
//could check inheritance..
if (String(script->get_instance_base_type()) != "EditorPlugin") {
- show_warning(TTR("Unable to load addon script from path: '") + path + "' Base type is not EditorPlugin.");
+ show_warning(vformat(TTR("Unable to load addon script from path: '%s' Base type is not EditorPlugin."), path));
return;
}
if (!script->is_tool()) {
- show_warning(TTR("Unable to load addon script from path: '") + path + "' Script is not in tool mode.");
+ show_warning(vformat(TTR("Unable to load addon script from path: '%s' Script is not in tool mode."), path));
return;
}
diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp
index 7c45e19f5f..64febd24ba 100644
--- a/editor/editor_settings.cpp
+++ b/editor/editor_settings.cpp
@@ -632,6 +632,7 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
_initial_set("text_editor/highlighting/syntax_highlighting", true);
_initial_set("text_editor/highlighting/highlight_all_occurrences", true);
+ _initial_set("text_editor/highlighting/highlight_current_line", true);
_initial_set("text_editor/cursor/scroll_past_end_of_file", false);
_initial_set("text_editor/indent/type", 0);
diff --git a/editor/plugins/shader_editor_plugin.cpp b/editor/plugins/shader_editor_plugin.cpp
index b0ee1a32ca..f7dcc4b52d 100644
--- a/editor/plugins/shader_editor_plugin.cpp
+++ b/editor/plugins/shader_editor_plugin.cpp
@@ -348,6 +348,7 @@ void ShaderEditor::_editor_settings_changed() {
shader_editor->get_text_edit()->set_show_line_numbers(EditorSettings::get_singleton()->get("text_editor/line_numbers/show_line_numbers"));
shader_editor->get_text_edit()->set_syntax_coloring(EditorSettings::get_singleton()->get("text_editor/highlighting/syntax_highlighting"));
shader_editor->get_text_edit()->set_highlight_all_occurrences(EditorSettings::get_singleton()->get("text_editor/highlighting/highlight_all_occurrences"));
+ shader_editor->get_text_edit()->set_highlight_current_line(EditorSettings::get_singleton()->get("text_editor/highlighting/highlight_current_line"));
shader_editor->get_text_edit()->cursor_set_blink_enabled(EditorSettings::get_singleton()->get("text_editor/cursor/caret_blink"));
shader_editor->get_text_edit()->cursor_set_blink_speed(EditorSettings::get_singleton()->get("text_editor/cursor/caret_blink_speed"));
shader_editor->get_text_edit()->add_constant_override("line_spacing", EditorSettings::get_singleton()->get("text_editor/theme/line_spacing"));
diff --git a/editor/plugins/tile_map_editor_plugin.cpp b/editor/plugins/tile_map_editor_plugin.cpp
index d12b3f1e0e..9235dafaa6 100644
--- a/editor/plugins/tile_map_editor_plugin.cpp
+++ b/editor/plugins/tile_map_editor_plugin.cpp
@@ -945,6 +945,7 @@ bool TileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
if (mm.is_valid()) {
Point2i new_over_tile = node->world_to_map(xform_inv.xform(mm->get_position()));
+ Point2i old_over_tile = over_tile;
if (new_over_tile != over_tile) {
@@ -963,17 +964,43 @@ bool TileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
if (tool == TOOL_PAINTING) {
+ // Paint using bresenham line to prevent holes in painting if the user moves fast
+
+ Vector<Point2i> points = line(old_over_tile.x, over_tile.x, old_over_tile.y, over_tile.y);
int id = get_selected_tile();
- if (id != TileMap::INVALID_CELL) {
+
+ for (int i = 0; i < points.size(); ++i) {
+
+ Point2i pos = points[i];
if (!paint_undo.has(over_tile)) {
- paint_undo[over_tile] = _get_op_from_cell(over_tile);
+ paint_undo[pos] = _get_op_from_cell(pos);
}
- _set_cell(over_tile, id, flip_h, flip_v, transpose);
+ _set_cell(pos, id, flip_h, flip_v, transpose);
+ }
- return true;
+ return true;
+ }
+
+ if (tool == TOOL_ERASING) {
+
+ // erase using bresenham line to prevent holes in painting if the user moves fast
+
+ Vector<Point2i> points = line(old_over_tile.x, over_tile.x, old_over_tile.y, over_tile.y);
+
+ for (int i = 0; i < points.size(); ++i) {
+
+ Point2i pos = points[i];
+
+ if (!paint_undo.has(over_tile)) {
+ paint_undo[pos] = _get_op_from_cell(pos);
+ }
+
+ _set_cell(pos, TileMap::INVALID_CELL);
}
+
+ return true;
}
if (tool == TOOL_SELECTING) {
@@ -1044,16 +1071,6 @@ bool TileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
return true;
}
- if (tool == TOOL_ERASING) {
-
- if (!paint_undo.has(over_tile)) {
- paint_undo[over_tile] = _get_op_from_cell(over_tile);
- }
-
- _set_cell(over_tile, TileMap::INVALID_CELL);
-
- return true;
- }
if (tool == TOOL_PICKING && Input::get_singleton()->is_mouse_button_pressed(BUTTON_LEFT)) {
_pick_tile(over_tile);
diff --git a/editor/script_editor_debugger.cpp b/editor/script_editor_debugger.cpp
index ef61aad341..bc2423fffd 100644
--- a/editor/script_editor_debugger.cpp
+++ b/editor/script_editor_debugger.cpp
@@ -574,7 +574,38 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da
for (int i = 0; i < arr.size(); i++) {
p[i] = arr[i];
if (i < perf_items.size()) {
- perf_items[i]->set_text(1, rtos(p[i]));
+
+ float v = p[i];
+ String vs = rtos(v);
+ String tt = vs;
+ switch (Performance::MonitorType((int)perf_items[i]->get_metadata(1))) {
+ case Performance::MONITOR_TYPE_MEMORY: {
+ // for the time being, going above GBs is a bad sign.
+ String unit = "B";
+ if ((int)v > 1073741824) {
+ unit = "GB";
+ v /= 1073741824.0;
+ } else if ((int)v > 1048576) {
+ unit = "MB";
+ v /= 1048576.0;
+ } else if ((int)v > 1024) {
+ unit = "KB";
+ v /= 1024.0;
+ }
+ tt += " bytes";
+ vs = rtos(v) + " " + unit;
+ } break;
+ case Performance::MONITOR_TYPE_TIME: {
+ tt += " seconds";
+ vs += " s";
+ } break;
+ default: {
+ tt += " " + perf_items[i]->get_text(0);
+ } break;
+ }
+
+ perf_items[i]->set_text(1, vs);
+ perf_items[i]->set_tooltip(1, tt);
if (p[i] > perf_max[i])
perf_max[i] = p[i];
}
@@ -775,7 +806,7 @@ void ScriptEditorDebugger::_set_reason_text(const String &p_reason, MessageType
reason->set_tooltip(p_reason);
}
-void ScriptEditorDebugger::_performance_select(Object *, int, bool) {
+void ScriptEditorDebugger::_performance_select() {
perf_draw->update();
}
@@ -785,7 +816,7 @@ void ScriptEditorDebugger::_performance_draw() {
Vector<int> which;
for (int i = 0; i < perf_items.size(); i++) {
- if (perf_items[i]->is_selected(0))
+ if (perf_items[i]->is_checked(0))
which.push_back(i);
}
@@ -816,14 +847,14 @@ void ScriptEditorDebugger::_performance_draw() {
r.position += graph_sb->get_offset();
r.size -= graph_sb->get_minimum_size();
int pi = which[i];
- Color c = get_color("success_color", "Editor");
- c.set_hsv(Math::fmod(c.get_h() + pi * 0.7654, 1), c.get_s(), c.get_v());
- //c = c.linear_interpolate(get_color("base_color", "Editor"), 0.9);
+ Color c = get_color("accent_color", "Editor");
+ float h = (float)which[i] / (float)(perf_items.size());
+ c.set_hsv(Math::fmod(h + 0.4, 0.9), c.get_s() * 0.9, c.get_v() * 1.4);
- c.a = 0.8;
- perf_draw->draw_string(graph_font, r.position + Point2(0, graph_font->get_ascent()), perf_items[pi]->get_text(0), c, r.size.x);
c.a = 0.6;
- perf_draw->draw_string(graph_font, r.position + Point2(graph_font->get_char_size('X').width, graph_font->get_ascent() + graph_font->get_height()), perf_items[pi]->get_text(1), c, r.size.y);
+ perf_draw->draw_string(graph_font, r.position + Point2(0, graph_font->get_ascent()), perf_items[pi]->get_text(0), c, r.size.x);
+ c.a = 0.9;
+ perf_draw->draw_string(graph_font, r.position + Point2(0, graph_font->get_ascent() + graph_font->get_height()), perf_items[pi]->get_text(1), c, r.size.y);
float spacing = point_sep / float(cols);
float from = r.size.width;
@@ -1785,13 +1816,12 @@ ScriptEditorDebugger::ScriptEditorDebugger(EditorNode *p_editor) {
perf_monitors->set_column_title(1, TTR("Value"));
perf_monitors->set_column_titles_visible(true);
hsp->add_child(perf_monitors);
- perf_monitors->set_select_mode(Tree::SELECT_MULTI);
- perf_monitors->connect("multi_selected", this, "_performance_select");
+ perf_monitors->connect("item_edited", this, "_performance_select");
perf_draw = memnew(Control);
perf_draw->connect("draw", this, "_performance_draw");
hsp->add_child(perf_draw);
hsp->set_name(TTR("Monitors"));
- hsp->set_split_offset(300);
+ hsp->set_split_offset(340 * EDSCALE);
tabs->add_child(hsp);
perf_max.resize(Performance::MONITOR_MAX);
@@ -1801,6 +1831,7 @@ ScriptEditorDebugger::ScriptEditorDebugger(EditorNode *p_editor) {
for (int i = 0; i < Performance::MONITOR_MAX; i++) {
String n = Performance::get_singleton()->get_monitor_name(Performance::Monitor(i));
+ Performance::MonitorType mtype = Performance::get_singleton()->get_monitor_type(Performance::Monitor(i));
String base = n.get_slice("/", 0);
String name = n.get_slice("/", 1);
if (!bases.has(base)) {
@@ -1808,12 +1839,16 @@ ScriptEditorDebugger::ScriptEditorDebugger(EditorNode *p_editor) {
b->set_text(0, base.capitalize());
b->set_editable(0, false);
b->set_selectable(0, false);
+ b->set_expand_right(0, true);
bases[base] = b;
}
TreeItem *it = perf_monitors->create_item(bases[base]);
- it->set_editable(0, false);
- it->set_selectable(0, true);
+ it->set_metadata(1, mtype);
+ it->set_cell_mode(0, TreeItem::CELL_MODE_CHECK);
+ it->set_editable(0, true);
+ it->set_selectable(0, false);
+ it->set_selectable(1, false);
it->set_text(0, name.capitalize());
perf_items.push_back(it);
perf_max[i] = 0;
diff --git a/editor/script_editor_debugger.h b/editor/script_editor_debugger.h
index d0faab5892..d18a625eef 100644
--- a/editor/script_editor_debugger.h
+++ b/editor/script_editor_debugger.h
@@ -142,7 +142,7 @@ class ScriptEditorDebugger : public Control {
bool live_debug;
void _performance_draw();
- void _performance_select(Object *, int, bool);
+ void _performance_select();
void _stack_dump_frame_selected();
void _output_clear();