diff options
Diffstat (limited to 'scene')
39 files changed, 105 insertions, 367 deletions
diff --git a/scene/3d/audio_stream_player_3d.cpp b/scene/3d/audio_stream_player_3d.cpp index efe23c6102..bdcab49e4e 100644 --- a/scene/3d/audio_stream_player_3d.cpp +++ b/scene/3d/audio_stream_player_3d.cpp @@ -391,7 +391,13 @@ Vector<AudioFrame> AudioStreamPlayer3D::_update_panning() { PhysicsDirectSpaceState3D *space_state = PhysicsServer3D::get_singleton()->space_get_direct_state(world_3d->get_space()); for (Camera3D *camera : cameras) { + if (!camera) { + continue; + } Viewport *vp = camera->get_viewport(); + if (!vp) { + continue; + } if (!vp->is_audio_listener_3d()) { continue; } diff --git a/scene/3d/proximity_group_3d.cpp b/scene/3d/proximity_group_3d.cpp deleted file mode 100644 index 23df00c1f6..0000000000 --- a/scene/3d/proximity_group_3d.cpp +++ /dev/null @@ -1,182 +0,0 @@ -/*************************************************************************/ -/* proximity_group_3d.cpp */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ - -#include "proximity_group_3d.h" - -#include "core/math/math_funcs.h" - -void ProximityGroup3D::_clear_groups() { - Map<StringName, uint32_t>::Element *E; - const int size = 16; - - do { - StringName remove_list[size]; - E = groups.front(); - int num = 0; - while (E && num < size) { - if (E->get() != group_version) { - remove_list[num++] = E->key(); - } - - E = E->next(); - } - for (int i = 0; i < num; i++) { - groups.erase(remove_list[i]); - } - } while (E); -} - -void ProximityGroup3D::_update_groups() { - if (grid_radius == Vector3(0, 0, 0)) { - return; - } - - ++group_version; - - Vector3 pos = get_global_transform().get_origin(); - Vector3 vcell = pos / cell_size; - int cell[3] = { Math::fast_ftoi(vcell.x), Math::fast_ftoi(vcell.y), Math::fast_ftoi(vcell.z) }; - - _add_groups(cell, group_name, 0); - - _clear_groups(); -} - -void ProximityGroup3D::_add_groups(int *p_cell, String p_base, int p_depth) { - p_base = p_base + "|"; - if (grid_radius[p_depth] == 0) { - if (p_depth == 2) { - _new_group(p_base); - } else { - _add_groups(p_cell, p_base, p_depth + 1); - } - } - - int start = p_cell[p_depth] - grid_radius[p_depth]; - int end = p_cell[p_depth] + grid_radius[p_depth]; - - for (int i = start; i <= end; i++) { - String gname = p_base + itos(i); - if (p_depth == 2) { - _new_group(gname); - } else { - _add_groups(p_cell, gname, p_depth + 1); - } - } -} - -void ProximityGroup3D::_new_group(StringName p_name) { - const Map<StringName, uint32_t>::Element *E = groups.find(p_name); - if (!E) { - add_to_group(p_name); - } - - groups[p_name] = group_version; -} - -void ProximityGroup3D::_notification(int p_what) { - switch (p_what) { - case NOTIFICATION_EXIT_TREE: - ++group_version; - _clear_groups(); - break; - case NOTIFICATION_TRANSFORM_CHANGED: - _update_groups(); - break; - } -} - -void ProximityGroup3D::broadcast(String p_method, Variant p_parameters) { - Map<StringName, uint32_t>::Element *E; - E = groups.front(); - while (E) { - get_tree()->call_group_flags(SceneTree::GROUP_CALL_DEFAULT, E->key(), "_proximity_group_broadcast", p_method, p_parameters); - E = E->next(); - } -} - -void ProximityGroup3D::_proximity_group_broadcast(String p_method, Variant p_parameters) { - if (dispatch_mode == MODE_PROXY) { - ERR_FAIL_COND(!is_inside_tree()); - get_parent()->call(p_method, p_parameters); - } else { - emit_signal(SNAME("broadcast"), p_method, p_parameters); - } -} - -void ProximityGroup3D::set_group_name(const String &p_group_name) { - group_name = p_group_name; -} - -String ProximityGroup3D::get_group_name() const { - return group_name; -} - -void ProximityGroup3D::set_dispatch_mode(DispatchMode p_mode) { - dispatch_mode = p_mode; -} - -ProximityGroup3D::DispatchMode ProximityGroup3D::get_dispatch_mode() const { - return dispatch_mode; -} - -void ProximityGroup3D::set_grid_radius(const Vector3 &p_radius) { - grid_radius = p_radius; -} - -Vector3 ProximityGroup3D::get_grid_radius() const { - return grid_radius; -} - -void ProximityGroup3D::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_group_name", "name"), &ProximityGroup3D::set_group_name); - ClassDB::bind_method(D_METHOD("get_group_name"), &ProximityGroup3D::get_group_name); - ClassDB::bind_method(D_METHOD("set_dispatch_mode", "mode"), &ProximityGroup3D::set_dispatch_mode); - ClassDB::bind_method(D_METHOD("get_dispatch_mode"), &ProximityGroup3D::get_dispatch_mode); - ClassDB::bind_method(D_METHOD("set_grid_radius", "radius"), &ProximityGroup3D::set_grid_radius); - ClassDB::bind_method(D_METHOD("get_grid_radius"), &ProximityGroup3D::get_grid_radius); - - ClassDB::bind_method(D_METHOD("broadcast", "method", "parameters"), &ProximityGroup3D::broadcast); - - ClassDB::bind_method(D_METHOD("_proximity_group_broadcast", "method", "parameters"), &ProximityGroup3D::_proximity_group_broadcast); - - ADD_PROPERTY(PropertyInfo(Variant::STRING, "group_name"), "set_group_name", "get_group_name"); - ADD_PROPERTY(PropertyInfo(Variant::INT, "dispatch_mode", PROPERTY_HINT_ENUM, "Proxy,Signal"), "set_dispatch_mode", "get_dispatch_mode"); - ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "grid_radius"), "set_grid_radius", "get_grid_radius"); - - ADD_SIGNAL(MethodInfo("broadcast", PropertyInfo(Variant::STRING, "method"), PropertyInfo(Variant::ARRAY, "parameters"))); - - BIND_ENUM_CONSTANT(MODE_PROXY); - BIND_ENUM_CONSTANT(MODE_SIGNAL); -} - -ProximityGroup3D::ProximityGroup3D() { - set_notify_transform(true); -} diff --git a/scene/3d/proximity_group_3d.h b/scene/3d/proximity_group_3d.h deleted file mode 100644 index e45adc3040..0000000000 --- a/scene/3d/proximity_group_3d.h +++ /dev/null @@ -1,85 +0,0 @@ -/*************************************************************************/ -/* proximity_group_3d.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ - -#ifndef PROXIMITY_GROUP_H -#define PROXIMITY_GROUP_H - -#include "node_3d.h" - -class ProximityGroup3D : public Node3D { - GDCLASS(ProximityGroup3D, Node3D); - -public: - enum DispatchMode { - MODE_PROXY, - MODE_SIGNAL, - }; - -private: - Map<StringName, uint32_t> groups; - - String group_name; - DispatchMode dispatch_mode = MODE_PROXY; - Vector3 grid_radius = Vector3(1, 1, 1); - - real_t cell_size = 1.0; - uint32_t group_version = 0; - - void _clear_groups(); - void _update_groups(); - void _add_groups(int *p_cell, String p_base, int p_depth); - void _new_group(StringName p_name); - - void _proximity_group_broadcast(String p_method, Variant p_parameters); - -protected: - void _notification(int p_what); - - static void _bind_methods(); - -public: - void set_group_name(const String &p_group_name); - String get_group_name() const; - - void set_dispatch_mode(DispatchMode p_mode); - DispatchMode get_dispatch_mode() const; - - void set_grid_radius(const Vector3 &p_radius); - Vector3 get_grid_radius() const; - - void broadcast(String p_method, Variant p_parameters); - - ProximityGroup3D(); - ~ProximityGroup3D() {} -}; - -VARIANT_ENUM_CAST(ProximityGroup3D::DispatchMode); - -#endif // PROXIMITY_GROUP_H diff --git a/scene/animation/animation_player.cpp b/scene/animation/animation_player.cpp index 93339711bd..b9435b6692 100644 --- a/scene/animation/animation_player.cpp +++ b/scene/animation/animation_player.cpp @@ -1754,7 +1754,7 @@ Ref<AnimatedValuesBackup> AnimationPlayer::backup_animated_values(Node *p_root_o Ref<AnimatedValuesBackup> AnimationPlayer::apply_reset(bool p_user_initiated) { ERR_FAIL_COND_V(!can_apply_reset(), Ref<AnimatedValuesBackup>()); - Ref<Animation> reset_anim = animation_set["RESET"].animation; + Ref<Animation> reset_anim = animation_set[SceneStringNames::get_singleton()->RESET].animation; ERR_FAIL_COND_V(reset_anim.is_null(), Ref<AnimatedValuesBackup>()); Node *root_node = get_node_or_null(root); @@ -1762,8 +1762,8 @@ Ref<AnimatedValuesBackup> AnimationPlayer::apply_reset(bool p_user_initiated) { AnimationPlayer *aux_player = memnew(AnimationPlayer); EditorNode::get_singleton()->add_child(aux_player); - aux_player->add_animation("RESET", reset_anim); - aux_player->set_assigned_animation("RESET"); + aux_player->add_animation(SceneStringNames::get_singleton()->RESET, reset_anim); + aux_player->set_assigned_animation(SceneStringNames::get_singleton()->RESET); // Forcing the use of the original root because the scene where original player belongs may be not the active one Node *root = get_node(get_root()); Ref<AnimatedValuesBackup> old_values = aux_player->backup_animated_values(root); @@ -1785,7 +1785,7 @@ Ref<AnimatedValuesBackup> AnimationPlayer::apply_reset(bool p_user_initiated) { } bool AnimationPlayer::can_apply_reset() const { - return has_animation("RESET") && playback.assigned != StringName("RESET"); + return has_animation(SceneStringNames::get_singleton()->RESET) && playback.assigned != SceneStringNames::get_singleton()->RESET; } #endif diff --git a/scene/gui/box_container.cpp b/scene/gui/box_container.cpp index cb9f13e970..83c392614b 100644 --- a/scene/gui/box_container.cpp +++ b/scene/gui/box_container.cpp @@ -295,7 +295,7 @@ void BoxContainer::_notification(int p_what) { _resort(); } break; case NOTIFICATION_THEME_CHANGED: { - minimum_size_changed(); + update_minimum_size(); } break; case NOTIFICATION_TRANSLATION_CHANGED: case NOTIFICATION_LAYOUT_DIRECTION_CHANGED: { diff --git a/scene/gui/button.cpp b/scene/gui/button.cpp index 9818c8f0cc..2932707401 100644 --- a/scene/gui/button.cpp +++ b/scene/gui/button.cpp @@ -82,13 +82,13 @@ void Button::_notification(int p_what) { xl_text = atr(text); _shape(); - minimum_size_changed(); + update_minimum_size(); update(); } break; case NOTIFICATION_THEME_CHANGED: { _shape(); - minimum_size_changed(); + update_minimum_size(); update(); } break; case NOTIFICATION_DRAW: { @@ -368,7 +368,7 @@ void Button::set_text(const String &p_text) { _shape(); update(); - minimum_size_changed(); + update_minimum_size(); } } @@ -428,7 +428,7 @@ void Button::set_icon(const Ref<Texture2D> &p_icon) { if (icon != p_icon) { icon = p_icon; update(); - minimum_size_changed(); + update_minimum_size(); } } @@ -440,7 +440,7 @@ void Button::set_expand_icon(bool p_enabled) { if (expand_icon != p_enabled) { expand_icon = p_enabled; update(); - minimum_size_changed(); + update_minimum_size(); } } @@ -463,7 +463,7 @@ void Button::set_clip_text(bool p_enabled) { if (clip_text != p_enabled) { clip_text = p_enabled; update(); - minimum_size_changed(); + update_minimum_size(); } } @@ -484,7 +484,7 @@ Button::TextAlign Button::get_text_align() const { void Button::set_icon_align(TextAlign p_align) { icon_align = p_align; - minimum_size_changed(); + update_minimum_size(); update(); } diff --git a/scene/gui/center_container.cpp b/scene/gui/center_container.cpp index 909516e7ef..e17552006f 100644 --- a/scene/gui/center_container.cpp +++ b/scene/gui/center_container.cpp @@ -61,7 +61,7 @@ void CenterContainer::set_use_top_left(bool p_enable) { use_top_left = p_enable; - minimum_size_changed(); + update_minimum_size(); queue_sort(); } diff --git a/scene/gui/container.cpp b/scene/gui/container.cpp index a1bd82f6f7..81afa53d85 100644 --- a/scene/gui/container.cpp +++ b/scene/gui/container.cpp @@ -35,7 +35,7 @@ void Container::_child_minsize_changed() { //Size2 ms = get_combined_minimum_size(); //if (ms.width > get_size().width || ms.height > get_size().height) { - minimum_size_changed(); + update_minimum_size(); queue_sort(); } @@ -51,7 +51,7 @@ void Container::add_child_notify(Node *p_child) { control->connect(SNAME("minimum_size_changed"), callable_mp(this, &Container::_child_minsize_changed)); control->connect(SNAME("visibility_changed"), callable_mp(this, &Container::_child_minsize_changed)); - minimum_size_changed(); + update_minimum_size(); queue_sort(); } @@ -62,7 +62,7 @@ void Container::move_child_notify(Node *p_child) { return; } - minimum_size_changed(); + update_minimum_size(); queue_sort(); } @@ -78,7 +78,7 @@ void Container::remove_child_notify(Node *p_child) { control->disconnect("minimum_size_changed", callable_mp(this, &Container::_child_minsize_changed)); control->disconnect("visibility_changed", callable_mp(this, &Container::_child_minsize_changed)); - minimum_size_changed(); + update_minimum_size(); queue_sort(); } diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp index 9f715be155..fd6fb48412 100644 --- a/scene/gui/control.cpp +++ b/scene/gui/control.cpp @@ -192,7 +192,7 @@ void Control::set_custom_minimum_size(const Size2 &p_custom) { return; } data.custom_minimum_size = p_custom; - minimum_size_changed(); + update_minimum_size(); } Size2 Control::get_custom_minimum_size() const { @@ -213,7 +213,7 @@ void Control::_update_minimum_size_cache() { data.minimum_size_valid = true; if (size_changed) { - minimum_size_changed(); + update_minimum_size(); } } @@ -713,7 +713,7 @@ void Control::_notification(int p_notification) { update(); } break; case NOTIFICATION_THEME_CHANGED: { - minimum_size_changed(); + update_minimum_size(); update(); } break; case NOTIFICATION_VISIBILITY_CHANGED: { @@ -2534,7 +2534,7 @@ void Control::grab_click_focus() { get_viewport()->_gui_grab_click_focus(this); } -void Control::minimum_size_changed() { +void Control::update_minimum_size() { if (!is_inside_tree() || data.block_minimum_size_adjust) { return; } @@ -2590,7 +2590,7 @@ Control *Control::get_focus_owner() const { void Control::warp_mouse(const Point2 &p_to_pos) { ERR_FAIL_COND(!is_inside_tree()); - get_viewport()->warp_mouse(get_global_transform().xform(p_to_pos)); + get_viewport()->warp_mouse(get_screen_transform().xform(p_to_pos)); } bool Control::is_text_field() const { @@ -2696,7 +2696,7 @@ real_t Control::get_rotation() const { void Control::_override_changed() { notification(NOTIFICATION_THEME_CHANGED); emit_signal(SceneStringNames::get_singleton()->theme_changed); - minimum_size_changed(); // overrides are likely to affect minimum size + update_minimum_size(); // Overrides are likely to affect minimum size. } void Control::set_pivot_offset(const Vector2 &p_pivot) { @@ -2977,7 +2977,7 @@ void Control::_bind_methods() { ClassDB::bind_method(D_METHOD("warp_mouse", "to_position"), &Control::warp_mouse); - ClassDB::bind_method(D_METHOD("minimum_size_changed"), &Control::minimum_size_changed); + ClassDB::bind_method(D_METHOD("update_minimum_size"), &Control::update_minimum_size); ClassDB::bind_method(D_METHOD("set_layout_direction", "direction"), &Control::set_layout_direction); ClassDB::bind_method(D_METHOD("get_layout_direction"), &Control::get_layout_direction); diff --git a/scene/gui/control.h b/scene/gui/control.h index 1a94cc68a6..4cc949d0a8 100644 --- a/scene/gui/control.h +++ b/scene/gui/control.h @@ -441,7 +441,7 @@ public: void set_stretch_ratio(real_t p_ratio); real_t get_stretch_ratio() const; - void minimum_size_changed(); + void update_minimum_size(); /* FOCUS */ diff --git a/scene/gui/graph_edit.cpp b/scene/gui/graph_edit.cpp index e7d98a686f..b0050f028b 100644 --- a/scene/gui/graph_edit.cpp +++ b/scene/gui/graph_edit.cpp @@ -1166,7 +1166,7 @@ void GraphEdit::gui_input(const Ref<InputEvent> &p_ev) { top_layer->update(); minimap->update(); } else { - emit_signal(SNAME("popup_request"), b->get_global_position()); + emit_signal(SNAME("popup_request"), get_screen_position() + b->get_position()); } } } diff --git a/scene/gui/graph_node.cpp b/scene/gui/graph_node.cpp index e7094c89b1..3177911a70 100644 --- a/scene/gui/graph_node.cpp +++ b/scene/gui/graph_node.cpp @@ -442,7 +442,7 @@ void GraphNode::_notification(int p_what) { case NOTIFICATION_THEME_CHANGED: { _shape(); - minimum_size_changed(); + update_minimum_size(); update(); } break; } @@ -666,7 +666,7 @@ void GraphNode::set_title(const String &p_title) { _shape(); update(); - minimum_size_changed(); + update_minimum_size(); } String GraphNode::get_title() const { diff --git a/scene/gui/grid_container.cpp b/scene/gui/grid_container.cpp index 2beb2624d2..624330cdf6 100644 --- a/scene/gui/grid_container.cpp +++ b/scene/gui/grid_container.cpp @@ -182,7 +182,7 @@ void GridContainer::_notification(int p_what) { } break; case NOTIFICATION_THEME_CHANGED: { - minimum_size_changed(); + update_minimum_size(); } break; case NOTIFICATION_TRANSLATION_CHANGED: case NOTIFICATION_LAYOUT_DIRECTION_CHANGED: { @@ -195,7 +195,7 @@ void GridContainer::set_columns(int p_columns) { ERR_FAIL_COND(p_columns < 1); columns = p_columns; queue_sort(); - minimum_size_changed(); + update_minimum_size(); } int GridContainer::get_columns() const { diff --git a/scene/gui/item_list.cpp b/scene/gui/item_list.cpp index 408ef53e89..93859cd4d6 100644 --- a/scene/gui/item_list.cpp +++ b/scene/gui/item_list.cpp @@ -1037,7 +1037,7 @@ void ItemList::_notification(int p_what) { } } - minimum_size_changed(); + update_minimum_size(); shape_changed = false; } diff --git a/scene/gui/label.cpp b/scene/gui/label.cpp index 50908f6a77..3e1b9c9ceb 100644 --- a/scene/gui/label.cpp +++ b/scene/gui/label.cpp @@ -44,7 +44,7 @@ void Label::set_autowrap_mode(Label::AutowrapMode p_mode) { update(); if (clip || overrun_behavior != OVERRUN_NO_TRIMMING) { - minimum_size_changed(); + update_minimum_size(); } } @@ -207,7 +207,7 @@ void Label::_shape() { _update_visible(); if (autowrap_mode == AUTOWRAP_OFF || !clip || overrun_behavior == OVERRUN_NO_TRIMMING) { - minimum_size_changed(); + update_minimum_size(); } } @@ -592,7 +592,7 @@ void Label::set_text(const String &p_string) { visible_chars = get_total_character_count() * percent_visible; } update(); - minimum_size_changed(); + update_minimum_size(); } void Label::set_text_direction(Control::TextDirection p_text_direction) { @@ -668,7 +668,7 @@ String Label::get_language() const { void Label::set_clip_text(bool p_clip) { clip = p_clip; update(); - minimum_size_changed(); + update_minimum_size(); } bool Label::is_clipping_text() const { @@ -682,7 +682,7 @@ void Label::set_text_overrun_behavior(Label::OverrunBehavior p_behavior) { } update(); if (clip || overrun_behavior != OVERRUN_NO_TRIMMING) { - minimum_size_changed(); + update_minimum_size(); } } diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp index 30a6f0fc9a..80f723de62 100644 --- a/scene/gui/line_edit.cpp +++ b/scene/gui/line_edit.cpp @@ -227,7 +227,7 @@ void LineEdit::gui_input(const Ref<InputEvent> &p_event) { } if (b->is_pressed() && b->get_button_index() == MouseButton::RIGHT && context_menu_enabled) { _ensure_menu(); - menu->set_position(get_screen_transform().xform(get_local_mouse_position())); + menu->set_position(get_screen_position() + get_local_mouse_position()); menu->reset_size(); menu->popup(); grab_focus(); @@ -392,7 +392,7 @@ void LineEdit::gui_input(const Ref<InputEvent> &p_event) { if (k->is_action("ui_menu", true)) { _ensure_menu(); Point2 pos = Point2(get_caret_pixel_pos().x, (get_size().y + get_theme_font(SNAME("font"))->get_height(get_theme_font_size(SNAME("font_size")))) / 2); - menu->set_position(get_global_transform().xform(pos)); + menu->set_position(get_screen_position() + pos); menu->reset_size(); menu->popup(); menu->grab_focus(); @@ -1718,7 +1718,7 @@ void LineEdit::set_editable(bool p_editable) { editable = p_editable; - minimum_size_changed(); + update_minimum_size(); update(); } @@ -1948,7 +1948,7 @@ void LineEdit::_editor_settings_changed() { void LineEdit::set_expand_to_text_length_enabled(bool p_enabled) { expand_to_text_length = p_enabled; - minimum_size_changed(); + update_minimum_size(); set_caret_column(caret_column); } @@ -1962,7 +1962,7 @@ void LineEdit::set_clear_button_enabled(bool p_enabled) { } clear_button_enabled = p_enabled; _fit_to_width(); - minimum_size_changed(); + update_minimum_size(); update(); } @@ -2023,7 +2023,7 @@ void LineEdit::set_right_icon(const Ref<Texture2D> &p_icon) { } right_icon = p_icon; _fit_to_width(); - minimum_size_changed(); + update_minimum_size(); update(); } @@ -2087,7 +2087,7 @@ void LineEdit::_shape() { Size2 size = TS->shaped_text_get_size(text_rid); if ((expand_to_text_length && old_size.x != size.x) || (old_size.y != size.y)) { - minimum_size_changed(); + update_minimum_size(); } } diff --git a/scene/gui/link_button.cpp b/scene/gui/link_button.cpp index c3201186ea..9856247b7c 100644 --- a/scene/gui/link_button.cpp +++ b/scene/gui/link_button.cpp @@ -52,7 +52,7 @@ void LinkButton::set_text(const String &p_text) { text = p_text; xl_text = atr(text); _shape(); - minimum_size_changed(); + update_minimum_size(); update(); } @@ -149,7 +149,7 @@ void LinkButton::_notification(int p_what) { xl_text = atr(text); _shape(); - minimum_size_changed(); + update_minimum_size(); update(); } break; case NOTIFICATION_LAYOUT_DIRECTION_CHANGED: { @@ -157,7 +157,7 @@ void LinkButton::_notification(int p_what) { } break; case NOTIFICATION_THEME_CHANGED: { _shape(); - minimum_size_changed(); + update_minimum_size(); update(); } break; case NOTIFICATION_DRAW: { diff --git a/scene/gui/margin_container.cpp b/scene/gui/margin_container.cpp index 50b4d192a9..af239d67ae 100644 --- a/scene/gui/margin_container.cpp +++ b/scene/gui/margin_container.cpp @@ -90,7 +90,7 @@ void MarginContainer::_notification(int p_what) { } } break; case NOTIFICATION_THEME_CHANGED: { - minimum_size_changed(); + update_minimum_size(); } break; } } diff --git a/scene/gui/nine_patch_rect.cpp b/scene/gui/nine_patch_rect.cpp index 8bf25ac915..ea5c82306d 100644 --- a/scene/gui/nine_patch_rect.cpp +++ b/scene/gui/nine_patch_rect.cpp @@ -97,7 +97,7 @@ void NinePatchRect::set_texture(const Ref<Texture2D> &p_tex) { if (texture.is_valid()) texture->set_flags(texture->get_flags()&(~Texture::FLAG_REPEAT)); //remove repeat from texture, it looks bad in sprites */ - minimum_size_changed(); + update_minimum_size(); emit_signal(SceneStringNames::get_singleton()->texture_changed); } @@ -109,7 +109,7 @@ void NinePatchRect::set_patch_margin(Side p_side, int p_size) { ERR_FAIL_INDEX((int)p_side, 4); margin[p_side] = p_size; update(); - minimum_size_changed(); + update_minimum_size(); } int NinePatchRect::get_patch_margin(Side p_side) const { diff --git a/scene/gui/popup_menu.cpp b/scene/gui/popup_menu.cpp index 2e854abb76..e67b54eaf9 100644 --- a/scene/gui/popup_menu.cpp +++ b/scene/gui/popup_menu.cpp @@ -216,7 +216,7 @@ void PopupMenu::_activate_submenu(int p_over) { submenu_pos.x = this_pos.x + submenu_size.width; } - if (submenu_pos.x + submenu_size.width > get_parent_rect().size.width) { + if (submenu_pos.x + submenu_size.width > get_parent_rect().position.x + get_parent_rect().size.width) { submenu_pos.x = this_pos.x - submenu_size.width; } diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp index fd19fad667..2cb6ef91b5 100644 --- a/scene/gui/rich_text_label.cpp +++ b/scene/gui/rich_text_label.cpp @@ -2190,7 +2190,7 @@ void RichTextLabel::_validate_line_caches(ItemFrame *p_frame) { updating_scroll = false; if (fit_content_height) { - minimum_size_changed(); + update_minimum_size(); } return; } @@ -2227,7 +2227,7 @@ void RichTextLabel::_validate_line_caches(ItemFrame *p_frame) { updating_scroll = false; if (fit_content_height) { - minimum_size_changed(); + update_minimum_size(); } } @@ -2324,7 +2324,7 @@ void RichTextLabel::_add_item(Item *p_item, bool p_enter, bool p_ensure_newline) _invalidate_current_line(current_frame); if (fixed_width != -1) { - minimum_size_changed(); + update_minimum_size(); } } @@ -2755,7 +2755,7 @@ void RichTextLabel::clear() { } if (fixed_width != -1) { - minimum_size_changed(); + update_minimum_size(); } } @@ -2772,7 +2772,7 @@ int RichTextLabel::get_tab_size() const { void RichTextLabel::set_fit_content_height(bool p_enabled) { if (p_enabled != fit_content_height) { fit_content_height = p_enabled; - minimum_size_changed(); + update_minimum_size(); } } @@ -4268,7 +4268,7 @@ int RichTextLabel::get_total_character_count() const { void RichTextLabel::set_fixed_size_to_width(int p_width) { fixed_width = p_width; - minimum_size_changed(); + update_minimum_size(); } Size2 RichTextLabel::get_minimum_size() const { diff --git a/scene/gui/scroll_container.cpp b/scene/gui/scroll_container.cpp index 7b2ea46e17..f89623630d 100644 --- a/scene/gui/scroll_container.cpp +++ b/scene/gui/scroll_container.cpp @@ -467,7 +467,7 @@ void ScrollContainer::set_enable_h_scroll(bool p_enable) { } scroll_h = p_enable; - minimum_size_changed(); + update_minimum_size(); queue_sort(); } @@ -481,7 +481,7 @@ void ScrollContainer::set_enable_v_scroll(bool p_enable) { } scroll_v = p_enable; - minimum_size_changed(); + update_minimum_size(); queue_sort(); } diff --git a/scene/gui/slider.cpp b/scene/gui/slider.cpp index 4cc425aad3..f8cabe172c 100644 --- a/scene/gui/slider.cpp +++ b/scene/gui/slider.cpp @@ -142,7 +142,7 @@ void Slider::gui_input(const Ref<InputEvent> &p_event) { void Slider::_notification(int p_what) { switch (p_what) { case NOTIFICATION_THEME_CHANGED: { - minimum_size_changed(); + update_minimum_size(); update(); } break; case NOTIFICATION_MOUSE_ENTER: { diff --git a/scene/gui/spin_box.cpp b/scene/gui/spin_box.cpp index f30206c943..94a4886fef 100644 --- a/scene/gui/spin_box.cpp +++ b/scene/gui/spin_box.cpp @@ -220,8 +220,8 @@ void SpinBox::_notification(int p_what) { } else if (p_what == NOTIFICATION_TRANSLATION_CHANGED) { _value_changed(0); } else if (p_what == NOTIFICATION_THEME_CHANGED) { - call_deferred(SNAME("minimum_size_changed")); - get_line_edit()->call_deferred(SNAME("minimum_size_changed")); + call_deferred(SNAME("update_minimum_size")); + get_line_edit()->call_deferred(SNAME("update_minimum_size")); } else if (p_what == NOTIFICATION_LAYOUT_DIRECTION_CHANGED || p_what == NOTIFICATION_TRANSLATION_CHANGED) { update(); } diff --git a/scene/gui/split_container.cpp b/scene/gui/split_container.cpp index 6b53c0220e..106bb7949f 100644 --- a/scene/gui/split_container.cpp +++ b/scene/gui/split_container.cpp @@ -201,7 +201,7 @@ void SplitContainer::_notification(int p_what) { } } break; case NOTIFICATION_THEME_CHANGED: { - minimum_size_changed(); + update_minimum_size(); } break; } } diff --git a/scene/gui/tab_bar.cpp b/scene/gui/tab_bar.cpp index c7d5a600a1..da23b0dde8 100644 --- a/scene/gui/tab_bar.cpp +++ b/scene/gui/tab_bar.cpp @@ -285,7 +285,7 @@ void TabBar::_notification(int p_what) { _shape(i); } _update_cache(); - minimum_size_changed(); + update_minimum_size(); update(); } break; case NOTIFICATION_RESIZED: { @@ -554,7 +554,7 @@ void TabBar::set_tab_title(int p_tab, const String &p_title) { tabs.write[p_tab].text = p_title; _shape(p_tab); update(); - minimum_size_changed(); + update_minimum_size(); } String TabBar::get_tab_title(int p_tab) const { @@ -621,7 +621,7 @@ void TabBar::set_tab_icon(int p_tab, const Ref<Texture2D> &p_icon) { ERR_FAIL_INDEX(p_tab, tabs.size()); tabs.write[p_tab].icon = p_icon; update(); - minimum_size_changed(); + update_minimum_size(); } Ref<Texture2D> TabBar::get_tab_icon(int p_tab) const { @@ -645,7 +645,7 @@ void TabBar::set_tab_right_button(int p_tab, const Ref<Texture2D> &p_right_butto tabs.write[p_tab].right_button = p_right_button; _update_cache(); update(); - minimum_size_changed(); + update_minimum_size(); } Ref<Texture2D> TabBar::get_tab_right_button(int p_tab) const { @@ -777,7 +777,7 @@ void TabBar::add_tab(const String &p_str, const Ref<Texture2D> &p_icon) { _update_cache(); call_deferred(SNAME("_update_hover")); update(); - minimum_size_changed(); + update_minimum_size(); } void TabBar::clear_tabs() { @@ -797,7 +797,7 @@ void TabBar::remove_tab(int p_idx) { _update_cache(); call_deferred(SNAME("_update_hover")); update(); - minimum_size_changed(); + update_minimum_size(); if (current < 0) { current = 0; @@ -945,7 +945,7 @@ void TabBar::set_clip_tabs(bool p_clip_tabs) { } clip_tabs = p_clip_tabs; update(); - minimum_size_changed(); + update_minimum_size(); } bool TabBar::get_clip_tabs() const { diff --git a/scene/gui/tab_container.cpp b/scene/gui/tab_container.cpp index ff53d91ea3..562f523f53 100644 --- a/scene/gui/tab_container.cpp +++ b/scene/gui/tab_container.cpp @@ -600,7 +600,7 @@ void TabContainer::_on_theme_changed() { _refresh_texts(); - minimum_size_changed(); + update_minimum_size(); if (get_tab_count() > 0) { _repaint(); update(); @@ -995,7 +995,7 @@ void TabContainer::set_tabs_visible(bool p_visible) { } update(); - minimum_size_changed(); + update_minimum_size(); } bool TabContainer::are_tabs_visible() const { diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index bc30bf4447..c54b4dda00 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -1624,7 +1624,7 @@ void TextEdit::gui_input(const Ref<InputEvent> &p_gui_input) { } _generate_context_menu(); - menu->set_position(get_screen_transform().xform(mpos)); + menu->set_position(get_screen_position() + mpos); menu->reset_size(); menu->popup(); grab_focus(); @@ -1871,7 +1871,7 @@ void TextEdit::gui_input(const Ref<InputEvent> &p_gui_input) { if (context_menu_enabled) { _generate_context_menu(); adjust_viewport_to_caret(); - menu->set_position(get_screen_transform().xform(get_caret_draw_pos())); + menu->set_position(get_screen_position() + get_caret_draw_pos()); menu->reset_size(); menu->popup(); menu->grab_focus(); diff --git a/scene/gui/texture_button.cpp b/scene/gui/texture_button.cpp index 8659ea06a2..3f0d907a7e 100644 --- a/scene/gui/texture_button.cpp +++ b/scene/gui/texture_button.cpp @@ -289,19 +289,19 @@ void TextureButton::_bind_methods() { void TextureButton::set_normal_texture(const Ref<Texture2D> &p_normal) { normal = p_normal; update(); - minimum_size_changed(); + update_minimum_size(); } void TextureButton::set_pressed_texture(const Ref<Texture2D> &p_pressed) { pressed = p_pressed; update(); - minimum_size_changed(); + update_minimum_size(); } void TextureButton::set_hover_texture(const Ref<Texture2D> &p_hover) { hover = p_hover; update(); - minimum_size_changed(); + update_minimum_size(); } void TextureButton::set_disabled_texture(const Ref<Texture2D> &p_disabled) { @@ -312,7 +312,7 @@ void TextureButton::set_disabled_texture(const Ref<Texture2D> &p_disabled) { void TextureButton::set_click_mask(const Ref<BitMap> &p_click_mask) { click_mask = p_click_mask; update(); - minimum_size_changed(); + update_minimum_size(); } Ref<Texture2D> TextureButton::get_normal_texture() const { @@ -349,7 +349,7 @@ bool TextureButton::get_expand() const { void TextureButton::set_expand(bool p_expand) { expand = p_expand; - minimum_size_changed(); + update_minimum_size(); update(); } diff --git a/scene/gui/texture_progress_bar.cpp b/scene/gui/texture_progress_bar.cpp index 3c10c6bd66..6a926a0364 100644 --- a/scene/gui/texture_progress_bar.cpp +++ b/scene/gui/texture_progress_bar.cpp @@ -35,7 +35,7 @@ void TextureProgressBar::set_under_texture(const Ref<Texture2D> &p_texture) { under = p_texture; update(); - minimum_size_changed(); + update_minimum_size(); } Ref<Texture2D> TextureProgressBar::get_under_texture() const { @@ -46,7 +46,7 @@ void TextureProgressBar::set_over_texture(const Ref<Texture2D> &p_texture) { over = p_texture; update(); if (under.is_null()) { - minimum_size_changed(); + update_minimum_size(); } } @@ -58,7 +58,7 @@ void TextureProgressBar::set_stretch_margin(Side p_side, int p_size) { ERR_FAIL_INDEX((int)p_side, 4); stretch_margin[p_side] = p_size; update(); - minimum_size_changed(); + update_minimum_size(); } int TextureProgressBar::get_stretch_margin(Side p_side) const { @@ -69,7 +69,7 @@ int TextureProgressBar::get_stretch_margin(Side p_side) const { void TextureProgressBar::set_nine_patch_stretch(bool p_stretch) { nine_patch_stretch = p_stretch; update(); - minimum_size_changed(); + update_minimum_size(); } bool TextureProgressBar::get_nine_patch_stretch() const { @@ -93,7 +93,7 @@ Size2 TextureProgressBar::get_minimum_size() const { void TextureProgressBar::set_progress_texture(const Ref<Texture2D> &p_texture) { progress = p_texture; update(); - minimum_size_changed(); + update_minimum_size(); } Ref<Texture2D> TextureProgressBar::get_progress_texture() const { diff --git a/scene/gui/texture_rect.cpp b/scene/gui/texture_rect.cpp index 1cba88e06f..85c15cdae7 100644 --- a/scene/gui/texture_rect.cpp +++ b/scene/gui/texture_rect.cpp @@ -152,7 +152,7 @@ void TextureRect::_bind_methods() { void TextureRect::_texture_changed() { if (texture.is_valid()) { update(); - minimum_size_changed(); + update_minimum_size(); } } @@ -172,7 +172,7 @@ void TextureRect::set_texture(const Ref<Texture2D> &p_tex) { } update(); - minimum_size_changed(); + update_minimum_size(); } Ref<Texture2D> TextureRect::get_texture() const { @@ -182,7 +182,7 @@ Ref<Texture2D> TextureRect::get_texture() const { void TextureRect::set_expand(bool p_expand) { expand = p_expand; update(); - minimum_size_changed(); + update_minimum_size(); } bool TextureRect::has_expand() const { diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp index 7c0612036d..050ba9f519 100644 --- a/scene/gui/tree.cpp +++ b/scene/gui/tree.cpp @@ -2532,7 +2532,7 @@ int Tree::propagate_mouse_event(const Point2i &p_pos, int x_ofs, int y_ofs, int } popup_menu->set_size(Size2(col_width, 0)); - popup_menu->set_position(get_global_position() + Point2i(col_ofs, _get_title_button_height() + y_ofs + item_h) - cache.offset); + popup_menu->set_position(get_screen_position() + Point2i(col_ofs, _get_title_button_height() + y_ofs + item_h) - cache.offset); popup_menu->popup(); popup_edited_item = p_item; popup_edited_item_col = col; @@ -3441,7 +3441,7 @@ bool Tree::edit_selected() { } popup_menu->set_size(Size2(rect.size.width, 0)); - popup_menu->set_position(get_global_position() + rect.position + Point2i(0, rect.size.height)); + popup_menu->set_position(get_screen_position() + rect.position + Point2i(0, rect.size.height)); popup_menu->popup(); popup_edited_item = s; popup_edited_item_col = col; @@ -4370,7 +4370,7 @@ void Tree::scroll_to_item(TreeItem *p_item) { void Tree::set_h_scroll_enabled(bool p_enable) { h_scroll_enabled = p_enable; - minimum_size_changed(); + update_minimum_size(); } bool Tree::is_h_scroll_enabled() const { @@ -4379,7 +4379,7 @@ bool Tree::is_h_scroll_enabled() const { void Tree::set_v_scroll_enabled(bool p_enable) { v_scroll_enabled = p_enable; - minimum_size_changed(); + update_minimum_size(); } bool Tree::is_v_scroll_enabled() const { diff --git a/scene/gui/video_player.cpp b/scene/gui/video_player.cpp index 989aabc549..55b7f01fd5 100644 --- a/scene/gui/video_player.cpp +++ b/scene/gui/video_player.cpp @@ -191,7 +191,7 @@ Size2 VideoPlayer::get_minimum_size() const { void VideoPlayer::set_expand(bool p_expand) { expand = p_expand; update(); - minimum_size_changed(); + update_minimum_size(); } bool VideoPlayer::has_expand() const { @@ -241,7 +241,7 @@ void VideoPlayer::set_stream(const Ref<VideoStream> &p_stream) { update(); if (!expand) { - minimum_size_changed(); + update_minimum_size(); } }; diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index 007e5d1173..af4032a77d 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -1183,7 +1183,7 @@ void Viewport::_gui_show_tooltip() { Control *tooltip_owner = nullptr; String tooltip_text = _gui_get_tooltip( gui.tooltip_control, - gui.tooltip_control->get_global_transform().xform_inv(gui.last_mouse_pos), + gui.tooltip_control->get_screen_transform().xform_inv(gui.last_mouse_pos), &tooltip_owner); tooltip_text = tooltip_text.strip_edges(); if (tooltip_text.is_empty()) { @@ -1712,7 +1712,7 @@ void Viewport::_gui_input_event(Ref<InputEvent> p_event) { if (gui.tooltip_popup) { if (gui.tooltip_control) { - String tooltip = _gui_get_tooltip(over, gui.tooltip_control->get_global_transform().xform_inv(mpos)); + String tooltip = _gui_get_tooltip(over, gui.tooltip_control->get_screen_transform().xform_inv(mpos)); if (tooltip.length() == 0) { _gui_cancel_tooltip(); diff --git a/scene/register_scene_types.cpp b/scene/register_scene_types.cpp index b1178b9263..664a67931a 100644 --- a/scene/register_scene_types.cpp +++ b/scene/register_scene_types.cpp @@ -232,7 +232,6 @@ #include "scene/3d/path_3d.h" #include "scene/3d/physics_body_3d.h" #include "scene/3d/position_3d.h" -#include "scene/3d/proximity_group_3d.h" #include "scene/3d/ray_cast_3d.h" #include "scene/3d/reflection_probe.h" #include "scene/3d/remote_transform_3d.h" @@ -511,7 +510,6 @@ void register_scene_types() { GDREGISTER_CLASS(VehicleBody3D); GDREGISTER_CLASS(VehicleWheel3D); GDREGISTER_CLASS(Area3D); - GDREGISTER_CLASS(ProximityGroup3D); GDREGISTER_CLASS(CollisionShape3D); GDREGISTER_CLASS(CollisionPolygon3D); GDREGISTER_CLASS(RayCast3D); @@ -964,7 +962,6 @@ void register_scene_types() { ClassDB::add_compatibility_class("PinJoint", "PinJoint3D"); ClassDB::add_compatibility_class("PlaneShape", "WorldBoundaryShape3D"); ClassDB::add_compatibility_class("ProceduralSky", "Sky"); - ClassDB::add_compatibility_class("ProximityGroup", "ProximityGroup3D"); ClassDB::add_compatibility_class("RayCast", "RayCast3D"); ClassDB::add_compatibility_class("RayShape", "SeparationRayShape3D"); ClassDB::add_compatibility_class("RayShape2D", "SeparationRayShape2D"); diff --git a/scene/resources/material.cpp b/scene/resources/material.cpp index 00c109f1a6..98bda4ad1b 100644 --- a/scene/resources/material.cpp +++ b/scene/resources/material.cpp @@ -2899,7 +2899,7 @@ bool StandardMaterial3D::_set(const StringName &p_name, const Variant &p_value) idx++; } - print_line("remapped parameter not found: " + String(p_name)); + WARN_PRINT("Godot 3.x SpatialMaterial remapped parameter not found: " + String(p_name)); return true; } diff --git a/scene/resources/mesh.cpp b/scene/resources/mesh.cpp index 51b4e1fbd8..e14d6be235 100644 --- a/scene/resources/mesh.cpp +++ b/scene/resources/mesh.cpp @@ -994,9 +994,9 @@ bool ArrayMesh::_set(const StringName &p_name, const Variant &p_value) { } //clear unused flags - print_line("format pre: " + itos(old_format)); + print_verbose("Mesh format pre-conversion: " + itos(old_format)); - print_line("format post: " + itos(new_format)); + print_verbose("Mesh format post-conversion: " + itos(new_format)); ERR_FAIL_COND_V(!d.has("aabb"), false); AABB aabb = d["aabb"]; diff --git a/scene/scene_string_names.cpp b/scene/scene_string_names.cpp index 186764e69e..a5ed27cb7b 100644 --- a/scene/scene_string_names.cpp +++ b/scene/scene_string_names.cpp @@ -61,6 +61,7 @@ SceneStringNames::SceneStringNames() { animation_finished = StaticCString::create("animation_finished"); animation_changed = StaticCString::create("animation_changed"); animation_started = StaticCString::create("animation_started"); + RESET = StaticCString::create("RESET"); pose_updated = StaticCString::create("pose_updated"); bone_pose_changed = StaticCString::create("bone_pose_changed"); diff --git a/scene/scene_string_names.h b/scene/scene_string_names.h index 67007c85e0..b1ace1748c 100644 --- a/scene/scene_string_names.h +++ b/scene/scene_string_names.h @@ -97,6 +97,7 @@ public: StringName animation_finished; StringName animation_changed; StringName animation_started; + StringName RESET; StringName pose_updated; StringName bone_pose_changed; |