mirror of
https://github.com/godotengine/godot.git
synced 2025-11-01 14:11:15 +00:00
Only add autoloads in editor if they have tool scripts
This commit is contained in:
parent
5e997c9483
commit
55b4b30ab2
3 changed files with 136 additions and 108 deletions
|
|
@ -1444,7 +1444,7 @@ bool Main::start() {
|
|||
}
|
||||
#endif
|
||||
|
||||
if (!project_manager) { // game or editor
|
||||
if (!project_manager && !editor) { // game
|
||||
if (game_path != "" || script != "") {
|
||||
//autoload
|
||||
List<PropertyInfo> props;
|
||||
|
|
@ -1465,24 +1465,13 @@ bool Main::start() {
|
|||
|
||||
if (global_var) {
|
||||
for (int i = 0; i < ScriptServer::get_language_count(); i++) {
|
||||
#ifdef TOOLS_ENABLED
|
||||
if (editor) {
|
||||
ScriptServer::get_language(i)->add_named_global_constant(name, Variant());
|
||||
} else {
|
||||
ScriptServer::get_language(i)->add_global_constant(name, Variant());
|
||||
}
|
||||
#else
|
||||
ScriptServer::get_language(i)->add_global_constant(name, Variant());
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//second pass, load into global constants
|
||||
List<Node *> to_add;
|
||||
#ifdef TOOLS_ENABLED
|
||||
ResourceLoader::set_timestamp_on_load(editor); // Avoid problems when editing
|
||||
#endif
|
||||
for (List<PropertyInfo>::Element *E = props.front(); E; E = E->next()) {
|
||||
|
||||
String s = E->get().name;
|
||||
|
|
@ -1528,23 +1517,11 @@ bool Main::start() {
|
|||
|
||||
if (global_var) {
|
||||
for (int i = 0; i < ScriptServer::get_language_count(); i++) {
|
||||
#ifdef TOOLS_ENABLED
|
||||
if (editor) {
|
||||
ScriptServer::get_language(i)->add_named_global_constant(name, n);
|
||||
} else {
|
||||
ScriptServer::get_language(i)->add_global_constant(name, n);
|
||||
}
|
||||
#else
|
||||
ScriptServer::get_language(i)->add_global_constant(name, n);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef TOOLS_ENABLED
|
||||
ResourceLoader::set_timestamp_on_load(false);
|
||||
#endif
|
||||
|
||||
for (List<Node *>::Element *E = to_add.front(); E; E = E->next()) {
|
||||
|
||||
sml->get_root()->add_child(E->get());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue