From de4a3fa151d2cef139149bb2b878ec8923ba2ce8 Mon Sep 17 00:00:00 2001 From: kobewi Date: Mon, 3 Jul 2023 21:29:37 +0200 Subject: [PATCH] Unify and streamline connecting to Resource changes --- core/io/resource.cpp | 36 ++++++++---------- core/io/resource.h | 11 ++---- doc/classes/CollisionShape3D.xml | 4 +- doc/classes/ShapeCast3D.xml | 4 +- editor/animation_track_editor.cpp | 4 +- editor/editor_node.cpp | 2 +- .../import/audio_stream_import_settings.cpp | 4 +- editor/plugins/audio_stream_editor_plugin.cpp | 5 +-- editor/plugins/curve_editor_plugin.cpp | 9 ++--- editor/plugins/gradient_editor.cpp | 2 +- .../gradient_texture_2d_editor_plugin.cpp | 2 +- editor/plugins/input_event_editor_plugin.cpp | 2 +- editor/plugins/node_3d_editor_plugin.cpp | 2 +- editor/plugins/polygon_3d_editor_plugin.cpp | 5 +-- editor/plugins/shader_file_editor_plugin.cpp | 4 +- editor/plugins/style_box_editor_plugin.cpp | 4 +- editor/plugins/text_shader_editor.cpp | 8 ++-- editor/plugins/texture_3d_editor_plugin.cpp | 6 +-- editor/plugins/texture_editor_plugin.cpp | 2 +- .../plugins/texture_layered_editor_plugin.cpp | 4 +- .../plugins/texture_region_editor_plugin.cpp | 9 ++--- editor/plugins/theme_editor_plugin.cpp | 16 ++++---- editor/plugins/tiles/tile_data_editors.cpp | 4 +- .../tiles/tile_set_atlas_source_editor.cpp | 6 +-- editor/plugins/tiles/tile_set_editor.cpp | 4 +- ...le_set_scenes_collection_source_editor.cpp | 4 +- .../plugins/visual_shader_editor_plugin.cpp | 29 +++++---------- modules/csg/csg_shape.cpp | 4 +- modules/gridmap/doc_classes/GridMap.xml | 4 +- modules/gridmap/grid_map.cpp | 13 +++---- modules/gridmap/grid_map.h | 2 + modules/noise/noise_texture_2d.cpp | 10 ++--- modules/noise/noise_texture_3d.cpp | 10 ++--- modules/noise/tests/test_noise_texture_2d.h | 8 ++-- modules/noise/tests/test_noise_texture_3d.h | 6 +-- scene/2d/collision_shape_2d.cpp | 4 +- scene/2d/cpu_particles_2d.cpp | 5 +-- scene/2d/gpu_particles_2d.cpp | 5 +-- scene/2d/light_occluder_2d.cpp | 4 +- scene/2d/line_2d.cpp | 9 ++--- scene/2d/multimesh_instance_2d.cpp | 5 +-- scene/2d/navigation_region_2d.cpp | 5 +-- scene/2d/path_2d.cpp | 4 +- scene/2d/physics_body_2d.cpp | 13 ++----- scene/2d/shape_cast_2d.cpp | 5 +-- scene/2d/sprite_2d.cpp | 5 +-- scene/2d/tile_map.cpp | 6 +-- scene/2d/touch_screen_button.cpp | 4 +- scene/3d/camera_3d.cpp | 5 +-- scene/3d/collision_object_3d.cpp | 14 +++---- scene/3d/collision_shape_3d.cpp | 17 ++++----- scene/3d/collision_shape_3d.h | 2 + scene/3d/gpu_particles_3d.cpp | 4 +- scene/3d/label_3d.cpp | 13 +++---- scene/3d/mesh_instance_3d.cpp | 5 +-- scene/3d/navigation_region_3d.cpp | 7 ++-- scene/3d/occluder_instance_3d.cpp | 5 +-- scene/3d/path_3d.cpp | 4 +- scene/3d/physics_body_3d.cpp | 13 ++----- scene/3d/shape_cast_3d.cpp | 21 +++-------- scene/3d/shape_cast_3d.h | 4 +- scene/3d/skeleton_3d.cpp | 2 +- scene/animation/animation_blend_tree.cpp | 8 ++-- scene/gui/button.cpp | 5 +-- scene/gui/control.cpp | 34 ++++++++--------- scene/gui/label.cpp | 5 +-- scene/gui/nine_patch_rect.cpp | 5 +-- scene/gui/popup_menu.cpp | 4 +- scene/gui/texture_button.cpp | 5 +-- scene/gui/texture_progress_bar.cpp | 5 +-- scene/gui/texture_rect.cpp | 5 +-- scene/main/viewport.cpp | 9 ++--- scene/main/window.cpp | 34 ++++++++--------- scene/resources/animation_library.cpp | 12 +++--- scene/resources/atlas_texture.cpp | 4 +- scene/resources/box_shape_3d.cpp | 2 +- scene/resources/capsule_shape_3d.cpp | 4 +- scene/resources/concave_polygon_shape_3d.cpp | 4 +- scene/resources/convex_polygon_shape_3d.cpp | 2 +- scene/resources/curve_texture.cpp | 16 ++++---- scene/resources/cylinder_shape_3d.cpp | 4 +- scene/resources/environment.cpp | 5 +-- scene/resources/font.cpp | 37 +++++++++---------- scene/resources/gradient_texture.cpp | 8 ++-- scene/resources/height_map_shape_3d.cpp | 6 +-- scene/resources/label_settings.cpp | 6 +-- scene/resources/material.cpp | 4 +- scene/resources/mesh_library.cpp | 8 ---- scene/resources/primitive_meshes.cpp | 13 +++---- scene/resources/separation_ray_shape_3d.cpp | 6 +-- scene/resources/shader.cpp | 4 +- scene/resources/shader_include.cpp | 4 +- scene/resources/sphere_shape_3d.cpp | 2 +- scene/resources/theme.cpp | 34 ++++++++--------- scene/resources/tile_set.cpp | 9 ++--- scene/resources/visual_shader.cpp | 6 +-- .../visual_shader_particle_nodes.cpp | 15 ++------ scene/resources/world_boundary_shape_3d.cpp | 2 +- 98 files changed, 341 insertions(+), 434 deletions(-) diff --git a/core/io/resource.cpp b/core/io/resource.cpp index 6b8ec8d5f667..07677337b43c 100644 --- a/core/io/resource.cpp +++ b/core/io/resource.cpp @@ -147,15 +147,28 @@ bool Resource::editor_can_reload_from_file() { return true; //by default yes } +void Resource::connect_changed(const Callable &p_callable, uint32_t p_flags) { + if (!is_connected(CoreStringNames::get_singleton()->changed, p_callable) || p_flags & CONNECT_REFERENCE_COUNTED) { + connect(CoreStringNames::get_singleton()->changed, p_callable, p_flags); + } +} + +void Resource::disconnect_changed(const Callable &p_callable) { + if (is_connected(CoreStringNames::get_singleton()->changed, p_callable)) { + disconnect(CoreStringNames::get_singleton()->changed, p_callable); + } +} + void Resource::reset_state() { } + Error Resource::copy_from(const Ref &p_resource) { ERR_FAIL_COND_V(p_resource.is_null(), ERR_INVALID_PARAMETER); if (get_class() != p_resource->get_class()) { return ERR_INVALID_PARAMETER; } - reset_state(); //may want to reset state + reset_state(); // May want to reset state. List pi; p_resource->get_property_list(&pi); @@ -322,23 +335,6 @@ RID Resource::get_rid() const { return RID(); } -void Resource::register_owner(Object *p_owner) { - owners.insert(p_owner->get_instance_id()); -} - -void Resource::unregister_owner(Object *p_owner) { - owners.erase(p_owner->get_instance_id()); -} - -void Resource::notify_change_to_owners() { - for (const ObjectID &E : owners) { - Object *obj = ObjectDB::get_instance(E); - ERR_CONTINUE_MSG(!obj, "Object was deleted, while still owning a resource."); //wtf - //TODO store string - obj->call("resource_changed", Ref(this)); - } -} - #ifdef TOOLS_ENABLED uint32_t Resource::hash_edited_version() const { @@ -443,6 +439,7 @@ void Resource::_bind_methods() { ClassDB::bind_method(D_METHOD("is_local_to_scene"), &Resource::is_local_to_scene); ClassDB::bind_method(D_METHOD("get_local_scene"), &Resource::get_local_scene); ClassDB::bind_method(D_METHOD("setup_local_to_scene"), &Resource::setup_local_to_scene); + ClassDB::bind_method(D_METHOD("emit_changed"), &Resource::emit_changed); ClassDB::bind_method(D_METHOD("duplicate", "subresources"), &Resource::duplicate, DEFVAL(false)); @@ -469,9 +466,6 @@ Resource::~Resource() { ResourceCache::resources.erase(path_cache); ResourceCache::lock.unlock(); } - if (owners.size()) { - WARN_PRINT("Resource is still owned."); - } } HashMap ResourceCache::resources; diff --git a/core/io/resource.h b/core/io/resource.h index 5135664f3632..af8c275a1c66 100644 --- a/core/io/resource.h +++ b/core/io/resource.h @@ -54,8 +54,6 @@ public: virtual String get_base_extension() const { return "res"; } private: - HashSet owners; - friend class ResBase; friend class ResourceCache; @@ -76,10 +74,6 @@ private: SelfList remapped_list; protected: - void emit_changed(); - - void notify_change_to_owners(); - virtual void _resource_path_changed(); static void _bind_methods(); @@ -96,8 +90,9 @@ public: virtual Error copy_from(const Ref &p_resource); virtual void reload_from_file(); - void register_owner(Object *p_owner); - void unregister_owner(Object *p_owner); + void emit_changed(); + void connect_changed(const Callable &p_callable, uint32_t p_flags = 0); + void disconnect_changed(const Callable &p_callable); void set_name(const String &p_name); String get_name() const; diff --git a/doc/classes/CollisionShape3D.xml b/doc/classes/CollisionShape3D.xml index 171deb9c626c..4e32545f279d 100644 --- a/doc/classes/CollisionShape3D.xml +++ b/doc/classes/CollisionShape3D.xml @@ -20,11 +20,11 @@ Sets the collision shape's shape to the addition of all its convexed [MeshInstance3D] siblings geometry. - + - If this method exists within a script it will be called whenever the shape resource has been modified. + [i]Obsoleted.[/i] Use [signal Resource.changed] instead. diff --git a/doc/classes/ShapeCast3D.xml b/doc/classes/ShapeCast3D.xml index 4bbf763a6e4b..ce7294409868 100644 --- a/doc/classes/ShapeCast3D.xml +++ b/doc/classes/ShapeCast3D.xml @@ -119,11 +119,11 @@ Removes a collision exception so the shape does report collisions with the specified [RID]. - + - This method is used internally to update the debug gizmo in the editor. Any code placed in this function will be called whenever the [member shape] resource is modified. + [i]Obsoleted.[/i] Use [signal Resource.changed] instead. diff --git a/editor/animation_track_editor.cpp b/editor/animation_track_editor.cpp index 24a6d89118d1..69728133f8c1 100644 --- a/editor/animation_track_editor.cpp +++ b/editor/animation_track_editor.cpp @@ -3297,7 +3297,7 @@ void AnimationTrackEditor::set_animation(const Ref &p_anim, bool p_re track_edits[_get_track_selected()]->release_focus(); } if (animation.is_valid()) { - animation->disconnect("changed", callable_mp(this, &AnimationTrackEditor::_animation_changed)); + animation->disconnect_changed(callable_mp(this, &AnimationTrackEditor::_animation_changed)); _clear_selection(); } animation = p_anim; @@ -3308,7 +3308,7 @@ void AnimationTrackEditor::set_animation(const Ref &p_anim, bool p_re _update_tracks(); if (animation.is_valid()) { - animation->connect("changed", callable_mp(this, &AnimationTrackEditor::_animation_changed)); + animation->connect_changed(callable_mp(this, &AnimationTrackEditor::_animation_changed)); hscroll->show(); edit->set_disabled(read_only); diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 0bdbf29ee170..4d8cf4fcdeb1 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -3192,7 +3192,7 @@ void EditorNode::add_editor_plugin(EditorPlugin *p_editor, bool p_config_changed if (icon.is_valid()) { tb->set_icon(icon); // Make sure the control is updated if the icon is reimported. - icon->connect("changed", callable_mp((Control *)tb, &Control::update_minimum_size)); + icon->connect_changed(callable_mp((Control *)tb, &Control::update_minimum_size)); } else if (singleton->gui_base->has_theme_icon(p_editor->get_name(), SNAME("EditorIcons"))) { tb->set_icon(singleton->gui_base->get_theme_icon(p_editor->get_name(), SNAME("EditorIcons"))); } diff --git a/editor/import/audio_stream_import_settings.cpp b/editor/import/audio_stream_import_settings.cpp index abf56c7ef8f6..1f7fbd8c5922 100644 --- a/editor/import/audio_stream_import_settings.cpp +++ b/editor/import/audio_stream_import_settings.cpp @@ -395,7 +395,7 @@ void AudioStreamImportSettings::_seek_to(real_t p_x) { void AudioStreamImportSettings::edit(const String &p_path, const String &p_importer, const Ref &p_stream) { if (!stream.is_null()) { - stream->disconnect("changed", callable_mp(this, &AudioStreamImportSettings::_audio_changed)); + stream->disconnect_changed(callable_mp(this, &AudioStreamImportSettings::_audio_changed)); } importer = p_importer; @@ -408,7 +408,7 @@ void AudioStreamImportSettings::edit(const String &p_path, const String &p_impor _duration_label->set_text(text); if (!stream.is_null()) { - stream->connect("changed", callable_mp(this, &AudioStreamImportSettings::_audio_changed)); + stream->connect_changed(callable_mp(this, &AudioStreamImportSettings::_audio_changed)); _preview->queue_redraw(); _indicator->queue_redraw(); color_rect->queue_redraw(); diff --git a/editor/plugins/audio_stream_editor_plugin.cpp b/editor/plugins/audio_stream_editor_plugin.cpp index e01849ff268c..89579150c2a3 100644 --- a/editor/plugins/audio_stream_editor_plugin.cpp +++ b/editor/plugins/audio_stream_editor_plugin.cpp @@ -30,7 +30,6 @@ #include "audio_stream_editor_plugin.h" -#include "core/core_string_names.h" #include "editor/audio_stream_preview.h" #include "editor/editor_scale.h" #include "editor/editor_settings.h" @@ -195,7 +194,7 @@ void AudioStreamEditor::_seek_to(real_t p_x) { void AudioStreamEditor::set_stream(const Ref &p_stream) { if (stream.is_valid()) { - stream->disconnect(CoreStringNames::get_singleton()->changed, callable_mp(this, &AudioStreamEditor::_stream_changed)); + stream->disconnect_changed(callable_mp(this, &AudioStreamEditor::_stream_changed)); } stream = p_stream; @@ -203,7 +202,7 @@ void AudioStreamEditor::set_stream(const Ref &p_stream) { hide(); return; } - stream->connect(CoreStringNames::get_singleton()->changed, callable_mp(this, &AudioStreamEditor::_stream_changed)); + stream->connect_changed(callable_mp(this, &AudioStreamEditor::_stream_changed)); _player->set_stream(stream); _current = 0; diff --git a/editor/plugins/curve_editor_plugin.cpp b/editor/plugins/curve_editor_plugin.cpp index 75be2b1a60d7..81be475d6461 100644 --- a/editor/plugins/curve_editor_plugin.cpp +++ b/editor/plugins/curve_editor_plugin.cpp @@ -31,7 +31,6 @@ #include "curve_editor_plugin.h" #include "canvas_item_editor_plugin.h" -#include "core/core_string_names.h" #include "core/input/input.h" #include "core/math/geometry_2d.h" #include "core/os/keyboard.h" @@ -62,15 +61,15 @@ void CurveEdit::set_curve(Ref p_curve) { } if (curve.is_valid()) { - curve->disconnect(CoreStringNames::get_singleton()->changed, callable_mp(this, &CurveEdit::_curve_changed)); - curve->disconnect(Curve::SIGNAL_RANGE_CHANGED, callable_mp(this, &CurveEdit::_curve_changed)); + curve->disconnect_changed(callable_mp(this, &CurveEdit::_curve_changed)); + curve->disconnect_changed(callable_mp(this, &CurveEdit::_curve_changed)); } curve = p_curve; if (curve.is_valid()) { - curve->connect(CoreStringNames::get_singleton()->changed, callable_mp(this, &CurveEdit::_curve_changed)); - curve->connect(Curve::SIGNAL_RANGE_CHANGED, callable_mp(this, &CurveEdit::_curve_changed)); + curve->connect_changed(callable_mp(this, &CurveEdit::_curve_changed)); + curve->connect_changed(callable_mp(this, &CurveEdit::_curve_changed)); } // Note: if you edit a curve, then set another, and try to undo, diff --git a/editor/plugins/gradient_editor.cpp b/editor/plugins/gradient_editor.cpp index e7fc2b1336a5..59bd0f02fc1f 100644 --- a/editor/plugins/gradient_editor.cpp +++ b/editor/plugins/gradient_editor.cpp @@ -39,7 +39,7 @@ void GradientEditor::set_gradient(const Ref &p_gradient) { gradient = p_gradient; connect("ramp_changed", callable_mp(this, &GradientEditor::_ramp_changed)); - gradient->connect("changed", callable_mp(this, &GradientEditor::_gradient_changed)); + gradient->connect_changed(callable_mp(this, &GradientEditor::_gradient_changed)); set_points(gradient->get_points()); set_interpolation_mode(gradient->get_interpolation_mode()); set_interpolation_color_space(gradient->get_interpolation_color_space()); diff --git a/editor/plugins/gradient_texture_2d_editor_plugin.cpp b/editor/plugins/gradient_texture_2d_editor_plugin.cpp index 034f531f44bb..c48de7c3ddd5 100644 --- a/editor/plugins/gradient_texture_2d_editor_plugin.cpp +++ b/editor/plugins/gradient_texture_2d_editor_plugin.cpp @@ -133,7 +133,7 @@ void GradientTexture2DEdit::gui_input(const Ref &p_event) { void GradientTexture2DEdit::set_texture(Ref &p_texture) { texture = p_texture; - texture->connect("changed", callable_mp((CanvasItem *)this, &CanvasItem::queue_redraw)); + texture->connect_changed(callable_mp((CanvasItem *)this, &CanvasItem::queue_redraw)); } void GradientTexture2DEdit::set_snap_enabled(bool p_snap_enabled) { diff --git a/editor/plugins/input_event_editor_plugin.cpp b/editor/plugins/input_event_editor_plugin.cpp index be36447432fd..9a54a8c1a144 100644 --- a/editor/plugins/input_event_editor_plugin.cpp +++ b/editor/plugins/input_event_editor_plugin.cpp @@ -77,7 +77,7 @@ void InputEventConfigContainer::set_event(const Ref &p_event) { input_event = p_event; _event_changed(); - input_event->connect("changed", callable_mp(this, &InputEventConfigContainer::_event_changed)); + input_event->connect_changed(callable_mp(this, &InputEventConfigContainer::_event_changed)); } InputEventConfigContainer::InputEventConfigContainer() { diff --git a/editor/plugins/node_3d_editor_plugin.cpp b/editor/plugins/node_3d_editor_plugin.cpp index d026916668dc..68d3661d10a6 100644 --- a/editor/plugins/node_3d_editor_plugin.cpp +++ b/editor/plugins/node_3d_editor_plugin.cpp @@ -4929,7 +4929,7 @@ void Node3DEditorViewport::register_shortcut_action(const String &p_path, const Ref sc = ED_SHORTCUT(p_path, p_name, p_keycode, p_physical); shortcut_changed_callback(sc, p_path); // Connect to the change event on the shortcut so the input binding can be updated. - sc->connect("changed", callable_mp(this, &Node3DEditorViewport::shortcut_changed_callback).bind(sc, p_path)); + sc->connect_changed(callable_mp(this, &Node3DEditorViewport::shortcut_changed_callback).bind(sc, p_path)); } // Update the action in the InputMap to the provided shortcut events. diff --git a/editor/plugins/polygon_3d_editor_plugin.cpp b/editor/plugins/polygon_3d_editor_plugin.cpp index efbb2b0d2bb1..ceff9cb5f331 100644 --- a/editor/plugins/polygon_3d_editor_plugin.cpp +++ b/editor/plugins/polygon_3d_editor_plugin.cpp @@ -30,7 +30,6 @@ #include "polygon_3d_editor_plugin.h" -#include "core/core_string_names.h" #include "core/input/input.h" #include "core/io/file_access.h" #include "core/math/geometry_2d.h" @@ -497,7 +496,7 @@ void Polygon3DEditor::edit(Node *p_node) { node_resource = node->call("_get_editable_3d_polygon_resource"); if (node_resource.is_valid()) { - node_resource->connect(CoreStringNames::get_singleton()->changed, callable_mp(this, &Polygon3DEditor::_polygon_draw)); + node_resource->connect_changed(callable_mp(this, &Polygon3DEditor::_polygon_draw)); } //Enable the pencil tool if the polygon is empty if (_get_polygon().is_empty()) { @@ -518,7 +517,7 @@ void Polygon3DEditor::edit(Node *p_node) { } else { node = nullptr; if (node_resource.is_valid()) { - node_resource->disconnect(CoreStringNames::get_singleton()->changed, callable_mp(this, &Polygon3DEditor::_polygon_draw)); + node_resource->disconnect_changed(callable_mp(this, &Polygon3DEditor::_polygon_draw)); } node_resource.unref(); diff --git a/editor/plugins/shader_file_editor_plugin.cpp b/editor/plugins/shader_file_editor_plugin.cpp index f9aa14dd090a..b0e532b13610 100644 --- a/editor/plugins/shader_file_editor_plugin.cpp +++ b/editor/plugins/shader_file_editor_plugin.cpp @@ -222,7 +222,7 @@ void ShaderFileEditor::_bind_methods() { void ShaderFileEditor::edit(const Ref &p_shader) { if (p_shader.is_null()) { if (shader_file.is_valid()) { - shader_file->disconnect("changed", callable_mp(this, &ShaderFileEditor::_shader_changed)); + shader_file->disconnect_changed(callable_mp(this, &ShaderFileEditor::_shader_changed)); } return; } @@ -234,7 +234,7 @@ void ShaderFileEditor::edit(const Ref &p_shader) { shader_file = p_shader; if (shader_file.is_valid()) { - shader_file->connect("changed", callable_mp(this, &ShaderFileEditor::_shader_changed)); + shader_file->connect_changed(callable_mp(this, &ShaderFileEditor::_shader_changed)); } _update_options(); diff --git a/editor/plugins/style_box_editor_plugin.cpp b/editor/plugins/style_box_editor_plugin.cpp index 16716e589e81..1d14f5e60b3d 100644 --- a/editor/plugins/style_box_editor_plugin.cpp +++ b/editor/plugins/style_box_editor_plugin.cpp @@ -43,11 +43,11 @@ void StyleBoxPreview::_grid_preview_toggled(bool p_active) { void StyleBoxPreview::edit(const Ref &p_stylebox) { if (stylebox.is_valid()) { - stylebox->disconnect("changed", callable_mp((CanvasItem *)this, &CanvasItem::queue_redraw)); + stylebox->disconnect_changed(callable_mp((CanvasItem *)this, &CanvasItem::queue_redraw)); } stylebox = p_stylebox; if (stylebox.is_valid()) { - stylebox->connect("changed", callable_mp((CanvasItem *)this, &CanvasItem::queue_redraw)); + stylebox->connect_changed(callable_mp((CanvasItem *)this, &CanvasItem::queue_redraw)); } Ref sbt = stylebox; grid_preview->set_visible(sbt.is_valid()); diff --git a/editor/plugins/text_shader_editor.cpp b/editor/plugins/text_shader_editor.cpp index 4838661fa881..ed98c7f85c5e 100644 --- a/editor/plugins/text_shader_editor.cpp +++ b/editor/plugins/text_shader_editor.cpp @@ -122,7 +122,7 @@ void ShaderTextEditor::set_edited_shader(const Ref &p_shader, const Stri return; } if (shader.is_valid()) { - shader->disconnect(SNAME("changed"), callable_mp(this, &ShaderTextEditor::_shader_changed)); + shader->disconnect_changed(callable_mp(this, &ShaderTextEditor::_shader_changed)); } shader = p_shader; shader_inc = Ref(); @@ -130,7 +130,7 @@ void ShaderTextEditor::set_edited_shader(const Ref &p_shader, const Stri set_edited_code(p_code); if (shader.is_valid()) { - shader->connect(SNAME("changed"), callable_mp(this, &ShaderTextEditor::_shader_changed)); + shader->connect_changed(callable_mp(this, &ShaderTextEditor::_shader_changed)); } } @@ -152,7 +152,7 @@ void ShaderTextEditor::set_edited_shader_include(const Ref &p_sha return; } if (shader_inc.is_valid()) { - shader_inc->disconnect(SNAME("changed"), callable_mp(this, &ShaderTextEditor::_shader_changed)); + shader_inc->disconnect_changed(callable_mp(this, &ShaderTextEditor::_shader_changed)); } shader_inc = p_shader_inc; shader = Ref(); @@ -160,7 +160,7 @@ void ShaderTextEditor::set_edited_shader_include(const Ref &p_sha set_edited_code(p_code); if (shader_inc.is_valid()) { - shader_inc->connect(SNAME("changed"), callable_mp(this, &ShaderTextEditor::_shader_changed)); + shader_inc->connect_changed(callable_mp(this, &ShaderTextEditor::_shader_changed)); } } diff --git a/editor/plugins/texture_3d_editor_plugin.cpp b/editor/plugins/texture_3d_editor_plugin.cpp index 9904b888f2d3..2702e941889f 100644 --- a/editor/plugins/texture_3d_editor_plugin.cpp +++ b/editor/plugins/texture_3d_editor_plugin.cpp @@ -115,7 +115,7 @@ void Texture3DEditor::_texture_rect_update_area() { void Texture3DEditor::edit(Ref p_texture) { if (!texture.is_null()) { - texture->disconnect("changed", callable_mp(this, &Texture3DEditor::_texture_changed)); + texture->disconnect_changed(callable_mp(this, &Texture3DEditor::_texture_changed)); } texture = p_texture; @@ -125,7 +125,7 @@ void Texture3DEditor::edit(Ref p_texture) { _make_shaders(); } - texture->connect("changed", callable_mp(this, &Texture3DEditor::_texture_changed)); + texture->connect_changed(callable_mp(this, &Texture3DEditor::_texture_changed)); queue_redraw(); texture_rect->set_material(material); setting = true; @@ -176,7 +176,7 @@ Texture3DEditor::Texture3DEditor() { Texture3DEditor::~Texture3DEditor() { if (!texture.is_null()) { - texture->disconnect("changed", callable_mp(this, &Texture3DEditor::_texture_changed)); + texture->disconnect_changed(callable_mp(this, &Texture3DEditor::_texture_changed)); } } diff --git a/editor/plugins/texture_editor_plugin.cpp b/editor/plugins/texture_editor_plugin.cpp index ee1a01eb9590..87b207ebcd44 100644 --- a/editor/plugins/texture_editor_plugin.cpp +++ b/editor/plugins/texture_editor_plugin.cpp @@ -140,7 +140,7 @@ TexturePreview::TexturePreview(Ref p_texture, bool p_show_metadata) { metadata_label = memnew(Label); _update_metadata_label_text(); - p_texture->connect("changed", callable_mp(this, &TexturePreview::_update_metadata_label_text)); + p_texture->connect_changed(callable_mp(this, &TexturePreview::_update_metadata_label_text)); // It's okay that these colors are static since the grid color is static too. metadata_label->add_theme_color_override("font_color", Color::named("white")); diff --git a/editor/plugins/texture_layered_editor_plugin.cpp b/editor/plugins/texture_layered_editor_plugin.cpp index 816d08161702..a0188b08e5c9 100644 --- a/editor/plugins/texture_layered_editor_plugin.cpp +++ b/editor/plugins/texture_layered_editor_plugin.cpp @@ -181,7 +181,7 @@ void TextureLayeredEditor::_texture_rect_update_area() { void TextureLayeredEditor::edit(Ref p_texture) { if (!texture.is_null()) { - texture->disconnect("changed", callable_mp(this, &TextureLayeredEditor::_texture_changed)); + texture->disconnect_changed(callable_mp(this, &TextureLayeredEditor::_texture_changed)); } texture = p_texture; @@ -191,7 +191,7 @@ void TextureLayeredEditor::edit(Ref p_texture) { _make_shaders(); } - texture->connect("changed", callable_mp(this, &TextureLayeredEditor::_texture_changed)); + texture->connect_changed(callable_mp(this, &TextureLayeredEditor::_texture_changed)); queue_redraw(); texture_rect->set_material(materials[texture->get_layered_type()]); setting = true; diff --git a/editor/plugins/texture_region_editor_plugin.cpp b/editor/plugins/texture_region_editor_plugin.cpp index 8e03b13481a6..19df31a0b340 100644 --- a/editor/plugins/texture_region_editor_plugin.cpp +++ b/editor/plugins/texture_region_editor_plugin.cpp @@ -30,7 +30,6 @@ #include "texture_region_editor_plugin.h" -#include "core/core_string_names.h" #include "core/input/input.h" #include "core/os/keyboard.h" #include "editor/editor_node.h" @@ -433,7 +432,7 @@ void TextureRegionEditor::_region_input(const Ref &p_input) { } else if (obj_styleBox.is_valid()) { undo_redo->add_do_method(obj_styleBox.ptr(), "set_texture_margin", side[edited_margin], obj_styleBox->get_texture_margin(side[edited_margin])); undo_redo->add_undo_method(obj_styleBox.ptr(), "set_texture_margin", side[edited_margin], prev_margin); - obj_styleBox->emit_signal(CoreStringNames::get_singleton()->changed); + obj_styleBox->emit_changed(); } edited_margin = -1; } else { @@ -913,10 +912,10 @@ void TextureRegionEditor::edit(Object *p_obj) { node_ninepatch->disconnect("texture_changed", callable_mp(this, &TextureRegionEditor::_texture_changed)); } if (obj_styleBox.is_valid()) { - obj_styleBox->disconnect("changed", callable_mp(this, &TextureRegionEditor::_texture_changed)); + obj_styleBox->disconnect_changed(callable_mp(this, &TextureRegionEditor::_texture_changed)); } if (atlas_tex.is_valid()) { - atlas_tex->disconnect("changed", callable_mp(this, &TextureRegionEditor::_texture_changed)); + atlas_tex->disconnect_changed(callable_mp(this, &TextureRegionEditor::_texture_changed)); } node_sprite_2d = nullptr; @@ -941,7 +940,7 @@ void TextureRegionEditor::edit(Object *p_obj) { } if (is_resource) { - p_obj->connect("changed", callable_mp(this, &TextureRegionEditor::_texture_changed)); + Object::cast_to(p_obj)->connect_changed(callable_mp(this, &TextureRegionEditor::_texture_changed)); } else { p_obj->connect("texture_changed", callable_mp(this, &TextureRegionEditor::_texture_changed)); } diff --git a/editor/plugins/theme_editor_plugin.cpp b/editor/plugins/theme_editor_plugin.cpp index 09053db122bf..a1ddfc4b8500 100644 --- a/editor/plugins/theme_editor_plugin.cpp +++ b/editor/plugins/theme_editor_plugin.cpp @@ -3151,7 +3151,7 @@ void ThemeTypeEditor::_stylebox_item_changed(Ref p_value, String p_ite void ThemeTypeEditor::_change_pinned_stylebox() { if (leading_stylebox.pinned) { if (leading_stylebox.stylebox.is_valid()) { - leading_stylebox.stylebox->disconnect("changed", callable_mp(this, &ThemeTypeEditor::_update_stylebox_from_leading)); + leading_stylebox.stylebox->disconnect_changed(callable_mp(this, &ThemeTypeEditor::_update_stylebox_from_leading)); } Ref new_stylebox = edited_theme->get_stylebox(leading_stylebox.item_name, edited_type); @@ -3159,10 +3159,10 @@ void ThemeTypeEditor::_change_pinned_stylebox() { leading_stylebox.ref_stylebox = (new_stylebox.is_valid() ? new_stylebox->duplicate() : Ref()); if (leading_stylebox.stylebox.is_valid()) { - new_stylebox->connect("changed", callable_mp(this, &ThemeTypeEditor::_update_stylebox_from_leading)); + new_stylebox->connect_changed(callable_mp(this, &ThemeTypeEditor::_update_stylebox_from_leading)); } } else if (leading_stylebox.stylebox.is_valid()) { - leading_stylebox.stylebox->disconnect("changed", callable_mp(this, &ThemeTypeEditor::_update_stylebox_from_leading)); + leading_stylebox.stylebox->disconnect_changed(callable_mp(this, &ThemeTypeEditor::_update_stylebox_from_leading)); } } @@ -3187,7 +3187,7 @@ void ThemeTypeEditor::_on_pin_leader_button_pressed(Control *p_editor, String p_ void ThemeTypeEditor::_pin_leading_stylebox(String p_item_name, Ref p_stylebox) { if (leading_stylebox.stylebox.is_valid()) { - leading_stylebox.stylebox->disconnect("changed", callable_mp(this, &ThemeTypeEditor::_update_stylebox_from_leading)); + leading_stylebox.stylebox->disconnect_changed(callable_mp(this, &ThemeTypeEditor::_update_stylebox_from_leading)); } LeadingStylebox leader; @@ -3198,7 +3198,7 @@ void ThemeTypeEditor::_pin_leading_stylebox(String p_item_name, Ref p_ leading_stylebox = leader; if (p_stylebox.is_valid()) { - p_stylebox->connect("changed", callable_mp(this, &ThemeTypeEditor::_update_stylebox_from_leading)); + p_stylebox->connect_changed(callable_mp(this, &ThemeTypeEditor::_update_stylebox_from_leading)); } _update_type_items(); @@ -3214,7 +3214,7 @@ void ThemeTypeEditor::_on_unpin_leader_button_pressed() { void ThemeTypeEditor::_unpin_leading_stylebox() { if (leading_stylebox.stylebox.is_valid()) { - leading_stylebox.stylebox->disconnect("changed", callable_mp(this, &ThemeTypeEditor::_update_stylebox_from_leading)); + leading_stylebox.stylebox->disconnect_changed(callable_mp(this, &ThemeTypeEditor::_update_stylebox_from_leading)); } LeadingStylebox leader; @@ -3337,12 +3337,12 @@ void ThemeTypeEditor::_bind_methods() { void ThemeTypeEditor::set_edited_theme(const Ref &p_theme) { if (edited_theme.is_valid()) { - edited_theme->disconnect("changed", callable_mp(this, &ThemeTypeEditor::_update_type_list_debounced)); + edited_theme->disconnect_changed(callable_mp(this, &ThemeTypeEditor::_update_type_list_debounced)); } edited_theme = p_theme; if (edited_theme.is_valid()) { - edited_theme->connect("changed", callable_mp(this, &ThemeTypeEditor::_update_type_list_debounced)); + edited_theme->connect_changed(callable_mp(this, &ThemeTypeEditor::_update_type_list_debounced)); _update_type_list(); } diff --git a/editor/plugins/tiles/tile_data_editors.cpp b/editor/plugins/tiles/tile_data_editors.cpp index 7767831ea3f3..24e61d7dc99d 100644 --- a/editor/plugins/tiles/tile_data_editors.cpp +++ b/editor/plugins/tiles/tile_data_editors.cpp @@ -88,11 +88,11 @@ void TileDataEditor::_bind_methods() { void TileDataEditor::set_tile_set(Ref p_tile_set) { if (tile_set.is_valid()) { - tile_set->disconnect("changed", callable_mp(this, &TileDataEditor::_tile_set_changed_plan_update)); + tile_set->disconnect_changed(callable_mp(this, &TileDataEditor::_tile_set_changed_plan_update)); } tile_set = p_tile_set; if (tile_set.is_valid()) { - tile_set->connect("changed", callable_mp(this, &TileDataEditor::_tile_set_changed_plan_update)); + tile_set->connect_changed(callable_mp(this, &TileDataEditor::_tile_set_changed_plan_update)); } _tile_set_changed_plan_update(); } diff --git a/editor/plugins/tiles/tile_set_atlas_source_editor.cpp b/editor/plugins/tiles/tile_set_atlas_source_editor.cpp index 4e8c28e99789..3a2d71ddf9a6 100644 --- a/editor/plugins/tiles/tile_set_atlas_source_editor.cpp +++ b/editor/plugins/tiles/tile_set_atlas_source_editor.cpp @@ -2104,7 +2104,7 @@ void TileSetAtlasSourceEditor::_tile_alternatives_control_unscaled_draw() { void TileSetAtlasSourceEditor::_tile_set_changed() { if (tile_set->get_source_count() == 0) { // No sources, so nothing to do here anymore. - tile_set->disconnect("changed", callable_mp(this, &TileSetAtlasSourceEditor::_tile_set_changed)); + tile_set->disconnect_changed(callable_mp(this, &TileSetAtlasSourceEditor::_tile_set_changed)); tile_set = Ref(); return; } @@ -2218,7 +2218,7 @@ void TileSetAtlasSourceEditor::edit(Ref p_tile_set, TileSetAtlasSource // Remove listener for old objects. if (tile_set.is_valid()) { - tile_set->disconnect("changed", callable_mp(this, &TileSetAtlasSourceEditor::_tile_set_changed)); + tile_set->disconnect_changed(callable_mp(this, &TileSetAtlasSourceEditor::_tile_set_changed)); } // Clear the selection. @@ -2233,7 +2233,7 @@ void TileSetAtlasSourceEditor::edit(Ref p_tile_set, TileSetAtlasSource read_only = new_read_only_state; if (tile_set.is_valid()) { - tile_set->connect("changed", callable_mp(this, &TileSetAtlasSourceEditor::_tile_set_changed)); + tile_set->connect_changed(callable_mp(this, &TileSetAtlasSourceEditor::_tile_set_changed)); } if (read_only && tools_button_group->get_pressed_button() == tool_paint_button) { diff --git a/editor/plugins/tiles/tile_set_editor.cpp b/editor/plugins/tiles/tile_set_editor.cpp index 9821588f63f7..9725ee72bb9e 100644 --- a/editor/plugins/tiles/tile_set_editor.cpp +++ b/editor/plugins/tiles/tile_set_editor.cpp @@ -723,7 +723,7 @@ void TileSetEditor::edit(Ref p_tile_set) { // Remove listener. if (tile_set.is_valid()) { - tile_set->disconnect("changed", callable_mp(this, &TileSetEditor::_tile_set_changed)); + tile_set->disconnect_changed(callable_mp(this, &TileSetEditor::_tile_set_changed)); } // Change the edited object. @@ -738,7 +738,7 @@ void TileSetEditor::edit(Ref p_tile_set) { sources_advanced_menu_button->set_disabled(read_only); source_sort_button->set_disabled(read_only); - tile_set->connect("changed", callable_mp(this, &TileSetEditor::_tile_set_changed)); + tile_set->connect_changed(callable_mp(this, &TileSetEditor::_tile_set_changed)); if (first_edit) { first_edit = false; _set_source_sort(EditorSettings::get_singleton()->get_project_metadata("editor_metadata", "tile_source_sort", 0)); diff --git a/editor/plugins/tiles/tile_set_scenes_collection_source_editor.cpp b/editor/plugins/tiles/tile_set_scenes_collection_source_editor.cpp index 6908dd7c3b23..5ffa7b4bd447 100644 --- a/editor/plugins/tiles/tile_set_scenes_collection_source_editor.cpp +++ b/editor/plugins/tiles/tile_set_scenes_collection_source_editor.cpp @@ -384,7 +384,7 @@ void TileSetScenesCollectionSourceEditor::edit(Ref p_tile_set, TileSetS // Remove listener for old objects. if (tile_set_scenes_collection_source) { - tile_set_scenes_collection_source->disconnect("changed", callable_mp(this, &TileSetScenesCollectionSourceEditor::_tile_set_scenes_collection_source_changed)); + tile_set_scenes_collection_source->disconnect_changed(callable_mp(this, &TileSetScenesCollectionSourceEditor::_tile_set_scenes_collection_source_changed)); } // Change the edited object. @@ -404,7 +404,7 @@ void TileSetScenesCollectionSourceEditor::edit(Ref p_tile_set, TileSetS // Add the listener again. if (tile_set_scenes_collection_source) { - tile_set_scenes_collection_source->connect("changed", callable_mp(this, &TileSetScenesCollectionSourceEditor::_tile_set_scenes_collection_source_changed)); + tile_set_scenes_collection_source->connect_changed(callable_mp(this, &TileSetScenesCollectionSourceEditor::_tile_set_scenes_collection_source_changed)); } // Update everything. diff --git a/editor/plugins/visual_shader_editor_plugin.cpp b/editor/plugins/visual_shader_editor_plugin.cpp index 2f37c2ccb2d8..bd30c3b6b718 100644 --- a/editor/plugins/visual_shader_editor_plugin.cpp +++ b/editor/plugins/visual_shader_editor_plugin.cpp @@ -31,7 +31,6 @@ #include "visual_shader_editor_plugin.h" #include "core/config/project_settings.h" -#include "core/core_string_names.h" #include "core/io/resource_loader.h" #include "core/math/math_defs.h" #include "core/os/keyboard.h" @@ -242,7 +241,7 @@ void VisualShaderGraphPlugin::update_curve(int p_node_id) { if (tex->get_texture().is_valid()) { links[p_node_id].curve_editors[0]->set_curve(tex->get_texture()->get_curve()); } - tex->emit_signal(CoreStringNames::get_singleton()->changed); + tex->emit_changed(); } } @@ -256,7 +255,7 @@ void VisualShaderGraphPlugin::update_curve_xyz(int p_node_id) { links[p_node_id].curve_editors[1]->set_curve(tex->get_texture()->get_curve_y()); links[p_node_id].curve_editors[2]->set_curve(tex->get_texture()->get_curve_z()); } - tex->emit_signal(CoreStringNames::get_singleton()->changed); + tex->emit_changed(); } } @@ -563,9 +562,8 @@ void VisualShaderGraphPlugin::add_node(VisualShader::Type p_type, int p_id, bool if (curve.is_valid()) { custom_editor->set_h_size_flags(Control::SIZE_EXPAND_FILL); - Callable ce = callable_mp(graph_plugin, &VisualShaderGraphPlugin::update_curve); - if (curve->get_texture().is_valid() && !curve->get_texture()->is_connected("changed", ce)) { - curve->get_texture()->connect("changed", ce.bind(p_id)); + if (curve->get_texture().is_valid()) { + curve->get_texture()->connect_changed(callable_mp(graph_plugin, &VisualShaderGraphPlugin::update_curve).bind(p_id)); } CurveEditor *curve_editor = memnew(CurveEditor); @@ -581,9 +579,8 @@ void VisualShaderGraphPlugin::add_node(VisualShader::Type p_type, int p_id, bool if (curve_xyz.is_valid()) { custom_editor->set_h_size_flags(Control::SIZE_EXPAND_FILL); - Callable ce = callable_mp(graph_plugin, &VisualShaderGraphPlugin::update_curve_xyz); - if (curve_xyz->get_texture().is_valid() && !curve_xyz->get_texture()->is_connected("changed", ce)) { - curve_xyz->get_texture()->connect("changed", ce.bind(p_id)); + if (curve_xyz->get_texture().is_valid()) { + curve_xyz->get_texture()->connect_changed(callable_mp(graph_plugin, &VisualShaderGraphPlugin::update_curve_xyz).bind(p_id)); } CurveEditor *curve_editor_x = memnew(CurveEditor); @@ -1162,20 +1159,14 @@ void VisualShaderEditor::edit(VisualShader *p_visual_shader) { visual_shader = Ref(p_visual_shader); graph_plugin->register_shader(visual_shader.ptr()); - Callable ce = callable_mp(this, &VisualShaderEditor::_update_preview); - if (!visual_shader->is_connected("changed", ce)) { - visual_shader->connect("changed", ce); - } + visual_shader->connect_changed(callable_mp(this, &VisualShaderEditor::_update_preview)); visual_shader->set_graph_offset(graph->get_scroll_ofs() / EDSCALE); _set_mode(visual_shader->get_mode()); _update_nodes(); } else { if (visual_shader.is_valid()) { - Callable ce = callable_mp(this, &VisualShaderEditor::_update_preview); - if (visual_shader->is_connected("changed", ce)) { - visual_shader->disconnect("changed", ce); - } + visual_shader->disconnect_changed(callable_mp(this, &VisualShaderEditor::_update_preview)); } visual_shader.unref(); } @@ -6450,7 +6441,7 @@ public: properties[i]->update_property(); properties[i]->set_name_split_ratio(0); } - node->connect("changed", callable_mp(this, &VisualShaderNodePluginDefaultEditor::_node_changed)); + node->connect_changed(callable_mp(this, &VisualShaderNodePluginDefaultEditor::_node_changed)); } static void _bind_methods() { @@ -6716,7 +6707,7 @@ void VisualShaderNodePortPreview::_shader_changed() { void VisualShaderNodePortPreview::setup(const Ref &p_shader, VisualShader::Type p_type, int p_node, int p_port, bool p_is_valid) { shader = p_shader; - shader->connect("changed", callable_mp(this, &VisualShaderNodePortPreview::_shader_changed), CONNECT_DEFERRED); + shader->connect_changed(callable_mp(this, &VisualShaderNodePortPreview::_shader_changed), CONNECT_DEFERRED); type = p_type; port = p_port; node = p_node; diff --git a/modules/csg/csg_shape.cpp b/modules/csg/csg_shape.cpp index c241f1cabdfb..4c217dac2801 100644 --- a/modules/csg/csg_shape.cpp +++ b/modules/csg/csg_shape.cpp @@ -953,12 +953,12 @@ void CSGMesh3D::set_mesh(const Ref &p_mesh) { return; } if (mesh.is_valid()) { - mesh->disconnect("changed", callable_mp(this, &CSGMesh3D::_mesh_changed)); + mesh->disconnect_changed(callable_mp(this, &CSGMesh3D::_mesh_changed)); } mesh = p_mesh; if (mesh.is_valid()) { - mesh->connect("changed", callable_mp(this, &CSGMesh3D::_mesh_changed)); + mesh->connect_changed(callable_mp(this, &CSGMesh3D::_mesh_changed)); } _mesh_changed(); diff --git a/modules/gridmap/doc_classes/GridMap.xml b/modules/gridmap/doc_classes/GridMap.xml index 6973bd3cd810..f9c3ca476a97 100644 --- a/modules/gridmap/doc_classes/GridMap.xml +++ b/modules/gridmap/doc_classes/GridMap.xml @@ -138,11 +138,11 @@ Returns the position of a grid cell in the GridMap's local coordinate space. To convert the returned value into global coordinates, use [method Node3D.to_global]. See also [method map_to_local]. - + - Notifies the [GridMap] about changed resource and recreates octant data. + [i]Obsoleted.[/i] Use [signal Resource.changed] instead. diff --git a/modules/gridmap/grid_map.cpp b/modules/gridmap/grid_map.cpp index c77fa98be2da..f1e2218434de 100644 --- a/modules/gridmap/grid_map.cpp +++ b/modules/gridmap/grid_map.cpp @@ -258,11 +258,11 @@ RID GridMap::get_navigation_map() const { void GridMap::set_mesh_library(const Ref &p_mesh_library) { if (!mesh_library.is_null()) { - mesh_library->unregister_owner(this); + mesh_library->disconnect_changed(callable_mp(this, &GridMap::_recreate_octant_data)); } mesh_library = p_mesh_library; if (!mesh_library.is_null()) { - mesh_library->register_owner(this); + mesh_library->connect_changed(callable_mp(this, &GridMap::_recreate_octant_data)); } _recreate_octant_data(); @@ -1005,9 +1005,10 @@ void GridMap::clear() { clear_baked_meshes(); } +#ifndef DISABLE_DEPRECATED void GridMap::resource_changed(const Ref &p_res) { - _recreate_octant_data(); } +#endif void GridMap::_update_octants_callback() { if (!awaiting_update) { @@ -1079,7 +1080,9 @@ void GridMap::_bind_methods() { ClassDB::bind_method(D_METHOD("map_to_local", "map_position"), &GridMap::map_to_local); ClassDB::bind_method(D_METHOD("_update_octants_callback"), &GridMap::_update_octants_callback); +#ifndef DISABLE_DEPRECATED ClassDB::bind_method(D_METHOD("resource_changed", "resource"), &GridMap::resource_changed); +#endif ClassDB::bind_method(D_METHOD("set_center_x", "enable"), &GridMap::set_center_x); ClassDB::bind_method(D_METHOD("get_center_x"), &GridMap::get_center_x); @@ -1336,10 +1339,6 @@ void GridMap::_navigation_map_changed(RID p_map) { #endif // DEBUG_ENABLED GridMap::~GridMap() { - if (!mesh_library.is_null()) { - mesh_library->unregister_owner(this); - } - clear(); #ifdef DEBUG_ENABLED NavigationServer3D::get_singleton()->disconnect("map_changed", callable_mp(this, &GridMap::_navigation_map_changed)); diff --git a/modules/gridmap/grid_map.h b/modules/gridmap/grid_map.h index 18c3f90269ef..e05979efbc58 100644 --- a/modules/gridmap/grid_map.h +++ b/modules/gridmap/grid_map.h @@ -203,7 +203,9 @@ class GridMap : public Node3D { void _queue_octants_dirty(); void _update_octants_callback(); +#ifndef DISABLE_DEPRECATED void resource_changed(const Ref &p_res); +#endif void _clear_internal(); diff --git a/modules/noise/noise_texture_2d.cpp b/modules/noise/noise_texture_2d.cpp index a7176e08169a..1b0c5cb9e391 100644 --- a/modules/noise/noise_texture_2d.cpp +++ b/modules/noise/noise_texture_2d.cpp @@ -32,8 +32,6 @@ #include "noise.h" -#include "core/core_string_names.h" - NoiseTexture2D::NoiseTexture2D() { noise = Ref(); @@ -223,11 +221,11 @@ void NoiseTexture2D::set_noise(Ref p_noise) { return; } if (noise.is_valid()) { - noise->disconnect(CoreStringNames::get_singleton()->changed, callable_mp(this, &NoiseTexture2D::_queue_update)); + noise->disconnect_changed(callable_mp(this, &NoiseTexture2D::_queue_update)); } noise = p_noise; if (noise.is_valid()) { - noise->connect(CoreStringNames::get_singleton()->changed, callable_mp(this, &NoiseTexture2D::_queue_update)); + noise->connect_changed(callable_mp(this, &NoiseTexture2D::_queue_update)); } _queue_update(); } @@ -347,11 +345,11 @@ void NoiseTexture2D::set_color_ramp(const Ref &p_gradient) { return; } if (color_ramp.is_valid()) { - color_ramp->disconnect(CoreStringNames::get_singleton()->changed, callable_mp(this, &NoiseTexture2D::_queue_update)); + color_ramp->disconnect_changed(callable_mp(this, &NoiseTexture2D::_queue_update)); } color_ramp = p_gradient; if (color_ramp.is_valid()) { - color_ramp->connect(CoreStringNames::get_singleton()->changed, callable_mp(this, &NoiseTexture2D::_queue_update)); + color_ramp->connect_changed(callable_mp(this, &NoiseTexture2D::_queue_update)); } _queue_update(); } diff --git a/modules/noise/noise_texture_3d.cpp b/modules/noise/noise_texture_3d.cpp index f6c67b0f2dee..ed242e7faae6 100644 --- a/modules/noise/noise_texture_3d.cpp +++ b/modules/noise/noise_texture_3d.cpp @@ -32,8 +32,6 @@ #include "noise.h" -#include "core/core_string_names.h" - NoiseTexture3D::NoiseTexture3D() { noise = Ref(); @@ -214,11 +212,11 @@ void NoiseTexture3D::set_noise(Ref p_noise) { return; } if (noise.is_valid()) { - noise->disconnect(CoreStringNames::get_singleton()->changed, callable_mp(this, &NoiseTexture3D::_queue_update)); + noise->disconnect_changed(callable_mp(this, &NoiseTexture3D::_queue_update)); } noise = p_noise; if (noise.is_valid()) { - noise->connect(CoreStringNames::get_singleton()->changed, callable_mp(this, &NoiseTexture3D::_queue_update)); + noise->connect_changed(callable_mp(this, &NoiseTexture3D::_queue_update)); } _queue_update(); } @@ -297,11 +295,11 @@ void NoiseTexture3D::set_color_ramp(const Ref &p_gradient) { return; } if (color_ramp.is_valid()) { - color_ramp->disconnect(CoreStringNames::get_singleton()->changed, callable_mp(this, &NoiseTexture3D::_queue_update)); + color_ramp->disconnect_changed(callable_mp(this, &NoiseTexture3D::_queue_update)); } color_ramp = p_gradient; if (color_ramp.is_valid()) { - color_ramp->connect(CoreStringNames::get_singleton()->changed, callable_mp(this, &NoiseTexture3D::_queue_update)); + color_ramp->connect_changed(callable_mp(this, &NoiseTexture3D::_queue_update)); } _queue_update(); } diff --git a/modules/noise/tests/test_noise_texture_2d.h b/modules/noise/tests/test_noise_texture_2d.h index e2ec39ef4898..938e8fd6ab76 100644 --- a/modules/noise/tests/test_noise_texture_2d.h +++ b/modules/noise/tests/test_noise_texture_2d.h @@ -210,7 +210,7 @@ TEST_CASE("[NoiseTexture2D][SceneTree] Generating a basic noise texture with mip noise_texture->set_generate_mipmaps(true); Ref tester = memnew(NoiseTextureTester(noise_texture.ptr())); - noise_texture->connect("changed", callable_mp(tester.ptr(), &NoiseTextureTester::check_mip_and_color_ramp)); + noise_texture->connect_changed(callable_mp(tester.ptr(), &NoiseTextureTester::check_mip_and_color_ramp)); MessageQueue::get_singleton()->flush(); } @@ -227,7 +227,7 @@ TEST_CASE("[NoiseTexture2D][SceneTree] Generating a normal map without mipmaps") noise_texture->set_generate_mipmaps(false); Ref tester = memnew(NoiseTextureTester(noise_texture.ptr())); - noise_texture->connect("changed", callable_mp(tester.ptr(), &NoiseTextureTester::check_normal_map)); + noise_texture->connect_changed(callable_mp(tester.ptr(), &NoiseTextureTester::check_normal_map)); MessageQueue::get_singleton()->flush(); } @@ -245,7 +245,7 @@ TEST_CASE("[NoiseTexture2D][SceneTree] Generating a seamless noise texture") { SUBCASE("Grayscale(L8) 16x16, with seamless blend skirt of 0.05") { noise_texture->set_seamless_blend_skirt(0.05); - noise_texture->connect("changed", callable_mp(tester.ptr(), &NoiseTextureTester::check_seamless_texture_grayscale)); + noise_texture->connect_changed(callable_mp(tester.ptr(), &NoiseTextureTester::check_seamless_texture_grayscale)); MessageQueue::get_singleton()->flush(); } @@ -257,7 +257,7 @@ TEST_CASE("[NoiseTexture2D][SceneTree] Generating a seamless noise texture") { gradient->set_points(points); noise_texture->set_color_ramp(gradient); noise_texture->set_seamless_blend_skirt(1.0); - noise_texture->connect("changed", callable_mp(tester.ptr(), &NoiseTextureTester::check_seamless_texture_rgba)); + noise_texture->connect_changed(callable_mp(tester.ptr(), &NoiseTextureTester::check_seamless_texture_rgba)); MessageQueue::get_singleton()->flush(); } } diff --git a/modules/noise/tests/test_noise_texture_3d.h b/modules/noise/tests/test_noise_texture_3d.h index a612f2920a2e..b708eac43b83 100644 --- a/modules/noise/tests/test_noise_texture_3d.h +++ b/modules/noise/tests/test_noise_texture_3d.h @@ -194,7 +194,7 @@ TEST_CASE("[NoiseTexture3D][SceneTree] Generating a basic noise texture with mip noise_texture->set_depth(16); Ref tester = memnew(NoiseTexture3DTester(noise_texture.ptr())); - noise_texture->connect("changed", callable_mp(tester.ptr(), &NoiseTexture3DTester::check_mip_and_color_ramp)); + noise_texture->connect_changed(callable_mp(tester.ptr(), &NoiseTexture3DTester::check_mip_and_color_ramp)); MessageQueue::get_singleton()->flush(); } @@ -213,7 +213,7 @@ TEST_CASE("[NoiseTexture3D][SceneTree] Generating a seamless noise texture") { SUBCASE("Grayscale(L8) 16x16x16, with seamless blend skirt of 0.05") { noise_texture->set_seamless_blend_skirt(0.05); - noise_texture->connect("changed", callable_mp(tester.ptr(), &NoiseTexture3DTester::check_seamless_texture_grayscale)); + noise_texture->connect_changed(callable_mp(tester.ptr(), &NoiseTexture3DTester::check_seamless_texture_grayscale)); MessageQueue::get_singleton()->flush(); } @@ -225,7 +225,7 @@ TEST_CASE("[NoiseTexture3D][SceneTree] Generating a seamless noise texture") { gradient->set_points(points); noise_texture->set_color_ramp(gradient); noise_texture->set_seamless_blend_skirt(1.0); - noise_texture->connect("changed", callable_mp(tester.ptr(), &NoiseTexture3DTester::check_seamless_texture_rgba)); + noise_texture->connect_changed(callable_mp(tester.ptr(), &NoiseTexture3DTester::check_seamless_texture_rgba)); MessageQueue::get_singleton()->flush(); } } diff --git a/scene/2d/collision_shape_2d.cpp b/scene/2d/collision_shape_2d.cpp index 10fc7ef5b2d8..70ec57aa7a2a 100644 --- a/scene/2d/collision_shape_2d.cpp +++ b/scene/2d/collision_shape_2d.cpp @@ -142,7 +142,7 @@ void CollisionShape2D::set_shape(const Ref &p_shape) { return; } if (shape.is_valid()) { - shape->disconnect("changed", callable_mp(this, &CollisionShape2D::_shape_changed)); + shape->disconnect_changed(callable_mp(this, &CollisionShape2D::_shape_changed)); } shape = p_shape; queue_redraw(); @@ -155,7 +155,7 @@ void CollisionShape2D::set_shape(const Ref &p_shape) { } if (shape.is_valid()) { - shape->connect("changed", callable_mp(this, &CollisionShape2D::_shape_changed)); + shape->connect_changed(callable_mp(this, &CollisionShape2D::_shape_changed)); } update_configuration_warnings(); diff --git a/scene/2d/cpu_particles_2d.cpp b/scene/2d/cpu_particles_2d.cpp index 899c94769a2d..1c193f991ee8 100644 --- a/scene/2d/cpu_particles_2d.cpp +++ b/scene/2d/cpu_particles_2d.cpp @@ -30,7 +30,6 @@ #include "cpu_particles_2d.h" -#include "core/core_string_names.h" #include "scene/2d/gpu_particles_2d.h" #include "scene/resources/atlas_texture.h" #include "scene/resources/curve_texture.h" @@ -207,13 +206,13 @@ void CPUParticles2D::set_texture(const Ref &p_texture) { } if (texture.is_valid()) { - texture->disconnect(CoreStringNames::get_singleton()->changed, callable_mp(this, &CPUParticles2D::_texture_changed)); + texture->disconnect_changed(callable_mp(this, &CPUParticles2D::_texture_changed)); } texture = p_texture; if (texture.is_valid()) { - texture->connect(CoreStringNames::get_singleton()->changed, callable_mp(this, &CPUParticles2D::_texture_changed)); + texture->connect_changed(callable_mp(this, &CPUParticles2D::_texture_changed)); } queue_redraw(); diff --git a/scene/2d/gpu_particles_2d.cpp b/scene/2d/gpu_particles_2d.cpp index 52455e1f9ee9..8c5782dc4188 100644 --- a/scene/2d/gpu_particles_2d.cpp +++ b/scene/2d/gpu_particles_2d.cpp @@ -30,7 +30,6 @@ #include "gpu_particles_2d.h" -#include "core/core_string_names.h" #include "scene/resources/atlas_texture.h" #include "scene/resources/particle_process_material.h" #include "scene/scene_string_names.h" @@ -357,13 +356,13 @@ Rect2 GPUParticles2D::capture_rect() const { void GPUParticles2D::set_texture(const Ref &p_texture) { if (texture.is_valid()) { - texture->disconnect(CoreStringNames::get_singleton()->changed, callable_mp(this, &GPUParticles2D::_texture_changed)); + texture->disconnect_changed(callable_mp(this, &GPUParticles2D::_texture_changed)); } texture = p_texture; if (texture.is_valid()) { - texture->connect(CoreStringNames::get_singleton()->changed, callable_mp(this, &GPUParticles2D::_texture_changed)); + texture->connect_changed(callable_mp(this, &GPUParticles2D::_texture_changed)); } _update_collision_size(); queue_redraw(); diff --git a/scene/2d/light_occluder_2d.cpp b/scene/2d/light_occluder_2d.cpp index 4c3161d049b6..61f5d5cd46bd 100644 --- a/scene/2d/light_occluder_2d.cpp +++ b/scene/2d/light_occluder_2d.cpp @@ -215,7 +215,7 @@ bool LightOccluder2D::_edit_is_selected_on_click(const Point2 &p_point, double p void LightOccluder2D::set_occluder_polygon(const Ref &p_polygon) { #ifdef DEBUG_ENABLED if (occluder_polygon.is_valid()) { - occluder_polygon->disconnect("changed", callable_mp(this, &LightOccluder2D::_poly_changed)); + occluder_polygon->disconnect_changed(callable_mp(this, &LightOccluder2D::_poly_changed)); } #endif occluder_polygon = p_polygon; @@ -228,7 +228,7 @@ void LightOccluder2D::set_occluder_polygon(const Ref &p_polyg #ifdef DEBUG_ENABLED if (occluder_polygon.is_valid()) { - occluder_polygon->connect("changed", callable_mp(this, &LightOccluder2D::_poly_changed)); + occluder_polygon->connect_changed(callable_mp(this, &LightOccluder2D::_poly_changed)); } queue_redraw(); #endif diff --git a/scene/2d/line_2d.cpp b/scene/2d/line_2d.cpp index 58dad4040375..3a9473d76c04 100644 --- a/scene/2d/line_2d.cpp +++ b/scene/2d/line_2d.cpp @@ -30,7 +30,6 @@ #include "line_2d.h" -#include "core/core_string_names.h" #include "core/math/geometry_2d.h" #include "line_builder.h" @@ -89,14 +88,14 @@ float Line2D::get_width() const { void Line2D::set_curve(const Ref &p_curve) { // Cleanup previous connection if any if (_curve.is_valid()) { - _curve->disconnect(CoreStringNames::get_singleton()->changed, callable_mp(this, &Line2D::_curve_changed)); + _curve->disconnect_changed(callable_mp(this, &Line2D::_curve_changed)); } _curve = p_curve; // Connect to the curve so the line will update when it is changed if (_curve.is_valid()) { - _curve->connect(CoreStringNames::get_singleton()->changed, callable_mp(this, &Line2D::_curve_changed)); + _curve->connect_changed(callable_mp(this, &Line2D::_curve_changed)); } queue_redraw(); @@ -159,14 +158,14 @@ Color Line2D::get_default_color() const { void Line2D::set_gradient(const Ref &p_gradient) { // Cleanup previous connection if any if (_gradient.is_valid()) { - _gradient->disconnect(CoreStringNames::get_singleton()->changed, callable_mp(this, &Line2D::_gradient_changed)); + _gradient->disconnect_changed(callable_mp(this, &Line2D::_gradient_changed)); } _gradient = p_gradient; // Connect to the gradient so the line will update when the Gradient is changed if (_gradient.is_valid()) { - _gradient->connect(CoreStringNames::get_singleton()->changed, callable_mp(this, &Line2D::_gradient_changed)); + _gradient->connect_changed(callable_mp(this, &Line2D::_gradient_changed)); } queue_redraw(); diff --git a/scene/2d/multimesh_instance_2d.cpp b/scene/2d/multimesh_instance_2d.cpp index f347eb65204c..9631b2cc4e6d 100644 --- a/scene/2d/multimesh_instance_2d.cpp +++ b/scene/2d/multimesh_instance_2d.cpp @@ -30,7 +30,6 @@ #include "multimesh_instance_2d.h" -#include "core/core_string_names.h" #include "scene/scene_string_names.h" void MultiMeshInstance2D::_notification(int p_what) { @@ -59,13 +58,13 @@ void MultiMeshInstance2D::_bind_methods() { void MultiMeshInstance2D::set_multimesh(const Ref &p_multimesh) { // Cleanup previous connection if any. if (multimesh.is_valid()) { - multimesh->disconnect(CoreStringNames::get_singleton()->changed, callable_mp((CanvasItem *)this, &CanvasItem::queue_redraw)); + multimesh->disconnect_changed(callable_mp((CanvasItem *)this, &CanvasItem::queue_redraw)); } multimesh = p_multimesh; // Connect to the multimesh so the AABB can update when instance transforms are changed. if (multimesh.is_valid()) { - multimesh->connect(CoreStringNames::get_singleton()->changed, callable_mp((CanvasItem *)this, &CanvasItem::queue_redraw)); + multimesh->connect_changed(callable_mp((CanvasItem *)this, &CanvasItem::queue_redraw)); } queue_redraw(); } diff --git a/scene/2d/navigation_region_2d.cpp b/scene/2d/navigation_region_2d.cpp index 529545de978d..fa037135924f 100644 --- a/scene/2d/navigation_region_2d.cpp +++ b/scene/2d/navigation_region_2d.cpp @@ -30,7 +30,6 @@ #include "navigation_region_2d.h" -#include "core/core_string_names.h" #include "core/math/geometry_2d.h" #include "scene/2d/navigation_obstacle_2d.h" #include "scene/resources/world_2d.h" @@ -193,14 +192,14 @@ void NavigationRegion2D::set_navigation_polygon(const Ref &p_ } if (navigation_polygon.is_valid()) { - navigation_polygon->disconnect(CoreStringNames::get_singleton()->changed, callable_mp(this, &NavigationRegion2D::_navigation_polygon_changed)); + navigation_polygon->disconnect_changed(callable_mp(this, &NavigationRegion2D::_navigation_polygon_changed)); } navigation_polygon = p_navigation_polygon; NavigationServer2D::get_singleton()->region_set_navigation_polygon(region, p_navigation_polygon); if (navigation_polygon.is_valid()) { - navigation_polygon->connect(CoreStringNames::get_singleton()->changed, callable_mp(this, &NavigationRegion2D::_navigation_polygon_changed)); + navigation_polygon->connect_changed(callable_mp(this, &NavigationRegion2D::_navigation_polygon_changed)); } _navigation_polygon_changed(); diff --git a/scene/2d/path_2d.cpp b/scene/2d/path_2d.cpp index 3e6a484e7264..ee0ccc42ff89 100644 --- a/scene/2d/path_2d.cpp +++ b/scene/2d/path_2d.cpp @@ -182,13 +182,13 @@ void Path2D::_curve_changed() { void Path2D::set_curve(const Ref &p_curve) { if (curve.is_valid()) { - curve->disconnect("changed", callable_mp(this, &Path2D::_curve_changed)); + curve->disconnect_changed(callable_mp(this, &Path2D::_curve_changed)); } curve = p_curve; if (curve.is_valid()) { - curve->connect("changed", callable_mp(this, &Path2D::_curve_changed)); + curve->connect_changed(callable_mp(this, &Path2D::_curve_changed)); } _curve_changed(); diff --git a/scene/2d/physics_body_2d.cpp b/scene/2d/physics_body_2d.cpp index b3acc1849bec..b9bde47507d8 100644 --- a/scene/2d/physics_body_2d.cpp +++ b/scene/2d/physics_body_2d.cpp @@ -30,7 +30,6 @@ #include "physics_body_2d.h" -#include "core/core_string_names.h" #include "scene/scene_string_names.h" void PhysicsBody2D::_bind_methods() { @@ -195,15 +194,13 @@ real_t StaticBody2D::get_constant_angular_velocity() const { void StaticBody2D::set_physics_material_override(const Ref &p_physics_material_override) { if (physics_material_override.is_valid()) { - if (physics_material_override->is_connected(CoreStringNames::get_singleton()->changed, callable_mp(this, &StaticBody2D::_reload_physics_characteristics))) { - physics_material_override->disconnect(CoreStringNames::get_singleton()->changed, callable_mp(this, &StaticBody2D::_reload_physics_characteristics)); - } + physics_material_override->disconnect_changed(callable_mp(this, &StaticBody2D::_reload_physics_characteristics)); } physics_material_override = p_physics_material_override; if (physics_material_override.is_valid()) { - physics_material_override->connect(CoreStringNames::get_singleton()->changed, callable_mp(this, &StaticBody2D::_reload_physics_characteristics)); + physics_material_override->connect_changed(callable_mp(this, &StaticBody2D::_reload_physics_characteristics)); } _reload_physics_characteristics(); } @@ -651,15 +648,13 @@ const Vector2 &RigidBody2D::get_center_of_mass() const { void RigidBody2D::set_physics_material_override(const Ref &p_physics_material_override) { if (physics_material_override.is_valid()) { - if (physics_material_override->is_connected(CoreStringNames::get_singleton()->changed, callable_mp(this, &RigidBody2D::_reload_physics_characteristics))) { - physics_material_override->disconnect(CoreStringNames::get_singleton()->changed, callable_mp(this, &RigidBody2D::_reload_physics_characteristics)); - } + physics_material_override->disconnect_changed(callable_mp(this, &RigidBody2D::_reload_physics_characteristics)); } physics_material_override = p_physics_material_override; if (physics_material_override.is_valid()) { - physics_material_override->connect(CoreStringNames::get_singleton()->changed, callable_mp(this, &RigidBody2D::_reload_physics_characteristics)); + physics_material_override->connect_changed(callable_mp(this, &RigidBody2D::_reload_physics_characteristics)); } _reload_physics_characteristics(); } diff --git a/scene/2d/shape_cast_2d.cpp b/scene/2d/shape_cast_2d.cpp index f1a9119458c0..90d80d754906 100644 --- a/scene/2d/shape_cast_2d.cpp +++ b/scene/2d/shape_cast_2d.cpp @@ -31,7 +31,6 @@ #include "shape_cast_2d.h" #include "core/config/engine.h" -#include "core/core_string_names.h" #include "scene/2d/collision_object_2d.h" #include "scene/2d/physics_body_2d.h" #include "scene/resources/circle_shape_2d.h" @@ -155,11 +154,11 @@ void ShapeCast2D::set_shape(const Ref &p_shape) { return; } if (shape.is_valid()) { - shape->disconnect(CoreStringNames::get_singleton()->changed, callable_mp(this, &ShapeCast2D::_shape_changed)); + shape->disconnect_changed(callable_mp(this, &ShapeCast2D::_shape_changed)); } shape = p_shape; if (shape.is_valid()) { - shape->connect(CoreStringNames::get_singleton()->changed, callable_mp(this, &ShapeCast2D::_shape_changed)); + shape->connect_changed(callable_mp(this, &ShapeCast2D::_shape_changed)); shape_rid = shape->get_rid(); } diff --git a/scene/2d/sprite_2d.cpp b/scene/2d/sprite_2d.cpp index 6e314160fdf8..7e6b43559ca2 100644 --- a/scene/2d/sprite_2d.cpp +++ b/scene/2d/sprite_2d.cpp @@ -30,7 +30,6 @@ #include "sprite_2d.h" -#include "core/core_string_names.h" #include "scene/main/window.h" #include "scene/scene_string_names.h" @@ -137,13 +136,13 @@ void Sprite2D::set_texture(const Ref &p_texture) { } if (texture.is_valid()) { - texture->disconnect(CoreStringNames::get_singleton()->changed, callable_mp(this, &Sprite2D::_texture_changed)); + texture->disconnect_changed(callable_mp(this, &Sprite2D::_texture_changed)); } texture = p_texture; if (texture.is_valid()) { - texture->connect(CoreStringNames::get_singleton()->changed, callable_mp(this, &Sprite2D::_texture_changed)); + texture->connect_changed(callable_mp(this, &Sprite2D::_texture_changed)); } queue_redraw(); diff --git a/scene/2d/tile_map.cpp b/scene/2d/tile_map.cpp index c5ce45091e8a..8f41bb61463c 100644 --- a/scene/2d/tile_map.cpp +++ b/scene/2d/tile_map.cpp @@ -524,7 +524,7 @@ void TileMap::set_tileset(const Ref &p_tileset) { // Set the tileset, registering to its changes. if (tile_set.is_valid()) { - tile_set->disconnect("changed", callable_mp(this, &TileMap::_tile_set_changed)); + tile_set->disconnect_changed(callable_mp(this, &TileMap::_tile_set_changed)); } if (!p_tileset.is_valid()) { @@ -534,7 +534,7 @@ void TileMap::set_tileset(const Ref &p_tileset) { tile_set = p_tileset; if (tile_set.is_valid()) { - tile_set->connect("changed", callable_mp(this, &TileMap::_tile_set_changed)); + tile_set->connect_changed(callable_mp(this, &TileMap::_tile_set_changed)); _clear_internals(); _recreate_internals(); } @@ -4250,7 +4250,7 @@ TileMap::TileMap() { TileMap::~TileMap() { if (tile_set.is_valid()) { - tile_set->disconnect("changed", callable_mp(this, &TileMap::_tile_set_changed)); + tile_set->disconnect_changed(callable_mp(this, &TileMap::_tile_set_changed)); } _clear_internals(); diff --git a/scene/2d/touch_screen_button.cpp b/scene/2d/touch_screen_button.cpp index 10a9e7edec57..5ed7fadb2a91 100644 --- a/scene/2d/touch_screen_button.cpp +++ b/scene/2d/touch_screen_button.cpp @@ -82,11 +82,11 @@ void TouchScreenButton::set_shape(const Ref &p_shape) { return; } if (shape.is_valid()) { - shape->disconnect("changed", callable_mp((CanvasItem *)this, &CanvasItem::queue_redraw)); + shape->disconnect_changed(callable_mp((CanvasItem *)this, &CanvasItem::queue_redraw)); } shape = p_shape; if (shape.is_valid()) { - shape->connect("changed", callable_mp((CanvasItem *)this, &CanvasItem::queue_redraw)); + shape->connect_changed(callable_mp((CanvasItem *)this, &CanvasItem::queue_redraw)); } queue_redraw(); } diff --git a/scene/3d/camera_3d.cpp b/scene/3d/camera_3d.cpp index 225b9b35b3fb..37ceb9d1a193 100644 --- a/scene/3d/camera_3d.cpp +++ b/scene/3d/camera_3d.cpp @@ -31,7 +31,6 @@ #include "camera_3d.h" #include "collision_object_3d.h" -#include "core/core_string_names.h" #include "core/math/projection.h" #include "scene/main/viewport.h" @@ -430,7 +429,7 @@ void Camera3D::set_attributes(const Ref &p_attributes) { if (attributes.is_valid()) { CameraAttributesPhysical *physical_attributes = Object::cast_to(attributes.ptr()); if (physical_attributes) { - attributes->disconnect(CoreStringNames::get_singleton()->changed, callable_mp(this, &Camera3D::_attributes_changed)); + attributes->disconnect_changed(callable_mp(this, &Camera3D::_attributes_changed)); } } @@ -439,7 +438,7 @@ void Camera3D::set_attributes(const Ref &p_attributes) { if (attributes.is_valid()) { CameraAttributesPhysical *physical_attributes = Object::cast_to(attributes.ptr()); if (physical_attributes) { - attributes->connect(CoreStringNames::get_singleton()->changed, callable_mp(this, &Camera3D::_attributes_changed)); + attributes->connect_changed(callable_mp(this, &Camera3D::_attributes_changed)); _attributes_changed(); } diff --git a/scene/3d/collision_object_3d.cpp b/scene/3d/collision_object_3d.cpp index 6d8d60dcaa80..bfe594adc234 100644 --- a/scene/3d/collision_object_3d.cpp +++ b/scene/3d/collision_object_3d.cpp @@ -394,11 +394,7 @@ void CollisionObject3D::_update_debug_shapes() { if (s.debug_shape.is_null()) { s.debug_shape = RS::get_singleton()->instance_create(); RS::get_singleton()->instance_set_scenario(s.debug_shape, get_world_3d()->get_scenario()); - - if (!s.shape->is_connected("changed", callable_mp(this, &CollisionObject3D::_shape_changed))) { - s.shape->connect("changed", callable_mp(this, &CollisionObject3D::_shape_changed).bind(s.shape), CONNECT_DEFERRED); - } - + s.shape->connect_changed(callable_mp(this, &CollisionObject3D::_shape_changed).bind(s.shape), CONNECT_DEFERRED); ++debug_shapes_count; } @@ -422,8 +418,8 @@ void CollisionObject3D::_clear_debug_shapes() { if (s.debug_shape.is_valid()) { RS::get_singleton()->free(s.debug_shape); s.debug_shape = RID(); - if (s.shape.is_valid() && s.shape->is_connected("changed", callable_mp(this, &CollisionObject3D::_update_shape_data))) { - s.shape->disconnect("changed", callable_mp(this, &CollisionObject3D::_update_shape_data)); + if (s.shape.is_valid()) { + s.shape->disconnect_changed(callable_mp(this, &CollisionObject3D::_update_shape_data)); } } } @@ -663,8 +659,8 @@ void CollisionObject3D::shape_owner_remove_shape(uint32_t p_owner, int p_shape) if (s.debug_shape.is_valid()) { RS::get_singleton()->free(s.debug_shape); - if (s.shape.is_valid() && s.shape->is_connected("changed", callable_mp(this, &CollisionObject3D::_shape_changed))) { - s.shape->disconnect("changed", callable_mp(this, &CollisionObject3D::_shape_changed)); + if (s.shape.is_valid()) { + s.shape->disconnect_changed(callable_mp(this, &CollisionObject3D::_shape_changed)); } --debug_shapes_count; } diff --git a/scene/3d/collision_shape_3d.cpp b/scene/3d/collision_shape_3d.cpp index 10eefc784d73..0bb03823018e 100644 --- a/scene/3d/collision_shape_3d.cpp +++ b/scene/3d/collision_shape_3d.cpp @@ -112,9 +112,10 @@ void CollisionShape3D::_notification(int p_what) { } } +#ifndef DISABLE_DEPRECATED void CollisionShape3D::resource_changed(Ref res) { - update_gizmos(); } +#endif PackedStringArray CollisionShape3D::get_configuration_warnings() const { PackedStringArray warnings = Node::get_configuration_warnings(); @@ -145,8 +146,9 @@ PackedStringArray CollisionShape3D::get_configuration_warnings() const { } void CollisionShape3D::_bind_methods() { - //not sure if this should do anything +#ifndef DISABLE_DEPRECATED ClassDB::bind_method(D_METHOD("resource_changed", "resource"), &CollisionShape3D::resource_changed); +#endif ClassDB::bind_method(D_METHOD("set_shape", "shape"), &CollisionShape3D::set_shape); ClassDB::bind_method(D_METHOD("get_shape"), &CollisionShape3D::get_shape); ClassDB::bind_method(D_METHOD("set_disabled", "enable"), &CollisionShape3D::set_disabled); @@ -162,12 +164,12 @@ void CollisionShape3D::set_shape(const Ref &p_shape) { if (p_shape == shape) { return; } - if (!shape.is_null()) { - shape->unregister_owner(this); + if (shape.is_valid()) { + shape->disconnect_changed(callable_mp((Node3D *)this, &Node3D::update_gizmos)); } shape = p_shape; - if (!shape.is_null()) { - shape->register_owner(this); + if (shape.is_valid()) { + shape->connect_changed(callable_mp((Node3D *)this, &Node3D::update_gizmos)); } update_gizmos(); if (collision_object) { @@ -206,8 +208,5 @@ CollisionShape3D::CollisionShape3D() { } CollisionShape3D::~CollisionShape3D() { - if (!shape.is_null()) { - shape->unregister_owner(this); - } //RenderingServer::get_singleton()->free(indicator); } diff --git a/scene/3d/collision_shape_3d.h b/scene/3d/collision_shape_3d.h index 74928bad6d39..bc0e70f8ac0b 100644 --- a/scene/3d/collision_shape_3d.h +++ b/scene/3d/collision_shape_3d.h @@ -43,7 +43,9 @@ class CollisionShape3D : public Node3D { uint32_t owner_id = 0; CollisionObject3D *collision_object = nullptr; +#ifndef DISABLE_DEPRECATED void resource_changed(Ref res); +#endif bool disabled = false; protected: diff --git a/scene/3d/gpu_particles_3d.cpp b/scene/3d/gpu_particles_3d.cpp index fb889c928d12..3a23cbcff186 100644 --- a/scene/3d/gpu_particles_3d.cpp +++ b/scene/3d/gpu_particles_3d.cpp @@ -234,13 +234,13 @@ void GPUParticles3D::set_draw_pass_mesh(int p_pass, const Ref &p_mesh) { ERR_FAIL_INDEX(p_pass, draw_passes.size()); if (Engine::get_singleton()->is_editor_hint() && draw_passes.write[p_pass].is_valid()) { - draw_passes.write[p_pass]->disconnect("changed", callable_mp((Node *)this, &Node::update_configuration_warnings)); + draw_passes.write[p_pass]->disconnect_changed(callable_mp((Node *)this, &Node::update_configuration_warnings)); } draw_passes.write[p_pass] = p_mesh; if (Engine::get_singleton()->is_editor_hint() && draw_passes.write[p_pass].is_valid()) { - draw_passes.write[p_pass]->connect("changed", callable_mp((Node *)this, &Node::update_configuration_warnings), CONNECT_DEFERRED); + draw_passes.write[p_pass]->connect_changed(callable_mp((Node *)this, &Node::update_configuration_warnings), CONNECT_DEFERRED); } RID mesh_rid; diff --git a/scene/3d/label_3d.cpp b/scene/3d/label_3d.cpp index 296218bf25a4..b0e7c732538b 100644 --- a/scene/3d/label_3d.cpp +++ b/scene/3d/label_3d.cpp @@ -30,7 +30,6 @@ #include "label_3d.h" -#include "core/core_string_names.h" #include "scene/main/viewport.h" #include "scene/resources/theme.h" #include "scene/scene_string_names.h" @@ -762,12 +761,12 @@ void Label3D::_font_changed() { void Label3D::set_font(const Ref &p_font) { if (font_override != p_font) { if (font_override.is_valid()) { - font_override->disconnect(CoreStringNames::get_singleton()->changed, callable_mp(this, &Label3D::_font_changed)); + font_override->disconnect_changed(callable_mp(this, &Label3D::_font_changed)); } font_override = p_font; dirty_font = true; if (font_override.is_valid()) { - font_override->connect(CoreStringNames::get_singleton()->changed, callable_mp(this, &Label3D::_font_changed)); + font_override->connect_changed(callable_mp(this, &Label3D::_font_changed)); } _queue_update(); } @@ -779,7 +778,7 @@ Ref Label3D::get_font() const { Ref Label3D::_get_font_or_default() const { if (theme_font.is_valid()) { - theme_font->disconnect(CoreStringNames::get_singleton()->changed, callable_mp(const_cast(this), &Label3D::_font_changed)); + theme_font->disconnect_changed(callable_mp(const_cast(this), &Label3D::_font_changed)); theme_font.unref(); } @@ -797,7 +796,7 @@ Ref Label3D::_get_font_or_default() const { Ref f = ThemeDB::get_singleton()->get_project_theme()->get_theme_item(Theme::DATA_TYPE_FONT, "font", E); if (f.is_valid()) { theme_font = f; - theme_font->connect(CoreStringNames::get_singleton()->changed, callable_mp(const_cast(this), &Label3D::_font_changed)); + theme_font->connect_changed(callable_mp(const_cast(this), &Label3D::_font_changed)); } return f; } @@ -814,7 +813,7 @@ Ref Label3D::_get_font_or_default() const { Ref f = ThemeDB::get_singleton()->get_default_theme()->get_theme_item(Theme::DATA_TYPE_FONT, "font", E); if (f.is_valid()) { theme_font = f; - theme_font->connect(CoreStringNames::get_singleton()->changed, callable_mp(const_cast(this), &Label3D::_font_changed)); + theme_font->connect_changed(callable_mp(const_cast(this), &Label3D::_font_changed)); } return f; } @@ -825,7 +824,7 @@ Ref Label3D::_get_font_or_default() const { Ref f = ThemeDB::get_singleton()->get_default_theme()->get_theme_item(Theme::DATA_TYPE_FONT, "font", StringName()); if (f.is_valid()) { theme_font = f; - theme_font->connect(CoreStringNames::get_singleton()->changed, callable_mp(const_cast(this), &Label3D::_font_changed)); + theme_font->connect_changed(callable_mp(const_cast(this), &Label3D::_font_changed)); } return f; } diff --git a/scene/3d/mesh_instance_3d.cpp b/scene/3d/mesh_instance_3d.cpp index 28a3cd0b13d2..0b0b098f65c3 100644 --- a/scene/3d/mesh_instance_3d.cpp +++ b/scene/3d/mesh_instance_3d.cpp @@ -31,7 +31,6 @@ #include "mesh_instance_3d.h" #include "collision_shape_3d.h" -#include "core/core_string_names.h" #include "physics_body_3d.h" #include "scene/resources/concave_polygon_shape_3d.h" #include "scene/resources/convex_polygon_shape_3d.h" @@ -111,7 +110,7 @@ void MeshInstance3D::set_mesh(const Ref &p_mesh) { } if (mesh.is_valid()) { - mesh->disconnect(CoreStringNames::get_singleton()->changed, callable_mp(this, &MeshInstance3D::_mesh_changed)); + mesh->disconnect_changed(callable_mp(this, &MeshInstance3D::_mesh_changed)); } mesh = p_mesh; @@ -120,7 +119,7 @@ void MeshInstance3D::set_mesh(const Ref &p_mesh) { // If mesh is a PrimitiveMesh, calling get_rid on it can trigger a changed callback // so do this before connecting _mesh_changed. set_base(mesh->get_rid()); - mesh->connect(CoreStringNames::get_singleton()->changed, callable_mp(this, &MeshInstance3D::_mesh_changed)); + mesh->connect_changed(callable_mp(this, &MeshInstance3D::_mesh_changed)); _mesh_changed(); } else { blend_shape_tracks.clear(); diff --git a/scene/3d/navigation_region_3d.cpp b/scene/3d/navigation_region_3d.cpp index 194d3082dfd4..3f18e23864e0 100644 --- a/scene/3d/navigation_region_3d.cpp +++ b/scene/3d/navigation_region_3d.cpp @@ -30,7 +30,6 @@ #include "navigation_region_3d.h" -#include "core/core_string_names.h" #include "scene/resources/navigation_mesh_source_geometry_data_3d.h" #include "servers/navigation_server_3d.h" @@ -193,13 +192,13 @@ void NavigationRegion3D::set_navigation_mesh(const Ref &p_naviga } if (navigation_mesh.is_valid()) { - navigation_mesh->disconnect(CoreStringNames::get_singleton()->changed, callable_mp(this, &NavigationRegion3D::_navigation_mesh_changed)); + navigation_mesh->disconnect_changed(callable_mp(this, &NavigationRegion3D::_navigation_mesh_changed)); } navigation_mesh = p_navigation_mesh; if (navigation_mesh.is_valid()) { - navigation_mesh->connect(CoreStringNames::get_singleton()->changed, callable_mp(this, &NavigationRegion3D::_navigation_mesh_changed)); + navigation_mesh->connect_changed(callable_mp(this, &NavigationRegion3D::_navigation_mesh_changed)); } NavigationServer3D::get_singleton()->region_set_navigation_mesh(region, p_navigation_mesh); @@ -462,7 +461,7 @@ NavigationRegion3D::~NavigationRegion3D() { } if (navigation_mesh.is_valid()) { - navigation_mesh->disconnect(CoreStringNames::get_singleton()->changed, callable_mp(this, &NavigationRegion3D::_navigation_mesh_changed)); + navigation_mesh->disconnect_changed(callable_mp(this, &NavigationRegion3D::_navigation_mesh_changed)); } ERR_FAIL_NULL(NavigationServer3D::get_singleton()); NavigationServer3D::get_singleton()->free(region); diff --git a/scene/3d/occluder_instance_3d.cpp b/scene/3d/occluder_instance_3d.cpp index 8fd1df372b81..7b535f616941 100644 --- a/scene/3d/occluder_instance_3d.cpp +++ b/scene/3d/occluder_instance_3d.cpp @@ -31,7 +31,6 @@ #include "occluder_instance_3d.h" #include "core/config/project_settings.h" -#include "core/core_string_names.h" #include "core/io/marshalls.h" #include "core/math/geometry_2d.h" #include "core/math/triangulate.h" @@ -441,14 +440,14 @@ void OccluderInstance3D::set_occluder(const Ref &p_occluder) { } if (occluder.is_valid()) { - occluder->disconnect(CoreStringNames::get_singleton()->changed, callable_mp(this, &OccluderInstance3D::_occluder_changed)); + occluder->disconnect_changed(callable_mp(this, &OccluderInstance3D::_occluder_changed)); } occluder = p_occluder; if (occluder.is_valid()) { set_base(occluder->get_rid()); - occluder->connect(CoreStringNames::get_singleton()->changed, callable_mp(this, &OccluderInstance3D::_occluder_changed)); + occluder->connect_changed(callable_mp(this, &OccluderInstance3D::_occluder_changed)); } else { set_base(RID()); } diff --git a/scene/3d/path_3d.cpp b/scene/3d/path_3d.cpp index 9516973ae2a1..6aea06309684 100644 --- a/scene/3d/path_3d.cpp +++ b/scene/3d/path_3d.cpp @@ -144,13 +144,13 @@ void Path3D::_curve_changed() { void Path3D::set_curve(const Ref &p_curve) { if (curve.is_valid()) { - curve->disconnect("changed", callable_mp(this, &Path3D::_curve_changed)); + curve->disconnect_changed(callable_mp(this, &Path3D::_curve_changed)); } curve = p_curve; if (curve.is_valid()) { - curve->connect("changed", callable_mp(this, &Path3D::_curve_changed)); + curve->connect_changed(callable_mp(this, &Path3D::_curve_changed)); } _curve_changed(); } diff --git a/scene/3d/physics_body_3d.cpp b/scene/3d/physics_body_3d.cpp index 6b31aa0a3c35..e49b43c65017 100644 --- a/scene/3d/physics_body_3d.cpp +++ b/scene/3d/physics_body_3d.cpp @@ -30,7 +30,6 @@ #include "physics_body_3d.h" -#include "core/core_string_names.h" #include "scene/scene_string_names.h" void PhysicsBody3D::_bind_methods() { @@ -214,15 +213,13 @@ real_t PhysicsBody3D::get_inverse_mass() const { void StaticBody3D::set_physics_material_override(const Ref &p_physics_material_override) { if (physics_material_override.is_valid()) { - if (physics_material_override->is_connected(CoreStringNames::get_singleton()->changed, callable_mp(this, &StaticBody3D::_reload_physics_characteristics))) { - physics_material_override->disconnect(CoreStringNames::get_singleton()->changed, callable_mp(this, &StaticBody3D::_reload_physics_characteristics)); - } + physics_material_override->disconnect_changed(callable_mp(this, &StaticBody3D::_reload_physics_characteristics)); } physics_material_override = p_physics_material_override; if (physics_material_override.is_valid()) { - physics_material_override->connect(CoreStringNames::get_singleton()->changed, callable_mp(this, &StaticBody3D::_reload_physics_characteristics)); + physics_material_override->connect_changed(callable_mp(this, &StaticBody3D::_reload_physics_characteristics)); } _reload_physics_characteristics(); } @@ -726,15 +723,13 @@ const Vector3 &RigidBody3D::get_center_of_mass() const { void RigidBody3D::set_physics_material_override(const Ref &p_physics_material_override) { if (physics_material_override.is_valid()) { - if (physics_material_override->is_connected(CoreStringNames::get_singleton()->changed, callable_mp(this, &RigidBody3D::_reload_physics_characteristics))) { - physics_material_override->disconnect(CoreStringNames::get_singleton()->changed, callable_mp(this, &RigidBody3D::_reload_physics_characteristics)); - } + physics_material_override->disconnect_changed(callable_mp(this, &RigidBody3D::_reload_physics_characteristics)); } physics_material_override = p_physics_material_override; if (physics_material_override.is_valid()) { - physics_material_override->connect(CoreStringNames::get_singleton()->changed, callable_mp(this, &RigidBody3D::_reload_physics_characteristics)); + physics_material_override->connect_changed(callable_mp(this, &RigidBody3D::_reload_physics_characteristics)); } _reload_physics_characteristics(); } diff --git a/scene/3d/shape_cast_3d.cpp b/scene/3d/shape_cast_3d.cpp index 75f94b36d38e..b6401832ed04 100644 --- a/scene/3d/shape_cast_3d.cpp +++ b/scene/3d/shape_cast_3d.cpp @@ -30,7 +30,6 @@ #include "shape_cast_3d.h" -#include "core/core_string_names.h" #include "scene/3d/collision_object_3d.h" #include "scene/3d/mesh_instance_3d.h" #include "scene/resources/concave_polygon_shape_3d.h" @@ -93,7 +92,9 @@ void ShapeCast3D::_notification(int p_what) { } void ShapeCast3D::_bind_methods() { +#ifndef DISABLE_DEPRECATED ClassDB::bind_method(D_METHOD("resource_changed", "resource"), &ShapeCast3D::resource_changed); +#endif ClassDB::bind_method(D_METHOD("set_enabled", "enabled"), &ShapeCast3D::set_enabled); ClassDB::bind_method(D_METHOD("is_enabled"), &ShapeCast3D::is_enabled); @@ -312,12 +313,10 @@ real_t ShapeCast3D::get_closest_collision_unsafe_fraction() const { return collision_unsafe_fraction; } +#ifndef DISABLE_DEPRECATED void ShapeCast3D::resource_changed(Ref p_res) { - if (is_inside_tree() && get_tree()->is_debugging_collisions_hint()) { - _update_debug_shape(); - } - update_gizmos(); } +#endif void ShapeCast3D::_shape_changed() { update_gizmos(); @@ -332,13 +331,11 @@ void ShapeCast3D::set_shape(const Ref &p_shape) { return; } if (shape.is_valid()) { - shape->disconnect(CoreStringNames::get_singleton()->changed, callable_mp(this, &ShapeCast3D::_shape_changed)); - shape->unregister_owner(this); + shape->disconnect_changed(callable_mp(this, &ShapeCast3D::_shape_changed)); } shape = p_shape; if (shape.is_valid()) { - shape->register_owner(this); - shape->connect(CoreStringNames::get_singleton()->changed, callable_mp(this, &ShapeCast3D::_shape_changed)); + shape->connect_changed(callable_mp(this, &ShapeCast3D::_shape_changed)); shape_rid = shape->get_rid(); } @@ -633,9 +630,3 @@ void ShapeCast3D::_clear_debug_shape() { debug_shape = nullptr; } - -ShapeCast3D::~ShapeCast3D() { - if (!shape.is_null()) { - shape->unregister_owner(this); - } -} diff --git a/scene/3d/shape_cast_3d.h b/scene/3d/shape_cast_3d.h index 98158d3c7cd3..043e35090f32 100644 --- a/scene/3d/shape_cast_3d.h +++ b/scene/3d/shape_cast_3d.h @@ -40,7 +40,9 @@ class ShapeCast3D : public Node3D { GDCLASS(ShapeCast3D, Node3D); bool enabled = true; +#ifndef DISABLE_DEPRECATED void resource_changed(Ref p_res); +#endif Ref shape; RID shape_rid; @@ -74,8 +76,6 @@ class ShapeCast3D : public Node3D { Array _get_collision_result() const; - ~ShapeCast3D(); - protected: void _notification(int p_what); void _update_shapecast_state(); diff --git a/scene/3d/skeleton_3d.cpp b/scene/3d/skeleton_3d.cpp index 51359059ef0c..445c1003b5dd 100644 --- a/scene/3d/skeleton_3d.cpp +++ b/scene/3d/skeleton_3d.cpp @@ -887,7 +887,7 @@ Ref Skeleton3D::register_skin(const Ref &p_skin) { skin_bindings.insert(skin_ref.operator->()); - skin_ref->skin->connect("changed", callable_mp(skin_ref.operator->(), &SkinReference::_skin_changed)); + skin_ref->skin->connect_changed(callable_mp(skin_ref.operator->(), &SkinReference::_skin_changed)); _make_dirty(); // Skin needs to be updated, so update skeleton. diff --git a/scene/animation/animation_blend_tree.cpp b/scene/animation/animation_blend_tree.cpp index 6a76b5ac168c..412017bc5a72 100644 --- a/scene/animation/animation_blend_tree.cpp +++ b/scene/animation/animation_blend_tree.cpp @@ -1142,7 +1142,7 @@ void AnimationNodeBlendTree::add_node(const StringName &p_name, Refconnect("tree_changed", callable_mp(this, &AnimationNodeBlendTree::_tree_changed), CONNECT_REFERENCE_COUNTED); p_node->connect("animation_node_renamed", callable_mp(this, &AnimationNodeBlendTree::_animation_node_renamed), CONNECT_REFERENCE_COUNTED); p_node->connect("animation_node_removed", callable_mp(this, &AnimationNodeBlendTree::_animation_node_removed), CONNECT_REFERENCE_COUNTED); - p_node->connect("changed", callable_mp(this, &AnimationNodeBlendTree::_node_changed).bind(p_name), CONNECT_REFERENCE_COUNTED); + p_node->connect_changed(callable_mp(this, &AnimationNodeBlendTree::_node_changed).bind(p_name), CONNECT_REFERENCE_COUNTED); } Ref AnimationNodeBlendTree::get_node(const StringName &p_name) const { @@ -1206,7 +1206,7 @@ void AnimationNodeBlendTree::remove_node(const StringName &p_name) { node->disconnect("tree_changed", callable_mp(this, &AnimationNodeBlendTree::_tree_changed)); node->disconnect("animation_node_renamed", callable_mp(this, &AnimationNodeBlendTree::_animation_node_renamed)); node->disconnect("animation_node_removed", callable_mp(this, &AnimationNodeBlendTree::_animation_node_removed)); - node->disconnect("changed", callable_mp(this, &AnimationNodeBlendTree::_node_changed)); + node->disconnect_changed(callable_mp(this, &AnimationNodeBlendTree::_node_changed)); } nodes.erase(p_name); @@ -1231,7 +1231,7 @@ void AnimationNodeBlendTree::rename_node(const StringName &p_name, const StringN ERR_FAIL_COND(p_name == SceneStringNames::get_singleton()->output); ERR_FAIL_COND(p_new_name == SceneStringNames::get_singleton()->output); - nodes[p_name].node->disconnect("changed", callable_mp(this, &AnimationNodeBlendTree::_node_changed)); + nodes[p_name].node->disconnect_changed(callable_mp(this, &AnimationNodeBlendTree::_node_changed)); nodes[p_new_name] = nodes[p_name]; nodes.erase(p_name); @@ -1245,7 +1245,7 @@ void AnimationNodeBlendTree::rename_node(const StringName &p_name, const StringN } } // 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); + nodes[p_new_name].node->connect_changed(callable_mp(this, &AnimationNodeBlendTree::_node_changed).bind(p_new_name), CONNECT_REFERENCE_COUNTED); emit_signal(SNAME("animation_node_renamed"), get_instance_id(), p_name, p_new_name); emit_signal(SNAME("tree_changed")); diff --git a/scene/gui/button.cpp b/scene/gui/button.cpp index dc3cdf04c902..430569432ab2 100644 --- a/scene/gui/button.cpp +++ b/scene/gui/button.cpp @@ -30,7 +30,6 @@ #include "button.h" -#include "core/core_string_names.h" #include "core/string/translation.h" #include "servers/rendering_server.h" @@ -540,13 +539,13 @@ void Button::set_icon(const Ref &p_icon) { } if (icon.is_valid()) { - icon->disconnect(CoreStringNames::get_singleton()->changed, callable_mp(this, &Button::_texture_changed)); + icon->disconnect_changed(callable_mp(this, &Button::_texture_changed)); } icon = p_icon; if (icon.is_valid()) { - icon->connect(CoreStringNames::get_singleton()->changed, callable_mp(this, &Button::_texture_changed)); + icon->connect_changed(callable_mp(this, &Button::_texture_changed)); } queue_redraw(); diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp index 78862364d57a..0ca04faf9b1a 100644 --- a/scene/gui/control.cpp +++ b/scene/gui/control.cpp @@ -271,21 +271,21 @@ bool Control::_set(const StringName &p_name, const Variant &p_value) { if (name.begins_with("theme_override_icons/")) { String dname = name.get_slicec('/', 1); if (data.theme_icon_override.has(dname)) { - data.theme_icon_override[dname]->disconnect("changed", callable_mp(this, &Control::_notify_theme_override_changed)); + data.theme_icon_override[dname]->disconnect_changed(callable_mp(this, &Control::_notify_theme_override_changed)); } data.theme_icon_override.erase(dname); _notify_theme_override_changed(); } else if (name.begins_with("theme_override_styles/")) { String dname = name.get_slicec('/', 1); if (data.theme_style_override.has(dname)) { - data.theme_style_override[dname]->disconnect("changed", callable_mp(this, &Control::_notify_theme_override_changed)); + data.theme_style_override[dname]->disconnect_changed(callable_mp(this, &Control::_notify_theme_override_changed)); } data.theme_style_override.erase(dname); _notify_theme_override_changed(); } else if (name.begins_with("theme_override_fonts/")) { String dname = name.get_slicec('/', 1); if (data.theme_font_override.has(dname)) { - data.theme_font_override[dname]->disconnect("changed", callable_mp(this, &Control::_notify_theme_override_changed)); + data.theme_font_override[dname]->disconnect_changed(callable_mp(this, &Control::_notify_theme_override_changed)); } data.theme_font_override.erase(dname); _notify_theme_override_changed(); @@ -2468,13 +2468,13 @@ void Control::set_theme(const Ref &p_theme) { } if (data.theme.is_valid()) { - data.theme->disconnect("changed", callable_mp(this, &Control::_theme_changed)); + data.theme->disconnect_changed(callable_mp(this, &Control::_theme_changed)); } data.theme = p_theme; if (data.theme.is_valid()) { data.theme_owner->propagate_theme_changed(this, this, is_inside_tree(), true); - data.theme->connect("changed", callable_mp(this, &Control::_theme_changed), CONNECT_DEFERRED); + data.theme->connect_changed(callable_mp(this, &Control::_theme_changed), CONNECT_DEFERRED); return; } @@ -2769,11 +2769,11 @@ void Control::add_theme_icon_override(const StringName &p_name, const Refdisconnect("changed", callable_mp(this, &Control::_notify_theme_override_changed)); + data.theme_icon_override[p_name]->disconnect_changed(callable_mp(this, &Control::_notify_theme_override_changed)); } data.theme_icon_override[p_name] = p_icon; - data.theme_icon_override[p_name]->connect("changed", callable_mp(this, &Control::_notify_theme_override_changed), CONNECT_REFERENCE_COUNTED); + data.theme_icon_override[p_name]->connect_changed(callable_mp(this, &Control::_notify_theme_override_changed), CONNECT_REFERENCE_COUNTED); _notify_theme_override_changed(); } @@ -2782,11 +2782,11 @@ void Control::add_theme_style_override(const StringName &p_name, const Ref