From d8f06085a2b5b2eb1838cefdb58aa39a99022324 Mon Sep 17 00:00:00 2001 From: Ignacio Etcheverry Date: Wed, 17 Feb 2016 19:40:06 +0100 Subject: Fix _quick_run method (Play custom scene) --- tools/editor/editor_node.cpp | 4 ++-- tools/editor/editor_node.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/editor/editor_node.cpp b/tools/editor/editor_node.cpp index b39a1b5350..794e02fa50 100644 --- a/tools/editor/editor_node.cpp +++ b/tools/editor/editor_node.cpp @@ -3843,9 +3843,9 @@ void EditorNode::_quick_opened() { } } -void EditorNode::_quick_run(const String& p_resource) { +void EditorNode::_quick_run() { - _run(false,p_resource); + _run(false,quick_run->get_selected()); } diff --git a/tools/editor/editor_node.h b/tools/editor/editor_node.h index a8aa6ac1f4..6893b78e8b 100644 --- a/tools/editor/editor_node.h +++ b/tools/editor/editor_node.h @@ -447,7 +447,7 @@ class EditorNode : public Node { void _hide_top_editors(); void _quick_opened(); - void _quick_run(const String& p_resource); + void _quick_run(); void _run(bool p_current=false, const String &p_custom=""); -- cgit v1.2.3 From 8c0accc4ba2388638ee2ed397216952f0bf5dde4 Mon Sep 17 00:00:00 2001 From: Ignacio Etcheverry Date: Wed, 17 Feb 2016 20:51:56 +0100 Subject: Added option to restart custom scene --- tools/editor/editor_node.cpp | 22 ++++++++++++++++++---- tools/editor/editor_node.h | 1 + 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/tools/editor/editor_node.cpp b/tools/editor/editor_node.cpp index 794e02fa50..8aa579d873 100644 --- a/tools/editor/editor_node.cpp +++ b/tools/editor/editor_node.cpp @@ -1795,6 +1795,8 @@ void EditorNode::_run(bool p_current,const String& p_custom) { //pause_button->set_pressed(false); play_scene_button->set_pressed(false); play_scene_button->set_icon(gui_base->get_icon("PlayScene","EditorIcons")); + play_custom_scene_button->set_pressed(false); + play_custom_scene_button->set_icon(gui_base->get_icon("PlayCustom","EditorIcons")); String current_filename; String run_filename; @@ -1804,7 +1806,6 @@ void EditorNode::_run(bool p_current,const String& p_custom) { if (p_current || (editor_data.get_edited_scene_root() && p_custom==editor_data.get_edited_scene_root()->get_filename())) { - Node *scene = editor_data.get_edited_scene_root(); if (!scene) { @@ -1913,6 +1914,10 @@ void EditorNode::_run(bool p_current,const String& p_custom) { if (p_current) { play_scene_button->set_pressed(true); play_scene_button->set_icon(gui_base->get_icon("Reload","EditorIcons")); + } else if (p_custom!="") { + run_custom_filename=run_filename; + play_custom_scene_button->set_pressed(true); + play_custom_scene_button->set_icon(gui_base->get_icon("Reload","EditorIcons")); } else { play_button->set_pressed(true); play_button->set_icon(gui_base->get_icon("Reload","EditorIcons")); @@ -2595,9 +2600,15 @@ void EditorNode::_menu_option_confirm(int p_option,bool p_confirmed) { } break; case RUN_PLAY_CUSTOM_SCENE: { - _menu_option_confirm(RUN_STOP,true); - quick_run->popup("PackedScene",true); - quick_run->set_title("Quick Run Scene.."); + if (run_custom_filename.empty() || editor_run.get_status()==EditorRun::STATUS_STOP) { + _menu_option_confirm(RUN_STOP,true); + quick_run->popup("PackedScene",true); + quick_run->set_title("Quick Run Scene.."); + } else { + String last_custom_scene=run_custom_filename; + _menu_option_confirm(RUN_STOP,true); + _run(false,last_custom_scene); + } } break; case RUN_PAUSE: { @@ -2611,10 +2622,13 @@ void EditorNode::_menu_option_confirm(int p_option,bool p_confirmed) { break; editor_run.stop(); + run_custom_filename.clear(); play_button->set_pressed(false); play_button->set_icon(gui_base->get_icon("MainPlay","EditorIcons")); play_scene_button->set_pressed(false); play_scene_button->set_icon(gui_base->get_icon("PlayScene","EditorIcons")); + play_custom_scene_button->set_pressed(false); + play_custom_scene_button->set_icon(gui_base->get_icon("PlayCustom","EditorIcons")); //pause_button->set_pressed(false); emit_signal("stop_pressed"); diff --git a/tools/editor/editor_node.h b/tools/editor/editor_node.h index 6893b78e8b..a83555d6e8 100644 --- a/tools/editor/editor_node.h +++ b/tools/editor/editor_node.h @@ -355,6 +355,7 @@ class EditorNode : public Node { Object *current; bool _playing_edited; + String run_custom_filename; bool reference_resource_mem; bool save_external_resources_mem; uint64_t saved_version; -- cgit v1.2.3