You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-07 12:30:27 +00:00
Expose methods to play scene from plugin code
(cherry picked from commit 49f6dc5004)
This commit is contained in:
committed by
Rémi Verschelde
parent
a8d4ca0e1b
commit
2b4773f0cf
@@ -1962,7 +1962,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_icon("PlayCustom", "EditorIcons"));
|
||||
|
||||
String main_scene;
|
||||
String run_filename;
|
||||
String args;
|
||||
bool skip_breakpoints;
|
||||
@@ -2387,8 +2386,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: {
|
||||
@@ -2399,8 +2397,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;
|
||||
@@ -2439,10 +2436,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_PLAY_NATIVE: {
|
||||
@@ -4541,10 +4535,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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user