From afbb6c064c88d743d8a7d04b5dbfb4b0b1b2db7f Mon Sep 17 00:00:00 2001 From: firefly2442 Date: Wed, 16 Sep 2015 15:35:30 -0500 Subject: ran cppcheck, found unused variables --- core/io/marshalls.cpp | 3 --- core/io/resource_loader.cpp | 2 -- 2 files changed, 5 deletions(-) (limited to 'core') diff --git a/core/io/marshalls.cpp b/core/io/marshalls.cpp index b0d24abfe3..1e76e2b4b2 100644 --- a/core/io/marshalls.cpp +++ b/core/io/marshalls.cpp @@ -299,10 +299,8 @@ Error decode_variant(Variant& r_variant,const uint8_t *p_buffer, int p_len,int * ERR_FAIL_COND_V(len<12,ERR_INVALID_DATA); Vector names; Vector subnames; - bool absolute; StringName prop; - int i=0; uint32_t namecount=strlen&=0x7FFFFFFF; uint32_t subnamecount = decode_uint32(buf+4); uint32_t flags = decode_uint32(buf+8); @@ -391,7 +389,6 @@ Error decode_variant(Variant& r_variant,const uint8_t *p_buffer, int p_len,int * ie.type=decode_uint32(&buf[0]); ie.device=decode_uint32(&buf[4]); - uint32_t len = decode_uint32(&buf[8])-12; if (r_len) (*r_len)+=12; diff --git a/core/io/resource_loader.cpp b/core/io/resource_loader.cpp index 1e014480f4..3862790b02 100644 --- a/core/io/resource_loader.cpp +++ b/core/io/resource_loader.cpp @@ -231,14 +231,12 @@ Ref ResourceLoader::load_import_metadata(const String &p local_path = Globals::get_singleton()->localize_path(p_path); String extension=p_path.extension(); - bool found=false; Ref ret; for (int i=0;irecognize(extension)) continue; - found=true; Error err = loader[i]->load_import_metadata(local_path,ret); if (err==OK) -- cgit v1.2.3 From d9583f8a7283bbeac1dceaf0885bba297961432e Mon Sep 17 00:00:00 2001 From: Bojidar Marinov Date: Thu, 24 Sep 2015 10:17:06 +0300 Subject: Add missing \n to world_wrap. Close #2516 The issue was that world_wrap would skip over newlines, without adding them to the output. --- core/ustring.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'core') diff --git a/core/ustring.cpp b/core/ustring.cpp index e5419effcb..7582376fe0 100644 --- a/core/ustring.cpp +++ b/core/ustring.cpp @@ -3066,7 +3066,7 @@ String String::world_wrap(int p_chars_per_line) const { } else if (operator[](i)==' ' || operator[](i)=='\t') { last_space=i; } else if (operator[](i)=='\n') { - ret+=substr(from,i-from); + ret+=substr(from,i-from)+"\n"; from=i+1; last_space=-1; } -- cgit v1.2.3 From 721d9a58c79fc6c82b6cbe27707ed10fb25ad9ba Mon Sep 17 00:00:00 2001 From: Bojidar Marinov Date: Fri, 25 Sep 2015 18:41:42 +0300 Subject: Removed a badly listed parameter from funcRef::call_func... --- core/func_ref.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'core') diff --git a/core/func_ref.cpp b/core/func_ref.cpp index 0e43112de8..fe09ae01af 100644 --- a/core/func_ref.cpp +++ b/core/func_ref.cpp @@ -32,7 +32,6 @@ void FuncRef::_bind_methods() { { MethodInfo mi; mi.name="call"; - mi.arguments.push_back( PropertyInfo( Variant::STRING, "method")); Vector defargs; for(int i=0;i<10;i++) { mi.arguments.push_back( PropertyInfo( Variant::NIL, "arg"+itos(i))); -- cgit v1.2.3 From a0dffc2942c5893e0204cc8d2b85c860c58ef2fe Mon Sep 17 00:00:00 2001 From: Bojidar Marinov Date: Fri, 25 Sep 2015 18:51:04 +0300 Subject: Update mi.name --- core/func_ref.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'core') diff --git a/core/func_ref.cpp b/core/func_ref.cpp index fe09ae01af..66962710bd 100644 --- a/core/func_ref.cpp +++ b/core/func_ref.cpp @@ -31,7 +31,7 @@ void FuncRef::_bind_methods() { { MethodInfo mi; - mi.name="call"; + mi.name="call_func"; Vector defargs; for(int i=0;i<10;i++) { mi.arguments.push_back( PropertyInfo( Variant::NIL, "arg"+itos(i))); -- cgit v1.2.3 From bbca86577d5f8fafce1abc471088909f2630735f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=BF=91=E8=97=A4=20=E7=9B=B4=E4=BA=BA?= Date: Fri, 9 Oct 2015 21:39:50 +0900 Subject: fix parentheses-equality warnings of osx clang --- core/io/unzip.c | 2 +- core/io/zip.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'core') diff --git a/core/io/unzip.c b/core/io/unzip.c index 0cd975211e..b438021ad7 100644 --- a/core/io/unzip.c +++ b/core/io/unzip.c @@ -1788,7 +1788,7 @@ extern int ZEXPORT unzReadCurrentFile (unzFile file, voidp buf, unsigned len) return UNZ_PARAMERROR; - if ((pfile_in_zip_read_info->read_buffer == NULL)) + if (pfile_in_zip_read_info->read_buffer==NULL) return UNZ_END_OF_LIST_OF_FILE; if (len==0) return 0; diff --git a/core/io/zip.c b/core/io/zip.c index 8f6aeb922f..c4ab93ab81 100644 --- a/core/io/zip.c +++ b/core/io/zip.c @@ -1114,9 +1114,9 @@ extern int ZEXPORT zipOpenNewFileInZip4_64 (zipFile file, const char* filename, zi->ci.flag = flagBase; if ((level==8) || (level==9)) zi->ci.flag |= 2; - if ((level==2)) + if (level==2) zi->ci.flag |= 4; - if ((level==1)) + if (level==1) zi->ci.flag |= 6; if (password != NULL) zi->ci.flag |= 1; -- cgit v1.2.3 From 422929e87fbe91be1efedf1fe3a9a71d61e58b40 Mon Sep 17 00:00:00 2001 From: reduz Date: Sat, 10 Oct 2015 09:09:09 -0300 Subject: Large improvements on scene packing and management -Ability to edit and keep changes of instanced scenes and sub-scenes -Ability to inherit from other scenes --- core/path_db.cpp | 31 +++++++++++++++++++++++++++++++ core/path_db.h | 5 ++++- core/resource.h | 2 +- 3 files changed, 36 insertions(+), 2 deletions(-) (limited to 'core') diff --git a/core/path_db.cpp b/core/path_db.cpp index d3dc3aceb8..c6ea25d966 100644 --- a/core/path_db.cpp +++ b/core/path_db.cpp @@ -286,6 +286,37 @@ NodePath::NodePath(const Vector& p_path,const Vector& p_ data->property=p_property; } + +void NodePath::simplify() { + + if (!data) + return; + for(int i=0;ipath.size();i++) { + if (data->path.size()==1) + break; + if (data->path[i].operator String()==".") { + data->path.remove(i); + i--; + } else if (data->path[i].operator String()==".." && i>0 && data->path[i-1].operator String()!="." && data->path[i-1].operator String()!="..") { + //remove both + data->path.remove(i-1); + data->path.remove(i-1); + i-=2; + if (data->path.size()==0) { + data->path.push_back("."); + break; + } + } + } +} + +NodePath NodePath::simplified() const { + + NodePath np=*this; + np.simplify(); + return np; +} + NodePath::NodePath(const String& p_path) { data=NULL; diff --git a/core/path_db.h b/core/path_db.h index b4f13d50be..de84216006 100644 --- a/core/path_db.h +++ b/core/path_db.h @@ -84,7 +84,10 @@ public: bool operator==(const NodePath& p_path) const; bool operator!=(const NodePath& p_path) const; void operator=(const NodePath& p_path); - + + void simplify(); + NodePath simplified() const; + NodePath(const Vector& p_path,bool p_absolute,const String& p_property=""); NodePath(const Vector& p_path,const Vector& p_subpath,bool p_absolute,const String& p_property=""); NodePath(const NodePath& p_path); diff --git a/core/resource.h b/core/resource.h index 9d9c445e1d..3596abe673 100644 --- a/core/resource.h +++ b/core/resource.h @@ -130,7 +130,7 @@ public: void set_name(const String& p_name); String get_name() const; - void set_path(const String& p_path,bool p_take_over=false); + virtual void set_path(const String& p_path,bool p_take_over=false); String get_path() const; void set_subindex(int p_sub_index); -- cgit v1.2.3 From 79e5ced7e668fa53567ac6aaf5a26393cea6c9a2 Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Tue, 13 Oct 2015 15:53:34 -0300 Subject: -A little More control about pixel snapping in 2D --- core/os/os.cpp | 1 + core/os/os.h | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'core') diff --git a/core/os/os.cpp b/core/os/os.cpp index 2db926e556..ee9f12b79d 100644 --- a/core/os/os.cpp +++ b/core/os/os.cpp @@ -516,6 +516,7 @@ OS::OS() { _target_fps=0; _render_thread_mode=RENDER_THREAD_SAFE; _time_scale=1.0; + _pixel_snap=false; Math::seed(1234567); } diff --git a/core/os/os.h b/core/os/os.h index d89734d7d3..e5338b4a02 100644 --- a/core/os/os.h +++ b/core/os/os.h @@ -58,6 +58,7 @@ class OS { float _fps; int _target_fps; float _time_scale; + bool _pixel_snap; char *last_error; @@ -393,7 +394,7 @@ public: void set_time_scale(float p_scale); float get_time_scale() const; - + _FORCE_INLINE_ bool get_use_pixel_snap() const { return _pixel_snap; } OS(); virtual ~OS(); -- cgit v1.2.3