diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/bind/core_bind.cpp | 21 | ||||
-rw-r--r-- | core/bind/core_bind.h | 2 | ||||
-rw-r--r-- | core/globals.cpp | 2 | ||||
-rw-r--r-- | core/io/resource_format_binary.cpp | 18 | ||||
-rw-r--r-- | core/io/resource_loader.cpp | 12 | ||||
-rw-r--r-- | core/io/resource_loader.h | 2 | ||||
-rw-r--r-- | core/io/resource_saver.cpp | 14 | ||||
-rw-r--r-- | core/io/resource_saver.h | 2 | ||||
-rw-r--r-- | core/os/input.cpp | 1 | ||||
-rw-r--r-- | core/os/input.h | 1 | ||||
-rw-r--r-- | core/os/os.cpp | 24 | ||||
-rw-r--r-- | core/os/os.h | 8 | ||||
-rw-r--r-- | core/path_db.cpp | 6 | ||||
-rw-r--r-- | core/path_db.h | 2 | ||||
-rw-r--r-- | core/resource.cpp | 7 | ||||
-rw-r--r-- | core/translation.cpp | 12 |
16 files changed, 87 insertions, 47 deletions
diff --git a/core/bind/core_bind.cpp b/core/bind/core_bind.cpp index 9df31124f8..9cc934bb6f 100644 --- a/core/bind/core_bind.cpp +++ b/core/bind/core_bind.cpp @@ -857,7 +857,6 @@ void _OS::print_all_textures_by_size() { for(List<_OSCoreBindImg>::Element *E=imgs.front();E;E=E->next()) { - print_line(E->get().path+" - "+String::humanize_size(E->get().vram)+" ("+E->get().size+") - total:"+String::humanize_size(total) ); total-=E->get().vram; } } @@ -891,19 +890,6 @@ void _OS::print_resources_by_type(const Vector<String>& p_types) { type_count[r->get_type()]++; - - print_line(r->get_type()+": "+r->get_path()); - - List<String> metas; - r->get_meta_list(&metas); - for (List<String>::Element* me = metas.front(); me; me = me->next()) { - print_line(" "+String(me->get()) + ": " + r->get_meta(me->get())); - }; - } - - for(Map<String,int>::Element *E=type_count.front();E;E=E->next()) { - - print_line(E->key()+" count: "+itos(E->get())); } }; @@ -1016,6 +1002,11 @@ void _OS::alert(const String& p_alert,const String& p_title) { OS::get_singleton()->alert(p_alert,p_title); } +Dictionary _OS::get_engine_version() const { + + return OS::get_singleton()->get_engine_version(); +} + _OS *_OS::singleton=NULL; void _OS::_bind_methods() { @@ -1163,6 +1154,8 @@ void _OS::_bind_methods() { ObjectTypeDB::bind_method(_MD("set_use_vsync","enable"),&_OS::set_use_vsync); ObjectTypeDB::bind_method(_MD("is_vsnc_enabled"),&_OS::is_vsnc_enabled); + ObjectTypeDB::bind_method(_MD("get_engine_version"),&_OS::get_engine_version); + BIND_CONSTANT( DAY_SUNDAY ); BIND_CONSTANT( DAY_MONDAY ); BIND_CONSTANT( DAY_TUESDAY ); diff --git a/core/bind/core_bind.h b/core/bind/core_bind.h index 5bd427578a..b43c5246ed 100644 --- a/core/bind/core_bind.h +++ b/core/bind/core_bind.h @@ -315,6 +315,8 @@ public: void set_use_vsync(bool p_enable); bool is_vsnc_enabled() const; + Dictionary get_engine_version() const; + static _OS *get_singleton() { return singleton; } _OS(); diff --git a/core/globals.cpp b/core/globals.cpp index 9e7b357d73..e760bc00d4 100644 --- a/core/globals.cpp +++ b/core/globals.cpp @@ -1429,7 +1429,7 @@ Globals::Globals() { set("application/name","" ); set("application/main_scene",""); - custom_prop_info["application/main_scene"]=PropertyInfo(Variant::STRING,"application/main_scene",PROPERTY_HINT_FILE,"scn,res,xscn,xml,tscn"); + custom_prop_info["application/main_scene"]=PropertyInfo(Variant::STRING,"application/main_scene",PROPERTY_HINT_FILE,"tscn,scn,xscn,xml,res"); set("application/disable_stdout",false); set("application/use_shared_user_dir",true); diff --git a/core/io/resource_format_binary.cpp b/core/io/resource_format_binary.cpp index 58f3a4df2b..343a54e0d7 100644 --- a/core/io/resource_format_binary.cpp +++ b/core/io/resource_format_binary.cpp @@ -1105,14 +1105,9 @@ void ResourceFormatLoaderBinary::get_recognized_extensions_for_type(const String for(List<String>::Element *E=extensions.front();E;E=E->next()) { String ext = E->get().to_lower(); - if (ext=="res") - continue; -// p_extensions->push_back("x"+ext); p_extensions->push_back(ext); } - p_extensions->push_back("res"); - } void ResourceFormatLoaderBinary::get_recognized_extensions(List<String> *p_extensions) const{ @@ -1122,12 +1117,9 @@ void ResourceFormatLoaderBinary::get_recognized_extensions(List<String> *p_exten for(List<String>::Element *E=extensions.front();E;E=E->next()) { String ext = E->get().to_lower(); - if (ext=="res") - continue; p_extensions->push_back(ext); } - p_extensions->push_back("res"); } bool ResourceFormatLoaderBinary::handles_type(const String& p_type) const{ @@ -2270,16 +2262,8 @@ bool ResourceFormatSaverBinary::recognize(const RES& p_resource) const { void ResourceFormatSaverBinary::get_recognized_extensions(const RES& p_resource,List<String> *p_extensions) const { - - //here comes the sun, lalalala String base = p_resource->get_base_extension().to_lower(); - if (base!="res") { - - p_extensions->push_back(base); - } - - p_extensions->push_back("res"); - + p_extensions->push_back(base); } diff --git a/core/io/resource_loader.cpp b/core/io/resource_loader.cpp index f414f85df8..08b4139047 100644 --- a/core/io/resource_loader.cpp +++ b/core/io/resource_loader.cpp @@ -360,10 +360,18 @@ Ref<ResourceInteractiveLoader> ResourceLoader::load_interactive(const String &p_ } -void ResourceLoader::add_resource_format_loader(ResourceFormatLoader *p_format_loader) { +void ResourceLoader::add_resource_format_loader(ResourceFormatLoader *p_format_loader, bool p_at_front) { ERR_FAIL_COND( loader_count >= MAX_LOADERS ); - loader[loader_count++]=p_format_loader; + if (p_at_front) { + for(int i=loader_count;i>0;i--) { + loader[i]=loader[i-1]; + } + loader[0]=p_format_loader; + loader_count++; + } else { + loader[loader_count++]=p_format_loader; + } } void ResourceLoader::get_dependencies(const String& p_path, List<String> *p_dependencies, bool p_add_types) { diff --git a/core/io/resource_loader.h b/core/io/resource_loader.h index 6404e6cb13..f976a43d91 100644 --- a/core/io/resource_loader.h +++ b/core/io/resource_loader.h @@ -102,7 +102,7 @@ public: static Ref<ResourceImportMetadata> load_import_metadata(const String &p_path); static void get_recognized_extensions_for_type(const String& p_type,List<String> *p_extensions); - static void add_resource_format_loader(ResourceFormatLoader *p_format_loader); + static void add_resource_format_loader(ResourceFormatLoader *p_format_loader,bool p_at_front=false); static String get_resource_type(const String &p_path); static void get_dependencies(const String& p_path,List<String> *p_dependencies,bool p_add_types=false); static Error rename_dependencies(const String &p_path,const Map<String,String>& p_map); diff --git a/core/io/resource_saver.cpp b/core/io/resource_saver.cpp index 8d78ecabbf..2ead405440 100644 --- a/core/io/resource_saver.cpp +++ b/core/io/resource_saver.cpp @@ -116,10 +116,20 @@ void ResourceSaver::get_recognized_extensions(const RES& p_resource,List<String> } -void ResourceSaver::add_resource_format_saver(ResourceFormatSaver *p_format_saver) { +void ResourceSaver::add_resource_format_saver(ResourceFormatSaver *p_format_saver, bool p_at_front) { ERR_FAIL_COND( saver_count >= MAX_SAVERS ); - saver[saver_count++]=p_format_saver; + + if (p_at_front) { + for(int i=saver_count;i>0;i--) { + saver[i]=saver[i-1]; + } + saver[0]=p_format_saver; + saver_count++; + } else { + saver[saver_count++]=p_format_saver; + } + } diff --git a/core/io/resource_saver.h b/core/io/resource_saver.h index 97500c46f4..b05ae23afc 100644 --- a/core/io/resource_saver.h +++ b/core/io/resource_saver.h @@ -80,7 +80,7 @@ public: static Error save(const String &p_path,const RES& p_resource,uint32_t p_flags=0); static void get_recognized_extensions(const RES& p_resource,List<String> *p_extensions); - static void add_resource_format_saver(ResourceFormatSaver *p_format_saver); + static void add_resource_format_saver(ResourceFormatSaver *p_format_saver,bool p_at_front=false); static void set_timestamp_on_save(bool p_timestamp) { timestamp_on_save=p_timestamp; } static void set_save_callback(ResourceSavedCallback p_callback); diff --git a/core/os/input.cpp b/core/os/input.cpp index efbae57950..531db73838 100644 --- a/core/os/input.cpp +++ b/core/os/input.cpp @@ -66,6 +66,7 @@ void Input::_bind_methods() { ObjectTypeDB::bind_method(_MD("stop_joy_vibration", "device"), &Input::stop_joy_vibration); ObjectTypeDB::bind_method(_MD("get_accelerometer"),&Input::get_accelerometer); ObjectTypeDB::bind_method(_MD("get_magnetometer"),&Input::get_magnetometer); + ObjectTypeDB::bind_method(_MD("get_gyroscope"),&Input::get_gyroscope); //ObjectTypeDB::bind_method(_MD("get_mouse_pos"),&Input::get_mouse_pos); - this is not the function you want ObjectTypeDB::bind_method(_MD("get_mouse_speed"),&Input::get_mouse_speed); ObjectTypeDB::bind_method(_MD("get_mouse_button_mask"),&Input::get_mouse_button_mask); diff --git a/core/os/input.h b/core/os/input.h index d11703470b..16bcc0ff9a 100644 --- a/core/os/input.h +++ b/core/os/input.h @@ -82,6 +82,7 @@ public: virtual Vector3 get_accelerometer()=0; virtual Vector3 get_magnetometer()=0; + virtual Vector3 get_gyroscope()=0; virtual void action_press(const StringName& p_action)=0; virtual void action_release(const StringName& p_action)=0; diff --git a/core/os/os.cpp b/core/os/os.cpp index e501bc2eb5..284bcb30cb 100644 --- a/core/os/os.cpp +++ b/core/os/os.cpp @@ -32,6 +32,8 @@ #include "dir_access.h" #include "globals.h" #include "input.h" +// For get_engine_version, could be removed if it's moved to a new Engine singleton +#include "version.h" OS* OS::singleton=NULL; @@ -548,6 +550,28 @@ bool OS::is_vsnc_enabled() const{ return true; } +Dictionary OS::get_engine_version() const { + + Dictionary dict; + dict["major"] = _MKSTR(VERSION_MAJOR); + dict["minor"] = _MKSTR(VERSION_MINOR); +#ifdef VERSION_PATCH + dict["patch"] = _MKSTR(VERSION_PATCH); +#else + dict["patch"] = ""; +#endif + dict["status"] = _MKSTR(VERSION_STATUS); + dict["revision"] = _MKSTR(VERSION_REVISION); + + String stringver = String(dict["major"]) + "." + String(dict["minor"]); + if (dict["patch"] != "") + stringver += "." + String(dict["patch"]); + stringver += "-" + String(dict["status"]) + " (" + String(dict["revision"]) + ")"; + dict["string"] = stringver; + + return dict; +} + OS::OS() { last_error=NULL; frames_drawn=0; diff --git a/core/os/os.h b/core/os/os.h index c291d09250..40f3989a55 100644 --- a/core/os/os.h +++ b/core/os/os.h @@ -186,14 +186,14 @@ public: virtual void set_target_fps(int p_fps); virtual float get_target_fps() const; - virtual float get_frames_per_second() const { return _fps; }; + virtual float get_frames_per_second() const { return _fps; } virtual void set_keep_screen_on(bool p_enabled); virtual bool is_keep_screen_on() const; virtual void set_low_processor_usage_mode(bool p_enabled); virtual bool is_in_low_processor_usage_mode() const; - virtual String get_installed_templates_path() const { return ""; }; + virtual String get_installed_templates_path() const { return ""; } virtual String get_executable_path() const; virtual Error execute(const String& p_path, const List<String>& p_arguments,bool p_blocking,ProcessID *r_child_id=NULL,String* r_pipe=NULL,int *r_exitcode=NULL)=0; virtual Error kill(const ProcessID& p_pid)=0; @@ -363,7 +363,7 @@ public: virtual void set_screen_orientation(ScreenOrientation p_orientation); ScreenOrientation get_screen_orientation() const; - virtual void move_window_to_foreground() {}; + virtual void move_window_to_foreground() {} virtual void debug_break(); @@ -423,6 +423,8 @@ public: virtual void set_use_vsync(bool p_enable); virtual bool is_vsnc_enabled() const; + Dictionary get_engine_version() const; + bool is_hidpi_allowed() const { return _allow_hidpi; } OS(); virtual ~OS(); diff --git a/core/path_db.cpp b/core/path_db.cpp index 0956c4cd3f..d0feda5c82 100644 --- a/core/path_db.cpp +++ b/core/path_db.cpp @@ -53,6 +53,12 @@ uint32_t NodePath::hash() const { } +void NodePath::prepend_period() { + + if (data->path.size() && data->path[0].operator String()!=".") { + data->path.insert(0,"."); + } +} bool NodePath::is_absolute() const { diff --git a/core/path_db.h b/core/path_db.h index 63adb42955..3a550fe1d0 100644 --- a/core/path_db.h +++ b/core/path_db.h @@ -72,6 +72,8 @@ public: NodePath rel_path_to(const NodePath& p_np) const; + void prepend_period(); + StringName get_property() const; NodePath get_parent() const; diff --git a/core/resource.cpp b/core/resource.cpp index b80ec7012d..e8d4069779 100644 --- a/core/resource.cpp +++ b/core/resource.cpp @@ -95,10 +95,9 @@ bool ResourceImportMetadata::has_option(const String& p_key) const { return options.has(p_key); } + Variant ResourceImportMetadata::get_option(const String& p_key) const { - if (!options.has(p_key)) - print_line(p_key); ERR_FAIL_COND_V(!options.has(p_key),Variant()); return options[p_key]; @@ -487,8 +486,6 @@ void ResourceCache::dump(const char* p_file,bool p_short) { if (!p_short) { if (f) f->store_line(r->get_type()+": "+r->get_path()); - else - print_line(r->get_type()+": "+r->get_path()); } } @@ -496,8 +493,6 @@ void ResourceCache::dump(const char* p_file,bool p_short) { if (f) f->store_line(E->key()+" count: "+itos(E->get())); - else - print_line(E->key()+" count: "+itos(E->get())); } if (f) { f->close(); diff --git a/core/translation.cpp b/core/translation.cpp index ee0ef2ea09..01789747ea 100644 --- a/core/translation.cpp +++ b/core/translation.cpp @@ -54,6 +54,9 @@ static const char* locale_list[]={ "be_BY", // Belarusian (Belarus) "bg", // Bulgarian "bg_BG", // Bulgarian (Bulgaria) +"bn", // Bengali +"bn_BD", // Bengali (Bangladesh) +"bn_IN", // Bengali (India) "ca", // Catalan "ca_ES", // Catalan (Spain) "cs", // Czech @@ -178,6 +181,9 @@ static const char* locale_list[]={ "tr_TR", // Turkish (Turkey) "uk", // Ukrainian "uk_UA", // Ukrainian (Ukraine) +"ur", // Urdu +"ur_IN", // Urdu (India) +"ur_PK", // Urdu (Pakistan) "vi", // Vietnamese "vi_VN", // Vietnamese (Vietnam) "zh", // Chinese @@ -211,6 +217,9 @@ static const char* locale_names[]={ "Belarusian (Belarus)", "Bulgarian", "Bulgarian (Bulgaria)", +"Bengali", +"Bengali (Bangladesh)", +"Bengali (India)", "Catalan", "Catalan (Spain)", "Czech", @@ -335,6 +344,9 @@ static const char* locale_names[]={ "Turkish (Turkey)", "Ukrainian", "Ukrainian (Ukraine)", +"Urdu", +"Urdu (India)", +"Urdu (Pakistan)", "Vietnamese", "Vietnamese (Vietnam)", "Chinese", |