summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/bind/core_bind.cpp7
-rw-r--r--core/bind/core_bind.h3
-rw-r--r--core/io/config_file.cpp6
-rw-r--r--core/io/json.cpp2
-rw-r--r--core/os/file_access.h1
-rw-r--r--core/os/os.cpp2
-rw-r--r--core/os/os.h2
-rw-r--r--core/ustring.cpp15
-rw-r--r--core/ustring.h1
-rw-r--r--core/variant_call.cpp6
-rw-r--r--core/variant_parser.cpp12
-rw-r--r--demos/3d/platformer/engine.cfg2
-rw-r--r--demos/3d/platformer/player.scnbin108067 -> 107922 bytes
-rw-r--r--drivers/gles2/rasterizer_gles2.cpp27
-rw-r--r--drivers/gles2/rasterizer_gles2.h3
-rw-r--r--drivers/unix/file_access_unix.cpp2
-rw-r--r--drivers/unix/os_unix.cpp5
-rw-r--r--drivers/unix/os_unix.h2
-rw-r--r--drivers/windows/file_access_windows.cpp2
-rw-r--r--modules/gdscript/gd_script.cpp2
-rw-r--r--platform/windows/detect.py2
-rw-r--r--platform/windows/os_windows.cpp10
-rw-r--r--platform/windows/os_windows.h2
-rw-r--r--platform/x11/detect.py6
-rw-r--r--scene/2d/collision_polygon_2d.cpp2
-rw-r--r--scene/2d/path_2d.cpp2
-rw-r--r--scene/2d/screen_button.cpp4
-rw-r--r--scene/gui/tabs.cpp84
-rw-r--r--scene/gui/tabs.h6
-rw-r--r--scene/main/viewport.cpp4
-rw-r--r--servers/physics/shape_sw.cpp4
-rw-r--r--servers/physics/space_sw.cpp4
-rw-r--r--servers/physics/space_sw.h2
-rw-r--r--servers/physics_server.h2
-rw-r--r--tools/editor/animation_editor.cpp6
-rw-r--r--tools/editor/editor_node.cpp8
-rw-r--r--tools/editor/plugins/script_editor_plugin.cpp6
-rw-r--r--tools/editor/project_settings.cpp5
-rw-r--r--tools/editor/property_editor.cpp17
-rw-r--r--tools/editor/property_editor.h1
-rw-r--r--tools/editor/scenes_dock.cpp2
41 files changed, 242 insertions, 39 deletions
diff --git a/core/bind/core_bind.cpp b/core/bind/core_bind.cpp
index f1edc3d7d7..f951237971 100644
--- a/core/bind/core_bind.cpp
+++ b/core/bind/core_bind.cpp
@@ -494,8 +494,8 @@ uint64_t _OS::get_unix_time() const {
return OS::get_singleton()->get_unix_time();
};
-uint64_t _OS::get_system_time_msec() const {
- return OS::get_singleton()->get_system_time_msec();
+uint64_t _OS::get_system_time_secs() const {
+ return OS::get_singleton()->get_system_time_secs();
}
void _OS::delay_usec(uint32_t p_usec) const {
@@ -810,7 +810,7 @@ void _OS::_bind_methods() {
ObjectTypeDB::bind_method(_MD("get_time","utc"),&_OS::get_time,DEFVAL(false));
ObjectTypeDB::bind_method(_MD("get_time_zone_info"),&_OS::get_time_zone_info);
ObjectTypeDB::bind_method(_MD("get_unix_time"),&_OS::get_unix_time);
- ObjectTypeDB::bind_method(_MD("get_system_time_msec"), &_OS::get_system_time_msec);
+ ObjectTypeDB::bind_method(_MD("get_system_time_secs"), &_OS::get_system_time_secs);
ObjectTypeDB::bind_method(_MD("set_icon","icon"),&_OS::set_icon);
@@ -1509,6 +1509,7 @@ void _File::_bind_methods() {
BIND_CONSTANT( READ );
BIND_CONSTANT( WRITE );
BIND_CONSTANT( READ_WRITE );
+ BIND_CONSTANT( WRITE_READ );
}
_File::_File(){
diff --git a/core/bind/core_bind.h b/core/bind/core_bind.h
index 172f33dac5..62572d7761 100644
--- a/core/bind/core_bind.h
+++ b/core/bind/core_bind.h
@@ -208,7 +208,7 @@ public:
Dictionary get_time(bool utc) const;
Dictionary get_time_zone_info() const;
uint64_t get_unix_time() const;
- uint64_t get_system_time_msec() const;
+ uint64_t get_system_time_secs() const;
int get_static_memory_usage() const;
int get_static_memory_peak_usage() const;
@@ -329,6 +329,7 @@ public:
READ=1,
WRITE=2,
READ_WRITE=3,
+ WRITE_READ=7,
};
Error open_encrypted(const String& p_path, int p_mode_flags,const Vector<uint8_t>& p_key);
diff --git a/core/io/config_file.cpp b/core/io/config_file.cpp
index d79a3d1288..fd20ec9404 100644
--- a/core/io/config_file.cpp
+++ b/core/io/config_file.cpp
@@ -127,6 +127,8 @@ Error ConfigFile::save(const String& p_path){
FileAccess *file = FileAccess::open(p_path,FileAccess::WRITE,&err);
if (err) {
+ if (file)
+ memdelete(file);
return err;
}
@@ -178,8 +180,10 @@ Error ConfigFile::load(const String& p_path) {
next_tag.name=String();
err = VariantParser::parse_tag_assign_eof(&stream,lines,error_text,next_tag,assign,value,NULL,true);
- if (err==ERR_FILE_EOF)
+ if (err==ERR_FILE_EOF) {
+ memdelete(f);
return OK;
+ }
else if (err!=OK) {
ERR_PRINTS("ConfgFile::load - "+p_path+":"+itos(lines)+" error: "+error_text);
memdelete(f);
diff --git a/core/io/json.cpp b/core/io/json.cpp
index 45a97ed720..f9a8638d06 100644
--- a/core/io/json.cpp
+++ b/core/io/json.cpp
@@ -86,7 +86,7 @@ String JSON::_print_var(const Variant& p_var) {
s+="}";
return s;
};
- default: return "\""+String(p_var).c_escape()+"\"";
+ default: return "\""+String(p_var).json_escape()+"\"";
}
diff --git a/core/os/file_access.h b/core/os/file_access.h
index 35514a129f..51cf839117 100644
--- a/core/os/file_access.h
+++ b/core/os/file_access.h
@@ -78,6 +78,7 @@ public:
READ=1,
WRITE=2,
READ_WRITE=3,
+ WRITE_READ=7,
};
virtual void close()=0; ///< close a file
diff --git a/core/os/os.cpp b/core/os/os.cpp
index eb5f91167a..1a505fb236 100644
--- a/core/os/os.cpp
+++ b/core/os/os.cpp
@@ -50,7 +50,7 @@ uint64_t OS::get_unix_time() const {
return 0;
};
-uint64_t OS::get_system_time_msec() const {
+uint64_t OS::get_system_time_secs() const {
return 0;
}
void OS::debug_break() {
diff --git a/core/os/os.h b/core/os/os.h
index 94cb1d4ea4..711743f23a 100644
--- a/core/os/os.h
+++ b/core/os/os.h
@@ -256,7 +256,7 @@ public:
virtual Time get_time(bool local=false) const=0;
virtual TimeZoneInfo get_time_zone_info() const=0;
virtual uint64_t get_unix_time() const;
- virtual uint64_t get_system_time_msec() const;
+ virtual uint64_t get_system_time_secs() const;
virtual void delay_usec(uint32_t p_usec) const=0;
virtual uint64_t get_ticks_usec() const=0;
diff --git a/core/ustring.cpp b/core/ustring.cpp
index 21c0d78fdb..ee750c39e5 100644
--- a/core/ustring.cpp
+++ b/core/ustring.cpp
@@ -3158,6 +3158,21 @@ String String::c_escape() const {
return escaped;
}
+String String::json_escape() const {
+
+ String escaped=*this;
+ escaped=escaped.replace("\\","\\\\");
+ escaped=escaped.replace("\b","\\b");
+ escaped=escaped.replace("\f","\\f");
+ escaped=escaped.replace("\n","\\n");
+ escaped=escaped.replace("\r","\\r");
+ escaped=escaped.replace("\t","\\t");
+ escaped=escaped.replace("\v","\\v");
+ escaped=escaped.replace("\"","\\\"");
+
+ return escaped;
+}
+
String String::xml_escape(bool p_escape_quotes) const {
String str=*this;
diff --git a/core/ustring.h b/core/ustring.h
index 2b967d368a..9276afa0f7 100644
--- a/core/ustring.h
+++ b/core/ustring.h
@@ -211,6 +211,7 @@ public:
String http_unescape() const;
String c_escape() const;
String c_unescape() const;
+ String json_escape() const;
String world_wrap(int p_chars_per_line) const;
String percent_encode() const;
diff --git a/core/variant_call.cpp b/core/variant_call.cpp
index 2122640be8..90f868c866 100644
--- a/core/variant_call.cpp
+++ b/core/variant_call.cpp
@@ -272,6 +272,9 @@ static void _call_##m_type##_##m_method(Variant& r_ret,Variant& p_self,const Var
VCALL_LOCALMEM0R(String,get_file);
VCALL_LOCALMEM0R(String,xml_escape);
VCALL_LOCALMEM0R(String,xml_unescape);
+ VCALL_LOCALMEM0R(String,c_escape);
+ VCALL_LOCALMEM0R(String,c_unescape);
+ VCALL_LOCALMEM0R(String,json_escape);
VCALL_LOCALMEM0R(String,percent_encode);
VCALL_LOCALMEM0R(String,percent_decode);
VCALL_LOCALMEM0R(String,is_valid_identifier);
@@ -1286,6 +1289,9 @@ _VariantCall::addfunc(Variant::m_vtype,Variant::m_ret,_SCS(#m_method),VCALL(m_cl
ADDFUNC0(STRING,STRING,String,get_file,varray());
ADDFUNC0(STRING,STRING,String,xml_escape,varray());
ADDFUNC0(STRING,STRING,String,xml_unescape,varray());
+ ADDFUNC0(STRING,STRING,String,c_escape,varray());
+ ADDFUNC0(STRING,STRING,String,c_unescape,varray());
+ ADDFUNC0(STRING,STRING,String,json_escape,varray());
ADDFUNC0(STRING,STRING,String,percent_encode,varray());
ADDFUNC0(STRING,STRING,String,percent_decode,varray());
ADDFUNC0(STRING,BOOL,String,is_valid_identifier,varray());
diff --git a/core/variant_parser.cpp b/core/variant_parser.cpp
index 446f9ae6d1..3efa87de80 100644
--- a/core/variant_parser.cpp
+++ b/core/variant_parser.cpp
@@ -448,7 +448,7 @@ Error VariantParser::_parse_construct(Stream *p_stream,Vector<T>& r_construct,in
if (!first) {
get_token(p_stream,token,line,r_err_str);
if (token.type==TK_COMMA) {
- //do none
+ //do none
} else if (token.type==TK_PARENTHESIS_CLOSE) {
break;
} else {
@@ -458,7 +458,10 @@ Error VariantParser::_parse_construct(Stream *p_stream,Vector<T>& r_construct,in
}
}
get_token(p_stream,token,line,r_err_str);
- if (token.type!=TK_NUMBER) {
+
+ if (first && token.type==TK_PARENTHESIS_CLOSE) {
+ break;
+ } else if (token.type!=TK_NUMBER) {
r_err_str="Expected float in constructor";
return ERR_PARSE_ERROR;
}
@@ -1801,7 +1804,10 @@ Error VariantWriter::write(const Variant& p_variant, StoreStringFunc p_store_str
} break;
case Variant::REAL: {
- p_store_string_func(p_store_string_ud, rtoss(p_variant.operator real_t()) );
+ String s = rtoss(p_variant.operator real_t());
+ if (s.find(".")==-1 && s.find("e")==-1)
+ s+=".0";
+ p_store_string_func(p_store_string_ud, s );
} break;
case Variant::STRING: {
diff --git a/demos/3d/platformer/engine.cfg b/demos/3d/platformer/engine.cfg
index 84cac52c97..84a7e8f597 100644
--- a/demos/3d/platformer/engine.cfg
+++ b/demos/3d/platformer/engine.cfg
@@ -6,7 +6,7 @@ icon="res://icon.png"
[display]
-height=450
+height=720
stretch_2d=true
[input]
diff --git a/demos/3d/platformer/player.scn b/demos/3d/platformer/player.scn
index 854a8397e4..3b24da94ec 100644
--- a/demos/3d/platformer/player.scn
+++ b/demos/3d/platformer/player.scn
Binary files differ
diff --git a/drivers/gles2/rasterizer_gles2.cpp b/drivers/gles2/rasterizer_gles2.cpp
index 9b26cbfc7c..58d5c307f0 100644
--- a/drivers/gles2/rasterizer_gles2.cpp
+++ b/drivers/gles2/rasterizer_gles2.cpp
@@ -929,6 +929,7 @@ void RasterizerGLES2::texture_allocate(RID p_texture,int p_width, int p_height,I
texture->compressed=compressed;
texture->has_alpha=false; //by default it doesn't have alpha unless something with alpha is blitteds
texture->data_size=0;
+ texture->mipmaps=0;
glActiveTexture(GL_TEXTURE0);
@@ -1086,6 +1087,7 @@ void RasterizerGLES2::texture_set_data(RID p_texture,const Image& p_image,VS::Cu
glGenerateMipmap(texture->target);
}
+ texture->mipmaps=mipmaps;
@@ -1269,11 +1271,14 @@ void RasterizerGLES2::texture_set_flags(RID p_texture,uint32_t p_flags) {
p_flags&=VS::TEXTURE_FLAG_FILTER;//can change only filter
}
+ bool had_mipmaps = texture->flags&VS::TEXTURE_FLAG_MIPMAPS;
+
glActiveTexture(GL_TEXTURE0);
glBindTexture(texture->target, texture->tex_id);
uint32_t cube = texture->flags & VS::TEXTURE_FLAG_CUBEMAP;
texture->flags=p_flags|cube; // can't remove a cube from being a cube
+
bool force_clamp_to_edge = !(p_flags&VS::TEXTURE_FLAG_MIPMAPS && !texture->ignore_mipmaps) && (nearest_power_of_2(texture->alloc_height)!=texture->alloc_height || nearest_power_of_2(texture->alloc_width)!=texture->alloc_width);
if (!force_clamp_to_edge && (texture->flags&VS::TEXTURE_FLAG_REPEAT || texture->flags&VS::TEXTURE_FLAG_MIRRORED_REPEAT) && texture->target != GL_TEXTURE_CUBE_MAP) {
@@ -1304,9 +1309,13 @@ void RasterizerGLES2::texture_set_flags(RID p_texture,uint32_t p_flags) {
}
}
- if (texture->flags&VS::TEXTURE_FLAG_MIPMAPS && !texture->ignore_mipmaps)
+ if (texture->flags&VS::TEXTURE_FLAG_MIPMAPS && !texture->ignore_mipmaps) {
+ if (!had_mipmaps && texture->mipmaps==1) {
+ glGenerateMipmap(texture->target);
+ }
glTexParameteri(texture->target,GL_TEXTURE_MIN_FILTER,use_fast_texture_filter?GL_LINEAR_MIPMAP_NEAREST:GL_LINEAR_MIPMAP_LINEAR);
- else{
+
+ } else{
if (texture->flags&VS::TEXTURE_FLAG_FILTER) {
glTexParameteri(texture->target,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
} else {
@@ -8330,6 +8339,14 @@ void RasterizerGLES2::canvas_draw_rect(const Rect2& p_rect, int p_flags, const R
if ( texture ) {
+ bool untile=false;
+
+ if (p_flags&CANVAS_RECT_TILE && !(texture->flags&VS::TEXTURE_FLAG_REPEAT)) {
+ glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT );
+ glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT );
+ untile=true;
+ }
+
if (!(p_flags&CANVAS_RECT_REGION)) {
Rect2 region = Rect2(0,0,texture->width,texture->height);
@@ -8340,6 +8357,12 @@ void RasterizerGLES2::canvas_draw_rect(const Rect2& p_rect, int p_flags, const R
_draw_textured_quad(p_rect, p_source, Size2(texture->width,texture->height),p_flags&CANVAS_RECT_FLIP_H,p_flags&CANVAS_RECT_FLIP_V,p_flags&CANVAS_RECT_TRANSPOSE);
}
+
+ if (untile) {
+ glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE );
+ glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE );
+ }
+
} else {
//glDisable(GL_TEXTURE_2D);
diff --git a/drivers/gles2/rasterizer_gles2.h b/drivers/gles2/rasterizer_gles2.h
index f3edc28861..0f70ceaa97 100644
--- a/drivers/gles2/rasterizer_gles2.h
+++ b/drivers/gles2/rasterizer_gles2.h
@@ -138,6 +138,8 @@ class RasterizerGLES2 : public Rasterizer {
StringName reloader_func;
Image image[6];
+ int mipmaps;
+
bool active;
GLuint tex_id;
@@ -159,6 +161,7 @@ class RasterizerGLES2 : public Rasterizer {
compressed=false;
total_data_size=0;
target=GL_TEXTURE_2D;
+ mipmaps=0;
reloader=0;
}
diff --git a/drivers/unix/file_access_unix.cpp b/drivers/unix/file_access_unix.cpp
index 349831077c..9f24633bd4 100644
--- a/drivers/unix/file_access_unix.cpp
+++ b/drivers/unix/file_access_unix.cpp
@@ -74,6 +74,8 @@ Error FileAccessUnix::_open(const String& p_path, int p_mode_flags) {
else if (p_mode_flags==WRITE)
mode_string="wb";
else if (p_mode_flags==READ_WRITE)
+ mode_string="rb+";
+ else if (p_mode_flags==WRITE_READ)
mode_string="wb+";
else
return ERR_INVALID_PARAMETER;
diff --git a/drivers/unix/os_unix.cpp b/drivers/unix/os_unix.cpp
index bdf7daf799..405d84f0f1 100644
--- a/drivers/unix/os_unix.cpp
+++ b/drivers/unix/os_unix.cpp
@@ -233,13 +233,12 @@ uint64_t OS_Unix::get_unix_time() const {
return time(NULL);
};
-uint64_t OS_Unix::get_system_time_msec() const {
+uint64_t OS_Unix::get_system_time_secs() const {
struct timeval tv_now;
gettimeofday(&tv_now, NULL);
//localtime(&tv_now.tv_usec);
//localtime((const long *)&tv_now.tv_usec);
- uint64_t msec = uint64_t(tv_now.tv_sec)*1000+tv_now.tv_usec/1000;
- return msec;
+ return uint64_t(tv_now.tv_sec);
}
diff --git a/drivers/unix/os_unix.h b/drivers/unix/os_unix.h
index 1baed9e869..a889bba0ff 100644
--- a/drivers/unix/os_unix.h
+++ b/drivers/unix/os_unix.h
@@ -95,7 +95,7 @@ public:
virtual TimeZoneInfo get_time_zone_info() const;
virtual uint64_t get_unix_time() const;
- virtual uint64_t get_system_time_msec() const;
+ virtual uint64_t get_system_time_secs() const;
virtual void delay_usec(uint32_t p_usec) const;
virtual uint64_t get_ticks_usec() const;
diff --git a/drivers/windows/file_access_windows.cpp b/drivers/windows/file_access_windows.cpp
index 818e4258ba..66181a6f44 100644
--- a/drivers/windows/file_access_windows.cpp
+++ b/drivers/windows/file_access_windows.cpp
@@ -71,6 +71,8 @@ Error FileAccessWindows::_open(const String& p_filename, int p_mode_flags) {
else if (p_mode_flags==WRITE)
mode_string=L"wb";
else if (p_mode_flags==READ_WRITE)
+ mode_string=L"rb+";
+ else if (p_mode_flags==WRITE_READ)
mode_string=L"wb+";
else
return ERR_INVALID_PARAMETER;
diff --git a/modules/gdscript/gd_script.cpp b/modules/gdscript/gd_script.cpp
index d753a9f167..9a3f50d3b8 100644
--- a/modules/gdscript/gd_script.cpp
+++ b/modules/gdscript/gd_script.cpp
@@ -1139,7 +1139,7 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a
if (!GDScriptLanguage::get_singleton()->debug_break(err_text,false)) {
// debugger break did not happen
- _err_print_error(err_func.utf8().get_data(),err_file.utf8().get_data(),err_line,err_text.utf8().get_data());
+ _err_print_error(err_func.utf8().get_data(),err_file.utf8().get_data(),err_line,err_text.utf8().get_data(),ERR_HANDLER_SCRIPT);
}
diff --git a/platform/windows/detect.py b/platform/windows/detect.py
index a1366e7630..c00d94a4fb 100644
--- a/platform/windows/detect.py
+++ b/platform/windows/detect.py
@@ -262,7 +262,7 @@ def configure(env):
env.Append(CCFLAGS=["/I"+DIRECTX_PATH+"/Include"])
env.Append(LIBPATH=[DIRECTX_PATH+"/Lib/x86"])
env['ENV'] = os.environ;
- env["x86_opt_vc"]=True
+ env["x86_opt_vc"]=env["bits"]!="64"
else:
# Workaround for MinGW. See:
diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp
index 95bfa2ea94..6ac27b7dbf 100644
--- a/platform/windows/os_windows.cpp
+++ b/platform/windows/os_windows.cpp
@@ -1681,10 +1681,16 @@ uint64_t OS_Windows::get_unix_time() const {
return (*(uint64_t*)&ft - *(uint64_t*)&fep) / 10000000;
};
-uint64_t OS_Windows::get_system_time_msec() const {
+uint64_t OS_Windows::get_system_time_secs() const {
SYSTEMTIME st;
GetSystemTime(&st);
- return st.wMilliseconds;
+ FILETIME ft;
+ SystemTimeToFileTime(&st,&ft);
+ uint64_t ret;
+ ret=ft.dwHighDateTime;
+ ret<<=32;
+ ret|=ft.dwLowDateTime;
+ return ret;
}
void OS_Windows::delay_usec(uint32_t p_usec) const {
diff --git a/platform/windows/os_windows.h b/platform/windows/os_windows.h
index dfa2b40595..69bdcda278 100644
--- a/platform/windows/os_windows.h
+++ b/platform/windows/os_windows.h
@@ -231,7 +231,7 @@ public:
virtual Time get_time(bool utc) const;
virtual TimeZoneInfo get_time_zone_info() const;
virtual uint64_t get_unix_time() const;
- virtual uint64_t get_system_time_msec() const;
+ virtual uint64_t get_system_time_secs() const;
virtual bool can_draw() const;
virtual Error set_cwd(const String& p_cwd);
diff --git a/platform/x11/detect.py b/platform/x11/detect.py
index 344545ab81..e035c72993 100644
--- a/platform/x11/detect.py
+++ b/platform/x11/detect.py
@@ -147,9 +147,13 @@ def configure(env):
env.Append(CPPFLAGS=['-DOPENGL_ENABLED','-DGLEW_ENABLED'])
- if platform.system() == 'Linux':
+
+ if os.system("pkg-config --exists alsa")==0:
+ print("Enabling ALSA")
env.Append(CPPFLAGS=["-DALSA_ENABLED"])
env.Append(LIBS=['asound'])
+ else:
+ print("ALSA libraries not found, disabling driver")
if (env["gamepad"]=="yes" and platform.system() == "Linux"):
# pkg-config returns 0 when the lib exists...
diff --git a/scene/2d/collision_polygon_2d.cpp b/scene/2d/collision_polygon_2d.cpp
index 386c7b9dd0..2a40a6207d 100644
--- a/scene/2d/collision_polygon_2d.cpp
+++ b/scene/2d/collision_polygon_2d.cpp
@@ -197,7 +197,7 @@ void CollisionPolygon2D::_notification(int p_what) {
Vector2 n = polygon[(i+1)%polygon.size()];
draw_line(p,n,Color(0.9,0.2,0.0,0.8),3);
}
-//#define DEBUG_DECOMPOSE
+#define DEBUG_DECOMPOSE
#if defined(TOOLS_ENABLED) && defined (DEBUG_DECOMPOSE)
Vector< Vector<Vector2> > decomp = _decompose_in_convex();
diff --git a/scene/2d/path_2d.cpp b/scene/2d/path_2d.cpp
index f135864098..bd7415aa04 100644
--- a/scene/2d/path_2d.cpp
+++ b/scene/2d/path_2d.cpp
@@ -74,6 +74,8 @@ void Path2D::set_curve(const Ref<Curve2D>& p_curve) {
curve->connect("changed",this,"_curve_changed");
}
+ _curve_changed();
+
}
Ref<Curve2D> Path2D::get_curve() const{
diff --git a/scene/2d/screen_button.cpp b/scene/2d/screen_button.cpp
index d7f9b191fe..fac94f19dc 100644
--- a/scene/2d/screen_button.cpp
+++ b/scene/2d/screen_button.cpp
@@ -102,6 +102,10 @@ void TouchScreenButton::_notification(int p_what) {
action_id=-1;
}
} break;
+ case NOTIFICATION_EXIT_TREE: {
+ if (is_pressed())
+ Input::get_singleton()->action_release(action);
+ } break;
}
}
diff --git a/scene/gui/tabs.cpp b/scene/gui/tabs.cpp
index 14cd0bee8e..bb64a57212 100644
--- a/scene/gui/tabs.cpp
+++ b/scene/gui/tabs.cpp
@@ -266,6 +266,7 @@ void Tabs::_notification(int p_what) {
int label_valign_fg = get_constant("label_valign_fg");
int label_valign_bg = get_constant("label_valign_bg");
+
int w=0;
int mw = 0;
@@ -277,12 +278,16 @@ void Tabs::_notification(int p_what) {
for(int i=0;i<tabs.size();i++) {
+
Ref<Texture> tex = tabs[i].icon;
if (tex.is_valid()) {
if (tabs[i].text!="")
mw+=get_constant("hseparation");
}
+
+ tabs[i].ofs_cache=mw;
+
mw+=font->get_string_size(tabs[i].text).width;
if (current==i)
mw+=tab_fg->get_minimum_size().width;
@@ -303,6 +308,9 @@ void Tabs::_notification(int p_what) {
bms.width+=get_constant("hseparation");
mw+=bms.width;
}
+
+
+
}
}
@@ -758,6 +766,79 @@ Tabs::TabAlign Tabs::get_tab_align() const {
}
+void Tabs::ensure_tab_visible(int p_idx) {
+
+ if (!is_inside_tree())
+ return;
+
+ ERR_FAIL_INDEX(p_idx,tabs.size());
+
+ if (p_idx<offset) {
+ offset=p_idx;
+ update();
+ return;
+ }
+
+ Ref<StyleBox> tab_bg = get_stylebox("tab_bg");
+ Ref<StyleBox> tab_fg = get_stylebox("tab_fg");
+ Ref<Font> font = get_font("font");
+
+ Ref<Texture> incr = get_icon("increment");
+ Ref<Texture> decr = get_icon("decrement");
+
+ int limit=get_size().width-incr->get_width()-decr->get_width();
+
+
+
+ int x=0;
+ for(int i=0;i<tabs.size();i++) {
+
+ if (i<offset)
+ continue;
+
+ Ref<Texture> tex = tabs[i].icon;
+ if (tex.is_valid()) {
+ if (tabs[i].text!="")
+ x+=get_constant("hseparation");
+
+ }
+
+ tabs[i].x_cache=x;
+
+ x+=font->get_string_size(tabs[i].text).width;
+ if (current==i)
+ x+=tab_fg->get_minimum_size().width;
+ else
+ x+=tab_bg->get_minimum_size().width;
+
+ if (tabs[i].right_button.is_valid()) {
+ Ref<Texture> rb=tabs[i].right_button;
+ Size2 bms = rb->get_size();//+get_stylebox("button")->get_minimum_size();
+ bms.width+=get_constant("hseparation");
+
+ x+=bms.width;
+ }
+
+ if (tabs[i].close_button.is_valid()) {
+ Ref<Texture> cb=tabs[i].close_button;
+ Size2 bms = cb->get_size();//+get_stylebox("button")->get_minimum_size();
+ bms.width+=get_constant("hseparation");
+ x+=bms.width;
+ }
+
+ tabs[i].x_size_cache=x-tabs[i].x_cache;
+
+
+
+ }
+
+ while(offset<tabs.size() && ( (tabs[p_idx].x_cache + tabs[p_idx].x_size_cache) - tabs[offset].x_cache) < limit) {
+ offset++;
+ }
+
+ update();
+}
+
void Tabs::_bind_methods() {
ObjectTypeDB::bind_method(_MD("_input_event"),&Tabs::_input_event);
@@ -772,6 +853,7 @@ void Tabs::_bind_methods() {
ObjectTypeDB::bind_method(_MD("add_tab","title","icon:Texture"),&Tabs::add_tab);
ObjectTypeDB::bind_method(_MD("set_tab_align","align"),&Tabs::set_tab_align);
ObjectTypeDB::bind_method(_MD("get_tab_align"),&Tabs::get_tab_align);
+ ObjectTypeDB::bind_method(_MD("ensure_tab_visible","idx"),&Tabs::ensure_tab_visible);
ADD_SIGNAL(MethodInfo("tab_changed",PropertyInfo(Variant::INT,"tab")));
ADD_SIGNAL(MethodInfo("right_button_pressed",PropertyInfo(Variant::INT,"tab")));
@@ -804,4 +886,6 @@ Tabs::Tabs() {
cb_displaypolicy = SHOW_NEVER; // Default : no close button
offset=0;
max_drawn_tab=0;
+
+
}
diff --git a/scene/gui/tabs.h b/scene/gui/tabs.h
index efcb291a52..82035291ec 100644
--- a/scene/gui/tabs.h
+++ b/scene/gui/tabs.h
@@ -59,10 +59,14 @@ private:
Ref<Texture> icon;
int ofs_cache;
int size_cache;
+ int x_cache;
+ int x_size_cache;
+
Ref<Texture> right_button;
Rect2 rb_rect;
Ref<Texture> close_button;
Rect2 cb_rect;
+
};
@@ -119,6 +123,8 @@ public:
void clear_tabs();
+ void ensure_tab_visible(int p_idx);
+
Size2 get_minimum_size() const;
Tabs();
diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp
index 6d18a53c9f..330f855006 100644
--- a/scene/main/viewport.cpp
+++ b/scene/main/viewport.cpp
@@ -577,7 +577,7 @@ void Viewport::_notification(int p_what) {
PhysicsDirectSpaceState *space = PhysicsServer::get_singleton()->space_get_direct_state(find_world()->get_space());
if (space) {
- bool col = space->intersect_ray(from,from+dir*10000,result,Set<RID>(),0xFFFFFFFF,0xFFFFFFFF);
+ bool col = space->intersect_ray(from,from+dir*10000,result,Set<RID>(),0xFFFFFFFF,0xFFFFFFFF,true);
ObjectID new_collider=0;
if (col) {
@@ -617,7 +617,7 @@ void Viewport::_notification(int p_what) {
PhysicsDirectSpaceState *space = PhysicsServer::get_singleton()->space_get_direct_state(find_world()->get_space());
if (space) {
- bool col = space->intersect_ray(from,from+dir*10000,result,Set<RID>(),0xFFFFFFFF,0xFFFFFFFF);
+ bool col = space->intersect_ray(from,from+dir*10000,result,Set<RID>(),0xFFFFFFFF,0xFFFFFFFF,true);
ObjectID new_collider=0;
if (col) {
if (result.collider) {
diff --git a/servers/physics/shape_sw.cpp b/servers/physics/shape_sw.cpp
index d289510cb6..5923f89120 100644
--- a/servers/physics/shape_sw.cpp
+++ b/servers/physics/shape_sw.cpp
@@ -1354,6 +1354,10 @@ void ConcavePolygonShapeSW::_fill_bvh(_VolumeSW_BVH* p_bvh_tree,BVH* p_bvh_array
void ConcavePolygonShapeSW::_setup(DVector<Vector3> p_faces) {
int src_face_count=p_faces.size();
+ if (src_face_count==0) {
+ configure(AABB());
+ return;
+ }
ERR_FAIL_COND(src_face_count%3);
src_face_count/=3;
diff --git a/servers/physics/space_sw.cpp b/servers/physics/space_sw.cpp
index c85e5a85e9..08f280a976 100644
--- a/servers/physics/space_sw.cpp
+++ b/servers/physics/space_sw.cpp
@@ -47,7 +47,7 @@ _FORCE_INLINE_ static bool _match_object_type_query(CollisionObjectSW *p_object,
}
-bool PhysicsDirectSpaceStateSW::intersect_ray(const Vector3& p_from, const Vector3& p_to,RayResult &r_result,const Set<RID>& p_exclude,uint32_t p_layer_mask,uint32_t p_object_type_mask) {
+bool PhysicsDirectSpaceStateSW::intersect_ray(const Vector3& p_from, const Vector3& p_to, RayResult &r_result, const Set<RID>& p_exclude, uint32_t p_layer_mask, uint32_t p_object_type_mask, bool p_pick_ray) {
ERR_FAIL_COND_V(space->locked,false);
@@ -77,7 +77,7 @@ bool PhysicsDirectSpaceStateSW::intersect_ray(const Vector3& p_from, const Vecto
if (!_match_object_type_query(space->intersection_query_results[i],p_layer_mask,p_object_type_mask))
continue;
- if (!(static_cast<CollisionObjectSW*>(space->intersection_query_results[i])->is_ray_pickable()))
+ if (p_pick_ray && !(static_cast<CollisionObjectSW*>(space->intersection_query_results[i])->is_ray_pickable()))
continue;
if (p_exclude.has( space->intersection_query_results[i]->get_self()))
diff --git a/servers/physics/space_sw.h b/servers/physics/space_sw.h
index 9c73565381..6300c206d8 100644
--- a/servers/physics/space_sw.h
+++ b/servers/physics/space_sw.h
@@ -46,7 +46,7 @@ public:
SpaceSW *space;
- virtual bool intersect_ray(const Vector3& p_from, const Vector3& p_to,RayResult &r_result,const Set<RID>& p_exclude=Set<RID>(),uint32_t p_layer_mask=0xFFFFFFFF,uint32_t p_object_type_mask=TYPE_MASK_COLLISION);
+ virtual bool intersect_ray(const Vector3& p_from, const Vector3& p_to,RayResult &r_result,const Set<RID>& p_exclude=Set<RID>(),uint32_t p_layer_mask=0xFFFFFFFF,uint32_t p_object_type_mask=TYPE_MASK_COLLISION,bool p_pick_ray=false);
virtual int intersect_shape(const RID& p_shape, const Transform& p_xform,float p_margin,ShapeResult *r_results,int p_result_max,const Set<RID>& p_exclude=Set<RID>(),uint32_t p_layer_mask=0xFFFFFFFF,uint32_t p_object_type_mask=TYPE_MASK_COLLISION);
virtual bool cast_motion(const RID& p_shape, const Transform& p_xform,const Vector3& p_motion,float p_margin,float &p_closest_safe,float &p_closest_unsafe, const Set<RID>& p_exclude=Set<RID>(),uint32_t p_layer_mask=0xFFFFFFFF,uint32_t p_object_type_mask=TYPE_MASK_COLLISION,ShapeRestInfo *r_info=NULL);
virtual bool collide_shape(RID p_shape, const Transform& p_shape_xform,float p_margin,Vector3 *r_results,int p_result_max,int &r_result_count, const Set<RID>& p_exclude=Set<RID>(),uint32_t p_layer_mask=0xFFFFFFFF,uint32_t p_object_type_mask=TYPE_MASK_COLLISION);
diff --git a/servers/physics_server.h b/servers/physics_server.h
index e04765633d..8e302bf363 100644
--- a/servers/physics_server.h
+++ b/servers/physics_server.h
@@ -170,7 +170,7 @@ public:
int shape;
};
- virtual bool intersect_ray(const Vector3& p_from, const Vector3& p_to,RayResult &r_result,const Set<RID>& p_exclude=Set<RID>(),uint32_t p_layer_mask=0xFFFFFFFF,uint32_t p_object_type_mask=TYPE_MASK_COLLISION)=0;
+ virtual bool intersect_ray(const Vector3& p_from, const Vector3& p_to,RayResult &r_result,const Set<RID>& p_exclude=Set<RID>(),uint32_t p_layer_mask=0xFFFFFFFF,uint32_t p_object_type_mask=TYPE_MASK_COLLISION,bool p_pick_ray=false)=0;
struct ShapeResult {
diff --git a/tools/editor/animation_editor.cpp b/tools/editor/animation_editor.cpp
index bf17b40f46..9a0dde783b 100644
--- a/tools/editor/animation_editor.cpp
+++ b/tools/editor/animation_editor.cpp
@@ -1702,7 +1702,7 @@ bool AnimationKeyEditor::_edit_if_single_selection() {
if (selection.size()==0) {
curve_edit->set_mode(AnimationCurveEdit::MODE_DISABLED);
- print_line("disable");
+ //print_line("disable");
} else {
curve_edit->set_mode(AnimationCurveEdit::MODE_MULTIPLE);
@@ -1713,13 +1713,13 @@ bool AnimationKeyEditor::_edit_if_single_selection() {
curve_edit->set_multiple(animation->track_get_key_transition(E->key().track,E->key().key));
}
- print_line("multiple");
+ //print_line("multiple");
}
return false;
}
curve_edit->set_mode(AnimationCurveEdit::MODE_SINGLE);
- print_line("regular");
+ //print_line("regular");
int idx = selection.front()->key().track;
int key = selection.front()->key().key;
diff --git a/tools/editor/editor_node.cpp b/tools/editor/editor_node.cpp
index 7dd0979452..d7708fcefd 100644
--- a/tools/editor/editor_node.cpp
+++ b/tools/editor/editor_node.cpp
@@ -520,7 +520,7 @@ void EditorNode::save_resource_as(const Ref<Resource>& p_resource) {
List<String> preferred;
for(int i=0;i<extensions.size();i++) {
- if (p_resource->is_type("Script") && extensions[i]=="tres" || extensions[i]=="res" || extensions[i]=="xml") {
+ if (p_resource->is_type("Script") && (extensions[i]=="tres" || extensions[i]=="res" || extensions[i]=="xml")) {
//this serves no purpose and confused people
continue;
}
@@ -4723,11 +4723,13 @@ void EditorNode::_scene_tab_changed(int p_tab) {
editor_data.get_undo_redo().add_do_method(this,"set_current_version",unsaved?saved_version:0);
editor_data.get_undo_redo().add_do_method(this,"set_current_scene",p_tab);
editor_data.get_undo_redo().add_do_method(scene_tabs,"set_current_tab",p_tab);
+ editor_data.get_undo_redo().add_do_method(scene_tabs,"ensure_tab_visible",p_tab);
editor_data.get_undo_redo().add_do_method(this,"set_current_version",next_scene_version==0?editor_data.get_undo_redo().get_version()+1:next_scene_version);
editor_data.get_undo_redo().add_undo_method(this,"set_current_version",next_scene_version);
editor_data.get_undo_redo().add_undo_method(this,"set_current_scene",editor_data.get_edited_scene());
editor_data.get_undo_redo().add_undo_method(scene_tabs,"set_current_tab",editor_data.get_edited_scene());
+ editor_data.get_undo_redo().add_undo_method(scene_tabs,"ensure_tab_visible",p_tab,editor_data.get_edited_scene());
editor_data.get_undo_redo().add_undo_method(this,"set_current_version",saved_version);
editor_data.get_undo_redo().commit_action();
@@ -5195,7 +5197,11 @@ EditorNode::EditorNode() {
p->add_separator();
p->add_item("Revert Scene",EDIT_REVERT);
p->add_separator();
+#ifdef OSX_ENABLED
p->add_item("Quit to Project List",RUN_PROJECT_MANAGER,KEY_MASK_SHIFT+KEY_MASK_ALT+KEY_Q);
+#else
+ p->add_item("Quit to Project List",RUN_PROJECT_MANAGER,KEY_MASK_SHIFT+KEY_MASK_CTRL+KEY_Q);
+#endif
p->add_item("Quit",FILE_QUIT,KEY_MASK_CMD+KEY_Q);
recent_scenes = memnew( PopupMenu );
diff --git a/tools/editor/plugins/script_editor_plugin.cpp b/tools/editor/plugins/script_editor_plugin.cpp
index 6c36c71e93..fc0d68b2f8 100644
--- a/tools/editor/plugins/script_editor_plugin.cpp
+++ b/tools/editor/plugins/script_editor_plugin.cpp
@@ -327,7 +327,11 @@ void ScriptTextEditor::_load_theme_settings() {
for(List<StringName>::Element *E=types.front();E;E=E->next()) {
- get_text_edit()->add_keyword_color(E->get(),type_color);
+ String n = E->get();
+ if (n.begins_with("_"))
+ n = n.substr(1, n.length());
+
+ get_text_edit()->add_keyword_color(n,type_color);
}
//colorize comments
diff --git a/tools/editor/project_settings.cpp b/tools/editor/project_settings.cpp
index b61fcfa780..6c5e18ec9a 100644
--- a/tools/editor/project_settings.cpp
+++ b/tools/editor/project_settings.cpp
@@ -530,7 +530,7 @@ void ProjectSettings::_item_selected() {
return;
if (!ti->get_parent())
return;
- category->set_text(ti->get_parent()->get_text(0));
+ category->set_text(globals_editor->get_current_section());
property->set_text(ti->get_text(0));
popup_platform->set_disabled(false);
@@ -569,7 +569,8 @@ void ProjectSettings::_item_add() {
String name = catname+"/"+propname;
Globals::get_singleton()->set(name,value);
- globals_editor->get_property_editor()->update_tree();
+ globals_editor->edit(NULL);
+ globals_editor->edit(Globals::get_singleton());
}
void ProjectSettings::_item_del() {
diff --git a/tools/editor/property_editor.cpp b/tools/editor/property_editor.cpp
index fc5fce1d47..9743dc7202 100644
--- a/tools/editor/property_editor.cpp
+++ b/tools/editor/property_editor.cpp
@@ -727,7 +727,17 @@ bool CustomPropertyEditor::edit(Object* p_owner,const String& p_name,Variant::Ty
RES cb=EditorSettings::get_singleton()->get_resource_clipboard();
- bool paste_valid=cb.is_valid() && (hint_text=="" || ObjectTypeDB::is_type(cb->get_type(),hint_text));
+ bool paste_valid=false;
+ if (cb.is_valid()) {
+ if (hint_text=="")
+ paste_valid=true;
+ else
+ for (int i = 0; i < hint_text.get_slice_count(",");i++)
+ if (ObjectTypeDB::is_type(cb->get_type(),hint_text.get_slice(",",i))) {
+ paste_valid=true;
+ break;
+ }
+ }
if (!RES(v).is_null() || paste_valid) {
menu->add_separator();
@@ -3812,6 +3822,11 @@ void SectionedPropertyEditor::_section_selected(int p_which) {
filter->set_section( sections->get_item_metadata(p_which) );
}
+String SectionedPropertyEditor::get_current_section() const {
+
+ return sections->get_item_metadata( sections->get_current() );
+}
+
String SectionedPropertyEditor::get_full_item_path(const String& p_item) {
String base = sections->get_item_metadata( sections->get_current() );
diff --git a/tools/editor/property_editor.h b/tools/editor/property_editor.h
index 4f03c0381f..63ad090901 100644
--- a/tools/editor/property_editor.h
+++ b/tools/editor/property_editor.h
@@ -270,6 +270,7 @@ public:
PropertyEditor *get_property_editor();
void edit(Object* p_object);
String get_full_item_path(const String& p_item);
+ String get_current_section() const;
SectionedPropertyEditor();
~SectionedPropertyEditor();
diff --git a/tools/editor/scenes_dock.cpp b/tools/editor/scenes_dock.cpp
index cdc0bf0d25..5abc4992df 100644
--- a/tools/editor/scenes_dock.cpp
+++ b/tools/editor/scenes_dock.cpp
@@ -1254,6 +1254,8 @@ ScenesDock::ScenesDock(EditorNode *p_editor) {
history_pos=0;
tree_mode=true;
+ path="res://";
+
}