void SGraphEditorImpl::SelectAllNodes() { FGraphPanelSelectionSet NewSet; for (int32 NodeIndex = 0; NodeIndex < EdGraphObj->Nodes.Num(); ++NodeIndex) { UEdGraphNode* Node = EdGraphObj->Nodes[NodeIndex]; ensureMsg(Node->IsValidLowLevel(), TEXT("Node is invalid")); NewSet.Add(Node); } GraphPanel->SelectionManager.SetSelectionSet(NewSet); }
bool FSoundCueEditor::CanDeleteNodes() const { const FGraphPanelSelectionSet SelectedNodes = GetSelectedNodes(); if (SelectedNodes.Num() == 1) { for (FGraphPanelSelectionSet::TConstIterator NodeIt(SelectedNodes); NodeIt; ++NodeIt) { if (Cast<USoundCueGraphNode_Root>(*NodeIt)) { // Return false if only root node is selected, as it can't be deleted return false; } } } return SelectedNodes.Num() > 0; }
void FSoundCueEditor::DeleteSelectedDuplicatableNodes() { // Cache off the old selection const FGraphPanelSelectionSet OldSelectedNodes = GetSelectedNodes(); // Clear the selection and only select the nodes that can be duplicated FGraphPanelSelectionSet RemainingNodes; SoundCueGraphEditor->ClearSelectionSet(); for (FGraphPanelSelectionSet::TConstIterator SelectedIter(OldSelectedNodes); SelectedIter; ++SelectedIter) { UEdGraphNode* Node = Cast<UEdGraphNode>(*SelectedIter); if ((Node != NULL) && Node->CanDuplicateNode()) { SoundCueGraphEditor->SetNodeSelection(Node, true); } else { RemainingNodes.Add(Node); } } // Delete the duplicatable nodes DeleteSelectedNodes(); // Reselect whatever's left from the original selection after the deletion SoundCueGraphEditor->ClearSelectionSet(); for (FGraphPanelSelectionSet::TConstIterator SelectedIter(RemainingNodes); SelectedIter; ++SelectedIter) { if (UEdGraphNode* Node = Cast<UEdGraphNode>(*SelectedIter)) { SoundCueGraphEditor->SetNodeSelection(Node, true); } } }