mirror of
https://github.com/godotengine/godot.git
synced 2025-10-19 16:03:29 +00:00
Add node list param to GraphEdit::delete_nodes_request
signal
This commit is contained in:
parent
4379383ccd
commit
c84d050980
6 changed files with 44 additions and 18 deletions
|
@ -3409,16 +3409,23 @@ void VisualShaderEditor::_delete_node_request(int p_type, int p_node) {
|
|||
undo_redo->commit_action();
|
||||
}
|
||||
|
||||
void VisualShaderEditor::_delete_nodes_request() {
|
||||
void VisualShaderEditor::_delete_nodes_request(const TypedArray<StringName> &p_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.is_empty()) {
|
||||
// Called from context menu.
|
||||
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 < p_nodes.size(); i++) {
|
||||
to_erase.push_back(p_nodes[i].operator String().to_int());
|
||||
}
|
||||
}
|
||||
|
||||
if (to_erase.is_empty()) {
|
||||
|
@ -4411,7 +4418,7 @@ void VisualShaderEditor::_node_menu_id_pressed(int p_idx) {
|
|||
_paste_nodes(true, menu_point);
|
||||
break;
|
||||
case NodeMenuOptions::DELETE:
|
||||
_delete_nodes_request();
|
||||
_delete_nodes_request(TypedArray<StringName>());
|
||||
break;
|
||||
case NodeMenuOptions::DUPLICATE:
|
||||
_duplicate_nodes();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue