summaryrefslogtreecommitdiffstats
path: root/editor/plugins/visual_shader_editor_plugin.cpp
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2020-02-21 23:26:13 +0100
committerRémi Verschelde <rverschelde@gmail.com>2020-02-28 14:24:09 +0100
commitf742dabafee7f54e1b77148d547e2031d7cc535e (patch)
tree5aab3c9c4b9aca10d190a7efa600afb8c7aef213 /editor/plugins/visual_shader_editor_plugin.cpp
parent01afc442c73661df677c2b93f4037a21992ee45b (diff)
downloadredot-engine-f742dabafee7f54e1b77148d547e2031d7cc535e.tar.gz
Signals: Manually port most of remaining connect_compat uses
It's tedious work... Some can't be ported as they depend on private or protected methods of different classes, which is not supported by callable_mp (even if it's a class inherited by the current one).
Diffstat (limited to 'editor/plugins/visual_shader_editor_plugin.cpp')
-rw-r--r--editor/plugins/visual_shader_editor_plugin.cpp32
1 files changed, 10 insertions, 22 deletions
diff --git a/editor/plugins/visual_shader_editor_plugin.cpp b/editor/plugins/visual_shader_editor_plugin.cpp
index 1f400974b6..b3b9afb811 100644
--- a/editor/plugins/visual_shader_editor_plugin.cpp
+++ b/editor/plugins/visual_shader_editor_plugin.cpp
@@ -85,7 +85,7 @@ void VisualShaderEditor::edit(VisualShader *p_visual_shader) {
visual_shader->set_graph_offset(graph->get_scroll_ofs() / EDSCALE);
} else {
if (visual_shader.is_valid()) {
- if (visual_shader->is_connected_compat("changed", this, "")) {
+ if (visual_shader->is_connected("changed", callable_mp(this, &VisualShaderEditor::_update_preview))) {
visual_shader->disconnect("changed", callable_mp(this, &VisualShaderEditor::_update_preview));
}
}
@@ -523,10 +523,6 @@ void VisualShaderEditor::_update_graph() {
expression = expression_node->get_expression();
}
- /*if (!vsnode->is_connected("changed", this, "_node_changed")) {
- vsnode->connect("changed", this, "_node_changed", varray(vsnode->get_instance_id()), CONNECT_DEFERRED);
- }*/
-
node->set_offset(position);
node->set_title(vsnode->get_caption());
@@ -662,7 +658,7 @@ void VisualShaderEditor::_update_graph() {
case Variant::COLOR: {
button->set_custom_minimum_size(Size2(30, 0) * EDSCALE);
- button->connect_compat("draw", this, "_draw_color_over_button", varray(button, default_value));
+ button->connect("draw", callable_mp(this, &VisualShaderEditor::_draw_color_over_button), varray(button, default_value));
} break;
case Variant::BOOL: {
button->set_text(((bool)default_value) ? "true" : "false");
@@ -2940,15 +2936,10 @@ class VisualShaderNodePluginInputEditor : public OptionButton {
Ref<VisualShaderNodeInput> input;
-protected:
- static void _bind_methods() {
- ClassDB::bind_method("_item_selected", &VisualShaderNodePluginInputEditor::_item_selected);
- }
-
public:
void _notification(int p_what) {
if (p_what == NOTIFICATION_READY) {
- connect_compat("item_selected", this, "_item_selected");
+ connect("item_selected", callable_mp(this, &VisualShaderNodePluginInputEditor::_item_selected));
}
}
@@ -3078,25 +3069,22 @@ public:
bool res_prop = Object::cast_to<EditorPropertyResource>(p_properties[i]);
if (res_prop) {
- p_properties[i]->connect_compat("resource_selected", this, "_resource_selected");
+ p_properties[i]->connect("resource_selected", callable_mp(this, &VisualShaderNodePluginDefaultEditor::_resource_selected));
}
- properties[i]->connect_compat("property_changed", this, "_property_changed");
+ properties[i]->connect("property_changed", callable_mp(this, &VisualShaderNodePluginDefaultEditor::_property_changed));
properties[i]->set_object_and_property(node.ptr(), p_names[i]);
properties[i]->update_property();
properties[i]->set_name_split_ratio(0);
}
- node->connect_compat("changed", this, "_node_changed");
- node->connect_compat("editor_refresh_request", this, "_refresh_request", varray(), CONNECT_DEFERRED);
+ node->connect("changed", callable_mp(this, &VisualShaderNodePluginDefaultEditor::_node_changed));
+ node->connect("editor_refresh_request", callable_mp(this, &VisualShaderNodePluginDefaultEditor::_refresh_request), varray(), CONNECT_DEFERRED);
}
static void _bind_methods() {
- ClassDB::bind_method("_property_changed", &VisualShaderNodePluginDefaultEditor::_property_changed, DEFVAL(String()), DEFVAL(false));
- ClassDB::bind_method("_node_changed", &VisualShaderNodePluginDefaultEditor::_node_changed);
- ClassDB::bind_method("_refresh_request", &VisualShaderNodePluginDefaultEditor::_refresh_request);
- ClassDB::bind_method("_resource_selected", &VisualShaderNodePluginDefaultEditor::_resource_selected);
- ClassDB::bind_method("_open_inspector", &VisualShaderNodePluginDefaultEditor::_open_inspector);
- ClassDB::bind_method("_show_prop_names", &VisualShaderNodePluginDefaultEditor::_show_prop_names);
+ ClassDB::bind_method("_refresh_request", &VisualShaderNodePluginDefaultEditor::_refresh_request); // Used by UndoRedo.
+ ClassDB::bind_method("_open_inspector", &VisualShaderNodePluginDefaultEditor::_open_inspector); // Used by UndoRedo.
+ ClassDB::bind_method("_show_prop_names", &VisualShaderNodePluginDefaultEditor::_show_prop_names); // Used with call_deferred.
}
};