Rename close requests to delete requests in GraphEdit
This commit is contained in:
parent
36945dad07
commit
378ab38b1f
9 changed files with 42 additions and 37 deletions
|
@ -5,7 +5,7 @@
|
|||
</brief_description>
|
||||
<description>
|
||||
[GraphEdit] provides tools for creation, manipulation, and display of various graphs. Its main purpose in the engine is to power the visual programming systems, such as visual shaders, but it is also available for use in user projects.
|
||||
[GraphEdit] by itself is only an empty container, representing an infinite grid where [GraphNode]s can be placed. Each [GraphNode] represents a node in the graph, a single unit of data in the connected scheme. [GraphEdit], in turn, helps to control various interactions with nodes and between nodes. When the user attempts to connect, disconnect, or close a [GraphNode], a signal is emitted in the [GraphEdit], but no action is taken by default. It is the responsibility of the programmer utilizing this control to implement the necessary logic to determine how each request should be handled.
|
||||
[GraphEdit] by itself is only an empty container, representing an infinite grid where [GraphNode]s can be placed. Each [GraphNode] represents a node in the graph, a single unit of data in the connected scheme. [GraphEdit], in turn, helps to control various interactions with nodes and between nodes. When the user attempts to connect, disconnect, or delete a [GraphNode], a signal is emitted in the [GraphEdit], but no action is taken by default. It is the responsibility of the programmer utilizing this control to implement the necessary logic to determine how each request should be handled.
|
||||
[b]Performance:[/b] It is greatly advised to enable low-processor usage mode (see [member OS.low_processor_usage_mode]) when using GraphEdits.
|
||||
</description>
|
||||
<tutorials>
|
||||
|
@ -289,12 +289,6 @@
|
|||
Emitted at the beginning of a GraphNode movement.
|
||||
</description>
|
||||
</signal>
|
||||
<signal name="close_nodes_request">
|
||||
<param index="0" name="nodes" type="StringName[]" />
|
||||
<description>
|
||||
Emitted when attempting to remove a GraphNode from the GraphEdit. Provides a list of node names to be removed (all selected nodes, excluding nodes without closing button).
|
||||
</description>
|
||||
</signal>
|
||||
<signal name="connection_drag_ended">
|
||||
<description>
|
||||
Emitted at the end of a connection drag.
|
||||
|
@ -338,6 +332,12 @@
|
|||
Emitted when the user presses [kbd]Ctrl + C[/kbd].
|
||||
</description>
|
||||
</signal>
|
||||
<signal name="delete_nodes_request">
|
||||
<param index="0" name="nodes" type="StringName[]" />
|
||||
<description>
|
||||
Emitted when attempting to remove a GraphNode from the GraphEdit. Provides a list of node names to be removed (all selected nodes, excluding nodes without closing button).
|
||||
</description>
|
||||
</signal>
|
||||
<signal name="disconnection_request">
|
||||
<param index="0" name="from_node" type="StringName" />
|
||||
<param index="1" name="from_port" type="int" />
|
||||
|
|
|
@ -27,9 +27,9 @@
|
|||
</member>
|
||||
</members>
|
||||
<signals>
|
||||
<signal name="close_request">
|
||||
<signal name="delete_request">
|
||||
<description>
|
||||
Emitted when closing the GraphElement is requested.
|
||||
Emitted when removing the GraphElement is requested.
|
||||
</description>
|
||||
</signal>
|
||||
<signal name="dragged">
|
||||
|
|
|
@ -170,7 +170,7 @@ void AnimationNodeBlendTreeEditor::update_graph() {
|
|||
name->connect("text_changed", callable_mp(this, &AnimationNodeBlendTreeEditor::_node_rename_lineedit_changed), CONNECT_DEFERRED);
|
||||
base = 1;
|
||||
agnode->set_closable(true);
|
||||
node->connect("close_request", callable_mp(this, &AnimationNodeBlendTreeEditor::_close_request).bind(E), CONNECT_DEFERRED);
|
||||
node->connect("delete_request", callable_mp(this, &AnimationNodeBlendTreeEditor::_delete_node_request).bind(E), CONNECT_DEFERRED);
|
||||
}
|
||||
|
||||
for (int i = 0; i < agnode->get_input_count(); i++) {
|
||||
|
@ -499,7 +499,7 @@ void AnimationNodeBlendTreeEditor::_anim_selected(int p_index, Array p_options,
|
|||
undo_redo->commit_action();
|
||||
}
|
||||
|
||||
void AnimationNodeBlendTreeEditor::_close_request(const String &p_which) {
|
||||
void AnimationNodeBlendTreeEditor::_delete_node_request(const String &p_which) {
|
||||
if (read_only) {
|
||||
return;
|
||||
}
|
||||
|
@ -523,7 +523,7 @@ void AnimationNodeBlendTreeEditor::_close_request(const String &p_which) {
|
|||
undo_redo->commit_action();
|
||||
}
|
||||
|
||||
void AnimationNodeBlendTreeEditor::_close_nodes_request(const TypedArray<StringName> &p_nodes) {
|
||||
void AnimationNodeBlendTreeEditor::_delete_nodes_request(const TypedArray<StringName> &p_nodes) {
|
||||
if (read_only) {
|
||||
return;
|
||||
}
|
||||
|
@ -557,7 +557,7 @@ void AnimationNodeBlendTreeEditor::_close_nodes_request(const TypedArray<StringN
|
|||
undo_redo->create_action(TTR("Delete Node(s)"));
|
||||
|
||||
for (const StringName &F : to_erase) {
|
||||
_close_request(F);
|
||||
_delete_node_request(F);
|
||||
}
|
||||
|
||||
undo_redo->commit_action();
|
||||
|
@ -1083,7 +1083,7 @@ AnimationNodeBlendTreeEditor::AnimationNodeBlendTreeEditor() {
|
|||
graph->connect("disconnection_request", callable_mp(this, &AnimationNodeBlendTreeEditor::_disconnection_request), CONNECT_DEFERRED);
|
||||
graph->connect("node_selected", callable_mp(this, &AnimationNodeBlendTreeEditor::_node_selected));
|
||||
graph->connect("scroll_offset_changed", callable_mp(this, &AnimationNodeBlendTreeEditor::_scroll_changed));
|
||||
graph->connect("close_nodes_request", callable_mp(this, &AnimationNodeBlendTreeEditor::_close_nodes_request));
|
||||
graph->connect("delete_nodes_request", callable_mp(this, &AnimationNodeBlendTreeEditor::_delete_nodes_request));
|
||||
graph->connect("popup_request", callable_mp(this, &AnimationNodeBlendTreeEditor::_popup_request));
|
||||
graph->connect("connection_to_empty", callable_mp(this, &AnimationNodeBlendTreeEditor::_connection_to_empty));
|
||||
graph->connect("connection_from_empty", callable_mp(this, &AnimationNodeBlendTreeEditor::_connection_from_empty));
|
||||
|
|
|
@ -109,8 +109,8 @@ class AnimationNodeBlendTreeEditor : public AnimationTreeNodeEditorPlugin {
|
|||
void _node_selected(Object *p_node);
|
||||
void _open_in_editor(const String &p_which);
|
||||
void _anim_selected(int p_index, Array p_options, const String &p_node);
|
||||
void _close_request(const String &p_which);
|
||||
void _close_nodes_request(const TypedArray<StringName> &p_nodes);
|
||||
void _delete_node_request(const String &p_which);
|
||||
void _delete_nodes_request(const TypedArray<StringName> &p_nodes);
|
||||
|
||||
bool _update_filters(const Ref<AnimationNode> &anode);
|
||||
void _inspect_filters(const String &p_which);
|
||||
|
|
|
@ -453,7 +453,7 @@ void VisualShaderGraphPlugin::add_node(VisualShader::Type p_type, int p_id, bool
|
|||
// All nodes are closable except the output node.
|
||||
if (p_id >= 2) {
|
||||
vsnode->set_closable(true);
|
||||
node->connect("close_request", callable_mp(editor, &VisualShaderEditor::_close_node_request).bind(p_type, p_id), CONNECT_DEFERRED);
|
||||
node->connect("delete_request", callable_mp(editor, &VisualShaderEditor::_delete_node_request).bind(p_type, p_id), CONNECT_DEFERRED);
|
||||
}
|
||||
graph->add_child(node);
|
||||
node->set_theme(vstheme);
|
||||
|
@ -3793,7 +3793,7 @@ void VisualShaderEditor::_convert_constants_to_parameters(bool p_vice_versa) {
|
|||
undo_redo->commit_action();
|
||||
}
|
||||
|
||||
void VisualShaderEditor::_close_node_request(int p_type, int p_node) {
|
||||
void VisualShaderEditor::_delete_node_request(int p_type, int p_node) {
|
||||
Ref<VisualShaderNode> node = visual_shader->get_node((VisualShader::Type)p_type, p_node);
|
||||
if (!node->is_closable()) {
|
||||
return;
|
||||
|
@ -3808,7 +3808,7 @@ void VisualShaderEditor::_close_node_request(int p_type, int p_node) {
|
|||
undo_redo->commit_action();
|
||||
}
|
||||
|
||||
void VisualShaderEditor::_close_nodes_request(const TypedArray<StringName> &p_nodes) {
|
||||
void VisualShaderEditor::_delete_nodes_request(const TypedArray<StringName> &p_nodes) {
|
||||
List<int> to_erase;
|
||||
|
||||
if (p_nodes.is_empty()) {
|
||||
|
@ -4839,7 +4839,7 @@ void VisualShaderEditor::_node_menu_id_pressed(int p_idx) {
|
|||
_paste_nodes(true, menu_point);
|
||||
break;
|
||||
case NodeMenuOptions::DELETE:
|
||||
_close_nodes_request(TypedArray<StringName>());
|
||||
_delete_nodes_request(TypedArray<StringName>());
|
||||
break;
|
||||
case NodeMenuOptions::DUPLICATE:
|
||||
_duplicate_nodes();
|
||||
|
@ -5139,7 +5139,7 @@ VisualShaderEditor::VisualShaderEditor() {
|
|||
graph->connect("duplicate_nodes_request", callable_mp(this, &VisualShaderEditor::_duplicate_nodes));
|
||||
graph->connect("copy_nodes_request", callable_mp(this, &VisualShaderEditor::_copy_nodes).bind(false));
|
||||
graph->connect("paste_nodes_request", callable_mp(this, &VisualShaderEditor::_paste_nodes).bind(false, Point2()));
|
||||
graph->connect("close_nodes_request", callable_mp(this, &VisualShaderEditor::_close_nodes_request));
|
||||
graph->connect("delete_nodes_request", callable_mp(this, &VisualShaderEditor::_delete_nodes_request));
|
||||
graph->connect("gui_input", callable_mp(this, &VisualShaderEditor::_graph_gui_input));
|
||||
graph->connect("connection_to_empty", callable_mp(this, &VisualShaderEditor::_connection_to_empty));
|
||||
graph->connect("connection_from_empty", callable_mp(this, &VisualShaderEditor::_connection_from_empty));
|
||||
|
|
|
@ -380,8 +380,8 @@ class VisualShaderEditor : public VBoxContainer {
|
|||
void _node_selected(Object *p_node);
|
||||
|
||||
void _delete_nodes(int p_type, const List<int> &p_nodes);
|
||||
void _close_node_request(int p_type, int p_node);
|
||||
void _close_nodes_request(const TypedArray<StringName> &p_nodes);
|
||||
void _delete_node_request(int p_type, int p_node);
|
||||
void _delete_nodes_request(const TypedArray<StringName> &p_nodes);
|
||||
|
||||
void _node_changed(int p_id);
|
||||
|
||||
|
|
|
@ -120,7 +120,6 @@ Excluded unexposed classes from extension_api.json.
|
|||
GH-79311
|
||||
--------
|
||||
|
||||
Validate extension JSON: API was removed: classes/GraphEdit/signals/delete_nodes_request
|
||||
Validate extension JSON: API was removed: classes/GraphNode/methods/get_connection_input_color
|
||||
Validate extension JSON: API was removed: classes/GraphNode/methods/get_connection_input_count
|
||||
Validate extension JSON: API was removed: classes/GraphNode/methods/get_connection_input_height
|
||||
|
|
|
@ -1384,7 +1384,7 @@ void GraphEdit::gui_input(const Ref<InputEvent> &p_ev) {
|
|||
}
|
||||
}
|
||||
|
||||
emit_signal(SNAME("close_nodes_request"), nodes);
|
||||
emit_signal(SNAME("delete_nodes_request"), nodes);
|
||||
accept_event();
|
||||
}
|
||||
}
|
||||
|
@ -1890,20 +1890,24 @@ void GraphEdit::_bind_methods() {
|
|||
|
||||
ADD_SIGNAL(MethodInfo("connection_request", PropertyInfo(Variant::STRING_NAME, "from_node"), PropertyInfo(Variant::INT, "from_port"), PropertyInfo(Variant::STRING_NAME, "to_node"), PropertyInfo(Variant::INT, "to_port")));
|
||||
ADD_SIGNAL(MethodInfo("disconnection_request", PropertyInfo(Variant::STRING_NAME, "from_node"), PropertyInfo(Variant::INT, "from_port"), PropertyInfo(Variant::STRING_NAME, "to_node"), PropertyInfo(Variant::INT, "to_port")));
|
||||
ADD_SIGNAL(MethodInfo("popup_request", PropertyInfo(Variant::VECTOR2, "position")));
|
||||
ADD_SIGNAL(MethodInfo("duplicate_nodes_request"));
|
||||
ADD_SIGNAL(MethodInfo("copy_nodes_request"));
|
||||
ADD_SIGNAL(MethodInfo("paste_nodes_request"));
|
||||
ADD_SIGNAL(MethodInfo("node_selected", PropertyInfo(Variant::OBJECT, "node", PROPERTY_HINT_RESOURCE_TYPE, "Node")));
|
||||
ADD_SIGNAL(MethodInfo("node_deselected", PropertyInfo(Variant::OBJECT, "node", PROPERTY_HINT_RESOURCE_TYPE, "Node")));
|
||||
ADD_SIGNAL(MethodInfo("connection_to_empty", PropertyInfo(Variant::STRING_NAME, "from_node"), PropertyInfo(Variant::INT, "from_port"), PropertyInfo(Variant::VECTOR2, "release_position")));
|
||||
ADD_SIGNAL(MethodInfo("connection_from_empty", PropertyInfo(Variant::STRING_NAME, "to_node"), PropertyInfo(Variant::INT, "to_port"), PropertyInfo(Variant::VECTOR2, "release_position")));
|
||||
ADD_SIGNAL(MethodInfo("close_nodes_request", PropertyInfo(Variant::ARRAY, "nodes", PROPERTY_HINT_ARRAY_TYPE, "StringName")));
|
||||
ADD_SIGNAL(MethodInfo("connection_drag_started", PropertyInfo(Variant::STRING_NAME, "from_node"), PropertyInfo(Variant::INT, "from_port"), PropertyInfo(Variant::BOOL, "is_output")));
|
||||
ADD_SIGNAL(MethodInfo("connection_drag_ended"));
|
||||
|
||||
ADD_SIGNAL(MethodInfo("copy_nodes_request"));
|
||||
ADD_SIGNAL(MethodInfo("paste_nodes_request"));
|
||||
ADD_SIGNAL(MethodInfo("duplicate_nodes_request"));
|
||||
ADD_SIGNAL(MethodInfo("delete_nodes_request", PropertyInfo(Variant::ARRAY, "nodes", PROPERTY_HINT_ARRAY_TYPE, "StringName")));
|
||||
|
||||
ADD_SIGNAL(MethodInfo("node_selected", PropertyInfo(Variant::OBJECT, "node", PROPERTY_HINT_RESOURCE_TYPE, "Node")));
|
||||
ADD_SIGNAL(MethodInfo("node_deselected", PropertyInfo(Variant::OBJECT, "node", PROPERTY_HINT_RESOURCE_TYPE, "Node")));
|
||||
|
||||
ADD_SIGNAL(MethodInfo("popup_request", PropertyInfo(Variant::VECTOR2, "position")));
|
||||
|
||||
ADD_SIGNAL(MethodInfo("begin_node_move"));
|
||||
ADD_SIGNAL(MethodInfo("end_node_move"));
|
||||
ADD_SIGNAL(MethodInfo("scroll_offset_changed", PropertyInfo(Variant::VECTOR2, "offset")));
|
||||
ADD_SIGNAL(MethodInfo("connection_drag_started", PropertyInfo(Variant::STRING_NAME, "from_node"), PropertyInfo(Variant::INT, "from_port"), PropertyInfo(Variant::BOOL, "is_output")));
|
||||
ADD_SIGNAL(MethodInfo("connection_drag_ended"));
|
||||
|
||||
BIND_ENUM_CONSTANT(SCROLL_ZOOMS);
|
||||
BIND_ENUM_CONSTANT(SCROLL_PANS);
|
||||
|
|
|
@ -233,13 +233,15 @@ void GraphElement::_bind_methods() {
|
|||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "selectable"), "set_selectable", "is_selectable");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "selected"), "set_selected", "is_selected");
|
||||
|
||||
ADD_SIGNAL(MethodInfo("position_offset_changed"));
|
||||
ADD_SIGNAL(MethodInfo("node_selected"));
|
||||
ADD_SIGNAL(MethodInfo("node_deselected"));
|
||||
ADD_SIGNAL(MethodInfo("dragged", PropertyInfo(Variant::VECTOR2, "from"), PropertyInfo(Variant::VECTOR2, "to")));
|
||||
|
||||
ADD_SIGNAL(MethodInfo("raise_request"));
|
||||
ADD_SIGNAL(MethodInfo("close_request"));
|
||||
ADD_SIGNAL(MethodInfo("delete_request"));
|
||||
ADD_SIGNAL(MethodInfo("resize_request", PropertyInfo(Variant::VECTOR2, "new_minsize")));
|
||||
|
||||
ADD_SIGNAL(MethodInfo("dragged", PropertyInfo(Variant::VECTOR2, "from"), PropertyInfo(Variant::VECTOR2, "to")));
|
||||
ADD_SIGNAL(MethodInfo("position_offset_changed"));
|
||||
|
||||
BIND_THEME_ITEM(Theme::DATA_TYPE_ICON, GraphElement, resizer);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue