diff --git a/main/main.cpp b/main/main.cpp index e339f399dea..ec4386ab208 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -1294,9 +1294,10 @@ bool Main::start() { } + String local_game_path; if (game_path!="" && !project_manager_request) { - String local_game_path=game_path.replace("\\","/"); + local_game_path=game_path.replace("\\","/"); if (!local_game_path.begins_with("res://")) { bool absolute=(local_game_path.size()>1) && (local_game_path[0]=='/' || local_game_path[1]==':'); @@ -1363,98 +1364,99 @@ bool Main::start() { OS::get_singleton()->set_context(OS::CONTEXT_EDITOR); //editor_node->set_edited_scene(game); - } else { + } #endif + } - { - //autoload - List props; - Globals::get_singleton()->get_property_list(&props); + if (!project_manager_request && !editor) { + if (game_path!="" || script!="") { + //autoload + List props; + Globals::get_singleton()->get_property_list(&props); - //first pass, add the constants so they exist before any script is loaded - for(List::Element *E=props.front();E;E=E->next()) { - - String s = E->get().name; - if (!s.begins_with("autoload/")) - continue; - String name = s.get_slicec('/',1); - String path = Globals::get_singleton()->get(s); - bool global_var=false; - if (path.begins_with("*")) { - global_var=true; - } - - if (global_var) { - for(int i=0;iadd_global_constant(name,Variant()); - } - } + //first pass, add the constants so they exist before any script is loaded + for(List::Element *E=props.front();E;E=E->next()) { + String s = E->get().name; + if (!s.begins_with("autoload/")) + continue; + String name = s.get_slicec('/',1); + String path = Globals::get_singleton()->get(s); + bool global_var=false; + if (path.begins_with("*")) { + global_var=true; } - //second pass, load into global constants - List to_add; - for(List::Element *E=props.front();E;E=E->next()) { - - String s = E->get().name; - if (!s.begins_with("autoload/")) - continue; - String name = s.get_slicec('/',1); - String path = Globals::get_singleton()->get(s); - bool global_var=false; - if (path.begins_with("*")) { - global_var=true; - path=path.substr(1,path.length()-1); + if (global_var) { + for(int i=0;iadd_global_constant(name,Variant()); } - - RES res = ResourceLoader::load(path); - ERR_EXPLAIN("Can't autoload: "+path); - ERR_CONTINUE(res.is_null()); - Node *n=NULL; - if (res->is_type("PackedScene")) { - Ref ps = res; - n=ps->instance(); - } else if (res->is_type("Script")) { - Ref