summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/bind/core_bind.cpp54
-rw-r--r--core/bind/core_bind.h9
-rw-r--r--core/globals.cpp2
-rw-r--r--core/image_quantize.cpp5
-rw-r--r--core/io/image_loader.cpp3
-rw-r--r--core/io/marshalls.cpp3
-rw-r--r--core/io/resource_format_binary.cpp18
-rw-r--r--core/io/resource_format_xml.cpp2
-rw-r--r--core/io/resource_loader.cpp13
-rw-r--r--core/io/resource_loader.h2
-rw-r--r--core/io/resource_saver.cpp14
-rw-r--r--core/io/resource_saver.h2
-rw-r--r--core/io/translation_loader_po.cpp3
-rw-r--r--core/math/geometry.cpp14
-rw-r--r--core/math/triangle_mesh.cpp14
-rw-r--r--core/object.cpp2
-rw-r--r--core/object_type_db.cpp2
-rw-r--r--core/os/input.cpp2
-rw-r--r--core/os/input.h2
-rw-r--r--core/os/os.cpp29
-rw-r--r--core/os/os.h9
-rw-r--r--core/path_db.cpp8
-rw-r--r--core/path_db.h2
-rw-r--r--core/pool_allocator.cpp1
-rw-r--r--core/resource.cpp7
-rw-r--r--core/translation.cpp12
-rw-r--r--core/ustring.cpp1
-rw-r--r--core/variant_call.cpp8
-rw-r--r--core/variant_op.cpp34
29 files changed, 177 insertions, 100 deletions
diff --git a/core/bind/core_bind.cpp b/core/bind/core_bind.cpp
index ace7e7c7b7..3e2f8ff263 100644
--- a/core/bind/core_bind.cpp
+++ b/core/bind/core_bind.cpp
@@ -435,6 +435,18 @@ String _OS::get_locale() const {
return OS::get_singleton()->get_locale();
}
+String _OS::get_latin_keyboard_variant() const {
+ switch( OS::get_singleton()->get_latin_keyboard_variant() ) {
+ case OS::LATIN_KEYBOARD_QWERTY: return "QWERTY";
+ case OS::LATIN_KEYBOARD_QWERTZ: return "QWERTZ";
+ case OS::LATIN_KEYBOARD_AZERTY: return "AZERTY";
+ case OS::LATIN_KEYBOARD_QZERTY: return "QZERTY";
+ case OS::LATIN_KEYBOARD_DVORAK: return "DVORAK";
+ case OS::LATIN_KEYBOARD_NEO : return "NEO";
+ default: return "ERROR";
+ }
+}
+
String _OS::get_model_name() const {
return OS::get_singleton()->get_model_name();
@@ -845,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;
}
}
@@ -879,23 +890,21 @@ 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()));
- }
+bool _OS::has_virtual_keyboard() const {
+ return OS::get_singleton()->has_virtual_keyboard();
+}
-};
+void _OS::show_virtual_keyboard(const String& p_existing_text) {
+ OS::get_singleton()->show_virtual_keyboard(p_existing_text, Rect2());
+}
+void _OS::hide_virtual_keyboard() {
+ OS::get_singleton()->hide_virtual_keyboard();
+}
void _OS::print_all_resources(const String& p_to_file ) {
@@ -946,6 +955,11 @@ void _OS::native_video_stop() {
OS::get_singleton()->native_video_stop();
};
+void _OS::request_attention() {
+
+ OS::get_singleton()->request_attention();
+}
+
bool _OS::is_debug_build() const {
#ifdef DEBUG_ENABLED
@@ -1004,6 +1018,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() {
@@ -1039,6 +1058,7 @@ void _OS::_bind_methods() {
ObjectTypeDB::bind_method(_MD("is_window_minimized"),&_OS::is_window_minimized);
ObjectTypeDB::bind_method(_MD("set_window_maximized", "enabled"),&_OS::set_window_maximized);
ObjectTypeDB::bind_method(_MD("is_window_maximized"),&_OS::is_window_maximized);
+ ObjectTypeDB::bind_method(_MD("request_attention"), &_OS::request_attention);
ObjectTypeDB::bind_method(_MD("set_borderless_window", "borderless"), &_OS::set_borderless_window);
ObjectTypeDB::bind_method(_MD("get_borderless_window"), &_OS::get_borderless_window);
@@ -1097,6 +1117,7 @@ void _OS::_bind_methods() {
ObjectTypeDB::bind_method(_MD("get_ticks_msec"),&_OS::get_ticks_msec);
ObjectTypeDB::bind_method(_MD("get_splash_tick_msec"),&_OS::get_splash_tick_msec);
ObjectTypeDB::bind_method(_MD("get_locale"),&_OS::get_locale);
+ ObjectTypeDB::bind_method(_MD("get_latin_keyboard_variant"),&_OS::get_latin_keyboard_variant);
ObjectTypeDB::bind_method(_MD("get_model_name"),&_OS::get_model_name);
ObjectTypeDB::bind_method(_MD("get_custom_level"),&_OS::get_custom_level);
@@ -1113,6 +1134,9 @@ void _OS::_bind_methods() {
ObjectTypeDB::bind_method(_MD("dump_memory_to_file","file"),&_OS::dump_memory_to_file);
ObjectTypeDB::bind_method(_MD("dump_resources_to_file","file"),&_OS::dump_resources_to_file);
+ ObjectTypeDB::bind_method(_MD("has_virtual_keyboard"),&_OS::has_virtual_keyboard);
+ ObjectTypeDB::bind_method(_MD("show_virtual_keyboard", "existing_text"),&_OS::show_virtual_keyboard,DEFVAL(""));
+ ObjectTypeDB::bind_method(_MD("hide_virtual_keyboard"),&_OS::hide_virtual_keyboard);
ObjectTypeDB::bind_method(_MD("print_resources_in_use","short"),&_OS::print_resources_in_use,DEFVAL(false));
ObjectTypeDB::bind_method(_MD("print_all_resources","tofile"),&_OS::print_all_resources,DEFVAL(""));
@@ -1150,6 +1174,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 );
@@ -1789,7 +1815,7 @@ void _File::_bind_methods() {
ObjectTypeDB::bind_method(_MD("get_line"),&_File::get_line);
ObjectTypeDB::bind_method(_MD("get_as_text"),&_File::get_as_text);
ObjectTypeDB::bind_method(_MD("get_md5","path"),&_File::get_md5);
- ObjectTypeDB::bind_method(_MD("get_sha256","path"),&_File::get_md5);
+ ObjectTypeDB::bind_method(_MD("get_sha256","path"),&_File::get_sha256);
ObjectTypeDB::bind_method(_MD("get_endian_swap"),&_File::get_endian_swap);
ObjectTypeDB::bind_method(_MD("set_endian_swap","enable"),&_File::set_endian_swap);
ObjectTypeDB::bind_method(_MD("get_error:Error"),&_File::get_error);
diff --git a/core/bind/core_bind.h b/core/bind/core_bind.h
index 856d942d02..14203ae863 100644
--- a/core/bind/core_bind.h
+++ b/core/bind/core_bind.h
@@ -158,6 +158,7 @@ public:
virtual bool is_window_minimized() const;
virtual void set_window_maximized(bool p_enabled);
virtual bool is_window_maximized() const;
+ virtual void request_attention();
virtual void set_borderless_window(bool p_borderless);
virtual bool get_borderless_window() const;
@@ -192,6 +193,8 @@ public:
Vector<String> get_cmdline_args();
String get_locale() const;
+ String get_latin_keyboard_variant() const;
+
String get_model_name() const;
MainLoop *get_main_loop() const;
@@ -202,6 +205,10 @@ public:
void dump_memory_to_file(const String& p_file);
void dump_resources_to_file(const String& p_file);
+ bool has_virtual_keyboard() const;
+ void show_virtual_keyboard(const String& p_existing_text="");
+ void hide_virtual_keyboard();
+
void print_resources_in_use(bool p_short=false);
void print_all_resources(const String& p_to_file);
void print_all_textures_by_size();
@@ -313,6 +320,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/image_quantize.cpp b/core/image_quantize.cpp
index b8d4658fda..f6fe7a88a0 100644
--- a/core/image_quantize.cpp
+++ b/core/image_quantize.cpp
@@ -59,7 +59,6 @@ int Image::MCBlock::get_longest_axis_index() const {
for(int i=0;i<4;i++) {
int d = max_color.color.col[i]-min_color.color.col[i];
- //printf(" ai:%i - %i\n",i,d);
if (d>max_dist) {
max_index=i;
max_dist=d;
@@ -71,13 +70,11 @@ int Image::MCBlock::get_longest_axis_index() const {
int Image::MCBlock::get_longest_axis_length() const {
int max_dist=-1;
- int max_index=0;
for(int i=0;i<4;i++) {
int d = max_color.color.col[i]-min_color.color.col[i];
if (d>max_dist) {
- max_index=i;
max_dist=d;
}
}
@@ -117,8 +114,6 @@ void Image::MCBlock::shrink() {
void Image::quantize() {
- Image::Format orig_format=format;
-
bool has_alpha = detect_alpha()!=ALPHA_NONE;
bool quantize_fast=OS::get_singleton()->has_environment("QUANTIZE_FAST");
diff --git a/core/io/image_loader.cpp b/core/io/image_loader.cpp
index 05bad97e90..ac6c00dc61 100644
--- a/core/io/image_loader.cpp
+++ b/core/io/image_loader.cpp
@@ -51,7 +51,7 @@ Error ImageLoader::load_image(String p_file,Image *p_image, FileAccess *p_custom
Error err;
f=FileAccess::open(p_file,FileAccess::READ,&err);
if (!f) {
- print_line("ERROR OPENING FILE: "+p_file);
+ ERR_PRINTS("Error opening file: "+p_file);
return err;
}
}
@@ -76,7 +76,6 @@ Error ImageLoader::load_image(String p_file,Image *p_image, FileAccess *p_custom
}
- print_line("NO LOADER?");
if (!p_custom)
memdelete(f);
diff --git a/core/io/marshalls.cpp b/core/io/marshalls.cpp
index 60617e1237..c9bd38c654 100644
--- a/core/io/marshalls.cpp
+++ b/core/io/marshalls.cpp
@@ -685,7 +685,6 @@ Error decode_variant(Variant& r_variant,const uint8_t *p_buffer, int p_len,int *
if (count) {
varray.resize(count);
DVector<Vector2>::Write w = varray.write();
- const float *r = (const float*)buf;
for(int i=0;i<(int)count;i++) {
@@ -724,7 +723,6 @@ Error decode_variant(Variant& r_variant,const uint8_t *p_buffer, int p_len,int *
if (count) {
varray.resize(count);
DVector<Vector3>::Write w = varray.write();
- const float *r = (const float*)buf;
for(int i=0;i<(int)count;i++) {
@@ -764,7 +762,6 @@ Error decode_variant(Variant& r_variant,const uint8_t *p_buffer, int p_len,int *
if (count) {
carray.resize(count);
DVector<Color>::Write w = carray.write();
- const float *r = (const float*)buf;
for(int i=0;i<(int)count;i++) {
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_format_xml.cpp b/core/io/resource_format_xml.cpp
index a42a922baf..0d545b16f5 100644
--- a/core/io/resource_format_xml.cpp
+++ b/core/io/resource_format_xml.cpp
@@ -1862,8 +1862,6 @@ void ResourceInteractiveLoaderXML::open(FileAccess *p_f) {
}
int major = version.get_slicec('.',0).to_int();
- int minor = version.get_slicec('.',1).to_int();
-
if (major>VERSION_MAJOR) {
error=ERR_FILE_UNRECOGNIZED;
diff --git a/core/io/resource_loader.cpp b/core/io/resource_loader.cpp
index 1bb80e74eb..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) {
@@ -443,7 +451,6 @@ String ResourceLoader::get_resource_type(const String &p_path) {
String remapped_path = PathRemap::get_singleton()->get_remap(local_path);
String extension=remapped_path.extension();
- bool found=false;
for (int i=0;i<loader_count;i++) {
String result = loader[i]->get_resource_type(local_path);
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/io/translation_loader_po.cpp b/core/io/translation_loader_po.cpp
index 4ddb276a27..a22c57b941 100644
--- a/core/io/translation_loader_po.cpp
+++ b/core/io/translation_loader_po.cpp
@@ -47,7 +47,6 @@ RES TranslationLoaderPO::load_translation(FileAccess *f, Error *r_error, const S
String msg_id;
String msg_str;
String config;
- int msg_line=0;
if (r_error)
*r_error=ERR_FILE_CORRUPT;
@@ -97,7 +96,6 @@ RES TranslationLoaderPO::load_translation(FileAccess *f, Error *r_error, const S
status=STATUS_READING_ID;
msg_id="";
msg_str="";
- msg_line=line;
}
if (l.begins_with("msgstr")) {
@@ -111,7 +109,6 @@ RES TranslationLoaderPO::load_translation(FileAccess *f, Error *r_error, const S
l=l.substr(6,l.length()).strip_edges();
status=STATUS_READING_STRING;
- msg_line=line;
}
if (l=="" || l.begins_with("#")) {
diff --git a/core/math/geometry.cpp b/core/math/geometry.cpp
index 5b767212f5..790903eff5 100644
--- a/core/math/geometry.cpp
+++ b/core/math/geometry.cpp
@@ -629,7 +629,7 @@ DVector< Face3 > Geometry::wrap_geometry( DVector< Face3 > p_array,float *p_erro
// create and initialize cells to zero
- print_line("Wrapper: Initializing Cells");
+ //print_line("Wrapper: Initializing Cells");
uint8_t ***cell_status=memnew_arr(uint8_t**,div_x);
for(int i=0;i<div_x;i++) {
@@ -648,7 +648,7 @@ DVector< Face3 > Geometry::wrap_geometry( DVector< Face3 > p_array,float *p_erro
}
// plot faces into cells
- print_line("Wrapper (1/6): Plotting Faces");
+ //print_line("Wrapper (1/6): Plotting Faces");
for (int i=0;i<face_count;i++) {
@@ -663,7 +663,7 @@ DVector< Face3 > Geometry::wrap_geometry( DVector< Face3 > p_array,float *p_erro
// determine which cells connect to the outside by traversing the outside and recursively flood-fill marking
- print_line("Wrapper (2/6) Flood Filling");
+ //print_line("Wrapper (2/6): Flood Filling");
for (int i=0;i<div_x;i++) {
@@ -694,7 +694,7 @@ DVector< Face3 > Geometry::wrap_geometry( DVector< Face3 > p_array,float *p_erro
// build faces for the inside-outside cell divisors
- print_line("Wrapper (3/6): Building Faces");
+ //print_line("Wrapper (3/6): Building Faces");
DVector<Face3> wrapped_faces;
@@ -709,7 +709,7 @@ DVector< Face3 > Geometry::wrap_geometry( DVector< Face3 > p_array,float *p_erro
}
}
- print_line("Wrapper (4/6): Transforming Back Vertices");
+ //print_line("Wrapper (4/6): Transforming Back Vertices");
// transform face vertices to global coords
@@ -728,7 +728,7 @@ DVector< Face3 > Geometry::wrap_geometry( DVector< Face3 > p_array,float *p_erro
}
// clean up grid
- print_line("Wrapper (5/6): Grid Cleanup");
+ //print_line("Wrapper (5/6): Grid Cleanup");
for(int i=0;i<div_x;i++) {
@@ -744,7 +744,7 @@ DVector< Face3 > Geometry::wrap_geometry( DVector< Face3 > p_array,float *p_erro
if (p_error)
*p_error=voxelsize.length();
- print_line("Wrapper (6/6): Finished.");
+ //print_line("Wrapper (6/6): Finished.");
return wrapped_faces;
}
diff --git a/core/math/triangle_mesh.cpp b/core/math/triangle_mesh.cpp
index adb9861092..7aea32a8a0 100644
--- a/core/math/triangle_mesh.cpp
+++ b/core/math/triangle_mesh.cpp
@@ -195,9 +195,6 @@ Vector3 TriangleMesh::get_area_normal(const AABB& p_aabb) const {
int n_count=0;
Vector3 n;
- //for(int i=0;i<max_depth;i++)
- // stack[i]=0;
-
int level=0;
DVector<Triangle>::Read trianglesr = triangles.read();
@@ -205,7 +202,6 @@ Vector3 TriangleMesh::get_area_normal(const AABB& p_aabb) const {
DVector<BVH>::Read bvhr=bvh.read();
const Triangle *triangleptr=trianglesr.ptr();
- const Vector3 *vertexptr=verticesr.ptr();
int pos=bvh.size()-1;
const BVH *bvhptr = bvhr.ptr();
@@ -301,14 +297,7 @@ bool TriangleMesh::intersect_segment(const Vector3& p_begin,const Vector3& p_end
real_t d=1e10;
bool inters=false;
- //for(int i=0;i<max_depth;i++)
- // stack[i]=0;
-
int level=0;
- //AABB ray_aabb;
- //ray_aabb.pos=p_begin;
- //ray_aabb.expand_to(p_end);
-
DVector<Triangle>::Read trianglesr = triangles.read();
DVector<Vector3>::Read verticesr=vertices.read();
@@ -431,9 +420,6 @@ bool TriangleMesh::intersect_ray(const Vector3& p_begin,const Vector3& p_dir,Vec
real_t d=1e20;
bool inters=false;
- //for(int i=0;i<max_depth;i++)
- // stack[i]=0;
-
int level=0;
DVector<Triangle>::Read trianglesr = triangles.read();
diff --git a/core/object.cpp b/core/object.cpp
index 99d4a1f46a..dc3d531927 100644
--- a/core/object.cpp
+++ b/core/object.cpp
@@ -1495,7 +1495,7 @@ void Object::disconnect(const StringName& p_signal, Object *p_to_object, const S
ERR_EXPLAIN("Disconnecting nonexistent signal '"+p_signal+"', slot: "+itos(target._id)+":"+target.method);
ERR_FAIL();
}
- int prev = p_to_object->connections.size();
+
p_to_object->connections.erase(s->slot_map[target].cE);
s->slot_map.erase(target);
diff --git a/core/object_type_db.cpp b/core/object_type_db.cpp
index 5f97df39a6..4998263961 100644
--- a/core/object_type_db.cpp
+++ b/core/object_type_db.cpp
@@ -828,7 +828,7 @@ MethodBind* ObjectTypeDB::bind_methodfi(uint32_t p_flags, MethodBind *p_bind , c
TypeInfo *type=types.getptr(instance_type);
if (!type) {
- print_line("couldn't bind method "+mdname+" for instance: "+instance_type);
+ ERR_PRINTS("Couldn't bind method '"+mdname+"' for instance: "+instance_type);
memdelete(p_bind);
ERR_FAIL_COND_V(!type,NULL);
}
diff --git a/core/os/input.cpp b/core/os/input.cpp
index dacddc0928..531db73838 100644
--- a/core/os/input.cpp
+++ b/core/os/input.cpp
@@ -59,12 +59,14 @@ void Input::_bind_methods() {
ObjectTypeDB::bind_method(_MD("get_joy_axis","device","axis"),&Input::get_joy_axis);
ObjectTypeDB::bind_method(_MD("get_joy_name","device"),&Input::get_joy_name);
ObjectTypeDB::bind_method(_MD("get_joy_guid","device"),&Input::get_joy_guid);
+ ObjectTypeDB::bind_method(_MD("get_connected_joysticks"),&Input::get_connected_joysticks);
ObjectTypeDB::bind_method(_MD("get_joy_vibration_strength", "device"), &Input::get_joy_vibration_strength);
ObjectTypeDB::bind_method(_MD("get_joy_vibration_duration", "device"), &Input::get_joy_vibration_duration);
ObjectTypeDB::bind_method(_MD("start_joy_vibration", "device", "weak_magnitude", "strong_magnitude", "duration"), &Input::start_joy_vibration, DEFVAL(0));
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 fa2cef5467..16bcc0ff9a 100644
--- a/core/os/input.h
+++ b/core/os/input.h
@@ -62,6 +62,7 @@ public:
virtual float get_joy_axis(int p_device,int p_axis)=0;
virtual String get_joy_name(int p_idx)=0;
+ virtual Array get_connected_joysticks()=0;
virtual void joy_connection_changed(int p_idx, bool p_connected, String p_name, String p_guid)=0;
virtual void add_joy_mapping(String p_mapping, bool p_update_existing=false)=0;
virtual void remove_joy_mapping(String p_guid)=0;
@@ -81,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..5f86962048 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;
@@ -207,18 +209,15 @@ bool OS::has_virtual_keyboard() const {
return false;
}
-void OS::show_virtual_keyboard(const String& p_existing_text,const Rect2& p_screen_rect) {
-
+void OS::show_virtual_keyboard(const String& p_existing_text,const Rect2& p_screen_rect) {
}
void OS::hide_virtual_keyboard(){
-
}
-
void OS::print_all_resources(String p_to_file) {
ERR_FAIL_COND(p_to_file!="" && _OSPRF);
@@ -548,6 +547,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..2521d67e29 100644
--- a/core/os/os.h
+++ b/core/os/os.h
@@ -174,6 +174,7 @@ public:
virtual bool is_window_minimized() const { return false; }
virtual void set_window_maximized(bool p_enabled) {}
virtual bool is_window_maximized() const { return true; }
+ virtual void request_attention() { }
virtual void set_borderless_window(int p_borderless) {}
virtual bool get_borderless_window() { return 0; }
@@ -186,14 +187,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 +364,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 +424,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 7545088978..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 {
@@ -329,7 +335,6 @@ NodePath::NodePath(const String& p_path) {
Vector<StringName> subpath;
int absolute=(path[0]=='/')?1:0;;
- bool valid=false;
bool last_is_slash=true;
int slices=0;
int subpath_pos=path.find(":");
@@ -373,7 +378,6 @@ NodePath::NodePath(const String& p_path) {
if (last_is_slash)
slices++;
- valid=true;
last_is_slash=false;
}
}
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/pool_allocator.cpp b/core/pool_allocator.cpp
index 849fd75f50..9f5fcf5f50 100644
--- a/core/pool_allocator.cpp
+++ b/core/pool_allocator.cpp
@@ -372,7 +372,6 @@ Error PoolAllocator::resize(ID p_mem,int p_new_size) {
}
//p_new_size = align(p_new_size)
- int _total = pool_size; // - static_area_size;
int _free = free_mem; // - static_area_size;
if ((_free + aligned(e->len)) - alloc_size < 0) {
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",
diff --git a/core/ustring.cpp b/core/ustring.cpp
index 3c22de35f1..6788ada1bb 100644
--- a/core/ustring.cpp
+++ b/core/ustring.cpp
@@ -3836,7 +3836,6 @@ String String::lpad(int min_length, const String& character) const {
String String::sprintf(const Array& values, bool* error) const {
String formatted;
CharType* self = (CharType*)c_str();
- int num_items = values.size();
bool in_format = false;
int value_index = 0;
int min_chars;
diff --git a/core/variant_call.cpp b/core/variant_call.cpp
index a56627970b..7956c14c2c 100644
--- a/core/variant_call.cpp
+++ b/core/variant_call.cpp
@@ -1669,10 +1669,10 @@ _VariantCall::addfunc(Variant::m_vtype,Variant::m_ret,_SCS(#m_method),VCALL(m_cl
ADDFUNC0(INPUT_EVENT,BOOL,InputEvent,is_pressed,varray());
ADDFUNC1(INPUT_EVENT,BOOL,InputEvent,is_action,STRING,"action",varray());
- ADDFUNC1(INPUT_EVENT,BOOL,InputEvent,is_action_pressed,STRING,"is_action_pressed",varray());
- ADDFUNC1(INPUT_EVENT,BOOL,InputEvent,is_action_released,STRING,"is_action_released",varray());
+ ADDFUNC1(INPUT_EVENT,BOOL,InputEvent,is_action_pressed,STRING,"action",varray());
+ ADDFUNC1(INPUT_EVENT,BOOL,InputEvent,is_action_released,STRING,"action",varray());
ADDFUNC0(INPUT_EVENT,BOOL,InputEvent,is_echo,varray());
- ADDFUNC2(INPUT_EVENT,NIL,InputEvent,set_as_action,STRING,"action",BOOL,"pressed",varray());
+ ADDFUNC2(INPUT_EVENT,NIL,InputEvent,set_as_action,STRING,"action",BOOL,"pressed",varray());
/* REGISTER CONSTRUCTORS */
@@ -1691,7 +1691,7 @@ _VariantCall::addfunc(Variant::m_vtype,Variant::m_ret,_SCS(#m_method),VCALL(m_cl
_VariantCall::add_constructor(_VariantCall::Plane_init3,Variant::PLANE,"normal",Variant::VECTOR3,"d",Variant::REAL);
_VariantCall::add_constructor(_VariantCall::Quat_init1,Variant::QUAT,"x",Variant::REAL,"y",Variant::REAL,"z",Variant::REAL,"w",Variant::REAL);
- _VariantCall::add_constructor(_VariantCall::Quat_init2,Variant::QUAT,"axis",Variant::VECTOR3,"angle",Variant::REAL);
+ _VariantCall::add_constructor(_VariantCall::Quat_init2,Variant::QUAT,"axis",Variant::VECTOR3,"angle",Variant::REAL);
_VariantCall::add_constructor(_VariantCall::Color_init1,Variant::COLOR,"r",Variant::REAL,"g",Variant::REAL,"b",Variant::REAL,"a",Variant::REAL);
_VariantCall::add_constructor(_VariantCall::Color_init2,Variant::COLOR,"r",Variant::REAL,"g",Variant::REAL,"b",Variant::REAL);
diff --git a/core/variant_op.cpp b/core/variant_op.cpp
index e549161de9..c537ed230f 100644
--- a/core/variant_op.cpp
+++ b/core/variant_op.cpp
@@ -600,6 +600,7 @@ void Variant::evaluate(const Operator& p_op, const Variant& p_a, const Variant&
case REAL: {
_RETURN( *reinterpret_cast<const Quat*>(p_a._data._mem) * p_b._data._real);
} break;
+ default: {}
};
r_valid=false;
return;
@@ -618,6 +619,7 @@ void Variant::evaluate(const Operator& p_op, const Variant& p_a, const Variant&
_RETURN( *p_a._data._matrix3 * *p_b._data._matrix3 );
};
+ default: {}
} ;
r_valid=false;
return;
@@ -635,6 +637,7 @@ void Variant::evaluate(const Operator& p_op, const Variant& p_a, const Variant&
_RETURN( *p_a._data._transform * *p_b._data._transform );
};
+ default: {}
} ;
r_valid=false;
return;
@@ -999,7 +1002,7 @@ Variant Variant::get_named(const StringName& p_index, bool *r_valid) const {
DEFAULT_OP_ARRAY_CMD(m_name, DVector<dv_type>, if(skip_cond) return;, arr->set(index, p_value);return)
#define DEFAULT_OP_DVECTOR_GET(m_name, dv_type)\
- DEFAULT_OP_ARRAY_CMD(m_name, const DVector<dv_type>, 0, return arr->get(index))
+ DEFAULT_OP_ARRAY_CMD(m_name, const DVector<dv_type>, ;, return arr->get(index))
void Variant::set(const Variant& p_index, const Variant& p_value, bool *r_valid) {
@@ -2417,7 +2420,7 @@ Variant Variant::get(const Variant& p_index, bool *r_valid) const {
return *res;
}
} break; // 20
- DEFAULT_OP_ARRAY_CMD(ARRAY, const Array, 0, return (*arr)[index])
+ DEFAULT_OP_ARRAY_CMD(ARRAY, const Array, ;, return (*arr)[index])
DEFAULT_OP_DVECTOR_GET(RAW_ARRAY, uint8_t)
DEFAULT_OP_DVECTOR_GET(INT_ARRAY, int)
DEFAULT_OP_DVECTOR_GET(REAL_ARRAY, real_t)
@@ -2911,6 +2914,14 @@ bool Variant::iter_init(Variant& r_iter,bool &valid) const {
return ret;
} break;
+ case STRING: {
+
+ const String *str=reinterpret_cast<const String*>(_data._mem);
+ if (str->empty())
+ return false;
+ r_iter = 0;
+ return true;
+ } break;
case DICTIONARY: {
const Dictionary *dic=reinterpret_cast<const Dictionary*>(_data._mem);
@@ -2986,6 +2997,7 @@ bool Variant::iter_init(Variant& r_iter,bool &valid) const {
return true;
} break;
+ default: {}
}
@@ -3028,6 +3040,17 @@ bool Variant::iter_next(Variant& r_iter,bool &valid) const {
return ret;
} break;
+
+ case STRING: {
+
+ const String *str=reinterpret_cast<const String*>(_data._mem);
+ int idx = r_iter;
+ idx++;
+ if (idx >= str->size())
+ return false;
+ r_iter = idx;
+ return true;
+ } break;
case DICTIONARY: {
const Dictionary *dic=reinterpret_cast<const Dictionary*>(_data._mem);
@@ -3118,6 +3141,7 @@ bool Variant::iter_next(Variant& r_iter,bool &valid) const {
r_iter=idx;
return true;
} break;
+ default: {}
}
@@ -3158,6 +3182,11 @@ Variant Variant::iter_get(const Variant& r_iter,bool &r_valid) const {
return ret;
} break;
+ case STRING: {
+
+ const String *str=reinterpret_cast<const String*>(_data._mem);
+ return str->substr(r_iter,1);
+ } break;
case DICTIONARY: {
return r_iter; //iterator is the same as the key
@@ -3255,6 +3284,7 @@ Variant Variant::iter_get(const Variant& r_iter,bool &r_valid) const {
#endif
return arr->get(idx);
} break;
+ default: {}
}