Unify and streamline connecting to Resource changes

This commit is contained in:
kobewi 2023-07-03 21:29:37 +02:00
parent 2c55214068
commit de4a3fa151
98 changed files with 341 additions and 434 deletions

View file

@ -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<AudioStream> &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<AudioStream> &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;

View file

@ -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<Curve> 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,

View file

@ -39,7 +39,7 @@
void GradientEditor::set_gradient(const Ref<Gradient> &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());

View file

@ -133,7 +133,7 @@ void GradientTexture2DEdit::gui_input(const Ref<InputEvent> &p_event) {
void GradientTexture2DEdit::set_texture(Ref<GradientTexture2D> &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) {

View file

@ -77,7 +77,7 @@ void InputEventConfigContainer::set_event(const Ref<InputEvent> &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() {

View file

@ -4929,7 +4929,7 @@ void Node3DEditorViewport::register_shortcut_action(const String &p_path, const
Ref<Shortcut> 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.

View file

@ -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();

View file

@ -222,7 +222,7 @@ void ShaderFileEditor::_bind_methods() {
void ShaderFileEditor::edit(const Ref<RDShaderFile> &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<RDShaderFile> &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();

View file

@ -43,11 +43,11 @@ void StyleBoxPreview::_grid_preview_toggled(bool p_active) {
void StyleBoxPreview::edit(const Ref<StyleBox> &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<StyleBoxTexture> sbt = stylebox;
grid_preview->set_visible(sbt.is_valid());

View file

@ -122,7 +122,7 @@ void ShaderTextEditor::set_edited_shader(const Ref<Shader> &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<ShaderInclude>();
@ -130,7 +130,7 @@ void ShaderTextEditor::set_edited_shader(const Ref<Shader> &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<ShaderInclude> &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<Shader>();
@ -160,7 +160,7 @@ void ShaderTextEditor::set_edited_shader_include(const Ref<ShaderInclude> &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));
}
}

View file

@ -115,7 +115,7 @@ void Texture3DEditor::_texture_rect_update_area() {
void Texture3DEditor::edit(Ref<Texture3D> 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<Texture3D> 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));
}
}

View file

@ -140,7 +140,7 @@ TexturePreview::TexturePreview(Ref<Texture2D> 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"));

View file

@ -181,7 +181,7 @@ void TextureLayeredEditor::_texture_rect_update_area() {
void TextureLayeredEditor::edit(Ref<TextureLayered> 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<TextureLayered> 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;

View file

@ -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<InputEvent> &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<Resource>(p_obj)->connect_changed(callable_mp(this, &TextureRegionEditor::_texture_changed));
} else {
p_obj->connect("texture_changed", callable_mp(this, &TextureRegionEditor::_texture_changed));
}

View file

@ -3151,7 +3151,7 @@ void ThemeTypeEditor::_stylebox_item_changed(Ref<StyleBox> 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<StyleBox> 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<Resource>());
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<StyleBox> 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<StyleBox> 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<Theme> &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();
}

View file

@ -88,11 +88,11 @@ void TileDataEditor::_bind_methods() {
void TileDataEditor::set_tile_set(Ref<TileSet> 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();
}

View file

@ -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<TileSet>();
return;
}
@ -2218,7 +2218,7 @@ void TileSetAtlasSourceEditor::edit(Ref<TileSet> 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<TileSet> 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) {

View file

@ -723,7 +723,7 @@ void TileSetEditor::edit(Ref<TileSet> 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<TileSet> 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));

View file

@ -384,7 +384,7 @@ void TileSetScenesCollectionSourceEditor::edit(Ref<TileSet> 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<TileSet> 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.

View file

@ -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<VisualShader>(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<VisualShader> &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;