summaryrefslogtreecommitdiff
path: root/tools/editor
diff options
context:
space:
mode:
Diffstat (limited to 'tools/editor')
-rw-r--r--tools/editor/collada/collada.h2
-rw-r--r--tools/editor/doc/doc_data.cpp2
-rw-r--r--tools/editor/editor_autoload_settings.cpp2
-rw-r--r--tools/editor/editor_data.cpp2
-rw-r--r--tools/editor/editor_export.cpp284
-rw-r--r--tools/editor/editor_export.h18
-rw-r--r--tools/editor/editor_file_system.cpp2
-rw-r--r--tools/editor/editor_node.cpp2
-rw-r--r--tools/editor/editor_plugin_settings.cpp2
-rw-r--r--tools/editor/editor_resource_preview.cpp2
-rw-r--r--tools/editor/editor_run.cpp2
-rw-r--r--tools/editor/editor_settings.cpp2
-rw-r--r--tools/editor/file_type_cache.cpp2
-rw-r--r--tools/editor/filesystem_dock.cpp2
-rw-r--r--tools/editor/plugins/animation_player_editor_plugin.cpp2
-rw-r--r--tools/editor/plugins/animation_tree_editor_plugin.cpp2
-rw-r--r--tools/editor/plugins/canvas_item_editor_plugin.cpp2
-rw-r--r--tools/editor/plugins/resource_preloader_editor_plugin.cpp2
-rw-r--r--tools/editor/plugins/script_editor_plugin.cpp2
-rw-r--r--tools/editor/plugins/spatial_editor_plugin.cpp2
-rw-r--r--tools/editor/plugins/sprite_frames_editor_plugin.cpp2
-rw-r--r--tools/editor/plugins/texture_editor_plugin.cpp2
-rw-r--r--tools/editor/project_export.cpp46
-rw-r--r--tools/editor/project_export.h6
-rw-r--r--tools/editor/project_settings.cpp2
-rw-r--r--tools/editor/property_editor.cpp4
-rw-r--r--tools/editor/resources_dock.cpp2
-rw-r--r--tools/editor/scene_tree_dock.cpp2
-rw-r--r--tools/editor/script_create_dialog.cpp2
-rw-r--r--tools/editor/script_editor_debugger.cpp2
-rw-r--r--tools/editor/settings_config_dialog.cpp2
31 files changed, 362 insertions, 48 deletions
diff --git a/tools/editor/collada/collada.h b/tools/editor/collada/collada.h
index fd7ad4920d..2de2d22935 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 d51dc886b2..e0a4750862 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 0038ab48d5..3e3362f515 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 2a3c55229a..d2fa40e08c 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 599ca6bf6a..9483fa84ac 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<PropertyInfo> *p_list) const{
}
}
-Ref<EditorExportPlatform> EditorExportPreset::get_platform() {
+Ref<EditorExportPlatform> EditorExportPreset::get_platform() const {
return platform;
}
@@ -254,6 +264,34 @@ void EditorExportPlatform::gen_debug_flags(Vector<String> &r_flags, int p_flags)
Error EditorExportPlatform::_save_pack_file(void *p_userdata,const String& p_path, const Vector<uint8_t>& 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;i<pad;i++) {
+ pd->f->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<EditorExportPreset> EditorExportPlatform::create_preset() {
}
+void EditorExportPlatform::_export_find_resources(EditorFileSystemDirectory *p_dir,Set<String>& p_paths) {
+
+ for(int i=0;i<p_dir->get_subdir_count();i++) {
+ _export_find_resources(p_dir->get_subdir(i),p_paths);
+ }
+
+ for(int i=0;i<p_dir->get_file_count();i++) {
+ p_paths.insert(p_dir->get_file_path(i));
+ }
+}
+
+
+void EditorExportPlatform::_export_find_dependencies(const String& p_path,Set<String>& 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<String> deps = dir->get_file_deps(file_idx);
+
+ for(int i=0;i<deps.size();i++) {
+
+ _export_find_dependencies(deps[i],p_paths);
+ }
+}
+
+
Error EditorExportPlatform::export_project_files(const Ref<EditorExportPreset>& p_preset,EditorExportSaveFunction p_func, void* p_udata) {
+ Ref<EditorExportPlatform> platform = p_preset->get_platform();
+ List<String> feature_list;
+ platform->get_preset_features(p_preset,&feature_list);
+ //figure out features
+ Set<String> features;
+ for (List<String>::Element *E=feature_list.front();E;E=E->next()) {
+ features.insert(E->get());
+ }
+
+ //figure out paths of files that will be exported
+ Set<String> 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<String> files = p_preset->get_files_to_export();
+ for(int i=0;i<files.size();i++) {
+ if (scenes_only && ResourceLoader::get_resource_type(files[i])!="PackedScene")
+ continue;
+
+ _export_find_dependencies(files[i],paths);
+ }
+ }
+
+ //store everything in the export medium
+ int idx = 0;
+ int total=paths.size();
+
+ for(Set<String>::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<ConfigFile> config;
+ config.instance();
+ Error err = config->load(path+".import");
+ if (err!=OK) {
+ ERR_PRINTS("Could not parse: '"+path+"', not exported.");
+ continue;
+ }
+
+ List<String> remaps;
+ config->get_section_keys("remap",&remaps);
+
+ for(List<String>::Element *F=remaps.front();F;F=F->next()) {
+
+ String remap=F->get();
+ if (remap=="path") {
+ String remapped_path=config->get_value("remap",remap);
+ Vector<uint8_t> 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<uint8_t> array = FileAccess::get_file_as_array(remapped_path);
+ p_func(p_udata,remapped_path,array,idx,total);
+ }
+ }
+ }
+
+ //also save the .import file
+ Vector<uint8_t> 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<uint8_t> 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<uint8_t> 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<EditorExportPreset>& p_preset,FileAccess *p_where) {
+Error EditorExportPlatform::save_pack(const Ref<EditorExportPreset>& 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;i<pd.file_ofs.size();i++) {
+ header_size += 4; // size of path string (32 bits is enough)
+ uint32_t string_len = pd.file_ofs[i].path_utf8.length();
+ header_size += string_len + _get_pad(4,string_len); ///size of path string
+ header_size += 8; // offset to file _with_ header size included
+ header_size += 8; // size of file
+ header_size +=16; // md5
+
+ }
+
+ size_t header_padding = _get_pad(PCK_PADDING,header_size);
+
+
+ for(int i=0;i<pd.file_ofs.size();i++) {
+
+ uint32_t string_len = pd.file_ofs[i].path_utf8.length();
+ uint32_t pad = _get_pad(4,string_len);;
+ f->store_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;j<pad;j++) {
+ f->store_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;j<header_padding;j++) {
+ f->store_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<EditorExportPreset>& 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 1aa4f103ec..d30ce9bd92 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<String> patches;
+
friend class EditorExport;
friend class EditorExportPlatform;
@@ -78,7 +79,7 @@ protected:
public:
- Ref<EditorExportPlatform> get_platform();
+ Ref<EditorExportPlatform> get_platform() const;
bool has(const StringName& p_property) const { return values.has(p_property); }
Vector<String> get_files_to_export() const;
@@ -126,9 +127,14 @@ private:
struct SavedData {
- String path;
uint64_t ofs;
uint64_t size;
+ Vector<uint8_t> 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<String>& p_paths);
+ void _export_find_dependencies(const String& p_path,Set<String>& p_paths);
+
void gen_debug_flags(Vector<String> &r_flags, int p_flags);
static Error _save_pack_file(void *p_userdata,const String& p_path, const Vector<uint8_t>& p_data,int p_file,int p_total);
static Error _save_zip_file(void *p_userdata,const String& p_path, const Vector<uint8_t>& p_data,int p_file,int p_total);
@@ -176,7 +184,7 @@ public:
Error export_project_files(const Ref<EditorExportPreset>& p_preset,EditorExportSaveFunction p_func, void* p_udata);
- Error save_pack(const Ref<EditorExportPreset>& p_preset,FileAccess *p_where);
+ Error save_pack(const Ref<EditorExportPreset>& p_preset,const String& p_path);
Error save_zip(const Ref<EditorExportPreset>& p_preset,const String& p_path);
diff --git a/tools/editor/editor_file_system.cpp b/tools/editor/editor_file_system.cpp
index b9b8345282..cd151cd90b 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 f6e2d5f954..5e2d6e7d6b 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 <stdio.h>
#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 2b6828e82f..2d879e38cf 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 b6cf24e527..ab2226e79a 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 813a8ee5b7..a5d39db6be 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 2e32cfe38b..f977a40243 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 aff99fbc05..891669db13 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 c6c1a02f3f..f5e4ef661a 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 7d6598bd4b..71173038e9 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 1ed52d2df6..988136d475 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 0830556ac1..8af925db7a 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 cfdfbdc1c6..de2245d98f 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 0a880de35b..b7d8cc2ba9 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 5e425ef3c4..ef971034cd 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 48808d9e04..c3c68e471e 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 1bfc05e2a7..90a798667f 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 86324f1cac..f6593a4895 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<EditorExportPreset> current = EditorExport::get_singleton()->get_export_preset(presets->get_current());
+ ERR_FAIL_COND (current.is_null());
+ Ref<EditorExportPlatform> 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 715d3c3e68..c977e90e56 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 2acd347dc6..ed3c59cc4a 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 9fc47b7da4..19b7b2ce66 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 5348c8c122..8648361bae 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 eee4aefce3..4f3700adb5 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 496d8670eb..dfaa1f645c 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 248eecc1c8..fa33ffe5c7 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 cd8403b271..6a62e035ec 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"