MCPcopy Create free account
hub / github.com/Redot-Engine/redot-engine / ensure_main_scene

Method ensure_main_scene

editor/editor_node.cpp:5920–5954  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5918}
5919
5920bool EditorNode::ensure_main_scene(bool p_from_native) {
5921 pick_main_scene->set_meta("from_native", p_from_native); // Whether from play button or native run.
5922 String main_scene = GLOBAL_GET("application/run/main_scene");
5923
5924 if (main_scene.is_empty()) {
5925 current_menu_option = -1;
5926 pick_main_scene->set_text(TTR("No main scene has ever been defined. Select one?\nYou can change it later in \"Project Settings\" under the 'application' category."));
5927 pick_main_scene->popup_centered();
5928
5929 if (editor_data.get_edited_scene_root()) {
5930 select_current_scene_button->set_disabled(false);
5931 select_current_scene_button->grab_focus();
5932 } else {
5933 select_current_scene_button->set_disabled(true);
5934 }
5935
5936 return false;
5937 }
5938
5939 if (!FileAccess::exists(main_scene)) {
5940 current_menu_option = -1;
5941 pick_main_scene->set_text(vformat(TTR("Selected scene '%s' does not exist. Select a valid one?\nYou can change it later in \"Project Settings\" under the 'application' category."), main_scene));
5942 pick_main_scene->popup_centered();
5943 return false;
5944 }
5945
5946 if (ResourceLoader::get_resource_type(main_scene) != "PackedScene") {
5947 current_menu_option = -1;
5948 pick_main_scene->set_text(vformat(TTR("Selected scene '%s' is not a scene file. Select a valid one?\nYou can change it later in \"Project Settings\" under the 'application' category."), main_scene));
5949 pick_main_scene->popup_centered();
5950 return false;
5951 }
5952
5953 return true;
5954}
5955
5956bool EditorNode::validate_custom_directory() {
5957 bool use_custom_dir = GLOBAL_GET("application/config/use_custom_user_dir");

Callers 2

start_run_nativeMethod · 0.80
_run_sceneMethod · 0.80

Calls 9

TTRFunction · 0.85
vformatFunction · 0.85
popup_centeredMethod · 0.80
set_metaMethod · 0.45
is_emptyMethod · 0.45
set_textMethod · 0.45
get_edited_scene_rootMethod · 0.45
set_disabledMethod · 0.45
grab_focusMethod · 0.45

Tested by

no test coverage detected