diff options
Diffstat (limited to 'scene')
-rw-r--r-- | scene/2d/camera_2d.cpp | 6 | ||||
-rw-r--r-- | scene/animation/animation_blend_tree.cpp | 32 | ||||
-rw-r--r-- | scene/animation/animation_blend_tree.h | 2 | ||||
-rw-r--r-- | scene/animation/animation_tree.cpp | 16 | ||||
-rw-r--r-- | scene/animation/animation_tree.h | 2 | ||||
-rw-r--r-- | scene/gui/control.cpp | 2 | ||||
-rw-r--r-- | scene/gui/control.h | 4 | ||||
-rw-r--r-- | scene/gui/line_edit.cpp | 2 | ||||
-rw-r--r-- | scene/main/canvas_item.cpp | 16 | ||||
-rw-r--r-- | scene/main/canvas_item.h | 4 | ||||
-rw-r--r-- | scene/main/viewport.cpp | 19 | ||||
-rw-r--r-- | scene/main/viewport.h | 3 | ||||
-rw-r--r-- | scene/main/window.cpp | 2 | ||||
-rw-r--r-- | scene/resources/primitive_meshes.cpp | 2 |
14 files changed, 47 insertions, 65 deletions
diff --git a/scene/2d/camera_2d.cpp b/scene/2d/camera_2d.cpp index 49c5501e77..fe6bee0f1b 100644 --- a/scene/2d/camera_2d.cpp +++ b/scene/2d/camera_2d.cpp @@ -250,7 +250,7 @@ void Camera2D::_notification(int p_what) { add_to_group(group_name); add_to_group(canvas_group_name); - if (enabled && !viewport->get_camera_2d()) { + if (!Engine::get_singleton()->is_editor_hint() && enabled && !viewport->get_camera_2d()) { make_current(); } @@ -260,11 +260,11 @@ void Camera2D::_notification(int p_what) { } break; case NOTIFICATION_EXIT_TREE: { + remove_from_group(group_name); + remove_from_group(canvas_group_name); if (is_current()) { clear_current(); } - remove_from_group(group_name); - remove_from_group(canvas_group_name); viewport = nullptr; } break; diff --git a/scene/animation/animation_blend_tree.cpp b/scene/animation/animation_blend_tree.cpp index 797999625b..12a96c8679 100644 --- a/scene/animation/animation_blend_tree.cpp +++ b/scene/animation/animation_blend_tree.cpp @@ -518,7 +518,7 @@ void AnimationNodeBlend2::get_parameter_list(List<PropertyInfo> *r_list) const { } Variant AnimationNodeBlend2::get_parameter_default_value(const StringName &p_parameter) const { - return 0; //for blend amount + return 0; // For blend amount. } String AnimationNodeBlend2::get_caption() const { @@ -531,7 +531,7 @@ double AnimationNodeBlend2::process(double p_time, bool p_seek, bool p_is_extern double rem0 = blend_input(0, p_time, p_seek, p_is_external_seeking, 1.0 - amount, FILTER_BLEND, sync); double rem1 = blend_input(1, p_time, p_seek, p_is_external_seeking, amount, FILTER_PASS, sync); - return amount > 0.5 ? rem1 : rem0; //hacky but good enough + return amount > 0.5 ? rem1 : rem0; // Hacky but good enough. } bool AnimationNodeBlend2::has_filter() const { @@ -553,7 +553,7 @@ void AnimationNodeBlend3::get_parameter_list(List<PropertyInfo> *r_list) const { } Variant AnimationNodeBlend3::get_parameter_default_value(const StringName &p_parameter) const { - return 0; //for blend amount + return 0; // For blend amount. } String AnimationNodeBlend3::get_caption() const { @@ -566,7 +566,7 @@ double AnimationNodeBlend3::process(double p_time, bool p_seek, bool p_is_extern double rem1 = blend_input(1, p_time, p_seek, p_is_external_seeking, 1.0 - ABS(amount), FILTER_IGNORE, sync); double rem2 = blend_input(2, p_time, p_seek, p_is_external_seeking, MAX(0, amount), FILTER_IGNORE, sync); - return amount > 0.5 ? rem2 : (amount < -0.5 ? rem0 : rem1); //hacky but good enough + return amount > 0.5 ? rem2 : (amount < -0.5 ? rem0 : rem1); // Hacky but good enough. } void AnimationNodeBlend3::_bind_methods() { @@ -585,7 +585,7 @@ void AnimationNodeTimeScale::get_parameter_list(List<PropertyInfo> *r_list) cons } Variant AnimationNodeTimeScale::get_parameter_default_value(const StringName &p_parameter) const { - return 1.0; //initial timescale + return 1.0; // Initial timescale. } String AnimationNodeTimeScale::get_caption() const { @@ -611,24 +611,24 @@ AnimationNodeTimeScale::AnimationNodeTimeScale() { //////////////////////////////////// void AnimationNodeTimeSeek::get_parameter_list(List<PropertyInfo> *r_list) const { - r_list->push_back(PropertyInfo(Variant::FLOAT, seek_pos, PROPERTY_HINT_RANGE, "-1,3600,0.01,or_greater")); + r_list->push_back(PropertyInfo(Variant::FLOAT, seek_pos_request, PROPERTY_HINT_RANGE, "-1,3600,0.01,or_greater")); // It will be reset to -1 after seeking the position immediately. } Variant AnimationNodeTimeSeek::get_parameter_default_value(const StringName &p_parameter) const { - return 1.0; //initial timescale + return -1.0; // Initial seek request. } String AnimationNodeTimeSeek::get_caption() const { - return "Seek"; + return "TimeSeek"; } double AnimationNodeTimeSeek::process(double p_time, bool p_seek, bool p_is_external_seeking) { - double cur_seek_pos = get_parameter(seek_pos); + double cur_seek_pos = get_parameter(seek_pos_request); if (p_seek) { return blend_input(0, p_time, true, p_is_external_seeking, 1.0, FILTER_IGNORE, true); } else if (cur_seek_pos >= 0) { double ret = blend_input(0, cur_seek_pos, true, true, 1.0, FILTER_IGNORE, true); - set_parameter(seek_pos, -1.0); //reset + set_parameter(seek_pos_request, -1.0); // Reset. return ret; } else { return blend_input(0, p_time, false, p_is_external_seeking, 1.0, FILTER_IGNORE, true); @@ -871,7 +871,7 @@ double AnimationNodeTransition::process(double p_time, bool p_seek, bool p_is_ex } } - if (cur_prev_index < 0) { // process current animation, check for transition + if (cur_prev_index < 0) { // Process current animation, check for transition. rem = blend_input(cur_current_index, p_time, p_seek, p_is_external_seeking, 1.0, FILTER_IGNORE, true); @@ -885,7 +885,7 @@ double AnimationNodeTransition::process(double p_time, bool p_seek, bool p_is_ex set_parameter(transition_request, get_input_name((cur_current_index + 1) % get_input_count())); } - } else { // cross-fading from prev to current + } else { // Cross-fading from prev to current. real_t blend = xfade_time == 0 ? 0 : (cur_prev_xfading / xfade_time); if (xfade_curve.is_valid()) { @@ -894,7 +894,7 @@ double AnimationNodeTransition::process(double p_time, bool p_seek, bool p_is_ex // Blend values must be more than CMP_EPSILON to process discrete keys in edge. real_t blend_inv = 1.0 - blend; - if (input_data[cur_current_index].reset && !p_seek && switched) { //just switched, seek to start of current + if (input_data[cur_current_index].reset && !p_seek && switched) { // Just switched, seek to start of current. rem = blend_input(cur_current_index, 0, true, p_is_external_seeking, Math::is_zero_approx(blend_inv) ? CMP_EPSILON : blend_inv, FILTER_IGNORE, true); } else { rem = blend_input(cur_current_index, p_time, p_seek, p_is_external_seeking, Math::is_zero_approx(blend_inv) ? CMP_EPSILON : blend_inv, FILTER_IGNORE, true); @@ -1052,7 +1052,7 @@ void AnimationNodeBlendTree::remove_node(const StringName &p_name) { nodes.erase(p_name); - //erase connections to name + // Erase connections to name. for (KeyValue<StringName, Node> &E : nodes) { for (int i = 0; i < E.value.connections.size(); i++) { if (E.value.connections[i] == p_name) { @@ -1076,7 +1076,7 @@ void AnimationNodeBlendTree::rename_node(const StringName &p_name, const StringN nodes[p_new_name] = nodes[p_name]; nodes.erase(p_name); - //rename connections + // Rename connections. for (KeyValue<StringName, Node> &E : nodes) { for (int i = 0; i < E.value.connections.size(); i++) { if (E.value.connections[i] == p_name) { @@ -1084,7 +1084,7 @@ void AnimationNodeBlendTree::rename_node(const StringName &p_name, const StringN } } } - //connection must be done with new name + // Connection must be done with new name. nodes[p_new_name].node->connect("changed", callable_mp(this, &AnimationNodeBlendTree::_node_changed).bind(p_new_name), CONNECT_REFERENCE_COUNTED); emit_signal(SNAME("tree_changed")); diff --git a/scene/animation/animation_blend_tree.h b/scene/animation/animation_blend_tree.h index 20f8e9b190..1e90952564 100644 --- a/scene/animation/animation_blend_tree.h +++ b/scene/animation/animation_blend_tree.h @@ -257,7 +257,7 @@ public: class AnimationNodeTimeSeek : public AnimationNode { GDCLASS(AnimationNodeTimeSeek, AnimationNode); - StringName seek_pos = PNAME("seek_position"); + StringName seek_pos_request = PNAME("seek_request"); protected: static void _bind_methods(); diff --git a/scene/animation/animation_tree.cpp b/scene/animation/animation_tree.cpp index fa72bbc593..dd5bf31c66 100644 --- a/scene/animation/animation_tree.cpp +++ b/scene/animation/animation_tree.cpp @@ -2084,20 +2084,6 @@ void AnimationTree::_get_property_list(List<PropertyInfo> *p_list) const { } } -void AnimationTree::rename_parameter(const String &p_base, const String &p_new_base) { - //rename values first - for (const PropertyInfo &E : properties) { - if (E.name.begins_with(p_base)) { - String new_name = E.name.replace_first(p_base, p_new_base); - property_map[new_name] = property_map[E.name]; - } - } - - //update tree second - properties_dirty = true; - _update_properties(); -} - real_t AnimationTree::get_connection_activity(const StringName &p_path, int p_connection) const { if (!input_activity_map_get.has(p_path)) { return 0; @@ -2143,8 +2129,6 @@ void AnimationTree::_bind_methods() { ClassDB::bind_method(D_METHOD("_update_properties"), &AnimationTree::_update_properties); - ClassDB::bind_method(D_METHOD("rename_parameter", "old_name", "new_name"), &AnimationTree::rename_parameter); - ClassDB::bind_method(D_METHOD("advance", "delta"), &AnimationTree::advance); GDVIRTUAL_BIND(_post_process_key_value, "animation", "track", "value", "object", "object_idx"); diff --git a/scene/animation/animation_tree.h b/scene/animation/animation_tree.h index a6fb4a8430..c5c2790fae 100644 --- a/scene/animation/animation_tree.h +++ b/scene/animation/animation_tree.h @@ -389,8 +389,6 @@ public: real_t get_connection_activity(const StringName &p_path, int p_connection) const; void advance(double p_time); - void rename_parameter(const String &p_base, const String &p_new_base); - uint64_t get_last_process_pass() const; AnimationTree(); ~AnimationTree(); diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp index 6f5e2cf058..f09e4962a9 100644 --- a/scene/gui/control.cpp +++ b/scene/gui/control.cpp @@ -692,7 +692,7 @@ Transform2D Control::get_transform() const { return xform; } -void Control::_toplevel_changed_on_parent() { +void Control::_top_level_changed_on_parent() { // Update root control status. _notification(NOTIFICATION_EXIT_CANVAS); _notification(NOTIFICATION_ENTER_CANVAS); diff --git a/scene/gui/control.h b/scene/gui/control.h index 5977f4dbea..2fb5d559b6 100644 --- a/scene/gui/control.h +++ b/scene/gui/control.h @@ -292,8 +292,8 @@ private: void _update_minimum_size(); void _size_changed(); - void _toplevel_changed() override{}; // Controls don't need to do anything, only other CanvasItems. - void _toplevel_changed_on_parent() override; + void _top_level_changed() override {} // Controls don't need to do anything, only other CanvasItems. + void _top_level_changed_on_parent() override; void _clear_size_warning(); diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp index dba08e16cb..16a718722c 100644 --- a/scene/gui/line_edit.cpp +++ b/scene/gui/line_edit.cpp @@ -84,6 +84,7 @@ void LineEdit::_move_caret_left(bool p_select, bool p_move_by_word) { } shift_selection_check_post(p_select); + _reset_caret_blink_timer(); } void LineEdit::_move_caret_right(bool p_select, bool p_move_by_word) { @@ -116,6 +117,7 @@ void LineEdit::_move_caret_right(bool p_select, bool p_move_by_word) { } shift_selection_check_post(p_select); + _reset_caret_blink_timer(); } void LineEdit::_move_caret_start(bool p_select) { diff --git a/scene/main/canvas_item.cpp b/scene/main/canvas_item.cpp index 541c7a0587..0ea8f6c5f1 100644 --- a/scene/main/canvas_item.cpp +++ b/scene/main/canvas_item.cpp @@ -185,7 +185,7 @@ void CanvasItem::_top_level_raise_self() { } void CanvasItem::_enter_canvas() { - // Resolves to nullptr if the node is toplevel. + // Resolves to nullptr if the node is top_level. CanvasItem *parent_item = get_parent_item(); if (parent_item) { @@ -400,26 +400,26 @@ void CanvasItem::set_as_top_level(bool p_top_level) { _exit_canvas(); top_level = p_top_level; - _toplevel_changed(); + _top_level_changed(); _enter_canvas(); _notify_transform(); } -void CanvasItem::_toplevel_changed() { - // Inform children that toplevel status has changed on a parent. +void CanvasItem::_top_level_changed() { + // Inform children that top_level status has changed on a parent. int children = get_child_count(); for (int i = 0; i < children; i++) { CanvasItem *child = Object::cast_to<CanvasItem>(get_child(i)); if (child) { - child->_toplevel_changed_on_parent(); + child->_top_level_changed_on_parent(); } } } -void CanvasItem::_toplevel_changed_on_parent() { - // Inform children that toplevel status has changed on a parent. - _toplevel_changed(); +void CanvasItem::_top_level_changed_on_parent() { + // Inform children that top_level status has changed on a parent. + _top_level_changed(); } bool CanvasItem::is_set_as_top_level() const { diff --git a/scene/main/canvas_item.h b/scene/main/canvas_item.h index 1ddfaa288c..2fa1d56667 100644 --- a/scene/main/canvas_item.h +++ b/scene/main/canvas_item.h @@ -125,8 +125,8 @@ private: void _propagate_visibility_changed(bool p_parent_visible_in_tree); void _handle_visibility_change(bool p_visible); - virtual void _toplevel_changed(); - virtual void _toplevel_changed_on_parent(); + virtual void _top_level_changed(); + virtual void _top_level_changed_on_parent(); void _redraw_callback(); diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index c31155bd5c..64bfec873a 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -524,7 +524,7 @@ void Viewport::_process_picking() { if (!physics_object_picking) { return; } - if (to_screen_rect != Rect2i() && Input::get_singleton()->get_mouse_mode() == Input::MOUSE_MODE_CAPTURED) { + if (Object::cast_to<Window>(this) && Input::get_singleton()->get_mouse_mode() == Input::MOUSE_MODE_CAPTURED) { return; } if (!gui.mouse_in_viewport) { @@ -796,14 +796,14 @@ void Viewport::update_canvas_items() { _update_canvas_items(this); } -void Viewport::_set_size(const Size2i &p_size, const Size2i &p_size_2d_override, const Rect2i &p_to_screen_rect, bool p_allocated) { +void Viewport::_set_size(const Size2i &p_size, const Size2i &p_size_2d_override, bool p_allocated) { Transform2D stretch_transform_new = Transform2D(); if (is_size_2d_override_stretch_enabled() && p_size_2d_override.width > 0 && p_size_2d_override.height > 0) { Size2 scale = Size2(p_size) / Size2(p_size_2d_override); stretch_transform_new.scale(scale); } - if (size == p_size && size_allocated == p_allocated && stretch_transform == stretch_transform_new && p_size_2d_override == size_2d_override && to_screen_rect == p_to_screen_rect) { + if (size == p_size && size_allocated == p_allocated && stretch_transform == stretch_transform_new && p_size_2d_override == size_2d_override) { return; } @@ -811,7 +811,6 @@ void Viewport::_set_size(const Size2i &p_size, const Size2i &p_size_2d_override, size_allocated = p_allocated; size_2d_override = p_size_2d_override; stretch_transform = stretch_transform_new; - to_screen_rect = p_to_screen_rect; #ifndef _3D_DISABLED if (!use_xr) { @@ -1061,10 +1060,10 @@ void Viewport::assign_next_enabled_camera_2d(const StringName &p_camera_group) { get_tree()->get_nodes_in_group(p_camera_group, &camera_list); Camera2D *new_camera = nullptr; - for (const Node *E : camera_list) { - const Camera2D *cam = Object::cast_to<Camera2D>(E); + for (Node *E : camera_list) { + Camera2D *cam = Object::cast_to<Camera2D>(E); if (cam->is_enabled()) { - new_camera = const_cast<Camera2D *>(cam); + new_camera = cam; break; } } @@ -4143,7 +4142,7 @@ void SubViewport::_internal_set_size(const Size2i &p_size, bool p_force) { return; } - _set_size(p_size, _get_size_2d_override(), Rect2i(), true); + _set_size(p_size, _get_size_2d_override(), true); if (c) { c->update_minimum_size(); @@ -4155,7 +4154,7 @@ Size2i SubViewport::get_size() const { } void SubViewport::set_size_2d_override(const Size2i &p_size) { - _set_size(_get_size(), p_size, Rect2i(), true); + _set_size(_get_size(), p_size, true); } Size2i SubViewport::get_size_2d_override() const { @@ -4168,7 +4167,7 @@ void SubViewport::set_size_2d_override_stretch(bool p_enable) { } size_2d_override_stretch = p_enable; - _set_size(_get_size(), _get_size_2d_override(), Rect2i(), true); + _set_size(_get_size(), _get_size_2d_override(), true); } bool SubViewport::is_size_2d_override_stretch_enabled() const { diff --git a/scene/main/viewport.h b/scene/main/viewport.h index 7546838568..96aee4a34d 100644 --- a/scene/main/viewport.h +++ b/scene/main/viewport.h @@ -275,7 +275,6 @@ private: Ref<World2D> world_2d; - Rect2i to_screen_rect; StringName input_group; StringName gui_input_group; StringName shortcut_input_group; @@ -471,7 +470,7 @@ private: uint64_t event_count = 0; protected: - void _set_size(const Size2i &p_size, const Size2i &p_size_2d_override, const Rect2i &p_to_screen_rect, bool p_allocated); + void _set_size(const Size2i &p_size, const Size2i &p_size_2d_override, bool p_allocated); Size2i _get_size() const; Size2i _get_size_2d_override() const; diff --git a/scene/main/window.cpp b/scene/main/window.cpp index b6f1d3f54b..be2a0dca13 100644 --- a/scene/main/window.cpp +++ b/scene/main/window.cpp @@ -1004,7 +1004,7 @@ void Window::_update_viewport_size() { } bool allocate = is_inside_tree() && visible && (window_id != DisplayServer::INVALID_WINDOW_ID || embedder != nullptr); - _set_size(final_size, final_size_override, attach_to_screen_rect, allocate); + _set_size(final_size, final_size_override, allocate); if (window_id != DisplayServer::INVALID_WINDOW_ID) { RenderingServer::get_singleton()->viewport_attach_to_screen(get_viewport_rid(), attach_to_screen_rect, window_id); diff --git a/scene/resources/primitive_meshes.cpp b/scene/resources/primitive_meshes.cpp index 86ed0001dd..ef1f6459e9 100644 --- a/scene/resources/primitive_meshes.cpp +++ b/scene/resources/primitive_meshes.cpp @@ -257,7 +257,7 @@ void PrimitiveMesh::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::AABB, "custom_aabb", PROPERTY_HINT_NONE, "suffix:m"), "set_custom_aabb", "get_custom_aabb"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "flip_faces"), "set_flip_faces", "get_flip_faces"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "add_uv2"), "set_add_uv2", "get_add_uv2"); - ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "uv2_padding"), "set_uv2_padding", "get_uv2_padding"); + ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "uv2_padding", PROPERTY_HINT_RANGE, "0,10,0.01,or_greater"), "set_uv2_padding", "get_uv2_padding"); GDVIRTUAL_BIND(_create_mesh_array); } |