Allow to ignore debugger error breaks

This commit is contained in:
kobewi 2024-04-20 19:52:54 +02:00
parent 74907876d3
commit 7d82704f12
11 changed files with 84 additions and 14 deletions

View file

@ -615,6 +615,10 @@ bool EditorDebuggerNode::is_skip_breakpoints() const {
return get_current_debugger()->is_skip_breakpoints();
}
bool EditorDebuggerNode::is_ignore_error_breaks() const {
return get_default_debugger()->is_ignore_error_breaks();
}
void EditorDebuggerNode::set_breakpoint(const String &p_path, int p_line, bool p_enabled) {
breakpoints[Breakpoint(p_path, p_line)] = p_enabled;
_for_all(tabs, [&](ScriptEditorDebugger *dbg) {

View file

@ -188,6 +188,7 @@ public:
bool get_debug_with_external_editor() { return debug_with_external_editor; }
bool is_skip_breakpoints() const;
bool is_ignore_error_breaks() const;
void set_breakpoint(const String &p_path, int p_line, bool p_enabled);
void set_breakpoints(const String &p_path, const Array &p_lines);
void reload_all_scripts();

View file

@ -102,6 +102,19 @@ void ScriptEditorDebugger::debug_skip_breakpoints() {
_put_msg("set_skip_breakpoints", msg, debugging_thread_id != Thread::UNASSIGNED_ID ? debugging_thread_id : Thread::MAIN_ID);
}
void ScriptEditorDebugger::debug_ignore_error_breaks() {
ignore_error_breaks_value = !ignore_error_breaks_value;
if (ignore_error_breaks_value) {
ignore_error_breaks->set_button_icon(get_theme_icon(SNAME("NotificationDisabled"), SNAME("EditorIcons")));
} else {
ignore_error_breaks->set_button_icon(get_theme_icon(SNAME("Notification"), SNAME("EditorIcons")));
}
Array msg;
msg.push_back(ignore_error_breaks_value);
_put_msg("set_ignore_error_breaks", msg);
}
void ScriptEditorDebugger::debug_next() {
ERR_FAIL_COND(!is_breaked());
@ -916,6 +929,11 @@ void ScriptEditorDebugger::_notification(int p_what) {
tabs->add_theme_style_override(SceneStringName(panel), get_theme_stylebox(SNAME("DebuggerPanel"), EditorStringName(EditorStyles)));
skip_breakpoints->set_button_icon(get_editor_theme_icon(skip_breakpoints_value ? SNAME("DebugSkipBreakpointsOn") : SNAME("DebugSkipBreakpointsOff")));
ignore_error_breaks->set_button_icon(get_editor_theme_icon(ignore_error_breaks_value ? SNAME("NotificationDisabled") : SNAME("Notification")));
ignore_error_breaks->add_theme_color_override("icon_normal_color", get_theme_color(SNAME("error_color"), SNAME("Editor")));
ignore_error_breaks->add_theme_color_override("icon_hover_color", get_theme_color(SNAME("error_color"), SNAME("Editor")));
ignore_error_breaks->add_theme_color_override("icon_pressed_color", get_theme_color(SNAME("error_color"), SNAME("Editor")));
ignore_error_breaks->add_theme_color_override("icon_focus_color", get_theme_color(SNAME("error_color"), SNAME("Editor")));
copy->set_button_icon(get_editor_theme_icon(SNAME("ActionCopy")));
step->set_button_icon(get_editor_theme_icon(SNAME("DebugStep")));
next->set_button_icon(get_editor_theme_icon(SNAME("DebugNext")));
@ -1592,10 +1610,14 @@ void ScriptEditorDebugger::reload_scripts(const Vector<String> &p_script_paths)
_put_msg("reload_scripts", Variant(p_script_paths).operator Array(), debugging_thread_id != Thread::UNASSIGNED_ID ? debugging_thread_id : Thread::MAIN_ID);
}
bool ScriptEditorDebugger::is_skip_breakpoints() {
bool ScriptEditorDebugger::is_skip_breakpoints() const {
return skip_breakpoints_value;
}
bool ScriptEditorDebugger::is_ignore_error_breaks() const {
return ignore_error_breaks_value;
}
void ScriptEditorDebugger::_error_activated() {
TreeItem *selected = error_tree->get_selected();
@ -1895,6 +1917,12 @@ ScriptEditorDebugger::ScriptEditorDebugger() {
skip_breakpoints->set_tooltip_text(TTR("Skip Breakpoints"));
skip_breakpoints->connect(SceneStringName(pressed), callable_mp(this, &ScriptEditorDebugger::debug_skip_breakpoints));
ignore_error_breaks = memnew(Button);
ignore_error_breaks->set_flat(true);
ignore_error_breaks->set_tooltip_text(TTR("Ignore Error Breaks"));
hbc->add_child(ignore_error_breaks);
ignore_error_breaks->connect("pressed", callable_mp(this, &ScriptEditorDebugger::debug_ignore_error_breaks));
hbc->add_child(memnew(VSeparator));
copy = memnew(Button);

View file

@ -113,6 +113,7 @@ private:
int warning_count;
bool skip_breakpoints_value = false;
bool ignore_error_breaks_value = false;
Ref<Script> stack_script;
TabContainer *tabs = nullptr;
@ -120,6 +121,7 @@ private:
Label *reason = nullptr;
Button *skip_breakpoints = nullptr;
Button *ignore_error_breaks = nullptr;
Button *copy = nullptr;
Button *step = nullptr;
Button *next = nullptr;
@ -261,6 +263,7 @@ public:
void stop();
void debug_skip_breakpoints();
void debug_ignore_error_breaks();
void debug_copy();
void debug_next();
@ -308,7 +311,8 @@ public:
void reload_all_scripts();
void reload_scripts(const Vector<String> &p_script_paths);
bool is_skip_breakpoints();
bool is_skip_breakpoints() const;
bool is_ignore_error_breaks() const;
virtual Size2 get_minimum_size() const override;