diff options
-rw-r--r-- | scene/3d/baked_light_instance.cpp | 2 | ||||
-rw-r--r-- | scene/3d/collision_polygon.cpp | 2 | ||||
-rw-r--r-- | scene/gui/control.cpp | 15 | ||||
-rw-r--r-- | scene/gui/control.h | 2 | ||||
-rw-r--r-- | scene/gui/line_edit.cpp | 4 | ||||
-rw-r--r-- | scene/gui/line_edit.h | 2 | ||||
-rw-r--r-- | scene/gui/text_edit.cpp | 3 | ||||
-rw-r--r-- | scene/gui/text_edit.h | 1 | ||||
-rw-r--r-- | servers/visual/visual_server_raster.cpp | 2 | ||||
-rw-r--r-- | tools/editor/animation_editor.cpp | 2 | ||||
-rw-r--r-- | tools/editor/plugins/canvas_item_editor_plugin.cpp | 2 | ||||
-rw-r--r-- | tools/editor/plugins/editor_preview_plugins.cpp | 2 | ||||
-rw-r--r-- | tools/editor/plugins/spatial_editor_plugin.cpp | 3 |
13 files changed, 35 insertions, 7 deletions
diff --git a/scene/3d/baked_light_instance.cpp b/scene/3d/baked_light_instance.cpp index b55093a779..1ae7866f0b 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 c857b4851a..bb0a1fca12 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<CollisionObject>(); if (co) { diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp index a1c0644650..bd6b8078ff 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 a759fafbc9..4311b299c8 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 fec9e401f1..2b4d7db01e 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 c19043e826..b1c4c8f616 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 b5fdde30cd..4eef1ec9a9 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 1b448bb782..9ffe8a5bae 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 fbea60c3a6..1da536c124 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 96bd1ed27d..5df49bd327 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<LineEdit>())) + 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 8fc2945450..c2cacd13bc 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 a77ba9a605..c2b3ecfcda 100644 --- a/tools/editor/plugins/editor_preview_plugins.cpp +++ b/tools/editor/plugins/editor_preview_plugins.cpp @@ -25,7 +25,7 @@ Ref<Texture> EditorTexturePreviewPlugin::generate(const RES& p_from) { if (img.is_compressed()) { if (img.decompress()!=OK) return Ref<Texture>(); - } 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 8fc6a6931e..3ab9339265 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) { |