Expose methods to play scene from plugin code
This commit is contained in:
parent
b43fb407b1
commit
49f6dc5004
7 changed files with 124 additions and 8 deletions
|
|
@ -2043,7 +2043,6 @@ void EditorNode::_run(bool p_current, const String &p_custom) {
|
|||
play_custom_scene_button->set_pressed(false);
|
||||
play_custom_scene_button->set_icon(gui_base->get_theme_icon("PlayCustom", "EditorIcons"));
|
||||
|
||||
String main_scene;
|
||||
String run_filename;
|
||||
String args;
|
||||
bool skip_breakpoints;
|
||||
|
|
@ -2464,8 +2463,7 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
|
|||
|
||||
} break;
|
||||
case RUN_PLAY: {
|
||||
_menu_option_confirm(RUN_STOP, true);
|
||||
_run(false);
|
||||
run_play();
|
||||
|
||||
} break;
|
||||
case RUN_PLAY_CUSTOM_SCENE: {
|
||||
|
|
@ -2476,8 +2474,7 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
|
|||
play_custom_scene_button->set_pressed(false);
|
||||
} else {
|
||||
String last_custom_scene = run_custom_filename;
|
||||
_menu_option_confirm(RUN_STOP, true);
|
||||
_run(false, last_custom_scene);
|
||||
run_play_custom(last_custom_scene);
|
||||
}
|
||||
|
||||
} break;
|
||||
|
|
@ -2517,9 +2514,7 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
|
|||
} break;
|
||||
|
||||
case RUN_PLAY_SCENE: {
|
||||
_save_default_environment();
|
||||
_menu_option_confirm(RUN_STOP, true);
|
||||
_run(true);
|
||||
run_play_current();
|
||||
|
||||
} break;
|
||||
case RUN_SCENE_SETTINGS: {
|
||||
|
|
@ -4524,10 +4519,35 @@ void EditorNode::run_play() {
|
|||
_run(false);
|
||||
}
|
||||
|
||||
void EditorNode::run_play_current() {
|
||||
_save_default_environment();
|
||||
_menu_option_confirm(RUN_STOP, true);
|
||||
_run(true);
|
||||
}
|
||||
|
||||
void EditorNode::run_play_custom(const String &p_custom) {
|
||||
_menu_option_confirm(RUN_STOP, true);
|
||||
_run(false, p_custom);
|
||||
}
|
||||
|
||||
void EditorNode::run_stop() {
|
||||
_menu_option_confirm(RUN_STOP, false);
|
||||
}
|
||||
|
||||
bool EditorNode::is_run_playing() const {
|
||||
EditorRun::Status status = editor_run.get_status();
|
||||
return (status == EditorRun::STATUS_PLAY || status == EditorRun::STATUS_PAUSED);
|
||||
}
|
||||
|
||||
String EditorNode::get_run_playing_scene() const {
|
||||
String run_filename = editor_run.get_running_scene();
|
||||
if (run_filename == "" && is_run_playing()) {
|
||||
run_filename = GLOBAL_DEF("application/run/main_scene", ""); // Must be the main scene then.
|
||||
}
|
||||
|
||||
return run_filename;
|
||||
}
|
||||
|
||||
int EditorNode::get_current_tab() {
|
||||
return scene_tabs->get_current_tab();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue