summaryrefslogtreecommitdiffstats
path: root/main/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'main/main.cpp')
-rw-r--r--main/main.cpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/main/main.cpp b/main/main.cpp
index 66391ffa7e..4dca79fd55 100644
--- a/main/main.cpp
+++ b/main/main.cpp
@@ -56,7 +56,7 @@
#ifdef TOOLS_ENABLED
#include "tools/editor/editor_node.h"
#include "tools/editor/project_manager.h"
-#include "tools/editor/console.h"
+
#include "tools/pck/pck_packer.h"
#endif
@@ -1330,6 +1330,12 @@ bool Main::start() {
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);
+ }
+
RES res = ResourceLoader::load(path);
ERR_EXPLAIN("Can't autoload: "+path);
ERR_CONTINUE(res.is_null());
@@ -1355,7 +1361,16 @@ bool Main::start() {
ERR_EXPLAIN("Path in autoload not a node or script: "+path);
ERR_CONTINUE(!n);
n->set_name(name);
+
sml->get_root()->add_child(n);
+
+ if (global_var) {
+ for(int i=0;i<ScriptServer::get_language_count();i++) {
+ ScriptServer::get_language(i)->add_global_constant(name,n);
+ }
+ }
+
+
}
}