From cef3bd026fa6a6c1b2e19693b111210b3ce876ac Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Sat, 3 Jan 2015 11:06:53 -0300 Subject: -fixed issue with denormals in half precission, closes #1073 -added h_offset and v_offset to 3D Camera, should allow to do the same as in #1102 --- scene/3d/camera.cpp | 35 +++++++++++++++++++++++++++++++++++ scene/3d/camera.h | 8 ++++++++ 2 files changed, 43 insertions(+) (limited to 'scene') diff --git a/scene/3d/camera.cpp b/scene/3d/camera.cpp index 1db9886261..27420f8002 100644 --- a/scene/3d/camera.cpp +++ b/scene/3d/camera.cpp @@ -86,6 +86,10 @@ bool Camera::_set(const StringName& p_name, const Variant& p_value) { set_keep_aspect_mode(KeepAspect(int(p_value))); else if (p_name=="vaspect") set_keep_aspect_mode(p_value?KEEP_WIDTH:KEEP_HEIGHT); + else if (p_name=="h_offset") + h_offset=p_value; + else if (p_name=="v_offset") + v_offset=p_value; else if (p_name=="current") { if (p_value.operator bool()) { make_current(); @@ -128,6 +132,10 @@ bool Camera::_get(const StringName& p_name,Variant &r_ret) const { } } else if (p_name=="visible_layers") { r_ret=get_visible_layers(); + } else if (p_name=="h_offset") { + r_ret=get_h_offset(); + } else if (p_name=="v_offset") { + r_ret=get_v_offset(); } else if (p_name=="environment") { r_ret=get_environment(); } else @@ -170,12 +178,16 @@ void Camera::_get_property_list( List *p_list) const { p_list->push_back( PropertyInfo( Variant::BOOL, "current" ) ); p_list->push_back( PropertyInfo( Variant::INT, "visible_layers",PROPERTY_HINT_ALL_FLAGS ) ); p_list->push_back( PropertyInfo( Variant::OBJECT, "environment",PROPERTY_HINT_RESOURCE_TYPE,"Environment" ) ); + p_list->push_back( PropertyInfo( Variant::REAL, "h_offset" ) ); + p_list->push_back( PropertyInfo( Variant::REAL, "v_offset" ) ); } void Camera::_update_camera() { Transform tr = get_camera_transform(); + tr.origin+=tr.basis.get_axis(1)*v_offset; + tr.origin+=tr.basis.get_axis(0)*h_offset; VisualServer::get_singleton()->camera_set_transform( camera, tr ); // here goes listener stuff @@ -757,6 +769,27 @@ void Camera::look_at_from_pos(const Vector3& p_pos,const Vector3& p_target, cons } +void Camera::set_v_offset(float p_offset) { + + v_offset=p_offset; + _update_camera();; +} + +float Camera::get_v_offset() const { + + return v_offset; +} + +void Camera::set_h_offset(float p_offset) { + h_offset=p_offset; + _update_camera(); +} + +float Camera::get_h_offset() const { + + return h_offset; +} + Camera::Camera() { @@ -772,6 +805,8 @@ Camera::Camera() { set_perspective(60.0,0.1,100.0); keep_aspect=KEEP_HEIGHT; layers=0xfffff; + v_offset=0; + h_offset=0; VisualServer::get_singleton()->camera_set_visible_layers(camera,layers); //active=false; } diff --git a/scene/3d/camera.h b/scene/3d/camera.h index bac8173bb7..950688dfda 100644 --- a/scene/3d/camera.h +++ b/scene/3d/camera.h @@ -61,6 +61,8 @@ private: float fov; float size; float near,far; + float v_offset; + float h_offset; KeepAspect keep_aspect; RID camera; @@ -140,6 +142,12 @@ public: void look_at(const Vector3& p_target, const Vector3& p_up_normal); void look_at_from_pos(const Vector3& p_pos,const Vector3& p_target, const Vector3& p_up_normal); + void set_v_offset(float p_offset); + float get_v_offset() const; + + void set_h_offset(float p_offset); + float get_h_offset() const; + Camera(); ~Camera(); -- cgit v1.2.3 From 6b5b95bb4e269a1bd740707e27eae09983b84268 Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Sat, 3 Jan 2015 13:03:13 -0300 Subject: -added new code completion guess locations, closes #1032 -moved commandline fix to mingw-only, should fix #1064 --- scene/gui/text_edit.cpp | 40 +++++++++++++++++++++++++++++++--------- 1 file changed, 31 insertions(+), 9 deletions(-) (limited to 'scene') diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index 933895a207..8afcbf3283 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -3274,19 +3274,41 @@ void TextEdit::_update_completion_candidates() { String s; - - while(cofs>0 && l[cofs-1]>32 && _is_completable(l[cofs-1])) { - s=String::chr(l[cofs-1])+s; - if (l[cofs-1]=='\'' || l[cofs-1]=='"') - break; - - cofs--; + + //look for keywords first + + bool pre_keyword=false; + + if (cofs>0 && l[cofs-1]==' ') { + int kofs=cofs-1; + String kw; + while (kofs>=0 && l[kofs]==' ') + kofs--; + + while(kofs>=0 && l[kofs]>32 && _is_completable(l[kofs])) { + kw=String::chr(l[kofs])+kw; + kofs--; + } + + pre_keyword=keywords.has(kw); + print_line("KW "+kw+"? "+itos(pre_keyword)); + + } else { + + + while(cofs>0 && l[cofs-1]>32 && _is_completable(l[cofs-1])) { + s=String::chr(l[cofs-1])+s; + if (l[cofs-1]=='\'' || l[cofs-1]=='"') + break; + + cofs--; + } } - + update(); - if (s=="" && (cofs==0 || !completion_prefixes.has(String::chr(l[cofs-1])))) { + if (!pre_keyword && s=="" && (cofs==0 || !completion_prefixes.has(String::chr(l[cofs-1])))) { //none to complete, cancel _cancel_completion(); return; -- cgit v1.2.3 From 167c1027bea5b208e5878c96682eb2bec6f59633 Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Sat, 3 Jan 2015 15:39:01 -0300 Subject: -fixed bug on focus capture, now respets line/text edit -when playing animations, property editor is now refreshed properly, fixes #1046 --- scene/gui/control.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'scene') diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp index 068801d0bb..ce268843b1 100644 --- a/scene/gui/control.cpp +++ b/scene/gui/control.cpp @@ -2684,8 +2684,8 @@ bool Control::is_stopping_mouse() const { Control *Control::get_focus_owner() const { ERR_FAIL_COND_V(!is_inside_tree(),NULL); - ERR_FAIL_COND_V(!window,NULL); - return window->key_focus; + ERR_FAIL_COND_V(!data.window,NULL); + return data.window->window->key_focus; } void Control::_bind_methods() { -- cgit v1.2.3