From 891db1e1125fc73c53ef815e2847b6841050da77 Mon Sep 17 00:00:00 2001 From: jack Date: Sat, 25 Apr 2015 22:18:57 -0400 Subject: [PATCH 01/22] Set name on isometric-light demo's engine.cfg --- demos/2d/isometric_light/engine.cfg | 1 + 1 file changed, 1 insertion(+) diff --git a/demos/2d/isometric_light/engine.cfg b/demos/2d/isometric_light/engine.cfg index 0d9e432d5de..08393f17240 100644 --- a/demos/2d/isometric_light/engine.cfg +++ b/demos/2d/isometric_light/engine.cfg @@ -1,5 +1,6 @@ [application] +name="Isometric 2D + Lighting" main_scene="res://map.scn" [input] From f62e09150e473d9416d4e12547925a3b321d8764 Mon Sep 17 00:00:00 2001 From: jack Date: Sat, 25 Apr 2015 22:20:06 -0400 Subject: [PATCH 02/22] Set name on truck-town demo's engine.cfg --- demos/3d/truck_town/engine.cfg | 1 + 1 file changed, 1 insertion(+) diff --git a/demos/3d/truck_town/engine.cfg b/demos/3d/truck_town/engine.cfg index f47c0de4fa8..3c340e6dcd2 100644 --- a/demos/3d/truck_town/engine.cfg +++ b/demos/3d/truck_town/engine.cfg @@ -1,5 +1,6 @@ [application] +name="Truck Town" main_scene="res://car_select.scn" [display] From d066c06e36bdf81b67a142732c519b6a464e51cd Mon Sep 17 00:00:00 2001 From: jack Date: Sat, 25 Apr 2015 22:21:09 -0400 Subject: [PATCH 03/22] Set name on rich text bbcode demo's engine.cfg --- demos/gui/rich_text_bbcode/engine.cfg | 1 + 1 file changed, 1 insertion(+) diff --git a/demos/gui/rich_text_bbcode/engine.cfg b/demos/gui/rich_text_bbcode/engine.cfg index 5fb2587d91a..e0ea296f6d9 100644 --- a/demos/gui/rich_text_bbcode/engine.cfg +++ b/demos/gui/rich_text_bbcode/engine.cfg @@ -1,3 +1,4 @@ [application] +name="Rich Text Label (BBCode)" main_scene="res://rich_text_bbcode.scn" From ffbe3eeff9782e19a33fea7eec60846f10729a9f Mon Sep 17 00:00:00 2001 From: jack Date: Sat, 25 Apr 2015 22:22:04 -0400 Subject: [PATCH 04/22] Set name on window management demo's engine.cfg --- demos/misc/window_management/engine.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/demos/misc/window_management/engine.cfg b/demos/misc/window_management/engine.cfg index c53bd45fb73..0a342316739 100644 --- a/demos/misc/window_management/engine.cfg +++ b/demos/misc/window_management/engine.cfg @@ -1,6 +1,6 @@ [application] -name="window_management" +name="Window Management" main_scene="res://window_management.scn" icon="icon.png" From d22a13e2e8979769fa8d50c98c8eecc8644fe9e4 Mon Sep 17 00:00:00 2001 From: jack Date: Sat, 25 Apr 2015 22:45:49 -0400 Subject: [PATCH 05/22] issue #1715 - menu separator There was a request for a separator between Open Scene and Save Scene to avoid accidental mis-clicks. So here's that! --- tools/editor/editor_node.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/editor/editor_node.cpp b/tools/editor/editor_node.cpp index f50db40525b..6d992960f34 100644 --- a/tools/editor/editor_node.cpp +++ b/tools/editor/editor_node.cpp @@ -3504,6 +3504,7 @@ EditorNode::EditorNode() { p=file_menu->get_popup(); p->add_item("New Scene",FILE_NEW_SCENE); p->add_item("Open Scene..",FILE_OPEN_SCENE,KEY_MASK_CMD+KEY_O); + p->add_separator(); p->add_item("Save Scene",FILE_SAVE_SCENE,KEY_MASK_CMD+KEY_S); p->add_item("Save Scene As..",FILE_SAVE_AS_SCENE,KEY_MASK_SHIFT+KEY_MASK_CMD+KEY_S); p->add_separator(); From 1a6012aff57498a476982f8dd918b5898da6e1f1 Mon Sep 17 00:00:00 2001 From: Gen Date: Tue, 28 Apr 2015 23:06:34 +0800 Subject: [PATCH 06/22] Update label.cpp --- scene/gui/label.cpp | 42 +++++++++++++++++++++++++++++++++++++----- 1 file changed, 37 insertions(+), 5 deletions(-) diff --git a/scene/gui/label.cpp b/scene/gui/label.cpp index 6afff81fdee..951df155d5c 100644 --- a/scene/gui/label.cpp +++ b/scene/gui/label.cpp @@ -170,7 +170,7 @@ void Label::_notification(int p_what) { while(to && to->char_pos>=0) { taken+=to->pixel_width; - if (to!=from) { + if (to!=from && to->space_insert) { spaces++; } to=to->next; @@ -212,15 +212,15 @@ void Label::_notification(int p_what) { ERR_PRINT("BUG"); return; } - if (from!=wc) { + if (from!=wc && from->space_insert) { /* spacing */ x_ofs+=space_w; if (can_fill && align==ALIGN_FILL && spaces) { - + x_ofs+=int((size.width-(taken+space_w*spaces))/spaces); } - - + + } @@ -411,6 +411,38 @@ void Label::regenerate_word_cache() { } + }else if ((current < 65||current >90) && (current<97||current>122)) { + if (current_word_size>0) { + + WordCache *wc = memnew( WordCache ); + if (word_cache) { + last->next=wc; + } else { + word_cache=wc; + } + last=wc; + + wc->pixel_width=current_word_size; + wc->char_pos=word_pos; + wc->word_len=i-word_pos; + current_word_size=0; + } + WordCache *wc = memnew( WordCache ); + if (word_cache) { + last->next=wc; + } else { + word_cache=wc; + } + last=wc; + + wc->pixel_width=font->get_char_size(current).width; + wc->char_pos=i; + wc->word_len=1; + wc->space_insert = false; + current_word_size=0; + word_pos = i+1; + line_width+=wc->pixel_width; + total_char_cache++; } else { if (current_word_size==0) { From dfc59d1e006a0c7c90d48d2781b48000cbd7c88c Mon Sep 17 00:00:00 2001 From: Gen Date: Tue, 28 Apr 2015 23:07:41 +0800 Subject: [PATCH 07/22] Update label.h --- scene/gui/label.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scene/gui/label.h b/scene/gui/label.h index 3b0dddc1a3a..6c1a5d8c86a 100644 --- a/scene/gui/label.h +++ b/scene/gui/label.h @@ -75,8 +75,9 @@ private: int char_pos; // if -1, then newline int word_len; int pixel_width; + bool space_insert; WordCache *next; - WordCache() { char_pos=0; word_len=0; pixel_width=0; next=0; } + WordCache() { char_pos=0; word_len=0; pixel_width=0; next=0; space_insert=true;} }; bool word_cache_dirty; From ad358562e5ab2c0fdb916acba7cf3118802de21f Mon Sep 17 00:00:00 2001 From: Gen Date: Wed, 29 Apr 2015 16:34:25 +0800 Subject: [PATCH 08/22] record the number of space before a words. --- scene/gui/label.cpp | 42 ++++++++++++++++++++++++++---------------- 1 file changed, 26 insertions(+), 16 deletions(-) diff --git a/scene/gui/label.cpp b/scene/gui/label.cpp index 951df155d5c..e5226ca9b31 100644 --- a/scene/gui/label.cpp +++ b/scene/gui/label.cpp @@ -170,8 +170,8 @@ void Label::_notification(int p_what) { while(to && to->char_pos>=0) { taken+=to->pixel_width; - if (to!=from && to->space_insert) { - spaces++; + if (to!=from && to->space_count) { + spaces+=to->space_count; } to=to->next; } @@ -212,9 +212,9 @@ void Label::_notification(int p_what) { ERR_PRINT("BUG"); return; } - if (from!=wc && from->space_insert) { + if (from!=wc && from->space_count) { /* spacing */ - x_ofs+=space_w; + x_ofs+=space_w*from->space_count; if (can_fill && align==ALIGN_FILL && spaces) { x_ofs+=int((size.width-(taken+space_w*spaces))/spaces); @@ -366,6 +366,8 @@ void Label::regenerate_word_cache() { int word_pos=0; int line_width=0; int last_width=0; + int space_count=0; + int space_width=font->get_char_size(' ').width; line_count=1; total_char_cache=0; @@ -383,7 +385,6 @@ void Label::regenerate_word_cache() { if (current<33) { if (current_word_size>0) { - WordCache *wc = memnew( WordCache ); if (word_cache) { last->next=wc; @@ -395,7 +396,9 @@ void Label::regenerate_word_cache() { wc->pixel_width=current_word_size; wc->char_pos=word_pos; wc->word_len=i-word_pos; + wc->space_count = space_count; current_word_size=0; + space_count=0; } @@ -408,10 +411,16 @@ void Label::regenerate_word_cache() { if (i 0) { + space_count++; + line_width+=space_width; + }else { + space_count=0; + } } - }else if ((current < 65||current >90) && (current<97||current>122)) { + }else if ((current < 65||current >90) && (current<97||current>122) && (current<48||current>57)) { if (current_word_size>0) { WordCache *wc = memnew( WordCache ); @@ -425,7 +434,9 @@ void Label::regenerate_word_cache() { wc->pixel_width=current_word_size; wc->char_pos=word_pos; wc->word_len=i-word_pos; + wc->space_count = space_count; current_word_size=0; + space_count=0; } WordCache *wc = memnew( WordCache ); if (word_cache) { @@ -438,16 +449,14 @@ void Label::regenerate_word_cache() { wc->pixel_width=font->get_char_size(current).width; wc->char_pos=i; wc->word_len=1; - wc->space_insert = false; + wc->space_count=space_count; current_word_size=0; - word_pos = i+1; - line_width+=wc->pixel_width; + space_count=0; total_char_cache++; + line_width+=wc->pixel_width; } else { - + // latin characters if (current_word_size==0) { - if (line_width>0) // add a space before the new word if a word existed before - line_width+=font->get_char_size(' ').width; word_pos=i; } @@ -457,9 +466,10 @@ void Label::regenerate_word_cache() { total_char_cache++; } - + + print_line(itos(line_width)); if ((autowrap && line_width>=width && last_widthnext=wc; @@ -467,14 +477,14 @@ void Label::regenerate_word_cache() { word_cache=wc; } last=wc; - + wc->pixel_width=0; wc->char_pos=insert_newline?WordCache::CHAR_NEWLINE:WordCache::CHAR_WRAPLINE; line_width=current_word_size; line_count++; - + } last_width=line_width; From 6fa342a1b05ad4f4f079ba38925e4980439137c4 Mon Sep 17 00:00:00 2001 From: Gen Date: Wed, 29 Apr 2015 16:34:56 +0800 Subject: [PATCH 09/22] record the number of space before a word. --- scene/gui/label.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scene/gui/label.h b/scene/gui/label.h index 6c1a5d8c86a..81e3ab5676c 100644 --- a/scene/gui/label.h +++ b/scene/gui/label.h @@ -75,9 +75,9 @@ private: int char_pos; // if -1, then newline int word_len; int pixel_width; - bool space_insert; + int space_count; WordCache *next; - WordCache() { char_pos=0; word_len=0; pixel_width=0; next=0; space_insert=true;} + WordCache() { char_pos=0; word_len=0; pixel_width=0; next=0; space_count=0;} }; bool word_cache_dirty; From 02d672753f18eb3dbae1f5479861b84a1912a5db Mon Sep 17 00:00:00 2001 From: Gen Date: Wed, 29 Apr 2015 23:43:39 +0800 Subject: [PATCH 10/22] space is only skipped when autowrap. --- scene/gui/label.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/scene/gui/label.cpp b/scene/gui/label.cpp index e5226ca9b31..83b36daff43 100644 --- a/scene/gui/label.cpp +++ b/scene/gui/label.cpp @@ -212,7 +212,7 @@ void Label::_notification(int p_what) { ERR_PRINT("BUG"); return; } - if (from!=wc && from->space_count) { + if (from->space_count) { /* spacing */ x_ofs+=space_w*from->space_count; if (can_fill && align==ALIGN_FILL && spaces) { @@ -411,7 +411,7 @@ void Label::regenerate_word_cache() { if (i 0) { + if (line_width > 0 || last==NULL || last->char_pos!=WordCache::CHAR_WRAPLINE) { space_count++; line_width+=space_width; }else { @@ -467,7 +467,6 @@ void Label::regenerate_word_cache() { } - print_line(itos(line_width)); if ((autowrap && line_width>=width && last_width Date: Thu, 30 Apr 2015 00:03:19 +0800 Subject: [PATCH 11/22] Update label.cpp --- scene/gui/label.cpp | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/scene/gui/label.cpp b/scene/gui/label.cpp index 83b36daff43..4069fbb553b 100644 --- a/scene/gui/label.cpp +++ b/scene/gui/label.cpp @@ -437,6 +437,25 @@ void Label::regenerate_word_cache() { wc->space_count = space_count; current_word_size=0; space_count=0; + } + float current_width = font->get_char_size(current).width; + if ((autowrap && line_width+current_width>=width && last_widthnext=wc; + } else { + word_cache=wc; + } + last=wc; + + wc->pixel_width=0; + wc->char_pos=WordCache::CHAR_WRAPLINE; + + line_width=0; + line_count++; + + } WordCache *wc = memnew( WordCache ); if (word_cache) { @@ -446,7 +465,7 @@ void Label::regenerate_word_cache() { } last=wc; - wc->pixel_width=font->get_char_size(current).width; + wc->pixel_width=current_width; wc->char_pos=i; wc->word_len=1; wc->space_count=space_count; From c322eddffb6ac9abc709cfdc7bdc4466bdb7b80a Mon Sep 17 00:00:00 2001 From: Gen Date: Thu, 30 Apr 2015 12:47:05 +0800 Subject: [PATCH 12/22] fixed a autowrap bug when word is too length. --- scene/gui/label.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/scene/gui/label.cpp b/scene/gui/label.cpp index 4069fbb553b..38e7435aeb1 100644 --- a/scene/gui/label.cpp +++ b/scene/gui/label.cpp @@ -99,7 +99,7 @@ void Label::_notification(int p_what) { int chars_total=0; int vbegin=0,vsep=0; - + if (lines_total && lines_total < lines_visible) { @@ -136,10 +136,9 @@ void Label::_notification(int p_what) { if (!wc) return; - + int c = 0; int line=0; while(wc) { - /* handle lines not meant to be drawn quickly */ if (line>line_to) break; @@ -253,7 +252,7 @@ void Label::_notification(int p_what) { } for (int i=0;iword_len;i++) { - + if (visible_chars < 0 || chars_total=width && last_width=width && last && last->char_pos >= 0) || insert_newline) { WordCache *wc = memnew( WordCache ); if (word_cache) { @@ -525,7 +524,7 @@ void Label::regenerate_word_cache() { set_max(line_count); word_cache_dirty=false; - + } From 0bc5b7a1464b442a9e54cd05c9720d1d53693ee1 Mon Sep 17 00:00:00 2001 From: Gen Date: Fri, 1 May 2015 18:47:34 +0800 Subject: [PATCH 13/22] Optimize the code. --- scene/gui/label.cpp | 97 +++++++++++++++------------------------------ 1 file changed, 31 insertions(+), 66 deletions(-) diff --git a/scene/gui/label.cpp b/scene/gui/label.cpp index 38e7435aeb1..1751d335ee9 100644 --- a/scene/gui/label.cpp +++ b/scene/gui/label.cpp @@ -360,11 +360,10 @@ void Label::regenerate_word_cache() { int width=autowrap?get_size().width:get_longest_line_width(); Ref font = get_font("font"); - + int current_word_size=0; int word_pos=0; int line_width=0; - int last_width=0; int space_count=0; int space_width=font->get_char_size(' ').width; line_count=1; @@ -375,14 +374,16 @@ void Label::regenerate_word_cache() { for (int i=0;i=33 && (current < 65||current >90) && (current<97||current>122) && (current<48||current>57); bool insert_newline=false; - + int char_width; + if (current<33) { - + if (current_word_size>0) { WordCache *wc = memnew( WordCache ); if (word_cache) { @@ -391,16 +392,16 @@ void Label::regenerate_word_cache() { word_cache=wc; } last=wc; - + wc->pixel_width=current_word_size; wc->char_pos=word_pos; wc->word_len=i-word_pos; wc->space_count = space_count; current_word_size=0; space_count=0; - + } - + if (current=='\n') { insert_newline=true; @@ -419,73 +420,39 @@ void Label::regenerate_word_cache() { } - }else if ((current < 65||current >90) && (current<97||current>122) && (current<48||current>57)) { - if (current_word_size>0) { - - WordCache *wc = memnew( WordCache ); - if (word_cache) { - last->next=wc; - } else { - word_cache=wc; - } - last=wc; - - wc->pixel_width=current_word_size; - wc->char_pos=word_pos; - wc->word_len=i-word_pos; - wc->space_count = space_count; - current_word_size=0; - space_count=0; - } - float current_width = font->get_char_size(current).width; - if ((autowrap && line_width+current_width>=width && last_widthnext=wc; - } else { - word_cache=wc; - } - last=wc; - - wc->pixel_width=0; - wc->char_pos=WordCache::CHAR_WRAPLINE; - - line_width=0; - line_count++; - - - } - WordCache *wc = memnew( WordCache ); - if (word_cache) { - last->next=wc; - } else { - word_cache=wc; - } - last=wc; - - wc->pixel_width=current_width; - wc->char_pos=i; - wc->word_len=1; - wc->space_count=space_count; - current_word_size=0; - space_count=0; - total_char_cache++; - line_width+=wc->pixel_width; } else { // latin characters if (current_word_size==0) { word_pos=i; } - int char_width=font->get_char_size(current).width; + char_width=font->get_char_size(current).width; current_word_size+=char_width; line_width+=char_width; total_char_cache++; } - if ((autowrap && line_width>=width && last && last->char_pos >= 0) || insert_newline) { + if ((autowrap && line_width>=width && (last && last->char_pos >= 0 || not_latin)) || insert_newline) { + if (not_latin) { + if (current_word_size>0) { + WordCache *wc = memnew( WordCache ); + if (word_cache) { + last->next=wc; + } else { + word_cache=wc; + } + last=wc; + + wc->pixel_width=current_word_size-char_width; + wc->char_pos=word_pos; + wc->word_len=i-word_pos; + wc->space_count = space_count; + current_word_size=char_width; + space_count=0; + word_pos=i; + } + } WordCache *wc = memnew( WordCache ); if (word_cache) { @@ -500,12 +467,10 @@ void Label::regenerate_word_cache() { line_width=current_word_size; line_count++; - + space_count=0; } - last_width=line_width; - } //total_char_cache -= line_count + 1; // do not count new lines (including the first one) From 8e7973d660b1f7bc25323b8ef843310f1deb2107 Mon Sep 17 00:00:00 2001 From: Biliogadafr Date: Sat, 2 May 2015 00:03:49 +0300 Subject: [PATCH 14/22] Triple click doesn't select line if click was done on different lines. Fix #1727 --- scene/gui/text_edit.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index 1e82432165e..6cdff20aaf0 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -1249,7 +1249,7 @@ void TextEdit::_input_event(const InputEvent& p_input_event) { } - if (!mb.doubleclick && (OS::get_singleton()->get_ticks_msec()-last_dblclk)<600) { + if (!mb.doubleclick && (OS::get_singleton()->get_ticks_msec()-last_dblclk)<600 && cursor.line==prev_line) { //tripleclick select line select(cursor.line,0,cursor.line,text[cursor.line].length()); last_dblclk=0; From 62129469278b284b91845a678b517c04cefbebfe Mon Sep 17 00:00:00 2001 From: Nathan Warden Date: Sat, 2 May 2015 12:17:59 -0500 Subject: [PATCH 15/22] Fixed some items caught in cppcheck --- scene/3d/sprite_3d.cpp | 2 +- scene/resources/animation.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/scene/3d/sprite_3d.cpp b/scene/3d/sprite_3d.cpp index 35f6523c6af..4952f742df6 100644 --- a/scene/3d/sprite_3d.cpp +++ b/scene/3d/sprite_3d.cpp @@ -292,7 +292,7 @@ SpriteBase3D::SpriteBase3D() { parent_sprite=NULL; pI=NULL; - for(int i=0;i<4;i++) + for(int i=0;i >& p_keys, float p_time, Inter if (p_ok) *p_ok=true; - - int next; + + int next=0; float c=0; // prepare for all cases of interpolation From 2830f85b056672f4cbcc61ca55437d625d0a58da Mon Sep 17 00:00:00 2001 From: Simon Wenner Date: Sun, 3 May 2015 01:45:55 +0200 Subject: [PATCH 16/22] fixed uninitialized variable (cppcheck) --- core/io/file_access_memory.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/io/file_access_memory.cpp b/core/io/file_access_memory.cpp index 749f7d16419..c22d637d012 100644 --- a/core/io/file_access_memory.cpp +++ b/core/io/file_access_memory.cpp @@ -132,7 +132,7 @@ bool FileAccessMemory::eof_reached() const { uint8_t FileAccessMemory::get_8() const { - uint8_t ret; + uint8_t ret = 0; if (pos < length) { ret = data[pos]; }; From a0e985c6c19a438ebf7afcd86cc922076f13e177 Mon Sep 17 00:00:00 2001 From: Simon Wenner Date: Sun, 3 May 2015 01:48:20 +0200 Subject: [PATCH 17/22] removed unnecessary semicolons --- core/io/file_access_memory.cpp | 40 +++++++++++++++++----------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/core/io/file_access_memory.cpp b/core/io/file_access_memory.cpp index c22d637d012..2880c4ebdab 100644 --- a/core/io/file_access_memory.cpp +++ b/core/io/file_access_memory.cpp @@ -39,7 +39,7 @@ void FileAccessMemory::register_file(String p_name, Vector p_data) { if (!files) { files = memnew((Map >)); - }; + } String name; if (Globals::get_singleton()) @@ -49,7 +49,7 @@ void FileAccessMemory::register_file(String p_name, Vector p_data) { name = DirAccess::normalize_path(name); (*files)[name] = p_data; -}; +} void FileAccessMemory::cleanup() { @@ -57,13 +57,13 @@ void FileAccessMemory::cleanup() { return; memdelete(files); -}; +} FileAccess* FileAccessMemory::create() { return memnew(FileAccessMemory); -}; +} bool FileAccessMemory::file_exists(const String& p_name) { @@ -71,7 +71,7 @@ bool FileAccessMemory::file_exists(const String& p_name) { name = DirAccess::normalize_path(name); return files && (files->find(name) != NULL); -}; +} Error FileAccessMemory::_open(const String& p_path, int p_mode_flags) { @@ -89,57 +89,57 @@ Error FileAccessMemory::_open(const String& p_path, int p_mode_flags) { pos = 0; return OK; -}; +} void FileAccessMemory::close() { data = NULL; -}; +} bool FileAccessMemory::is_open() const { return data != NULL; -}; +} void FileAccessMemory::seek(size_t p_position) { ERR_FAIL_COND(!data); pos = p_position; -}; +} void FileAccessMemory::seek_end(int64_t p_position) { ERR_FAIL_COND(!data); pos = length + p_position; -}; +} size_t FileAccessMemory::get_pos() const { ERR_FAIL_COND_V(!data, 0); return pos; -}; +} size_t FileAccessMemory::get_len() const { ERR_FAIL_COND_V(!data, 0); return length; -}; +} bool FileAccessMemory::eof_reached() const { return pos >= length; -}; +} uint8_t FileAccessMemory::get_8() const { uint8_t ret = 0; if (pos < length) { ret = data[pos]; - }; + } ++pos; return ret; -}; +} int FileAccessMemory::get_buffer(uint8_t *p_dst,int p_length) const { @@ -156,19 +156,19 @@ int FileAccessMemory::get_buffer(uint8_t *p_dst,int p_length) const { pos += p_length; return read; -}; +} Error FileAccessMemory::get_error() const { return pos >= length ? ERR_FILE_EOF : OK; -}; +} void FileAccessMemory::store_8(uint8_t p_byte) { ERR_FAIL_COND(!data); ERR_FAIL_COND(pos >= length); data[pos++] = p_byte; -}; +} void FileAccessMemory::store_buffer(const uint8_t *p_src,int p_length) { @@ -176,11 +176,11 @@ void FileAccessMemory::store_buffer(const uint8_t *p_src,int p_length) { int write = MIN(p_length, left); if (write < p_length) { WARN_PRINT("Writing less data than requested"); - }; + } copymem(&data[pos], p_src, write); pos += p_length; -}; +} FileAccessMemory::FileAccessMemory() { From bd08cd7fd2b309d0aa0af310f485ea056424fdd5 Mon Sep 17 00:00:00 2001 From: Simon Wenner Date: Sun, 3 May 2015 02:04:30 +0200 Subject: [PATCH 18/22] fixed broken comment block --- platform/android/android_native_app_glue.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/android/android_native_app_glue.h b/platform/android/android_native_app_glue.h index a902a3b4dac..f5ba27ae665 100644 --- a/platform/android/android_native_app_glue.h +++ b/platform/android/android_native_app_glue.h @@ -26,7 +26,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ - * Copyright (C) 2010 The Android Open Source Project +/* Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. From 332d9af81ba9b74bf71b1201c65651db1f90756c Mon Sep 17 00:00:00 2001 From: Simon Wenner Date: Sun, 3 May 2015 02:11:43 +0200 Subject: [PATCH 19/22] fixed memory leak: triangulated (cppcheck) --- drivers/convex_decomp/b2Polygon.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/convex_decomp/b2Polygon.cpp b/drivers/convex_decomp/b2Polygon.cpp index 49a3e74c2aa..668313967e6 100644 --- a/drivers/convex_decomp/b2Polygon.cpp +++ b/drivers/convex_decomp/b2Polygon.cpp @@ -970,6 +970,7 @@ int32 DecomposeConvex(b2Polygon* p, b2Polygon* results, int32 maxPolys) { } if (nTri < 1) { //Still no luck? Oh well... + delete[] triangulated; return -1; } int32 nPolys = PolygonizeTriangles(triangulated, nTri, results, maxPolys); From 3f1826866bbd2b92cf5a9de780ef948323fe7b09 Mon Sep 17 00:00:00 2001 From: Simon Wenner Date: Sun, 3 May 2015 02:16:26 +0200 Subject: [PATCH 20/22] fixed uninitialized name pointers (cppcheck) --- drivers/chibi/cp_player_data_control.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/chibi/cp_player_data_control.cpp b/drivers/chibi/cp_player_data_control.cpp index 4d30c1a7038..d5ca648fff5 100644 --- a/drivers/chibi/cp_player_data_control.cpp +++ b/drivers/chibi/cp_player_data_control.cpp @@ -233,7 +233,7 @@ int CPPlayer::get_channel_voice(int p_channel) { const char* CPPlayer::get_voice_sample_name(int p_voice) { - const char *name; + const char *name = NULL; @@ -302,7 +302,7 @@ const char * CPPlayer::get_voice_instrument_name(int p_voice) { - const char *name; + const char *name = NULL; From 256a9fd1df44dfa222ef3303dacd176008e7a9cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ricardo=20P=C3=A9rez?= Date: Sun, 3 May 2015 22:09:42 +0200 Subject: [PATCH 21/22] Missing return statement --- core/variant.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/variant.cpp b/core/variant.cpp index fe6a6b3e4f2..5e2ab962a62 100644 --- a/core/variant.cpp +++ b/core/variant.cpp @@ -532,7 +532,7 @@ bool Variant::is_zero() const { } break; case QUAT: { - *reinterpret_cast(_data._mem)==Quat(); + return *reinterpret_cast(_data._mem)==Quat(); } break; case MATRIX3: { From 2a4da03f103448a69c48ee66e415f8dd2d617f58 Mon Sep 17 00:00:00 2001 From: Antony Jones Date: Sun, 3 May 2015 15:18:56 -0600 Subject: [PATCH 22/22] Added Visual Studio project generation. Use "vsproj=yes" in command line. This does not set up NMAKE properly. --- SConstruct | 46 ++++++++++ drivers/SCsub | 185 +++++++++++++++++++++-------------------- platform/windows/SCsub | 6 ++ 3 files changed, 146 insertions(+), 91 deletions(-) diff --git a/SConstruct b/SConstruct index 537bb0e395a..11b35e0b4bb 100644 --- a/SConstruct +++ b/SConstruct @@ -123,6 +123,7 @@ opts.Add('disable_3d', 'Disable 3D nodes for smaller executable (yes/no)', "no") opts.Add('disable_advanced_gui', 'Disable advance 3D gui nodes and behaviors (yes/no)', "no") opts.Add('colored', 'Enable colored output for the compilation (yes/no)', 'no') opts.Add('extra_suffix', 'Custom extra suffix added to the base filename of all generated binary files.', '') +opts.Add('vsproj', 'Generate Visual Studio Project. (yes/no)', 'no') # add platform specific options @@ -177,6 +178,25 @@ if selected_platform in platform_list: else: env = env_base.Clone() + if env['vsproj']=="yes": + env.vs_incs = [] + env.vs_srcs = [] + + def AddToVSProject( sources ): + for x in sources: + if type(x) == type(""): + fname = env.File(x).path + else: + fname = env.File(x)[0].path + pieces = fname.split(".") + if len(pieces)>0: + basename = pieces[0] + basename = basename.replace('\\\\','/') + env.vs_srcs = env.vs_srcs + [basename + ".cpp"] + env.vs_incs = env.vs_incs + [basename + ".h"] + #print basename + env.AddToVSProject = AddToVSProject + env.extra_suffix="" if env["extra_suffix"] != '' : @@ -330,6 +350,32 @@ if selected_platform in platform_list: SConscript("main/SCsub") SConscript("platform/"+selected_platform+"/SCsub"); # build selected platform + + # Microsoft Visual Studio Project Generation + if (env['vsproj'])=="yes": + + AddToVSProject(env.core_sources) + AddToVSProject(env.main_sources) + AddToVSProject(env.modules_sources) + AddToVSProject(env.scene_sources) + AddToVSProject(env.servers_sources) + AddToVSProject(env.tool_sources) + + debug_variants = ['Debug|Win32']+['Debug|x64'] + release_variants = ['Release|Win32']+['Release|x64'] + release_debug_variants = ['Release_Debug|Win32']+['Release_Debug|x64'] + variants = debug_variants + release_variants + release_debug_variants + debug_targets = ['Debug']+['Debug'] + release_targets = ['Release']+['Release'] + release_debug_targets = ['ReleaseDebug']+['ReleaseDebug'] + targets = debug_targets + release_targets + release_debug_targets + msvproj = env.MSVSProject(target = ['#godot' + env['MSVSPROJECTSUFFIX'] ], + incs = env.vs_incs, + srcs = env.vs_srcs, + runfile = targets, + buildtarget = targets, + auto_build_solution=1, + variant = variants) else: diff --git a/drivers/SCsub b/drivers/SCsub index a1a2191cbc2..6ab09736252 100644 --- a/drivers/SCsub +++ b/drivers/SCsub @@ -1,91 +1,94 @@ -Import('env') - -env.drivers_sources=[] -#env.add_source_files(env.drivers_sources,"*.cpp") -env.Append(CPPPATH=["vorbis"]) -Export('env') - -SConscript('unix/SCsub'); -SConscript('alsa/SCsub'); -SConscript('pulseaudio/SCsub'); -SConscript('windows/SCsub'); -SConscript('gles2/SCsub'); -SConscript('gl_context/SCsub'); -SConscript('openssl/SCsub'); - -if (env["png"]=="yes"): - SConscript("png/SCsub"); -if (env["jpg"]=="yes"): - SConscript("jpg/SCsub"); -if (env["webp"]=="yes"): - SConscript("webp/SCsub"); -SConscript("dds/SCsub"); -SConscript("pvr/SCsub"); -SConscript("etc1/SCsub") -if (env["builtin_zlib"]=="yes"): - SConscript("builtin_zlib/SCsub"); -if (env["openssl"]=="builtin"): - SConscript("builtin_openssl2/SCsub"); - -SConscript("rtaudio/SCsub"); -SConscript("nedmalloc/SCsub"); -SConscript("trex/SCsub"); -SConscript("chibi/SCsub"); -if (env["vorbis"]=="yes" or env["speex"]=="yes" or env["theora"]=="yes"): - SConscript("ogg/SCsub"); -if (env["vorbis"]=="yes"): - SConscript("vorbis/SCsub"); -if (env["tools"]=="yes"): - SConscript("convex_decomp/SCsub"); - -if env["theora"]=="yes": - SConscript("theoraplayer/SCsub") -if (env["theora"]=="yes"): - SConscript("theora/SCsub"); -if (env['speex']=='yes'): - SConscript("speex/SCsub"); -if (env['musepack']=='yes'): - SConscript("mpc/SCsub"); -if (env["squish"]=="yes" and env["tools"]=="yes"): - SConscript("squish/SCsub"); - -num = 0 -cur_base = "" -total = len(env.drivers_sources) -max_src = 64 -list = [] -lib_list = [] - -import string - -for f in env.drivers_sources: - fname = "" - if type(f) == type(""): - fname = env.File(f).path - else: - fname = env.File(f)[0].path - #base = string.join(fname.split("/")[:-1], "/") - fname = fname.replace("\\", "/") - base = string.join(fname.split("/")[:2], "/") - if base != cur_base and len(list) > max_src: - lib = env.Library("drivers"+str(num), list) - lib_list.append(lib) - list = [] - num = num+1 - cur_base = base - list.append(f) - -if len(list) > 0: - lib = env.Library("drivers"+str(num), list) - lib_list.append(lib) - - -drivers_base=[] -env.add_source_files(drivers_base,"*.cpp") -lib_list.insert(0, env.Library("drivers", drivers_base)) - -env.Prepend(LIBS=lib_list) - -#lib = env.Library("drivers",env.drivers_sources) -#env.Prepend(LIBS=[lib]) - +Import('env') + +env.drivers_sources=[] +#env.add_source_files(env.drivers_sources,"*.cpp") +env.Append(CPPPATH=["vorbis"]) +Export('env') + +SConscript('unix/SCsub'); +SConscript('alsa/SCsub'); +SConscript('pulseaudio/SCsub'); +SConscript('windows/SCsub'); +SConscript('gles2/SCsub'); +SConscript('gl_context/SCsub'); +SConscript('openssl/SCsub'); + +if (env["png"]=="yes"): + SConscript("png/SCsub"); +if (env["jpg"]=="yes"): + SConscript("jpg/SCsub"); +if (env["webp"]=="yes"): + SConscript("webp/SCsub"); +SConscript("dds/SCsub"); +SConscript("pvr/SCsub"); +SConscript("etc1/SCsub") +if (env["builtin_zlib"]=="yes"): + SConscript("builtin_zlib/SCsub"); +if (env["openssl"]=="builtin"): + SConscript("builtin_openssl2/SCsub"); + +SConscript("rtaudio/SCsub"); +SConscript("nedmalloc/SCsub"); +SConscript("trex/SCsub"); +SConscript("chibi/SCsub"); +if (env["vorbis"]=="yes" or env["speex"]=="yes" or env["theora"]=="yes"): + SConscript("ogg/SCsub"); +if (env["vorbis"]=="yes"): + SConscript("vorbis/SCsub"); +if (env["tools"]=="yes"): + SConscript("convex_decomp/SCsub"); + +if env["theora"]=="yes": + SConscript("theoraplayer/SCsub") +if (env["theora"]=="yes"): + SConscript("theora/SCsub"); +if (env['speex']=='yes'): + SConscript("speex/SCsub"); +if (env['musepack']=='yes'): + SConscript("mpc/SCsub"); +if (env["squish"]=="yes" and env["tools"]=="yes"): + SConscript("squish/SCsub"); + +num = 0 +cur_base = "" +total = len(env.drivers_sources) +max_src = 64 +list = [] +lib_list = [] + +import string + +if env['vsproj']=="yes": + env.AddToVSProject(env.drivers_sources) + +for f in env.drivers_sources: + fname = "" + if type(f) == type(""): + fname = env.File(f).path + else: + fname = env.File(f)[0].path + #base = string.join(fname.split("/")[:-1], "/") + fname = fname.replace("\\", "/") + base = string.join(fname.split("/")[:2], "/") + if base != cur_base and len(list) > max_src: + lib = env.Library("drivers"+str(num), list) + lib_list.append(lib) + list = [] + num = num+1 + cur_base = base + list.append(f) + +if len(list) > 0: + lib = env.Library("drivers"+str(num), list) + lib_list.append(lib) + + +drivers_base=[] +env.add_source_files(drivers_base,"*.cpp") +lib_list.insert(0, env.Library("drivers", drivers_base)) + +env.Prepend(LIBS=lib_list) + +#lib = env.Library("drivers",env.drivers_sources) +#env.Prepend(LIBS=[lib]) + diff --git a/platform/windows/SCsub b/platform/windows/SCsub index a77428e9548..1ad32e79897 100644 --- a/platform/windows/SCsub +++ b/platform/windows/SCsub @@ -12,3 +12,9 @@ common_win=[ ] env.Program('#bin/godot',['godot_win.cpp']+common_win,PROGSUFFIX=env["PROGSUFFIX"]) + +# Microsoft Visual Studio Project Generation +if (env['vsproj'])=="yes": + env.vs_srcs = env.vs_srcs + ["platform/windows/godot_win.cpp"] + for x in common_win: + env.vs_srcs = env.vs_srcs + ["platform/windows/" + x]