summaryrefslogtreecommitdiff
path: root/core/io
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2017-01-05 09:16:00 -0300
committerJuan Linietsky <reduzio@gmail.com>2017-01-05 09:16:00 -0300
commit0f7af4ea51744cda23c4d3c7481f9c332973d1d4 (patch)
tree27b8914062558b5648655ccf3db13251d217af98 /core/io
parent9e477babb3bf0ce5179395c2a5155a3f3cd36798 (diff)
-Changed most project settings in the engine, so they have major and minor categories.
-Changed SectionedPropertyEditor to support this -Renamed Globals singleton to GlobalConfig, makes more sense. -Changed the logic behind persisten global settings, instead of the persist checkbox, a revert button is now available
Diffstat (limited to 'core/io')
-rw-r--r--core/io/file_access_memory.cpp4
-rw-r--r--core/io/file_access_network.cpp14
-rw-r--r--core/io/file_access_network.h2
-rw-r--r--core/io/packet_peer.cpp3
-rw-r--r--core/io/packet_peer.h2
-rw-r--r--core/io/resource_format_binary.cpp16
-rw-r--r--core/io/resource_format_xml.cpp18
-rw-r--r--core/io/resource_loader.cpp14
-rw-r--r--core/io/resource_saver.cpp2
9 files changed, 44 insertions, 31 deletions
diff --git a/core/io/file_access_memory.cpp b/core/io/file_access_memory.cpp
index e1f6831f7b..a9dbf56c15 100644
--- a/core/io/file_access_memory.cpp
+++ b/core/io/file_access_memory.cpp
@@ -42,8 +42,8 @@ void FileAccessMemory::register_file(String p_name, Vector<uint8_t> p_data) {
}
String name;
- if (Globals::get_singleton())
- name = Globals::get_singleton()->globalize_path(p_name);
+ if (GlobalConfig::get_singleton())
+ name = GlobalConfig::get_singleton()->globalize_path(p_name);
else
name = p_name;
//name = DirAccess::normalize_path(name);
diff --git a/core/io/file_access_network.cpp b/core/io/file_access_network.cpp
index 3516ad8808..19076b57be 100644
--- a/core/io/file_access_network.cpp
+++ b/core/io/file_access_network.cpp
@@ -528,6 +528,14 @@ uint64_t FileAccessNetwork::_get_modified_time(const String& p_file){
}
+void FileAccessNetwork::configure() {
+
+ GLOBAL_DEF("network/remote_fs/page_size",65536);
+ GLOBAL_DEF("network/remote_fs/page_read_ahead",4);
+ GLOBAL_DEF("network/remote_fs/max_pages",20);
+
+}
+
FileAccessNetwork::FileAccessNetwork() {
eof_flag=false;
@@ -541,9 +549,9 @@ FileAccessNetwork::FileAccessNetwork() {
id=nc->last_id++;
nc->accesses[id]=this;
nc->unlock_mutex();
- page_size = GLOBAL_DEF("remote_fs/page_size",65536);
- read_ahead = GLOBAL_DEF("remote_fs/page_read_ahead",4);
- max_pages = GLOBAL_DEF("remote_fs/max_pages",20);
+ page_size = GLOBAL_GET("network/remote_fs/page_size");
+ read_ahead = GLOBAL_GET("network/remote_fs/page_read_ahead");
+ max_pages = GLOBAL_GET("network/remote_fs/max_pages");
last_activity_val=0;
waiting_on_page=-1;
last_page=-1;
diff --git a/core/io/file_access_network.h b/core/io/file_access_network.h
index 867991bcbe..4dbfb04b10 100644
--- a/core/io/file_access_network.h
+++ b/core/io/file_access_network.h
@@ -162,6 +162,8 @@ public:
virtual uint64_t _get_modified_time(const String& p_file);
+ static void configure();
+
FileAccessNetwork();
~FileAccessNetwork();
};
diff --git a/core/io/packet_peer.cpp b/core/io/packet_peer.cpp
index 1d05e95010..720e912e71 100644
--- a/core/io/packet_peer.cpp
+++ b/core/io/packet_peer.cpp
@@ -265,7 +265,8 @@ void PacketPeerStream::set_input_buffer_max_size(int p_max_size) {
PacketPeerStream::PacketPeerStream() {
- int rbsize=GLOBAL_DEF( "core/packet_stream_peer_max_buffer_po2",(16));
+ int rbsize=GLOBAL_GET( "network/packets/packet_stream_peer_max_buffer_po2");
+
ring_buffer.resize(rbsize);
temp_buffer.resize(1<<rbsize);
diff --git a/core/io/packet_peer.h b/core/io/packet_peer.h
index 7aa8d8d456..c67cfb943e 100644
--- a/core/io/packet_peer.h
+++ b/core/io/packet_peer.h
@@ -92,6 +92,8 @@ public:
virtual int get_max_packet_size() const;
+
+
void set_stream_peer(const Ref<StreamPeer>& p_peer);
void set_input_buffer_max_size(int p_max_size);
PacketPeerStream();
diff --git a/core/io/resource_format_binary.cpp b/core/io/resource_format_binary.cpp
index 5328bb68fe..512031b128 100644
--- a/core/io/resource_format_binary.cpp
+++ b/core/io/resource_format_binary.cpp
@@ -355,7 +355,7 @@ Error ResourceInteractiveLoaderBinary::parse_variant(Variant& r_v) {
if (path.find("://")==-1 && path.is_rel_path()) {
// path is relative to file being loaded, so convert to a resource path
- path=Globals::get_singleton()->localize_path(res_path.get_base_dir().plus_file(path));
+ path=GlobalConfig::get_singleton()->localize_path(res_path.get_base_dir().plus_file(path));
}
@@ -385,7 +385,7 @@ Error ResourceInteractiveLoaderBinary::parse_variant(Variant& r_v) {
if (path.find("://")==-1 && path.is_rel_path()) {
// path is relative to file being loaded, so convert to a resource path
- path=Globals::get_singleton()->localize_path(res_path.get_base_dir().plus_file(path));
+ path=GlobalConfig::get_singleton()->localize_path(res_path.get_base_dir().plus_file(path));
}
@@ -1047,7 +1047,7 @@ Ref<ResourceInteractiveLoader> ResourceFormatLoaderBinary::load_interactive(cons
}
Ref<ResourceInteractiveLoaderBinary> ria = memnew( ResourceInteractiveLoaderBinary );
- ria->local_path=Globals::get_singleton()->localize_path(p_path);
+ ria->local_path=GlobalConfig::get_singleton()->localize_path(p_path);
ria->res_path=ria->local_path;
// ria->set_local_path( Globals::get_singleton()->localize_path(p_path) );
ria->open(f);
@@ -1102,7 +1102,7 @@ Error ResourceFormatLoaderBinary::load_import_metadata(const String &p_path, Ref
}
Ref<ResourceInteractiveLoaderBinary> ria = memnew( ResourceInteractiveLoaderBinary );
- ria->local_path=Globals::get_singleton()->localize_path(p_path);
+ ria->local_path=GlobalConfig::get_singleton()->localize_path(p_path);
ria->res_path=ria->local_path;
// ria->set_local_path( Globals::get_singleton()->localize_path(p_path) );
ria->recognize(f);
@@ -1147,7 +1147,7 @@ void ResourceFormatLoaderBinary::get_dependencies(const String& p_path,List<Stri
ERR_FAIL_COND(!f);
Ref<ResourceInteractiveLoaderBinary> ria = memnew( ResourceInteractiveLoaderBinary );
- ria->local_path=Globals::get_singleton()->localize_path(p_path);
+ ria->local_path=GlobalConfig::get_singleton()->localize_path(p_path);
ria->res_path=ria->local_path;
// ria->set_local_path( Globals::get_singleton()->localize_path(p_path) );
ria->get_dependencies(f,p_dependencies,p_add_types);
@@ -1237,7 +1237,7 @@ Error ResourceFormatLoaderBinary::rename_dependencies(const String &p_path,const
}
Ref<ResourceInteractiveLoaderBinary> ria = memnew( ResourceInteractiveLoaderBinary );
- ria->local_path=Globals::get_singleton()->localize_path(p_path);
+ ria->local_path=GlobalConfig::get_singleton()->localize_path(p_path);
ria->res_path=ria->local_path;
ria->remaps=p_map;
// ria->set_local_path( Globals::get_singleton()->localize_path(p_path) );
@@ -1372,7 +1372,7 @@ String ResourceFormatLoaderBinary::get_resource_type(const String &p_path) const
}
Ref<ResourceInteractiveLoaderBinary> ria = memnew( ResourceInteractiveLoaderBinary );
- ria->local_path=Globals::get_singleton()->localize_path(p_path);
+ ria->local_path=GlobalConfig::get_singleton()->localize_path(p_path);
ria->res_path=ria->local_path;
// ria->set_local_path( Globals::get_singleton()->localize_path(p_path) );
String r = ria->recognize(f);
@@ -2192,7 +2192,7 @@ Error ResourceFormatSaverBinaryInstance::save(const String &p_path,const RES& p_
Error ResourceFormatSaverBinary::save(const String &p_path,const RES& p_resource,uint32_t p_flags) {
- String local_path = Globals::get_singleton()->localize_path(p_path);
+ String local_path = GlobalConfig::get_singleton()->localize_path(p_path);
ResourceFormatSaverBinaryInstance saver;
return saver.save(local_path,p_resource,p_flags);
diff --git a/core/io/resource_format_xml.cpp b/core/io/resource_format_xml.cpp
index 7bb9e2efb7..d4808d4741 100644
--- a/core/io/resource_format_xml.cpp
+++ b/core/io/resource_format_xml.cpp
@@ -467,7 +467,7 @@ Error ResourceInteractiveLoaderXML::parse_property(Variant& r_v, String &r_name)
path=path.replace("local://",local_path+"::");
else if (path.find("://")==-1 && path.is_rel_path()) {
// path is relative to file being loaded, so convert to a resource path
- path=Globals::get_singleton()->localize_path(local_path.get_base_dir().plus_file(path));
+ path=GlobalConfig::get_singleton()->localize_path(local_path.get_base_dir().plus_file(path));
}
@@ -1425,7 +1425,7 @@ Error ResourceInteractiveLoaderXML::poll() {
if (path.find("://")==-1 && path.is_rel_path()) {
// path is relative to file being loaded, so convert to a resource path
- path=Globals::get_singleton()->localize_path(local_path.get_base_dir().plus_file(path));
+ path=GlobalConfig::get_singleton()->localize_path(local_path.get_base_dir().plus_file(path));
}
if (remaps.has(path)) {
@@ -1622,7 +1622,7 @@ void ResourceInteractiveLoaderXML::get_dependencies(FileAccess *f,List<String> *
if (path.find("://")==-1 && path.is_rel_path()) {
// path is relative to file being loaded, so convert to a resource path
- path=Globals::get_singleton()->localize_path(local_path.get_base_dir().plus_file(path));
+ path=GlobalConfig::get_singleton()->localize_path(local_path.get_base_dir().plus_file(path));
}
if (path.ends_with("*")) {
@@ -1760,7 +1760,7 @@ Error ResourceInteractiveLoaderXML::rename_dependencies(FileAccess *p_f, const S
}
Ref<ResourceInteractiveLoaderXML> ria = memnew( ResourceInteractiveLoaderXML );
- ria->local_path=Globals::get_singleton()->localize_path(p_path);
+ ria->local_path=GlobalConfig::get_singleton()->localize_path(p_path);
ria->res_path=ria->local_path;
ria->remaps=p_map;
// ria->set_local_path( Globals::get_singleton()->localize_path(p_path) );
@@ -1924,7 +1924,7 @@ Ref<ResourceInteractiveLoader> ResourceFormatLoaderXML::load_interactive(const S
}
Ref<ResourceInteractiveLoaderXML> ria = memnew( ResourceInteractiveLoaderXML );
- ria->local_path=Globals::get_singleton()->localize_path(p_path);
+ ria->local_path=GlobalConfig::get_singleton()->localize_path(p_path);
ria->res_path=ria->local_path;
// ria->set_local_path( Globals::get_singleton()->localize_path(p_path) );
ria->open(f);
@@ -1989,7 +1989,7 @@ String ResourceFormatLoaderXML::get_resource_type(const String &p_path) const{
}
Ref<ResourceInteractiveLoaderXML> ria = memnew( ResourceInteractiveLoaderXML );
- ria->local_path=Globals::get_singleton()->localize_path(p_path);
+ ria->local_path=GlobalConfig::get_singleton()->localize_path(p_path);
ria->res_path=ria->local_path;
// ria->set_local_path( Globals::get_singleton()->localize_path(p_path) );
String r = ria->recognize(f);
@@ -2006,7 +2006,7 @@ void ResourceFormatLoaderXML::get_dependencies(const String& p_path,List<String>
}
Ref<ResourceInteractiveLoaderXML> ria = memnew( ResourceInteractiveLoaderXML );
- ria->local_path=Globals::get_singleton()->localize_path(p_path);
+ ria->local_path=GlobalConfig::get_singleton()->localize_path(p_path);
ria->res_path=ria->local_path;
// ria->set_local_path( Globals::get_singleton()->localize_path(p_path) );
ria->get_dependencies(f,p_dependencies,p_add_types);
@@ -2023,7 +2023,7 @@ Error ResourceFormatLoaderXML::rename_dependencies(const String &p_path,const Ma
}
Ref<ResourceInteractiveLoaderXML> ria = memnew( ResourceInteractiveLoaderXML );
- ria->local_path=Globals::get_singleton()->localize_path(p_path);
+ ria->local_path=GlobalConfig::get_singleton()->localize_path(p_path);
ria->res_path=ria->local_path;
// ria->set_local_path( Globals::get_singleton()->localize_path(p_path) );
return ria->rename_dependencies(f,p_path,p_map);
@@ -2716,7 +2716,7 @@ Error ResourceFormatSaverXMLInstance::save(const String &p_path,const RES& p_res
ERR_FAIL_COND_V( err, ERR_CANT_OPEN );
FileAccessRef _fref(f);
- local_path = Globals::get_singleton()->localize_path(p_path);
+ local_path = GlobalConfig::get_singleton()->localize_path(p_path);
relative_paths=p_flags&ResourceSaver::FLAG_RELATIVE_PATHS;
skip_editor=p_flags&ResourceSaver::FLAG_OMIT_EDITOR_PROPERTIES;
diff --git a/core/io/resource_loader.cpp b/core/io/resource_loader.cpp
index f299a75d85..cc3c8ce006 100644
--- a/core/io/resource_loader.cpp
+++ b/core/io/resource_loader.cpp
@@ -164,7 +164,7 @@ RES ResourceLoader::load(const String &p_path, const String& p_type_hint, bool p
if (p_path.is_rel_path())
local_path="res://"+p_path;
else
- local_path = Globals::get_singleton()->localize_path(p_path);
+ local_path = GlobalConfig::get_singleton()->localize_path(p_path);
local_path=find_complete_path(local_path,p_type_hint);
ERR_FAIL_COND_V(local_path=="",RES());
@@ -228,7 +228,7 @@ Ref<ResourceImportMetadata> ResourceLoader::load_import_metadata(const String &p
if (p_path.is_rel_path())
local_path="res://"+p_path;
else
- local_path = Globals::get_singleton()->localize_path(p_path);
+ local_path = GlobalConfig::get_singleton()->localize_path(p_path);
String extension=p_path.extension();
Ref<ResourceImportMetadata> ret;
@@ -307,7 +307,7 @@ Ref<ResourceInteractiveLoader> ResourceLoader::load_interactive(const String &p_
if (p_path.is_rel_path())
local_path="res://"+p_path;
else
- local_path = Globals::get_singleton()->localize_path(p_path);
+ local_path = GlobalConfig::get_singleton()->localize_path(p_path);
local_path=find_complete_path(local_path,p_type_hint);
ERR_FAIL_COND_V(local_path=="",Ref<ResourceInteractiveLoader>());
@@ -381,7 +381,7 @@ void ResourceLoader::get_dependencies(const String& p_path, List<String> *p_depe
if (p_path.is_rel_path())
local_path="res://"+p_path;
else
- local_path = Globals::get_singleton()->localize_path(p_path);
+ local_path = GlobalConfig::get_singleton()->localize_path(p_path);
String remapped_path = PathRemap::get_singleton()->get_remap(local_path);
@@ -406,7 +406,7 @@ Error ResourceLoader::rename_dependencies(const String &p_path,const Map<String,
if (p_path.is_rel_path())
local_path="res://"+p_path;
else
- local_path = Globals::get_singleton()->localize_path(p_path);
+ local_path = GlobalConfig::get_singleton()->localize_path(p_path);
String remapped_path = PathRemap::get_singleton()->get_remap(local_path);
@@ -434,7 +434,7 @@ String ResourceLoader::guess_full_filename(const String &p_path,const String& p_
if (p_path.is_rel_path())
local_path="res://"+p_path;
else
- local_path = Globals::get_singleton()->localize_path(p_path);
+ local_path = GlobalConfig::get_singleton()->localize_path(p_path);
return find_complete_path(local_path,p_type);
@@ -446,7 +446,7 @@ String ResourceLoader::get_resource_type(const String &p_path) {
if (p_path.is_rel_path())
local_path="res://"+p_path;
else
- local_path = Globals::get_singleton()->localize_path(p_path);
+ local_path = GlobalConfig::get_singleton()->localize_path(p_path);
String remapped_path = PathRemap::get_singleton()->get_remap(local_path);
String extension=remapped_path.extension();
diff --git a/core/io/resource_saver.cpp b/core/io/resource_saver.cpp
index 704603f9ff..9081adaa8f 100644
--- a/core/io/resource_saver.cpp
+++ b/core/io/resource_saver.cpp
@@ -64,7 +64,7 @@ Error ResourceSaver::save(const String &p_path,const RES& p_resource,uint32_t p_
String old_path=p_resource->get_path();
- String local_path=Globals::get_singleton()->localize_path(p_path);
+ String local_path=GlobalConfig::get_singleton()->localize_path(p_path);
RES rwcopy = p_resource;
if (p_flags&FLAG_CHANGE_PATH)