diff --git a/scene/3d/baked_light_instance.cpp b/scene/3d/baked_light_instance.cpp index b55093a7796..1ae7866f0bc 100644 --- a/scene/3d/baked_light_instance.cpp +++ b/scene/3d/baked_light_instance.cpp @@ -81,7 +81,7 @@ float BakedLightSampler::get_param(Param p_param) const{ void BakedLightSampler::set_resolution(int p_resolution){ - ERR_FAIL_COND(p_resolution<4 && p_resolution>32); + ERR_FAIL_COND(p_resolution<4 || p_resolution>32); resolution=p_resolution; VS::get_singleton()->baked_light_sampler_set_resolution(base,resolution); } diff --git a/scene/3d/collision_polygon.cpp b/scene/3d/collision_polygon.cpp index c857b4851ae..bb0a1fca12d 100644 --- a/scene/3d/collision_polygon.cpp +++ b/scene/3d/collision_polygon.cpp @@ -126,7 +126,7 @@ void CollisionPolygon::_notification(int p_what) { } break; case NOTIFICATION_LOCAL_TRANSFORM_CHANGED: { - if (!can_update_body && shape_from>=0 && shape_from>=0) { + if (!can_update_body && shape_from>=0 && shape_to>=0) { CollisionObject *co = get_parent()->cast_to(); if (co) { diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp index a1c06446502..bd6b8078ff1 100644 --- a/scene/gui/control.cpp +++ b/scene/gui/control.cpp @@ -2713,6 +2713,21 @@ void Control::warp_mouse(const Point2& p_to_pos) { get_viewport()->warp_mouse(get_global_transform().xform(p_to_pos)); } + +bool Control::is_text_field() const { +/* + if (get_script_instance()) { + Variant v=p_point; + const Variant *p[2]={&v,&p_data}; + Variant::CallError ce; + Variant ret = get_script_instance()->call("is_text_field",p,2,ce); + if (ce.error==Variant::CallError::CALL_OK) + return ret; + } + */ + return false; +} + void Control::_bind_methods() { ObjectTypeDB::bind_method(_MD("_window_input_event"),&Control::_window_input_event); diff --git a/scene/gui/control.h b/scene/gui/control.h index a759fafbc95..4311b299c8b 100644 --- a/scene/gui/control.h +++ b/scene/gui/control.h @@ -382,6 +382,8 @@ public: void warp_mouse(const Point2& p_to_pos); + virtual bool is_text_field() const; + Control(); ~Control(); diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp index fec9e401f16..2b4d7db01e8 100644 --- a/scene/gui/line_edit.cpp +++ b/scene/gui/line_edit.cpp @@ -782,6 +782,10 @@ void LineEdit::select(int p_from, int p_to) { update(); } +bool LineEdit::is_text_field() const { + + return true; +} void LineEdit::_bind_methods() { diff --git a/scene/gui/line_edit.h b/scene/gui/line_edit.h index c19043e8267..b1c4c8f6169 100644 --- a/scene/gui/line_edit.h +++ b/scene/gui/line_edit.h @@ -112,6 +112,8 @@ public: void select(int p_from=0, int p_to=-1); virtual Size2 get_minimum_size() const; + + virtual bool is_text_field() const; LineEdit(); ~LineEdit(); diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index b5fdde30cdf..4eef1ec9a9e 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -3568,7 +3568,10 @@ void TextEdit::set_show_line_numbers(bool p_show) { update(); } +bool TextEdit::is_text_field() const { + return true; +} void TextEdit::_bind_methods() { diff --git a/scene/gui/text_edit.h b/scene/gui/text_edit.h index 1b448bb782e..9ffe8a5bae3 100644 --- a/scene/gui/text_edit.h +++ b/scene/gui/text_edit.h @@ -393,6 +393,7 @@ public: String get_text_for_completion(); + virtual bool is_text_field() const; TextEdit(); ~TextEdit(); }; diff --git a/servers/visual/visual_server_raster.cpp b/servers/visual/visual_server_raster.cpp index fbea60c3a6b..1da536c1242 100644 --- a/servers/visual/visual_server_raster.cpp +++ b/servers/visual/visual_server_raster.cpp @@ -1375,7 +1375,7 @@ void VisualServerRaster::_update_baked_light_sampler_dp_cache(BakedLightSampler void VisualServerRaster::baked_light_sampler_set_resolution(RID p_baked_light_sampler,int p_resolution){ - ERR_FAIL_COND(p_resolution<4 && p_resolution>64); + ERR_FAIL_COND(p_resolution<4 || p_resolution>64); VS_CHANGED; BakedLightSampler * blsamp = baked_light_sampler_owner.get(p_baked_light_sampler); ERR_FAIL_COND(!blsamp); diff --git a/tools/editor/animation_editor.cpp b/tools/editor/animation_editor.cpp index 96bd1ed27d1..5df49bd3277 100644 --- a/tools/editor/animation_editor.cpp +++ b/tools/editor/animation_editor.cpp @@ -2369,7 +2369,7 @@ void AnimationKeyEditor::_track_editor_input_event(const InputEvent& p_input) { te->update(); track_editor->set_tooltip(""); - if (!track_editor->has_focus() && (!get_focus_owner() || !get_focus_owner()->cast_to())) + if (!track_editor->has_focus() && (!get_focus_owner() || !get_focus_owner()->is_text_field())) track_editor->call_deferred("grab_focus"); diff --git a/tools/editor/plugins/canvas_item_editor_plugin.cpp b/tools/editor/plugins/canvas_item_editor_plugin.cpp index 8fc2945450a..c2cacd13bcc 100644 --- a/tools/editor/plugins/canvas_item_editor_plugin.cpp +++ b/tools/editor/plugins/canvas_item_editor_plugin.cpp @@ -1281,7 +1281,7 @@ void CanvasItemEditor::_viewport_input_event(const InputEvent& p_event) { if (p_event.type==InputEvent::MOUSE_MOTION) { - if (!viewport->has_focus()) + if (!viewport->has_focus() && (!get_focus_owner() || !get_focus_owner()->is_text_field())) viewport->call_deferred("grab_focus"); const InputEventMouseMotion &m=p_event.mouse_motion; diff --git a/tools/editor/plugins/editor_preview_plugins.cpp b/tools/editor/plugins/editor_preview_plugins.cpp index a77ba9a605d..c2b3ecfcdaa 100644 --- a/tools/editor/plugins/editor_preview_plugins.cpp +++ b/tools/editor/plugins/editor_preview_plugins.cpp @@ -25,7 +25,7 @@ Ref EditorTexturePreviewPlugin::generate(const RES& p_from) { if (img.is_compressed()) { if (img.decompress()!=OK) return Ref(); - } else if (img.get_format()!=Image::FORMAT_RGB && img.get_format()!=Image::FORMAT_RGB) { + } else if (img.get_format()!=Image::FORMAT_RGB && img.get_format()!=Image::FORMAT_RGBA) { img.convert(Image::FORMAT_RGBA); } diff --git a/tools/editor/plugins/spatial_editor_plugin.cpp b/tools/editor/plugins/spatial_editor_plugin.cpp index 8fc6a6931e7..3ab93392650 100644 --- a/tools/editor/plugins/spatial_editor_plugin.cpp +++ b/tools/editor/plugins/spatial_editor_plugin.cpp @@ -677,7 +677,8 @@ bool SpatialEditorViewport::_gizmo_select(const Vector2& p_screenpos,bool p_hili void SpatialEditorViewport::_smouseenter() { - surface->grab_focus(); + if (!surface->has_focus() && (!get_focus_owner() || !get_focus_owner()->is_text_field())) + surface->grab_focus(); } void SpatialEditorViewport::_sinput(const InputEvent &p_event) {