@@ -121,6 +121,7 @@ ScriptEditorDebugger *EditorDebuggerNode::_add_debugger() {
121121 node->connect (" set_breakpoint" , callable_mp (this , &EditorDebuggerNode::_breakpoint_set_in_tree).bind (id));
122122 node->connect (" clear_breakpoints" , callable_mp (this , &EditorDebuggerNode::_breakpoints_cleared_in_tree).bind (id));
123123 node->connect (" errors_cleared" , callable_mp (this , &EditorDebuggerNode::_update_errors));
124+ node->connect (" run_scene_requested" , callable_mp (this , &EditorDebuggerNode::_run_scene_requested).bind (id));
124125
125126 if (tabs->get_tab_count () > 0 ) {
126127 get_debugger (0 )->clear_style ();
@@ -780,6 +781,24 @@ void EditorDebuggerNode::_save_node_requested(ObjectID p_id, const String &p_fil
780781 get_current_debugger ()->save_node (p_id, p_file);
781782}
782783
784+ void EditorDebuggerNode::_run_scene_requested (const String &p_scene, const Vector<String> &p_args, int p_debugger) {
785+ EditorRunBar *editor_run_bar = EditorRunBar::get_singleton ();
786+ ERR_FAIL_NULL (editor_run_bar);
787+
788+ editor_run_bar->stop_playing ();
789+
790+ // Defer starting the new one, so the old one has a chance to fully stop.
791+ callable_mp (this , &EditorDebuggerNode::_run_scene_internal).call_deferred (editor_run_bar, p_scene, p_args);
792+ }
793+
794+ void EditorDebuggerNode::_run_scene_internal (EditorRunBar *p_editor_run_bar, const String &p_scene, const Vector<String> &p_args) {
795+ if (p_scene.is_empty ()) {
796+ p_editor_run_bar->play_main_scene (false );
797+ } else {
798+ p_editor_run_bar->play_custom_scene (p_scene, p_args);
799+ }
800+ }
801+
783802void EditorDebuggerNode::_breakpoint_set_in_tree (Ref<RefCounted> p_script, int p_line, bool p_enabled, int p_debugger) {
784803 if (p_debugger != tabs->get_current_tab ()) {
785804 return ;
0 commit comments