1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-06 12:20:30 +00:00

Expose methods to play scene from plugin code

(cherry picked from commit 49f6dc5004)
This commit is contained in:
Yuri Sizov
2020-04-05 17:19:24 +03:00
committed by Rémi Verschelde
parent a8d4ca0e1b
commit 2b4773f0cf
7 changed files with 124 additions and 9 deletions

View File

@@ -184,6 +184,30 @@ void EditorInterface::reload_scene_from_path(const String &scene_path) {
EditorNode::get_singleton()->reload_scene(scene_path);
}
void EditorInterface::play_main_scene() {
EditorNode::get_singleton()->run_play();
}
void EditorInterface::play_current_scene() {
EditorNode::get_singleton()->run_play_current();
}
void EditorInterface::play_custom_scene(const String &scene_path) {
EditorNode::get_singleton()->run_play_custom(scene_path);
}
void EditorInterface::stop_playing_scene() {
EditorNode::get_singleton()->run_stop();
}
bool EditorInterface::is_playing_scene() const {
return EditorNode::get_singleton()->is_run_playing();
}
String EditorInterface::get_playing_scene() const {
return EditorNode::get_singleton()->get_run_playing_scene();
}
Node *EditorInterface::get_edited_scene_root() {
return EditorNode::get_singleton()->get_edited_scene();
}
@@ -295,6 +319,12 @@ void EditorInterface::_bind_methods() {
ClassDB::bind_method(D_METHOD("edit_resource", "resource"), &EditorInterface::edit_resource);
ClassDB::bind_method(D_METHOD("open_scene_from_path", "scene_filepath"), &EditorInterface::open_scene_from_path);
ClassDB::bind_method(D_METHOD("reload_scene_from_path", "scene_filepath"), &EditorInterface::reload_scene_from_path);
ClassDB::bind_method(D_METHOD("play_main_scene"), &EditorInterface::play_main_scene);
ClassDB::bind_method(D_METHOD("play_current_scene"), &EditorInterface::play_current_scene);
ClassDB::bind_method(D_METHOD("play_custom_scene", "scene_filepath"), &EditorInterface::play_custom_scene);
ClassDB::bind_method(D_METHOD("stop_playing_scene"), &EditorInterface::stop_playing_scene);
ClassDB::bind_method(D_METHOD("is_playing_scene"), &EditorInterface::is_playing_scene);
ClassDB::bind_method(D_METHOD("get_playing_scene"), &EditorInterface::get_playing_scene);
ClassDB::bind_method(D_METHOD("get_open_scenes"), &EditorInterface::get_open_scenes);
ClassDB::bind_method(D_METHOD("get_edited_scene_root"), &EditorInterface::get_edited_scene_root);
ClassDB::bind_method(D_METHOD("get_resource_previewer"), &EditorInterface::get_resource_previewer);