diff --git a/core/SCsub b/core/SCsub index 8d89f6427bb..a9721a10526 100644 --- a/core/SCsub +++ b/core/SCsub @@ -13,7 +13,7 @@ for x in env.global_defaults: gd_inc += '#include "platform/' + x + '/globals/global_defaults.h"\n' gd_call += "\tregister_" + x + "_global_defaults();\n" -gd_cpp = '#include "globals.h"\n' +gd_cpp = '#include "global_config.h"\n' gd_cpp += gd_inc gd_cpp += "void GlobalConfig::register_global_defaults() {\n" + gd_call + "\n}\n" @@ -45,7 +45,7 @@ if ("SCRIPT_AES256_ENCRYPTION_KEY" in os.environ): print("Invalid AES256 encryption key, not 64 bits hex: " + e) f = open("script_encryption_key.cpp", "wb") -f.write("#include \"globals.h\"\nuint8_t script_encryption_key[32]={" + txt + "};\n") +f.write("#include \"global_config.h\"\nuint8_t script_encryption_key[32]={" + txt + "};\n") f.close() diff --git a/core/bind/core_bind.cpp b/core/bind/core_bind.cpp index 7bd652349d3..54ab51657ba 100644 --- a/core/bind/core_bind.cpp +++ b/core/bind/core_bind.cpp @@ -31,7 +31,7 @@ #include "geometry.h" #include "io/marshalls.h" #include "io/base64.h" -#include "core/globals.h" +#include "core/global_config.h" #include "io/file_access_encrypted.h" #include "os/keyboard.h" diff --git a/core/globals.cpp b/core/global_config.cpp similarity index 90% rename from core/globals.cpp rename to core/global_config.cpp index 0c35a9f89ab..b76991c04e9 100644 --- a/core/globals.cpp +++ b/core/global_config.cpp @@ -26,7 +26,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#include "globals.h" +#include "global_config.h" #include "os/dir_access.h" #include "os/file_access.h" @@ -247,50 +247,7 @@ bool GlobalConfig::_load_resource_pack(const String& p_pack) { Error GlobalConfig::setup(const String& p_path,const String & p_main_pack) { - //an absolute mess of a function, must be cleaned up and reorganized somehow at some point - - //_load_settings(p_path+"/override.cfg"); - - if (p_main_pack!="") { - - bool ok = _load_resource_pack(p_main_pack); - ERR_FAIL_COND_V(!ok,ERR_CANT_OPEN); - - if (_load_settings("res://godot.cfg")==OK || _load_settings_binary("res://godot.cfb")==OK) { - - _load_settings("res://override.cfg"); - - } - - return OK; - - } - - if (OS::get_singleton()->get_executable_path()!="") { - - if (_load_resource_pack(OS::get_singleton()->get_executable_path())) { - - if (p_path!="") { - resource_path=p_path; - } else { - DirAccess *d = DirAccess::create(DirAccess::ACCESS_FILESYSTEM); - resource_path=d->get_current_dir(); - memdelete(d); - - } - if (_load_settings("res://godot.cfg")==OK || _load_settings_binary("res://godot.cfb")==OK) { - - _load_settings("res://override.cfg"); - - } - - - - return OK; - } - - } - + //If looking for files in network, just use network! if (FileAccessNetworkClient::get_singleton()) { @@ -303,20 +260,58 @@ Error GlobalConfig::setup(const String& p_path,const String & p_main_pack) { return OK; } + String exec_path = OS::get_singleton()->get_executable_path(); + + //Attempt with a passed main pack first + + if (p_main_pack!="") { + + bool ok = _load_resource_pack(p_main_pack); + ERR_FAIL_COND_V(!ok,ERR_CANT_OPEN); + + if (_load_settings("res://godot.cfg")==OK || _load_settings_binary("res://godot.cfb")==OK) { + //load override from location of the main pack + _load_settings(p_main_pack.get_base_dir().plus_file("override.cfg")); + + } + + return OK; + + } + + //Attempt with execname.pck + if (exec_path!="") { + + + if (_load_resource_pack(exec_path.get_basename()+".pck")) { + + if (_load_settings("res://godot.cfg")==OK || _load_settings_binary("res://godot.cfb")==OK) { + //load override from location of executable + _load_settings(exec_path.get_base_dir().plus_file("override.cfg")); + + } + + + + return OK; + } + + } + + + //Try to use the filesystem for files, according to OS. (only Android -when reading from pck- and iOS use this) if (OS::get_singleton()->get_resource_dir()!="") { - //OS will call Globals->get_resource_path which will be empty if not overriden! + //OS will call Globals->get_resource_path which will be empty if not overriden! //if the OS would rather use somewhere else, then it will not be empty. + resource_path=OS::get_singleton()->get_resource_dir().replace("\\","/"); if (resource_path.length() && resource_path[ resource_path.length()-1]=='/') resource_path=resource_path.substr(0,resource_path.length()-1); // chop end - print_line("has res dir: "+resource_path); - if (!_load_resource_pack("res://data.pck")) - _load_resource_pack("res://data.zip"); - // make sure this is load from the resource path - print_line("exists engine cfg? "+itos(FileAccess::exists("/godot.cfg"))); + // data.pck and data.zip are deprecated and no longer supported, apologies. + // make sure this is loaded from the resource path + if (_load_settings("res://godot.cfg")==OK || _load_settings_binary("res://godot.cfb")==OK) { - print_line("loaded godot.cfg"); _load_settings("res://override.cfg"); } @@ -324,67 +319,41 @@ Error GlobalConfig::setup(const String& p_path,const String & p_main_pack) { return OK; } + //Nothing was found, try to find a godot.cfg somewhere! + DirAccess *d = DirAccess::create(DirAccess::ACCESS_FILESYSTEM); - if (!d) { + ERR_FAIL_COND_V(!d,ERR_CANT_CREATE); - resource_path = p_path; + d->change_dir(p_path); - } else { + String candidate = d->get_current_dir(); + String current_dir = d->get_current_dir(); + bool found = false; - d->change_dir(p_path); + while(true) { + //try to load settings in ascending through dirs shape! - String candidate = d->get_current_dir(); - String current_dir = d->get_current_dir(); - String exec_name = OS::get_singleton()->get_executable_path().get_file().get_basename(); - bool found = false; - bool first_time=true; + if (_load_settings(current_dir+"/godot.cfg")==OK || _load_settings_binary(current_dir+"/godot.cfb")==OK) { - while(true) { - //try to load settings in ascending through dirs shape! - - //tries to open pack, but only first time - if (first_time && (_load_resource_pack(current_dir+"/"+exec_name+".pck") || _load_resource_pack(current_dir+"/"+exec_name+".zip") )) { - if (_load_settings("res://godot.cfg")==OK || _load_settings_binary("res://godot.cfb")==OK) { - - _load_settings("res://override.cfg"); - found=true; - - - } - break; - } else if (first_time && (_load_resource_pack(current_dir+"/data.pck") || _load_resource_pack(current_dir+"/data.zip") )) { - if (_load_settings("res://godot.cfg")==OK || _load_settings_binary("res://godot.cfb")==OK) { - - _load_settings("res://override.cfg"); - found=true; - - - } - break; - } else if (_load_settings(current_dir+"/godot.cfg")==OK || _load_settings_binary(current_dir+"/godot.cfb")==OK) { - - _load_settings(current_dir+"/override.cfg"); - candidate=current_dir; - found=true; - break; - } - - d->change_dir(".."); - if (d->get_current_dir()==current_dir) - break; //not doing anything useful - current_dir=d->get_current_dir(); - first_time=false; + _load_settings(current_dir+"/override.cfg"); + candidate=current_dir; + found=true; + break; } + d->change_dir(".."); + if (d->get_current_dir()==current_dir) + break; //not doing anything useful + current_dir=d->get_current_dir(); + } - resource_path=candidate; - resource_path = resource_path.replace("\\","/"); // windows path to unix path just in case - memdelete(d); - if (!found) - return ERR_FILE_NOT_FOUND; - }; + resource_path=candidate; + resource_path = resource_path.replace("\\","/"); // windows path to unix path just in case + memdelete(d); + if (!found) + return ERR_FILE_NOT_FOUND; if (resource_path.length() && resource_path[ resource_path.length()-1]=='/') resource_path=resource_path.substr(0,resource_path.length()-1); // chop end diff --git a/core/globals.h b/core/global_config.h similarity index 99% rename from core/globals.h rename to core/global_config.h index faf077f2a54..471f1ff8851 100644 --- a/core/globals.h +++ b/core/global_config.h @@ -26,8 +26,8 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef GLOBALS_H -#define GLOBALS_H +#ifndef GLOBAL_CONFIG_H +#define GLOBAL_CONFIG_H #include "object.h" #include "set.h" diff --git a/core/input_map.cpp b/core/input_map.cpp index 249c75cea00..444c55cac6e 100644 --- a/core/input_map.cpp +++ b/core/input_map.cpp @@ -28,7 +28,7 @@ /*************************************************************************/ #include "input_map.h" -#include "globals.h" +#include "global_config.h" #include "os/keyboard.h" InputMap *InputMap::singleton=NULL; diff --git a/core/io/file_access_memory.cpp b/core/io/file_access_memory.cpp index 32eb0032286..b4ba14ddc9c 100644 --- a/core/io/file_access_memory.cpp +++ b/core/io/file_access_memory.cpp @@ -30,7 +30,7 @@ #include "os/dir_access.h" #include "os/copymem.h" -#include "globals.h" +#include "global_config.h" #include "map.h" static Map >* files = NULL; diff --git a/core/io/file_access_network.cpp b/core/io/file_access_network.cpp index 7bf750f6e1e..d9fdc9cedc1 100644 --- a/core/io/file_access_network.cpp +++ b/core/io/file_access_network.cpp @@ -28,7 +28,7 @@ /*************************************************************************/ #include "file_access_network.h" #include "marshalls.h" -#include "globals.h" +#include "global_config.h" #include "os/os.h" #include "io/ip.h" diff --git a/core/io/file_access_pack.cpp b/core/io/file_access_pack.cpp index d63539a7a5c..fa1bebde165 100644 --- a/core/io/file_access_pack.cpp +++ b/core/io/file_access_pack.cpp @@ -31,7 +31,7 @@ #include -#define PACK_VERSION 0 +#define PACK_VERSION 1 Error PackedData::add_pack(const String& p_path) { @@ -167,8 +167,8 @@ bool PackedSourcePCK::try_open_pack(const String& p_path) { uint32_t ver_minor = f->get_32(); uint32_t ver_rev = f->get_32(); - ERR_EXPLAIN("Pack version newer than supported by engine: "+itos(version)); - ERR_FAIL_COND_V( version > PACK_VERSION, ERR_INVALID_DATA); + ERR_EXPLAIN("Pack version unsupported: "+itos(version)); + ERR_FAIL_COND_V( version != PACK_VERSION, ERR_INVALID_DATA); ERR_EXPLAIN("Pack created with a newer version of the engine: "+itos(ver_major)+"."+itos(ver_minor)+"."+itos(ver_rev)); ERR_FAIL_COND_V( ver_major > VERSION_MAJOR || (ver_major == VERSION_MAJOR && ver_minor > VERSION_MINOR), ERR_INVALID_DATA); diff --git a/core/io/packet_peer.cpp b/core/io/packet_peer.cpp index aca095b6a52..cf5883121f9 100644 --- a/core/io/packet_peer.cpp +++ b/core/io/packet_peer.cpp @@ -29,7 +29,7 @@ #include "packet_peer.h" #include "io/marshalls.h" -#include "globals.h" +#include "global_config.h" /* helpers / binders */ diff --git a/core/io/resource_format_binary.cpp b/core/io/resource_format_binary.cpp index 2c02dbcc9bf..2d733842fac 100644 --- a/core/io/resource_format_binary.cpp +++ b/core/io/resource_format_binary.cpp @@ -28,7 +28,7 @@ /*************************************************************************/ #include "version.h" #include "resource_format_binary.h" -#include "globals.h" +#include "global_config.h" #include "io/file_access_compressed.h" #include "io/marshalls.h" #include "os/dir_access.h" diff --git a/core/io/resource_loader.cpp b/core/io/resource_loader.cpp index b6d28bccfa8..c14389eefa9 100644 --- a/core/io/resource_loader.cpp +++ b/core/io/resource_loader.cpp @@ -28,7 +28,7 @@ /*************************************************************************/ #include "resource_loader.h" #include "print_string.h" -#include "globals.h" +#include "global_config.h" #include "path_remap.h" #include "os/file_access.h" #include "os/os.h" diff --git a/core/io/resource_saver.cpp b/core/io/resource_saver.cpp index 222d3e6bc0a..f0bea300517 100644 --- a/core/io/resource_saver.cpp +++ b/core/io/resource_saver.cpp @@ -27,7 +27,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ #include "resource_saver.h" -#include "globals.h" +#include "global_config.h" #include "os/file_access.h" #include "script_language.h" #include "resource_loader.h" diff --git a/core/message_queue.cpp b/core/message_queue.cpp index 668d321e057..50b52e4970b 100644 --- a/core/message_queue.cpp +++ b/core/message_queue.cpp @@ -28,7 +28,7 @@ /*************************************************************************/ #include "message_queue.h" -#include "globals.h" +#include "global_config.h" #include "script_language.h" MessageQueue *MessageQueue::singleton=NULL; diff --git a/core/os/dir_access.cpp b/core/os/dir_access.cpp index 804fe15c39d..974225a3e81 100644 --- a/core/os/dir_access.cpp +++ b/core/os/dir_access.cpp @@ -30,7 +30,7 @@ #include "os/file_access.h" #include "os/memory.h" #include "os/os.h" -#include "globals.h" +#include "global_config.h" String DirAccess::_get_root_path() const { diff --git a/core/os/file_access.cpp b/core/os/file_access.cpp index 06723c51319..ae592720e82 100644 --- a/core/os/file_access.cpp +++ b/core/os/file_access.cpp @@ -27,7 +27,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ #include "file_access.h" -#include "globals.h" +#include "global_config.h" #include "os/os.h" #include "core/io/marshalls.h" #include "io/md5.h" diff --git a/core/os/input.cpp b/core/os/input.cpp index e20c966ff28..34883e63bad 100644 --- a/core/os/input.cpp +++ b/core/os/input.cpp @@ -29,7 +29,7 @@ #include "input.h" #include "input_map.h" #include "os/os.h" -#include "globals.h" +#include "global_config.h" Input *Input::singleton=NULL; Input *Input::get_singleton() { diff --git a/core/os/os.cpp b/core/os/os.cpp index 3a8e15a6920..912f7f0b0f2 100644 --- a/core/os/os.cpp +++ b/core/os/os.cpp @@ -29,7 +29,7 @@ #include "os.h" #include "dir_access.h" -#include "globals.h" +#include "global_config.h" #include "input.h" #include "os/file_access.h" diff --git a/core/register_core_types.cpp b/core/register_core_types.cpp index ab94b56cdc9..00f6f8662f5 100644 --- a/core/register_core_types.cpp +++ b/core/register_core_types.cpp @@ -35,7 +35,7 @@ #include "io/packet_peer.h" #include "math/a_star.h" #include "math/triangle_mesh.h" -#include "globals.h" +#include "global_config.h" #include "class_db.h" #include "geometry.h" #include "bind/core_bind.h" diff --git a/core/script_debugger_remote.cpp b/core/script_debugger_remote.cpp index 62d14c4e5ac..b14eb51b6c0 100644 --- a/core/script_debugger_remote.cpp +++ b/core/script_debugger_remote.cpp @@ -30,7 +30,7 @@ #include "os/os.h" #include "io/ip.h" -#include "globals.h" +#include "global_config.h" #include "os/input.h" void ScriptDebuggerRemote::_send_video_memory() { diff --git a/core/translation.cpp b/core/translation.cpp index 655bfd36b87..d9d4fe77847 100644 --- a/core/translation.cpp +++ b/core/translation.cpp @@ -28,7 +28,7 @@ /*************************************************************************/ #include "translation.h" -#include "globals.h" +#include "global_config.h" #include "io/resource_loader.h" #include "os/os.h" diff --git a/core/ustring.cpp b/core/ustring.cpp index a0d26ea0af3..c13c13ec114 100644 --- a/core/ustring.cpp +++ b/core/ustring.cpp @@ -52,8 +52,40 @@ #define UPPERCASE(m_c) (((m_c)>='a' && (m_c)<='z')?((m_c)-('a'-'A')):(m_c)) #define LOWERCASE(m_c) (((m_c)>='A' && (m_c)<='Z')?((m_c)+('a'-'A')):(m_c)) + + + /** STRING **/ +bool CharString::operator<(const CharString& p_right) const { + + if (length()==0) { + return p_right.length()!=0; + } + + + const char *this_str=get_data(); + const char *that_str=get_data(); + while (true) { + + if (*that_str==0 && *this_str==0) + return false; //this can't be equal, sadly + else if (*this_str==0) + return true; //if this is empty, and the other one is not, then we're less.. I think? + else if (*that_str==0) + return false; //otherwise the other one is smaller.. + else if (*this_str < *that_str ) //more than + return true; + else if (*this_str > *that_str ) //less than + return false; + + this_str++; + that_str++; + } + + return false; //should never reach here anyway +} + const char *CharString::get_data() const { if (size()) diff --git a/core/ustring.h b/core/ustring.h index 5665a23112e..87289f9e164 100644 --- a/core/ustring.h +++ b/core/ustring.h @@ -41,6 +41,8 @@ class CharString : public Vector { public: + + bool operator<(const CharString& p_right) const; int length() const { return size() ? size()-1 : 0; } const char *get_data() const; operator const char*() {return get_data();}; diff --git a/drivers/alsa/audio_driver_alsa.cpp b/drivers/alsa/audio_driver_alsa.cpp index 8984d412a32..f2616b11b82 100644 --- a/drivers/alsa/audio_driver_alsa.cpp +++ b/drivers/alsa/audio_driver_alsa.cpp @@ -30,7 +30,7 @@ #ifdef ALSA_ENABLED -#include "globals.h" +#include "global_config.h" #include diff --git a/drivers/gles2/rasterizer_gles2.cpp b/drivers/gles2/rasterizer_gles2.cpp index 1486e85a045..94c5ecdec10 100644 --- a/drivers/gles2/rasterizer_gles2.cpp +++ b/drivers/gles2/rasterizer_gles2.cpp @@ -30,7 +30,7 @@ #include "rasterizer_gles2.h" #include "os/os.h" -#include "globals.h" +#include "global_config.h" #include #include "servers/visual/shader_language.h" #include "servers/visual/particle_system_sw.h" diff --git a/drivers/gles3/rasterizer_gles3.cpp b/drivers/gles3/rasterizer_gles3.cpp index eb58759c475..aea4642d88b 100644 --- a/drivers/gles3/rasterizer_gles3.cpp +++ b/drivers/gles3/rasterizer_gles3.cpp @@ -1,6 +1,6 @@ #include "rasterizer_gles3.h" #include "os/os.h" -#include "globals.h" +#include "global_config.h" #include "gl_context/context_gl.h" #include RasterizerStorage *RasterizerGLES3::get_storage() { diff --git a/drivers/gles3/rasterizer_scene_gles3.cpp b/drivers/gles3/rasterizer_scene_gles3.cpp index bbbe9351ec2..ceb6bc336d9 100644 --- a/drivers/gles3/rasterizer_scene_gles3.cpp +++ b/drivers/gles3/rasterizer_scene_gles3.cpp @@ -1,5 +1,5 @@ #include "rasterizer_scene_gles3.h" -#include "globals.h" +#include "global_config.h" #include "os/os.h" #include "rasterizer_canvas_gles3.h" diff --git a/drivers/gles3/rasterizer_storage_gles3.cpp b/drivers/gles3/rasterizer_storage_gles3.cpp index 6ae7ef86c49..ac8bf8c2627 100644 --- a/drivers/gles3/rasterizer_storage_gles3.cpp +++ b/drivers/gles3/rasterizer_storage_gles3.cpp @@ -1,7 +1,7 @@ #include "rasterizer_storage_gles3.h" #include "rasterizer_canvas_gles3.h" #include "rasterizer_scene_gles3.h" -#include "globals.h" +#include "global_config.h" /* TEXTURE API */ diff --git a/drivers/png/resource_saver_png.cpp b/drivers/png/resource_saver_png.cpp index a9a199bb593..f55b089ded9 100644 --- a/drivers/png/resource_saver_png.cpp +++ b/drivers/png/resource_saver_png.cpp @@ -29,7 +29,7 @@ #include "resource_saver_png.h" #include "core/image.h" -#include "globals.h" +#include "global_config.h" #include "os/file_access.h" #include "scene/resources/texture.h" diff --git a/drivers/pulseaudio/audio_driver_pulseaudio.cpp b/drivers/pulseaudio/audio_driver_pulseaudio.cpp index 5f0e6475458..f5268f3ebd0 100644 --- a/drivers/pulseaudio/audio_driver_pulseaudio.cpp +++ b/drivers/pulseaudio/audio_driver_pulseaudio.cpp @@ -32,7 +32,7 @@ #include -#include "globals.h" +#include "global_config.h" Error AudioDriverPulseAudio::init() { diff --git a/drivers/rtaudio/audio_driver_rtaudio.cpp b/drivers/rtaudio/audio_driver_rtaudio.cpp index 6ada0aaa68b..cc715545bda 100644 --- a/drivers/rtaudio/audio_driver_rtaudio.cpp +++ b/drivers/rtaudio/audio_driver_rtaudio.cpp @@ -28,7 +28,7 @@ /*************************************************************************/ #include "audio_driver_rtaudio.h" -#include "globals.h" +#include "global_config.h" #include "os/os.h" #ifdef RTAUDIO_ENABLED diff --git a/drivers/unix/os_unix.cpp b/drivers/unix/os_unix.cpp index edf5f227144..fe49501328a 100644 --- a/drivers/unix/os_unix.cpp +++ b/drivers/unix/os_unix.cpp @@ -61,7 +61,7 @@ #include #include #include -#include "globals.h" +#include "global_config.h" extern bool _print_error_enabled; diff --git a/drivers/xaudio2/audio_driver_xaudio2.cpp b/drivers/xaudio2/audio_driver_xaudio2.cpp index fa55c973255..cd61fefd919 100644 --- a/drivers/xaudio2/audio_driver_xaudio2.cpp +++ b/drivers/xaudio2/audio_driver_xaudio2.cpp @@ -28,7 +28,7 @@ /*************************************************************************/ #include "audio_driver_xaudio2.h" -#include "globals.h" +#include "global_config.h" #include "os/os.h" const char * AudioDriverXAudio2::get_name() const diff --git a/main/main.cpp b/main/main.cpp index 21a839a25f6..9be77c31b6c 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -28,7 +28,7 @@ /*************************************************************************/ #include "main.h" #include "os/os.h" -#include "globals.h" +#include "global_config.h" #include "splash.h" #include "core/register_core_types.h" #include "scene/register_scene_types.h" diff --git a/main/tests/test_io.cpp b/main/tests/test_io.cpp index 42664e73cd4..23459c68d1e 100644 --- a/main/tests/test_io.cpp +++ b/main/tests/test_io.cpp @@ -39,7 +39,7 @@ #include "io/resource_loader.h" #include "io/resource_saver.h" #include "os/dir_access.h" -#include "core/globals.h" +#include "core/global_config.h" #include "io/file_access_memory.h" diff --git a/modules/gdscript/gd_editor.cpp b/modules/gdscript/gd_editor.cpp index 114a25feeb9..f325aec0728 100644 --- a/modules/gdscript/gd_editor.cpp +++ b/modules/gdscript/gd_editor.cpp @@ -28,7 +28,7 @@ /*************************************************************************/ #include "gd_script.h" #include "gd_compiler.h" -#include "globals.h" +#include "global_config.h" #include "os/file_access.h" void GDScriptLanguage::get_comment_delimiters(List *p_delimiters) const { diff --git a/modules/gdscript/gd_script.cpp b/modules/gdscript/gd_script.cpp index 167ede4853d..d4646aa36d5 100644 --- a/modules/gdscript/gd_script.cpp +++ b/modules/gdscript/gd_script.cpp @@ -27,7 +27,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ #include "gd_script.h" -#include "globals.h" +#include "global_config.h" #include "global_constants.h" #include "gd_compiler.h" #include "os/file_access.h" diff --git a/modules/openssl/stream_peer_openssl.h b/modules/openssl/stream_peer_openssl.h index 3d6875698c5..84ae03fe07e 100644 --- a/modules/openssl/stream_peer_openssl.h +++ b/modules/openssl/stream_peer_openssl.h @@ -31,7 +31,7 @@ #include // If you don't know what this is for stop reading now. #include "io/stream_peer_ssl.h" -#include "globals.h" +#include "global_config.h" #include "os/file_access.h" #include "curl_hostcheck.h" diff --git a/modules/theora/video_stream_theora.cpp b/modules/theora/video_stream_theora.cpp index 9d2dfc7f566..2a7b2707bf2 100644 --- a/modules/theora/video_stream_theora.cpp +++ b/modules/theora/video_stream_theora.cpp @@ -28,7 +28,7 @@ /*************************************************************************/ #include "video_stream_theora.h" -#include "globals.h" +#include "global_config.h" #include "os/os.h" #include "yuv2rgb.h" diff --git a/modules/visual_script/visual_script.cpp b/modules/visual_script/visual_script.cpp index ec09335b7da..6941ed54860 100644 --- a/modules/visual_script/visual_script.cpp +++ b/modules/visual_script/visual_script.cpp @@ -2,7 +2,7 @@ #include "visual_script_nodes.h" #include "scene/main/node.h" #include "os/os.h" -#include "globals.h" +#include "global_config.h" diff --git a/modules/visual_script/visual_script_flow_control.cpp b/modules/visual_script/visual_script_flow_control.cpp index d2781c6dcc9..93e395f0f28 100644 --- a/modules/visual_script/visual_script_flow_control.cpp +++ b/modules/visual_script/visual_script_flow_control.cpp @@ -1,6 +1,6 @@ #include "visual_script_flow_control.h" #include "os/keyboard.h" -#include "globals.h" +#include "global_config.h" ////////////////////////////////////////// diff --git a/modules/visual_script/visual_script_func_nodes.cpp b/modules/visual_script/visual_script_func_nodes.cpp index 5c8f52ebb15..fd91385f9c6 100644 --- a/modules/visual_script/visual_script_func_nodes.cpp +++ b/modules/visual_script/visual_script_func_nodes.cpp @@ -4,7 +4,7 @@ #include "scene/main/node.h" #include "visual_script_nodes.h" #include "io/resource_loader.h" -#include "globals.h" +#include "global_config.h" ////////////////////////////////////////// ////////////////CALL////////////////////// diff --git a/modules/visual_script/visual_script_nodes.cpp b/modules/visual_script/visual_script_nodes.cpp index 2b5a180bbe1..d1ee5be3785 100644 --- a/modules/visual_script/visual_script_nodes.cpp +++ b/modules/visual_script/visual_script_nodes.cpp @@ -1,6 +1,6 @@ #include "visual_script_nodes.h" #include "global_constants.h" -#include "globals.h" +#include "global_config.h" #include "scene/main/scene_main_loop.h" #include "os/os.h" #include "scene/main/node.h" diff --git a/modules/webm/video_stream_webm.cpp b/modules/webm/video_stream_webm.cpp index bdd97f1df7f..d4995ad7986 100644 --- a/modules/webm/video_stream_webm.cpp +++ b/modules/webm/video_stream_webm.cpp @@ -35,7 +35,7 @@ #include "../theora/yuv2rgb.h" #include "os/file_access.h" -#include "globals.h" +#include "global_config.h" #include diff --git a/platform/android/audio_driver_jandroid.cpp b/platform/android/audio_driver_jandroid.cpp index e0e89e63443..415223c1da8 100644 --- a/platform/android/audio_driver_jandroid.cpp +++ b/platform/android/audio_driver_jandroid.cpp @@ -28,7 +28,7 @@ /*************************************************************************/ #include "audio_driver_jandroid.h" -#include "globals.h" +#include "global_config.h" #include "os/os.h" #include "thread_jandroid.h" diff --git a/platform/android/export/export.cpp b/platform/android/export/export.cpp index 4fc318d4aec..1d1ee25622e 100644 --- a/platform/android/export/export.cpp +++ b/platform/android/export/export.cpp @@ -33,7 +33,7 @@ #include "tools/editor/editor_node.h" #include "io/zip_io.h" #include "io/marshalls.h" -#include "globals.h" +#include "global_config.h" #include "os/file_access.h" #include "os/os.h" #include "platform/android/logo.h" diff --git a/platform/android/globals/global_defaults.cpp b/platform/android/globals/global_defaults.cpp index bbf9bd5b0ba..01daac92600 100644 --- a/platform/android/globals/global_defaults.cpp +++ b/platform/android/globals/global_defaults.cpp @@ -27,7 +27,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ #include "global_defaults.h" -#include "globals.h" +#include "global_config.h" void register_android_global_defaults() { diff --git a/platform/android/java_glue.cpp b/platform/android/java_glue.cpp index dfbb4373445..41558cf86a9 100644 --- a/platform/android/java_glue.cpp +++ b/platform/android/java_glue.cpp @@ -36,7 +36,7 @@ #include "file_access_android.h" #include "dir_access_jandroid.h" #include "audio_driver_jandroid.h" -#include "globals.h" +#include "global_config.h" #include "thread_jandroid.h" #include "core/os/keyboard.h" #include "java_class_wrapper.h" diff --git a/platform/android/os_android.cpp b/platform/android/os_android.cpp index 1095689a5ba..2290571735f 100644 --- a/platform/android/os_android.cpp +++ b/platform/android/os_android.cpp @@ -36,7 +36,7 @@ #include "servers/visual/visual_server_wrap_mt.h" #include "main/main.h" #include "file_access_android.h" -#include "core/globals.h" +#include "core/global_config.h" #ifdef ANDROID_NATIVE_ACTIVITY #include "file_access_android.h" diff --git a/platform/bb10/export/export.cpp b/platform/bb10/export/export.cpp index 0a401d3cd8a..2643c96576b 100644 --- a/platform/bb10/export/export.cpp +++ b/platform/bb10/export/export.cpp @@ -33,7 +33,7 @@ #include "tools/editor/editor_node.h" #include "io/zip_io.h" #include "io/marshalls.h" -#include "globals.h" +#include "global_config.h" #include "os/file_access.h" #include "os/os.h" #include "platform/bb10/logo.h" diff --git a/platform/bb10/os_bb10.cpp b/platform/bb10/os_bb10.cpp index c51f1c60922..728707628bf 100644 --- a/platform/bb10/os_bb10.cpp +++ b/platform/bb10/os_bb10.cpp @@ -31,7 +31,7 @@ #include "drivers/gles2/rasterizer_gles2.h" #include "servers/visual/visual_server_raster.h" #include "core/os/dir_access.h" -#include "core/globals.h" +#include "core/global_config.h" #include "main/main.h" #include "bbutil.h" #include "core/os/keyboard.h" diff --git a/platform/iphone/app_delegate.mm b/platform/iphone/app_delegate.mm index 740f1d7edc5..1c47801b8e3 100644 --- a/platform/iphone/app_delegate.mm +++ b/platform/iphone/app_delegate.mm @@ -30,7 +30,7 @@ #import "gl_view.h" #include "os_iphone.h" -#include "core/globals.h" +#include "core/global_config.h" #include "main/main.h" #ifdef MODULE_FACEBOOKSCORER_IOS_ENABLED diff --git a/platform/iphone/gl_view.mm b/platform/iphone/gl_view.mm index a3af8f4aa88..adc76a622e5 100755 --- a/platform/iphone/gl_view.mm +++ b/platform/iphone/gl_view.mm @@ -31,7 +31,7 @@ #import #include "os_iphone.h" #include "core/os/keyboard.h" -#include "core/globals.h" +#include "core/global_config.h" #include "servers/audio_server.h" #import "gl_view.h" diff --git a/platform/iphone/globals/global_defaults.cpp b/platform/iphone/globals/global_defaults.cpp index 76b5c9aa012..bf716c36f04 100755 --- a/platform/iphone/globals/global_defaults.cpp +++ b/platform/iphone/globals/global_defaults.cpp @@ -27,7 +27,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ #include "global_defaults.h" -#include "globals.h" +#include "global_config.h" void register_iphone_global_defaults() { diff --git a/platform/javascript/export/export.cpp b/platform/javascript/export/export.cpp index 73ec7bbc54c..2657eaddb56 100644 --- a/platform/javascript/export/export.cpp +++ b/platform/javascript/export/export.cpp @@ -33,7 +33,7 @@ #include "tools/editor/editor_node.h" #include "io/zip_io.h" #include "io/marshalls.h" -#include "globals.h" +#include "global_config.h" #include "os/file_access.h" #include "os/os.h" #include "platform/javascript/logo.h" diff --git a/platform/javascript/javascript_main.cpp b/platform/javascript/javascript_main.cpp index 94320d53c15..e096e96a360 100644 --- a/platform/javascript/javascript_main.cpp +++ b/platform/javascript/javascript_main.cpp @@ -158,9 +158,8 @@ int main(int argc, char *argv[]) { char *args[]={"-test","gui","-v",NULL}; Error err = Main::setup("apk",3,args); #else - //char *args[]={"-v",NULL};// - //Error err = Main::setup("",1,args); - Error err = Main::setup("",0,NULL); + char *args[]={"-main_pack","data.pck",NULL}; //pass location of main pack manually, because it wont get an executable name + Error err = Main::setup("",2,args); #endif ResourceLoader::set_abort_on_missing_resources(false); //ease up compatibility diff --git a/platform/javascript/os_javascript.cpp b/platform/javascript/os_javascript.cpp index b8c3dea3b49..931f60ea820 100644 --- a/platform/javascript/os_javascript.cpp +++ b/platform/javascript/os_javascript.cpp @@ -34,7 +34,7 @@ #include "drivers/unix/dir_access_unix.h" #include "servers/visual/visual_server_raster.h" #include "main/main.h" -#include "core/globals.h" +#include "core/global_config.h" #include "dom_keys.h" #include diff --git a/platform/osx/export/export.cpp b/platform/osx/export/export.cpp index 79103a9b3e1..69973dc95d9 100644 --- a/platform/osx/export/export.cpp +++ b/platform/osx/export/export.cpp @@ -34,7 +34,7 @@ #include "io/zip_io.h" #include "io/marshalls.h" #include "io/resource_saver.h" -#include "globals.h" +#include "global_config.h" #include "os/file_access.h" #include "os/os.h" #include "platform/osx/logo.h" diff --git a/platform/uwp/os_uwp.cpp b/platform/uwp/os_uwp.cpp index 90c21e11a13..61b8a1c240f 100644 --- a/platform/uwp/os_uwp.cpp +++ b/platform/uwp/os_uwp.cpp @@ -40,7 +40,7 @@ #include "servers/audio_server.h" //#include "servers/visual/visual_server_wrap_mt.h" #include "os/memory_pool_dynamic_prealloc.h" -#include "globals.h" +#include "global_config.h" #include "io/marshalls.h" #include "platform/windows/packet_peer_udp_winsock.h" #include "platform/windows/stream_peer_winsock.h" diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp index 1e51c18b631..1afbfd5230c 100644 --- a/platform/windows/os_windows.cpp +++ b/platform/windows/os_windows.cpp @@ -44,7 +44,7 @@ #include "packet_peer_udp_winsock.h" #include "stream_peer_winsock.h" #include "lang_table.h" -#include "globals.h" +#include "global_config.h" #include "io/marshalls.h" #include "joypad.h" diff --git a/scene/3d/light.cpp b/scene/3d/light.cpp index 11eaa2ed334..473bca8d3b4 100644 --- a/scene/3d/light.cpp +++ b/scene/3d/light.cpp @@ -28,7 +28,7 @@ /*************************************************************************/ #include "light.h" -#include "globals.h" +#include "global_config.h" #include "scene/resources/surface_tool.h" #include "baked_light_instance.h" diff --git a/scene/3d/portal.cpp b/scene/3d/portal.cpp index 44e4fb54da5..19f1261238b 100644 --- a/scene/3d/portal.cpp +++ b/scene/3d/portal.cpp @@ -29,7 +29,7 @@ #include "portal.h" #include "servers/visual_server.h" #include "scene/resources/surface_tool.h" -#include "globals.h" +#include "global_config.h" bool Portal::_set(const StringName& p_name, const Variant& p_value) { diff --git a/scene/3d/room_instance.cpp b/scene/3d/room_instance.cpp index fbfc44ce906..b363c05ef79 100644 --- a/scene/3d/room_instance.cpp +++ b/scene/3d/room_instance.cpp @@ -31,7 +31,7 @@ #include "servers/visual_server.h" #include "geometry.h" -#include "globals.h" +#include "global_config.h" #include "scene/resources/surface_tool.h" diff --git a/scene/3d/skeleton.cpp b/scene/3d/skeleton.cpp index 1bb6d83393c..04e82ba914f 100644 --- a/scene/3d/skeleton.cpp +++ b/scene/3d/skeleton.cpp @@ -31,7 +31,7 @@ #include "message_queue.h" #include "scene/resources/surface_tool.h" -#include "core/globals.h" +#include "core/global_config.h" bool Skeleton::_set(const StringName& p_path, const Variant& p_value) { diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp index e52afdffdf2..cffe2ce2181 100644 --- a/scene/gui/control.cpp +++ b/scene/gui/control.cpp @@ -30,7 +30,7 @@ #include "servers/visual_server.h" #include "scene/main/viewport.h" #include "scene/main/canvas_layer.h" -#include "globals.h" +#include "global_config.h" #include "print_string.h" #include "os/keyboard.h" diff --git a/scene/gui/item_list.cpp b/scene/gui/item_list.cpp index d16688407ca..a35df53e526 100644 --- a/scene/gui/item_list.cpp +++ b/scene/gui/item_list.cpp @@ -28,7 +28,7 @@ /*************************************************************************/ #include "item_list.h" #include "os/os.h" -#include "globals.h" +#include "global_config.h" void ItemList::add_item(const String& p_item,const Ref& p_texture,bool p_selectable) { diff --git a/scene/gui/label.cpp b/scene/gui/label.cpp index dfcea30056a..915eaa2f457 100644 --- a/scene/gui/label.cpp +++ b/scene/gui/label.cpp @@ -28,7 +28,7 @@ /*************************************************************************/ #include "label.h" #include "print_string.h" -#include "globals.h" +#include "global_config.h" #include "translation.h" diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index cacb79268c9..3f2eab8bef9 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -32,7 +32,7 @@ #include "os/input.h" #include "os/os.h" -#include "globals.h" +#include "global_config.h" #include "message_queue.h" #include "scene/main/viewport.h" diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp index 524ef2aae4b..7bfc24079b5 100644 --- a/scene/gui/tree.cpp +++ b/scene/gui/tree.cpp @@ -30,7 +30,7 @@ #include "print_string.h" #include "os/os.h" #include "os/keyboard.h" -#include "globals.h" +#include "global_config.h" #include "os/input.h" #include "scene/main/viewport.h" diff --git a/scene/main/node.h b/scene/main/node.h index d88db8ecb0a..93b250ab0f4 100644 --- a/scene/main/node.h +++ b/scene/main/node.h @@ -29,7 +29,7 @@ #ifndef NODE_H #define NODE_H -#include "globals.h" +#include "global_config.h" #include "object.h" #include "path_db.h" #include "map.h" diff --git a/scene/main/scene_main_loop.cpp b/scene/main/scene_main_loop.cpp index f64a563e23d..418eb92ee21 100644 --- a/scene/main/scene_main_loop.cpp +++ b/scene/main/scene_main_loop.cpp @@ -32,7 +32,7 @@ #include "os/os.h" #include "message_queue.h" #include "node.h" -#include "globals.h" +#include "global_config.h" #include #include "os/keyboard.h" //#include "servers/spatial_sound_2d_server.h" diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index f7bd98a0020..ef39dcde4bd 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -48,7 +48,7 @@ #include "scene/main/timer.h" #include "scene/scene_string_names.h" -#include "globals.h" +#include "global_config.h" void ViewportTexture::setup_local_to_scene() { diff --git a/scene/register_scene_types.cpp b/scene/register_scene_types.cpp index c0bd86382b4..ffdc85301ad 100644 --- a/scene/register_scene_types.cpp +++ b/scene/register_scene_types.cpp @@ -28,7 +28,7 @@ /*************************************************************************/ #include "register_scene_types.h" #include "os/os.h" -#include "globals.h" +#include "global_config.h" #include "scene/io/resource_format_image.h" #include "scene/io/resource_format_wav.h" diff --git a/scene/resources/audio_stream_resampled.cpp b/scene/resources/audio_stream_resampled.cpp index 7b49ec08499..b2f314a55e6 100644 --- a/scene/resources/audio_stream_resampled.cpp +++ b/scene/resources/audio_stream_resampled.cpp @@ -27,7 +27,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ #include "audio_stream_resampled.h" -#include "globals.h" +#include "global_config.h" #if 0 diff --git a/scene/resources/environment.cpp b/scene/resources/environment.cpp index eb1a3b550a9..f44b37f6f5f 100644 --- a/scene/resources/environment.cpp +++ b/scene/resources/environment.cpp @@ -28,7 +28,7 @@ /*************************************************************************/ #include "environment.h" #include "texture.h" -#include "globals.h" +#include "global_config.h" #include "servers/visual_server.h" RID Environment::get_rid() const { diff --git a/scene/resources/packed_scene.cpp b/scene/resources/packed_scene.cpp index 99734fd6565..5e3347687a3 100644 --- a/scene/resources/packed_scene.cpp +++ b/scene/resources/packed_scene.cpp @@ -27,7 +27,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ #include "packed_scene.h" -#include "globals.h" +#include "global_config.h" #include "io/resource_loader.h" #include "scene/3d/spatial.h" #include "scene/gui/control.h" diff --git a/scene/resources/scene_format_text.cpp b/scene/resources/scene_format_text.cpp index 9719f321d6c..3a254836a2f 100644 --- a/scene/resources/scene_format_text.cpp +++ b/scene/resources/scene_format_text.cpp @@ -28,7 +28,7 @@ /*************************************************************************/ #include "scene_format_text.h" -#include "globals.h" +#include "global_config.h" #include "version.h" #include "os/dir_access.h" diff --git a/scene/resources/world_2d.cpp b/scene/resources/world_2d.cpp index b2713da5697..6b745d5d35b 100644 --- a/scene/resources/world_2d.cpp +++ b/scene/resources/world_2d.cpp @@ -30,11 +30,11 @@ #include "servers/visual_server.h" #include "servers/physics_2d_server.h" //#include "servers/spatial_sound_2d_server.h" -#include "globals.h" +#include "global_config.h" #include "scene/2d/visibility_notifier_2d.h" #include "scene/main/viewport.h" #include "scene/2d/camera_2d.h" -#include "globals.h" +#include "global_config.h" struct SpatialIndexer2D { diff --git a/scene/resources/world_2d.h b/scene/resources/world_2d.h index a9110b3bd9f..c02880e9ed4 100644 --- a/scene/resources/world_2d.h +++ b/scene/resources/world_2d.h @@ -31,7 +31,7 @@ #include "resource.h" #include "servers/physics_2d_server.h" -#include "globals.h" +#include "global_config.h" class SpatialIndexer2D; class VisibilityNotifier2D; diff --git a/servers/audio/audio_driver_dummy.cpp b/servers/audio/audio_driver_dummy.cpp index 6e0c0089ca9..6c129578513 100644 --- a/servers/audio/audio_driver_dummy.cpp +++ b/servers/audio/audio_driver_dummy.cpp @@ -28,7 +28,7 @@ /*************************************************************************/ #include "audio_driver_dummy.h" -#include "globals.h" +#include "global_config.h" #include "os/os.h" diff --git a/servers/audio_server.cpp b/servers/audio_server.cpp index edc7f36ff24..192d958a64c 100644 --- a/servers/audio_server.cpp +++ b/servers/audio_server.cpp @@ -27,7 +27,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ #include "audio_server.h" -#include "globals.h" +#include "global_config.h" #include "os/os.h" #include "servers/audio/effects/audio_effect_compressor.h" #include "io/resource_loader.h" diff --git a/servers/physics/space_sw.cpp b/servers/physics/space_sw.cpp index eaa3d3194c8..04b8f5b68db 100644 --- a/servers/physics/space_sw.cpp +++ b/servers/physics/space_sw.cpp @@ -26,7 +26,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#include "globals.h" +#include "global_config.h" #include "space_sw.h" #include "collision_solver_sw.h" #include "physics_server_sw.h" diff --git a/servers/physics/space_sw.h b/servers/physics/space_sw.h index 0abc4726ea3..3ec01c9205a 100644 --- a/servers/physics/space_sw.h +++ b/servers/physics/space_sw.h @@ -37,7 +37,7 @@ #include "area_pair_sw.h" #include "broad_phase_sw.h" #include "collision_object_sw.h" -#include "globals.h" +#include "global_config.h" class PhysicsDirectSpaceStateSW : public PhysicsDirectSpaceState { diff --git a/servers/physics_2d/broad_phase_2d_hash_grid.cpp b/servers/physics_2d/broad_phase_2d_hash_grid.cpp index 8b7a410b3d9..06eead64cd2 100644 --- a/servers/physics_2d/broad_phase_2d_hash_grid.cpp +++ b/servers/physics_2d/broad_phase_2d_hash_grid.cpp @@ -27,7 +27,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ #include "broad_phase_2d_hash_grid.h" -#include "globals.h" +#include "global_config.h" #define LARGE_ELEMENT_FI 1.01239812 diff --git a/servers/physics_2d/physics_2d_server_sw.cpp b/servers/physics_2d/physics_2d_server_sw.cpp index d134ce7ea83..15cf82c122e 100644 --- a/servers/physics_2d/physics_2d_server_sw.cpp +++ b/servers/physics_2d/physics_2d_server_sw.cpp @@ -30,7 +30,7 @@ #include "broad_phase_2d_basic.h" #include "broad_phase_2d_hash_grid.h" #include "collision_solver_2d_sw.h" -#include "globals.h" +#include "global_config.h" #include "script_language.h" #include "os/os.h" diff --git a/servers/physics_2d/physics_2d_server_wrap_mt.h b/servers/physics_2d/physics_2d_server_wrap_mt.h index 851ba901ec8..7360c0637b4 100644 --- a/servers/physics_2d/physics_2d_server_wrap_mt.h +++ b/servers/physics_2d/physics_2d_server_wrap_mt.h @@ -33,7 +33,7 @@ #include "servers/physics_2d_server.h" #include "command_queue_mt.h" #include "os/thread.h" -#include "globals.h" +#include "global_config.h" #ifdef DEBUG_SYNC #define SYNC_DEBUG print_line("sync on: "+String(__FUNCTION__)); diff --git a/servers/physics_2d/space_2d_sw.h b/servers/physics_2d/space_2d_sw.h index 5dee3dea5ab..72b34e8c4f5 100644 --- a/servers/physics_2d/space_2d_sw.h +++ b/servers/physics_2d/space_2d_sw.h @@ -37,7 +37,7 @@ #include "area_pair_2d_sw.h" #include "broad_phase_2d_sw.h" #include "collision_object_2d_sw.h" -#include "globals.h" +#include "global_config.h" class Physics2DDirectSpaceStateSW : public Physics2DDirectSpaceState { diff --git a/servers/register_server_types.cpp b/servers/register_server_types.cpp index 01f8ffa5049..0d0619e880d 100644 --- a/servers/register_server_types.cpp +++ b/servers/register_server_types.cpp @@ -27,7 +27,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ #include "register_server_types.h" -#include "globals.h" +#include "global_config.h" #include "visual_server.h" #include "audio_server.h" diff --git a/servers/visual/visual_server_raster.cpp b/servers/visual/visual_server_raster.cpp index 8f874252120..3a5ffda8f58 100644 --- a/servers/visual/visual_server_raster.cpp +++ b/servers/visual/visual_server_raster.cpp @@ -28,7 +28,7 @@ /*************************************************************************/ #include "visual_server_raster.h" #include "os/os.h" -#include "globals.h" +#include "global_config.h" #include "default_mouse_cursor.xpm" #include "sort.h" #include "io/marshalls.h" diff --git a/servers/visual/visual_server_viewport.cpp b/servers/visual/visual_server_viewport.cpp index d2ee32f9cc8..d32c4dd6bfd 100644 --- a/servers/visual/visual_server_viewport.cpp +++ b/servers/visual/visual_server_viewport.cpp @@ -2,7 +2,7 @@ #include "visual_server_global.h" #include "visual_server_canvas.h" #include "visual_server_scene.h" -#include "globals.h" +#include "global_config.h" diff --git a/servers/visual_server.cpp b/servers/visual_server.cpp index dbf8fb442bc..5d231d208e7 100644 --- a/servers/visual_server.cpp +++ b/servers/visual_server.cpp @@ -27,7 +27,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ #include "visual_server.h" -#include "globals.h" +#include "global_config.h" #include "method_bind_ext.inc" VisualServer *VisualServer::singleton=NULL; diff --git a/tools/editor/collada/collada.h b/tools/editor/collada/collada.h index fd7ad4920dd..2de2d22935d 100644 --- a/tools/editor/collada/collada.h +++ b/tools/editor/collada/collada.h @@ -33,7 +33,7 @@ #include "scene/resources/material.h" -#include "globals.h" +#include "global_config.h" #include "io/xml_parser.h" #include "map.h" diff --git a/tools/editor/doc/doc_data.cpp b/tools/editor/doc/doc_data.cpp index d51dc886b2b..e0a4750862b 100644 --- a/tools/editor/doc/doc_data.cpp +++ b/tools/editor/doc/doc_data.cpp @@ -30,7 +30,7 @@ #include "version.h" #include "global_constants.h" -#include "globals.h" +#include "global_config.h" #include "script_language.h" #include "io/marshalls.h" #include "io/compression.h" diff --git a/tools/editor/editor_autoload_settings.cpp b/tools/editor/editor_autoload_settings.cpp index 0038ab48d52..3e3362f5151 100644 --- a/tools/editor/editor_autoload_settings.cpp +++ b/tools/editor/editor_autoload_settings.cpp @@ -28,7 +28,7 @@ /*************************************************************************/ #include "editor_autoload_settings.h" -#include "globals.h" +#include "global_config.h" #include "global_constants.h" #include "editor_node.h" diff --git a/tools/editor/editor_data.cpp b/tools/editor/editor_data.cpp index 2a3c55229ac..d2fa40e08c4 100644 --- a/tools/editor/editor_data.cpp +++ b/tools/editor/editor_data.cpp @@ -28,7 +28,7 @@ /*************************************************************************/ #include "editor_data.h" -#include "globals.h" +#include "global_config.h" #include "editor_settings.h" #include "os/dir_access.h" #include "io/resource_loader.h" diff --git a/tools/editor/editor_export.cpp b/tools/editor/editor_export.cpp index 599ca6bf6a0..9483fa84ac3 100644 --- a/tools/editor/editor_export.cpp +++ b/tools/editor/editor_export.cpp @@ -29,7 +29,7 @@ #include "editor_export.h" #include "version.h" #include "script_language.h" -#include "globals.h" +#include "global_config.h" #include "os/file_access.h" #include "os/dir_access.h" #include "tools/editor/editor_file_system.h" @@ -42,8 +42,18 @@ #include "tools/editor/plugins/script_editor_plugin.h" #include "io/zip_io.h" +static int _get_pad(int p_alignment, int p_n) { + int rest = p_n % p_alignment; + int pad = 0; + if (rest > 0) { + pad = p_alignment - rest; + }; + return pad; +}; + +#define PCK_PADDING 16 bool EditorExportPreset::_set(const StringName& p_name, const Variant& p_value) { @@ -73,7 +83,7 @@ void EditorExportPreset::_get_property_list( List *p_list) const{ } } -Ref EditorExportPreset::get_platform() { +Ref EditorExportPreset::get_platform() const { return platform; } @@ -254,6 +264,34 @@ void EditorExportPlatform::gen_debug_flags(Vector &r_flags, int p_flags) Error EditorExportPlatform::_save_pack_file(void *p_userdata,const String& p_path, const Vector& p_data,int p_file,int p_total) { + PackData *pd = (PackData*)p_userdata; + + SavedData sd; + sd.path_utf8=p_path.utf8(); + sd.ofs = pd->f->get_pos(); + sd.size = p_data.size(); + + pd->f->store_buffer(p_data.ptr(),p_data.size()); + int pad = _get_pad(PCK_PADDING,sd.size); + for(int i=0;if->store_8(0); + } + + { + MD5_CTX ctx; + MD5Init(&ctx); + MD5Update(&ctx,(unsigned char*)p_data.ptr(),p_data.size()); + MD5Final(&ctx); + sd.md5.resize(16); + for(int i=0;i<16;i++) { + sd.md5[i]=ctx.digest[i]; + } + } + + pd->file_ofs.push_back(sd); + + pd->ep->step(TTR("Storing File:")+" "+p_path,2+p_file*100/p_total,false); + return OK; } @@ -281,7 +319,7 @@ Error EditorExportPlatform::_save_zip_file(void *p_userdata,const String& p_path zipCloseFileInZip(zip); zd->ep->step(TTR("Storing File:")+" "+p_path,2+p_file*100/p_total,false); - zd->count++; + return OK; } @@ -335,18 +373,250 @@ Ref EditorExportPlatform::create_preset() { } +void EditorExportPlatform::_export_find_resources(EditorFileSystemDirectory *p_dir,Set& p_paths) { + + for(int i=0;iget_subdir_count();i++) { + _export_find_resources(p_dir->get_subdir(i),p_paths); + } + + for(int i=0;iget_file_count();i++) { + p_paths.insert(p_dir->get_file_path(i)); + } +} + + +void EditorExportPlatform::_export_find_dependencies(const String& p_path,Set& p_paths) { + + if (p_paths.has(p_path)) + return; + + p_paths.insert(p_path); + + EditorFileSystemDirectory *dir; + int file_idx; + dir = EditorFileSystem::get_singleton()->find_file(p_path,&file_idx); + if (!dir) + return; + + Vector deps = dir->get_file_deps(file_idx); + + for(int i=0;i& p_preset,EditorExportSaveFunction p_func, void* p_udata) { + Ref platform = p_preset->get_platform(); + List feature_list; + platform->get_preset_features(p_preset,&feature_list); + //figure out features + Set features; + for (List::Element *E=feature_list.front();E;E=E->next()) { + features.insert(E->get()); + } + + //figure out paths of files that will be exported + Set paths; + + if (p_preset->get_export_filter()==EditorExportPreset::EXPORT_ALL_RESOURCES) { + //find stuff + _export_find_resources(EditorFileSystem::get_singleton()->get_filesystem(),paths); + } else { + bool scenes_only = p_preset->get_export_filter()==EditorExportPreset::EXPORT_SELECTED_SCENES; + + Vector files = p_preset->get_files_to_export(); + for(int i=0;i::Element *E=paths.front();E;E=E->next()) { + + String path = E->get(); + + if (FileAccess::exists(path+".import")) { + //file is imported, replace by what it imports + Ref config; + config.instance(); + Error err = config->load(path+".import"); + if (err!=OK) { + ERR_PRINTS("Could not parse: '"+path+"', not exported."); + continue; + } + + List remaps; + config->get_section_keys("remap",&remaps); + + for(List::Element *F=remaps.front();F;F=F->next()) { + + String remap=F->get(); + if (remap=="path") { + String remapped_path=config->get_value("remap",remap); + Vector array = FileAccess::get_file_as_array(remapped_path); + p_func(p_udata,remapped_path,array,idx,total); + } else if (remap.begins_with("path.")) { + String feature = remap.get_slice(".",1); + if (features.has(feature)) { + String remapped_path=config->get_value("remap",remap); + Vector array = FileAccess::get_file_as_array(remapped_path); + p_func(p_udata,remapped_path,array,idx,total); + } + } + } + + //also save the .import file + Vector array = FileAccess::get_file_as_array(path+".import"); + p_func(p_udata,path+".import",array,idx,total); + + } else { + //just store it as it comes + Vector array = FileAccess::get_file_as_array(path); + p_func(p_udata,path,array,idx,total); + } + + idx++; + } + + //save config! + + String config_file="godot.cfb"; + String engine_cfb =EditorSettings::get_singleton()->get_settings_path()+"/tmp/tmp"+config_file; + GlobalConfig::get_singleton()->save_custom(engine_cfb); + Vector data = FileAccess::get_file_as_array(engine_cfb); + + p_func(p_udata,"res://"+config_file,data,idx,total); + return OK; } -Error EditorExportPlatform::save_pack(const Ref& p_preset,FileAccess *p_where) { +Error EditorExportPlatform::save_pack(const Ref& p_preset,const String& p_path) { + + EditorProgress ep("savepack",TTR("Packing"),102); + + String tmppath = EditorSettings::get_singleton()->get_settings_path()+"/tmp/packtmp"; + FileAccess *ftmp = FileAccess::open(tmppath,FileAccess::WRITE); + ERR_FAIL_COND_V(!ftmp,ERR_CANT_CREATE) + + PackData pd; + pd.ep=&ep; + pd.f=ftmp; + + Error err = export_project_files(p_preset,_save_pack_file,&pd); + + memdelete(ftmp); //close tmp file + + if (err) + return err; + + pd.file_ofs.sort(); //do sort, so we can do binary search later + + + FileAccess *f = FileAccess::open(p_path,FileAccess::WRITE); + ERR_FAIL_COND_V(!f,ERR_CANT_CREATE) + f->store_32(0x43504447); //GDPK + f->store_32(1); //pack version + f->store_32(VERSION_MAJOR); + f->store_32(VERSION_MINOR); + f->store_32(0); //hmph + for(int i=0;i<16;i++) { + //reserved + f->store_32(0); + } + + f->store_32(pd.file_ofs.size()); //amount of files + + size_t header_size = f->get_pos(); + + //precalculate header size + + for(int i=0;istore_32(string_len+pad); + f->store_buffer((const uint8_t*)pd.file_ofs[i].path_utf8.get_data(),string_len); + for(uint32_t j=0;jstore_8(0); + } + + f->store_64(pd.file_ofs[i].ofs + header_padding + header_size); + f->store_64(pd.file_ofs[i].size); // pay attention here, this is where file is + f->store_buffer(pd.file_ofs[i].md5.ptr(),16); //also save md5 for file + } + + for(uint32_t j=0;jstore_8(0); + } + + //save the rest of the data + + ftmp = FileAccess::open(tmppath,FileAccess::READ); + if (!ftmp) { + memdelete(f); + ERR_FAIL_COND_V(!ftmp,ERR_CANT_CREATE) + } + + const int bufsize=16384; + uint8_t buf[bufsize]; + + while(true) { + + int got = ftmp->get_buffer(buf,bufsize); + if (got<=0) + break; + f->store_buffer(buf,got); + } + + memdelete(ftmp); + + f->store_32(0x43504447); //GDPK + memdelete(f); return OK; } Error EditorExportPlatform::save_zip(const Ref& p_preset,const String& p_path) { + EditorProgress ep("savezip",TTR("Packing"),102); + + //FileAccess *tmp = FileAccess::open(tmppath,FileAccess::WRITE); + + FileAccess *src_f; + zlib_filefunc_def io = zipio_create_io_from_file(&src_f); + zipFile zip=zipOpen2(p_path.utf8().get_data(),APPEND_STATUS_CREATE,NULL,&io); + + ZipData zd; + zd.ep=&ep; + zd.zip=zip; + + + Error err = export_project_files(p_preset,_save_zip_file,&zd); + + zipClose(zip,NULL); + return OK; } @@ -387,9 +657,7 @@ void EditorExport::_save() { config->set_value(section,"export_filter","resources"); save_files=true; } break; - case EditorExportPreset::EXPORT_ALL_FILES: { - config->set_value(section,"export_filter","all_files"); - } break; + } @@ -527,8 +795,6 @@ void EditorExport::load_config() { } else if (export_filter=="resources") { preset->set_export_filter(EditorExportPreset::EXPORT_SELECTED_RESOURCES); get_files=true; - } else if (export_filter=="all_files") { - preset->set_export_filter(EditorExportPreset::EXPORT_ALL_FILES); } if (get_files) { diff --git a/tools/editor/editor_export.h b/tools/editor/editor_export.h index 1aa4f103eca..d30ce9bd92e 100644 --- a/tools/editor/editor_export.h +++ b/tools/editor/editor_export.h @@ -39,6 +39,7 @@ class EditorProgress; class FileAccess; class EditorExportPlatform; +class EditorFileSystemDirectory; class EditorExportPreset : public Reference { @@ -48,7 +49,6 @@ public: EXPORT_ALL_RESOURCES, EXPORT_SELECTED_SCENES, EXPORT_SELECTED_RESOURCES, - EXPORT_ALL_FILES, }; private: @@ -64,6 +64,7 @@ private: Vector patches; + friend class EditorExport; friend class EditorExportPlatform; @@ -78,7 +79,7 @@ protected: public: - Ref get_platform(); + Ref get_platform() const; bool has(const StringName& p_property) const { return values.has(p_property); } Vector get_files_to_export() const; @@ -126,9 +127,14 @@ private: struct SavedData { - String path; uint64_t ofs; uint64_t size; + Vector md5; + CharString path_utf8; + + bool operator<(const SavedData& p_data) const { + return path_utf8 < p_data.path_utf8; + } }; struct PackData { @@ -142,10 +148,12 @@ private: void* zip; EditorProgress *ep; - int count; }; + void _export_find_resources(EditorFileSystemDirectory *p_dir,Set& p_paths); + void _export_find_dependencies(const String& p_path,Set& p_paths); + void gen_debug_flags(Vector &r_flags, int p_flags); static Error _save_pack_file(void *p_userdata,const String& p_path, const Vector& p_data,int p_file,int p_total); static Error _save_zip_file(void *p_userdata,const String& p_path, const Vector& p_data,int p_file,int p_total); @@ -176,7 +184,7 @@ public: Error export_project_files(const Ref& p_preset,EditorExportSaveFunction p_func, void* p_udata); - Error save_pack(const Ref& p_preset,FileAccess *p_where); + Error save_pack(const Ref& p_preset,const String& p_path); Error save_zip(const Ref& p_preset,const String& p_path); diff --git a/tools/editor/editor_file_system.cpp b/tools/editor/editor_file_system.cpp index b9b83452827..cd151cd90bd 100644 --- a/tools/editor/editor_file_system.cpp +++ b/tools/editor/editor_file_system.cpp @@ -28,7 +28,7 @@ /*************************************************************************/ #include "editor_file_system.h" -#include "globals.h" +#include "global_config.h" #include "io/resource_loader.h" #include "os/os.h" #include "os/file_access.h" diff --git a/tools/editor/editor_node.cpp b/tools/editor/editor_node.cpp index f6e2d5f9548..5e2d6e7d6b0 100644 --- a/tools/editor/editor_node.cpp +++ b/tools/editor/editor_node.cpp @@ -37,7 +37,7 @@ #include "servers/physics_2d_server.h" #include "scene/resources/packed_scene.h" #include "editor_settings.h" -#include "globals.h" +#include "global_config.h" #include #include "class_db.h" #include "os/keyboard.h" diff --git a/tools/editor/editor_plugin_settings.cpp b/tools/editor/editor_plugin_settings.cpp index 2b6828e82fc..2d879e38cf9 100644 --- a/tools/editor/editor_plugin_settings.cpp +++ b/tools/editor/editor_plugin_settings.cpp @@ -32,7 +32,7 @@ #include "io/config_file.h" #include "os/file_access.h" #include "os/main_loop.h" -#include "globals.h" +#include "global_config.h" #include "editor_node.h" void EditorPluginSettings::_notification(int p_what) { diff --git a/tools/editor/editor_resource_preview.cpp b/tools/editor/editor_resource_preview.cpp index b6cf24e527f..ab2226e79a6 100644 --- a/tools/editor/editor_resource_preview.cpp +++ b/tools/editor/editor_resource_preview.cpp @@ -32,7 +32,7 @@ #include "os/file_access.h" #include "io/resource_loader.h" #include "io/resource_saver.h" -#include "globals.h" +#include "global_config.h" #include "editor_scale.h" #include "message_queue.h" diff --git a/tools/editor/editor_run.cpp b/tools/editor/editor_run.cpp index 813a8ee5b72..a5d39db6bea 100644 --- a/tools/editor/editor_run.cpp +++ b/tools/editor/editor_run.cpp @@ -28,7 +28,7 @@ /*************************************************************************/ #include "editor_run.h" -#include "globals.h" +#include "global_config.h" #include "editor_settings.h" EditorRun::Status EditorRun::get_status() const { diff --git a/tools/editor/editor_settings.cpp b/tools/editor/editor_settings.cpp index 2e32cfe38b1..f977a402431 100644 --- a/tools/editor/editor_settings.cpp +++ b/tools/editor/editor_settings.cpp @@ -39,7 +39,7 @@ #include "scene/main/viewport.h" #include "io/config_file.h" #include "editor_node.h" -#include "globals.h" +#include "global_config.h" #include "translations.h" #include "io/file_access_memory.h" #include "io/translation_loader_po.h" diff --git a/tools/editor/file_type_cache.cpp b/tools/editor/file_type_cache.cpp index aff99fbc050..891669db139 100644 --- a/tools/editor/file_type_cache.cpp +++ b/tools/editor/file_type_cache.cpp @@ -28,7 +28,7 @@ /*************************************************************************/ #include "file_type_cache.h" -#include "globals.h" +#include "global_config.h" #include "os/file_access.h" FileTypeCache* FileTypeCache::singleton=NULL; diff --git a/tools/editor/filesystem_dock.cpp b/tools/editor/filesystem_dock.cpp index c6c1a02f3f2..f5e4ef661ad 100644 --- a/tools/editor/filesystem_dock.cpp +++ b/tools/editor/filesystem_dock.cpp @@ -30,7 +30,7 @@ #include "os/dir_access.h" #include "os/file_access.h" -#include "globals.h" +#include "global_config.h" #include "io/resource_loader.h" #include "os/os.h" #include "editor_node.h" diff --git a/tools/editor/plugins/animation_player_editor_plugin.cpp b/tools/editor/plugins/animation_player_editor_plugin.cpp index 7d6598bd4b7..71173038e96 100644 --- a/tools/editor/plugins/animation_player_editor_plugin.cpp +++ b/tools/editor/plugins/animation_player_editor_plugin.cpp @@ -28,7 +28,7 @@ /*************************************************************************/ #include "animation_player_editor_plugin.h" -#include "globals.h" +#include "global_config.h" #include "io/resource_loader.h" #include "io/resource_saver.h" #include "os/keyboard.h" diff --git a/tools/editor/plugins/animation_tree_editor_plugin.cpp b/tools/editor/plugins/animation_tree_editor_plugin.cpp index 1ed52d2df6f..988136d4753 100644 --- a/tools/editor/plugins/animation_tree_editor_plugin.cpp +++ b/tools/editor/plugins/animation_tree_editor_plugin.cpp @@ -32,7 +32,7 @@ #include "scene/gui/panel.h" #include "scene/main/viewport.h" #include "core/io/resource_loader.h" -#include "core/globals.h" +#include "core/global_config.h" #include "os/input.h" #include "os/keyboard.h" diff --git a/tools/editor/plugins/canvas_item_editor_plugin.cpp b/tools/editor/plugins/canvas_item_editor_plugin.cpp index 0830556ac18..8af925db7ae 100644 --- a/tools/editor/plugins/canvas_item_editor_plugin.cpp +++ b/tools/editor/plugins/canvas_item_editor_plugin.cpp @@ -38,7 +38,7 @@ #include "scene/2d/particles_2d.h" #include "scene/2d/polygon_2d.h" #include "scene/2d/screen_button.h" -#include "globals.h" +#include "global_config.h" #include "os/input.h" #include "tools/editor/editor_settings.h" #include "scene/gui/grid_container.h" diff --git a/tools/editor/plugins/resource_preloader_editor_plugin.cpp b/tools/editor/plugins/resource_preloader_editor_plugin.cpp index cfdfbdc1c66..de2245d98fd 100644 --- a/tools/editor/plugins/resource_preloader_editor_plugin.cpp +++ b/tools/editor/plugins/resource_preloader_editor_plugin.cpp @@ -29,7 +29,7 @@ #include "resource_preloader_editor_plugin.h" #include "io/resource_loader.h" -#include "globals.h" +#include "global_config.h" #include "tools/editor/editor_settings.h" diff --git a/tools/editor/plugins/script_editor_plugin.cpp b/tools/editor/plugins/script_editor_plugin.cpp index 0a880de35b7..b7d8cc2ba91 100644 --- a/tools/editor/plugins/script_editor_plugin.cpp +++ b/tools/editor/plugins/script_editor_plugin.cpp @@ -35,7 +35,7 @@ #include "os/os.h" #include "tools/editor/editor_node.h" #include "tools/editor/script_editor_debugger.h" -#include "globals.h" +#include "global_config.h" #include "os/file_access.h" #include "scene/main/viewport.h" #include "os/keyboard.h" diff --git a/tools/editor/plugins/spatial_editor_plugin.cpp b/tools/editor/plugins/spatial_editor_plugin.cpp index 5e425ef3c44..ef971034cd2 100644 --- a/tools/editor/plugins/spatial_editor_plugin.cpp +++ b/tools/editor/plugins/spatial_editor_plugin.cpp @@ -38,7 +38,7 @@ #include "tools/editor/editor_settings.h" #include "scene/resources/surface_tool.h" #include "tools/editor/spatial_editor_gizmos.h" -#include "globals.h" +#include "global_config.h" #include "tools/editor/plugins/animation_player_editor_plugin.h" #include "tools/editor/animation_editor.h" diff --git a/tools/editor/plugins/sprite_frames_editor_plugin.cpp b/tools/editor/plugins/sprite_frames_editor_plugin.cpp index 48808d9e045..c3c68e471ef 100644 --- a/tools/editor/plugins/sprite_frames_editor_plugin.cpp +++ b/tools/editor/plugins/sprite_frames_editor_plugin.cpp @@ -29,7 +29,7 @@ #include "sprite_frames_editor_plugin.h" #include "io/resource_loader.h" -#include "globals.h" +#include "global_config.h" #include "tools/editor/editor_settings.h" #include "scene/3d/sprite_3d.h" diff --git a/tools/editor/plugins/texture_editor_plugin.cpp b/tools/editor/plugins/texture_editor_plugin.cpp index 1bfc05e2a7d..90a798667f0 100644 --- a/tools/editor/plugins/texture_editor_plugin.cpp +++ b/tools/editor/plugins/texture_editor_plugin.cpp @@ -29,7 +29,7 @@ #include "texture_editor_plugin.h" #include "io/resource_loader.h" -#include "globals.h" +#include "global_config.h" #include "tools/editor/editor_settings.h" void TextureEditor::_gui_input(InputEvent p_event) { diff --git a/tools/editor/project_export.cpp b/tools/editor/project_export.cpp index 86324f1cac8..f6593a48955 100644 --- a/tools/editor/project_export.cpp +++ b/tools/editor/project_export.cpp @@ -29,7 +29,7 @@ #include "project_export.h" #include "os/dir_access.h" #include "os/file_access.h" -#include "globals.h" +#include "global_config.h" #include "io/resource_loader.h" #include "io/resource_saver.h" #include "os/os.h" @@ -48,6 +48,8 @@ void ProjectExportDialog::_notification(int p_what) { if (p_what==NOTIFICATION_READY) { delete_preset->set_icon(get_icon("Del","EditorIcons")); + connect("confirmed",this,"_export_pck_zip"); + } } @@ -528,7 +530,7 @@ void ProjectExportDialog::_fill_resource_tree() { EditorExportPreset::ExportFilter f = current->get_export_filter(); - if (f==EditorExportPreset::EXPORT_ALL_RESOURCES || f==EditorExportPreset::EXPORT_ALL_FILES) { + if (f==EditorExportPreset::EXPORT_ALL_RESOURCES) { return; } @@ -616,6 +618,27 @@ void ProjectExportDialog::_tree_changed() { } } + +void ProjectExportDialog::_export_pck_zip() { + + export_pck_zip->popup_centered_ratio(); +} + +void ProjectExportDialog::_export_pck_zip_selected(const String& p_path) { + + Ref current = EditorExport::get_singleton()->get_export_preset(presets->get_current()); + ERR_FAIL_COND (current.is_null()); + Ref platform = current->get_platform(); + ERR_FAIL_COND( platform.is_null() ); + + if (p_path.ends_with(".zip")) { + platform->save_zip(current,p_path); + } else if (p_path.ends_with(".pck")) { + platform->save_pack(current,p_path); + } +} + + void ProjectExportDialog::_bind_methods() { ClassDB::bind_method("_add_preset",&ProjectExportDialog::_add_preset); @@ -634,8 +657,8 @@ void ProjectExportDialog::_bind_methods() { ClassDB::bind_method("_patch_selected",&ProjectExportDialog::_patch_selected); ClassDB::bind_method("_patch_deleted",&ProjectExportDialog::_patch_deleted); ClassDB::bind_method("_patch_edited",&ProjectExportDialog::_patch_edited); - - + ClassDB::bind_method("_export_pck_zip",&ProjectExportDialog::_export_pck_zip); + ClassDB::bind_method("_export_pck_zip_selected",&ProjectExportDialog::_export_pck_zip_selected); } @@ -699,7 +722,6 @@ ProjectExportDialog::ProjectExportDialog() { export_filter->add_item(TTR("Export all resources in the project")); export_filter->add_item(TTR("Export selected scenes (and dependencies)")); export_filter->add_item(TTR("Export selected resources (and dependencies)")); - export_filter->add_item(TTR("Export all files in the project directory")); resources_vb->add_margin_child(TTR("Export Mode:"),export_filter); export_filter->connect("item_selected",this,"_export_type_changed"); @@ -770,7 +792,19 @@ ProjectExportDialog::ProjectExportDialog() { updating=false; get_ok()->set_text("Export PCK/Zip"); - add_button("Export Project",!OS::get_singleton()->get_swap_ok_cancel(),"export"); + export_button = add_button("Export Project",!OS::get_singleton()->get_swap_ok_cancel(),"export"); + + export_pck_zip = memnew( FileDialog ); + export_pck_zip->add_filter("*.zip ; ZIP File"); + export_pck_zip->add_filter("*.pck ; Godot Game Pack"); + export_pck_zip->set_access(FileDialog::ACCESS_FILESYSTEM); + export_pck_zip->set_mode(FileDialog::MODE_SAVE_FILE); + add_child(export_pck_zip); + export_pck_zip->connect("file_selected",this,"_export_pck_zip_selected"); + + set_hide_on_ok(false); + + editor_icons = "EditorIcons"; } diff --git a/tools/editor/project_export.h b/tools/editor/project_export.h index 715d3c3e686..c977e90e56f 100644 --- a/tools/editor/project_export.h +++ b/tools/editor/project_export.h @@ -91,6 +91,8 @@ private: FileDialog *patch_dialog; ConfirmationDialog *patch_erase; + Button *export_button; + void _patch_selected(const String& p_path); void _patch_deleted(); @@ -117,6 +119,10 @@ private: bool can_drop_data_fw(const Point2& p_point,const Variant& p_data,Control* p_from) const; void drop_data_fw(const Point2& p_point,const Variant& p_data,Control* p_from); + FileDialog *export_pck_zip; + + void _export_pck_zip(); + void _export_pck_zip_selected(const String& p_path); protected: void _notification(int p_what); diff --git a/tools/editor/project_settings.cpp b/tools/editor/project_settings.cpp index 2acd347dc6b..ed3c59cc4ad 100644 --- a/tools/editor/project_settings.cpp +++ b/tools/editor/project_settings.cpp @@ -29,7 +29,7 @@ #include "project_settings.h" #include "scene/gui/tab_container.h" -#include "globals.h" +#include "global_config.h" #include "os/keyboard.h" #include "editor_node.h" #include "scene/gui/margin_container.h" diff --git a/tools/editor/property_editor.cpp b/tools/editor/property_editor.cpp index 9fc47b7da4d..19b7b2ce665 100644 --- a/tools/editor/property_editor.cpp +++ b/tools/editor/property_editor.cpp @@ -33,7 +33,7 @@ #include "io/image_loader.h" #include "class_db.h" #include "print_string.h" -#include "globals.h" +#include "global_config.h" #include "scene/resources/font.h" #include "pair.h" #include "scene/scene_string_names.h" @@ -48,7 +48,7 @@ #include "editor_file_system.h" #include "create_dialog.h" #include "property_selector.h" -#include "globals.h" +#include "global_config.h" void CustomPropertyEditor::_notification(int p_what) { diff --git a/tools/editor/resources_dock.cpp b/tools/editor/resources_dock.cpp index 5348c8c1228..8648361bae8 100644 --- a/tools/editor/resources_dock.cpp +++ b/tools/editor/resources_dock.cpp @@ -33,7 +33,7 @@ #include "io/resource_saver.h" #include "editor_settings.h" #include "project_settings.h" -#include "globals.h" +#include "global_config.h" #include "editor_file_system.h" diff --git a/tools/editor/scene_tree_dock.cpp b/tools/editor/scene_tree_dock.cpp index eee4aefce3e..4f3700adb5b 100644 --- a/tools/editor/scene_tree_dock.cpp +++ b/tools/editor/scene_tree_dock.cpp @@ -29,7 +29,7 @@ #include "scene_tree_dock.h" #include "editor_node.h" -#include "globals.h" +#include "global_config.h" #include "os/keyboard.h" #include "scene/resources/packed_scene.h" #include "editor_settings.h" diff --git a/tools/editor/script_create_dialog.cpp b/tools/editor/script_create_dialog.cpp index 496d8670ebf..dfaa1f645c3 100644 --- a/tools/editor/script_create_dialog.cpp +++ b/tools/editor/script_create_dialog.cpp @@ -29,7 +29,7 @@ #include "script_create_dialog.h" #include "script_language.h" -#include "globals.h" +#include "global_config.h" #include "io/resource_saver.h" #include "os/file_access.h" #include "editor_file_system.h" diff --git a/tools/editor/script_editor_debugger.cpp b/tools/editor/script_editor_debugger.cpp index 248eecc1c81..fa33ffe5c72 100644 --- a/tools/editor/script_editor_debugger.cpp +++ b/tools/editor/script_editor_debugger.cpp @@ -39,7 +39,7 @@ #include "scene/gui/rich_text_label.h" #include "scene/gui/margin_container.h" #include "property_editor.h" -#include "globals.h" +#include "global_config.h" #include "editor_node.h" #include "main/performance.h" #include "editor_profiler.h" diff --git a/tools/editor/settings_config_dialog.cpp b/tools/editor/settings_config_dialog.cpp index cd8403b271e..6a62e035ecd 100644 --- a/tools/editor/settings_config_dialog.cpp +++ b/tools/editor/settings_config_dialog.cpp @@ -30,7 +30,7 @@ #include "editor_settings.h" #include "scene/gui/margin_container.h" -#include "globals.h" +#include "global_config.h" #include "editor_file_system.h" #include "editor_node.h" #include "os/keyboard.h"