MCPcopy Create free account
hub / github.com/Redot-Engine/redot-engine / _set_breakpoint

Method _set_breakpoint

editor/script/script_editor_plugin.cpp:578–608  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

576}
577
578void ScriptEditor::_set_breakpoint(Ref<RefCounted> p_script, int p_line, bool p_enabled) {
579 Ref<Script> scr = Object::cast_to<Script>(*p_script);
580 if (scr.is_valid() && (scr->has_source_code() || scr->get_path().is_resource_file())) {
581 // Update if open.
582 for (int i = 0; i < tab_container->get_tab_count(); i++) {
583 ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(tab_container->get_tab_control(i));
584 if (se && se->get_edited_resource()->get_path() == scr->get_path()) {
585 se->set_breakpoint(p_line, p_enabled);
586 return;
587 }
588 }
589
590 // Handle closed.
591 Dictionary state = script_editor_cache->get_value(scr->get_path(), "state");
592 Array breakpoints;
593 if (state.has("breakpoints")) {
594 breakpoints = state["breakpoints"];
595 }
596
597 if (breakpoints.has(p_line)) {
598 if (!p_enabled) {
599 breakpoints.erase(p_line);
600 }
601 } else if (p_enabled) {
602 breakpoints.push_back(p_line);
603 }
604 state["breakpoints"] = breakpoints;
605 script_editor_cache->set_value(scr->get_path(), "state", state);
606 EditorDebuggerNode::get_singleton()->set_breakpoint(scr->get_path(), p_line + 1, p_enabled);
607 }
608}
609
610void ScriptEditor::_clear_breakpoints() {
611 for (int i = 0; i < tab_container->get_tab_count(); i++) {

Callers

nothing calls this directly

Calls 13

is_resource_fileMethod · 0.80
get_tab_controlMethod · 0.80
is_validMethod · 0.45
has_source_codeMethod · 0.45
get_pathMethod · 0.45
get_tab_countMethod · 0.45
get_edited_resourceMethod · 0.45
set_breakpointMethod · 0.45
get_valueMethod · 0.45
hasMethod · 0.45
eraseMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected