void OnElementsAddedToGroup(Group graphGroup, IEnumerable <GraphElement> element) { var groupData = graphGroup.userData as GroupData; if (groupData != null) { var anyChanged = false; foreach (var materialNodeView in element.Select(e => e).OfType <MaterialNodeView>()) { if (materialNodeView.node.groupGuid != groupData.guid) { anyChanged = true; break; } } if (!anyChanged) { return; } m_Graph.owner.RegisterCompleteObjectUndo(groupData.title); foreach (var materialNodeView in element.Select(e => e).OfType <MaterialNodeView>()) { m_Graph.SetNodeGroup(materialNodeView.node, groupData); } } }