mirror of
https://github.com/godotengine/godot.git
synced 2025-10-21 17:03:42 +00:00
Add node list param to GraphEdit::delete_nodes_request signal
This commit is contained in:
parent
e86d840d4f
commit
32b9818965
6 changed files with 43 additions and 19 deletions
|
@ -1831,18 +1831,24 @@ void VisualScriptEditor::_on_nodes_paste() {
|
|||
}
|
||||
}
|
||||
|
||||
void VisualScriptEditor::_on_nodes_delete() {
|
||||
void VisualScriptEditor::_on_nodes_delete(const Array &p_nodes) {
|
||||
// delete all the selected nodes
|
||||
|
||||
List<int> to_erase;
|
||||
|
||||
for (int i = 0; i < graph->get_child_count(); i++) {
|
||||
GraphNode *gn = Object::cast_to<GraphNode>(graph->get_child(i));
|
||||
if (gn) {
|
||||
if (gn->is_selected() && gn->is_close_button_visible()) {
|
||||
to_erase.push_back(gn->get_name().operator String().to_int());
|
||||
if (p_nodes.empty()) {
|
||||
for (int i = 0; i < graph->get_child_count(); i++) {
|
||||
GraphNode *gn = Object::cast_to<GraphNode>(graph->get_child(i));
|
||||
if (gn) {
|
||||
if (gn->is_selected() && gn->is_close_button_visible()) {
|
||||
to_erase.push_back(gn->get_name().operator String().to_int());
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (int i = 0; i < graph->get_child_count(); i++) {
|
||||
to_erase.push_back(p_nodes[i].operator String().to_int());
|
||||
}
|
||||
}
|
||||
|
||||
if (to_erase.empty()) {
|
||||
|
@ -4253,7 +4259,7 @@ void VisualScriptEditor::_comment_node_resized(const Vector2 &p_new_size, int p_
|
|||
void VisualScriptEditor::_menu_option(int p_what) {
|
||||
switch (p_what) {
|
||||
case EDIT_DELETE_NODES: {
|
||||
_on_nodes_delete();
|
||||
_on_nodes_delete(Array());
|
||||
} break;
|
||||
case EDIT_TOGGLE_BREAKPOINT: {
|
||||
List<String> reselect;
|
||||
|
@ -4288,7 +4294,7 @@ void VisualScriptEditor::_menu_option(int p_what) {
|
|||
} break;
|
||||
case EDIT_CUT_NODES: {
|
||||
_on_nodes_copy();
|
||||
_on_nodes_delete();
|
||||
_on_nodes_delete(Array());
|
||||
} break;
|
||||
case EDIT_PASTE_NODES: {
|
||||
_on_nodes_paste();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue