private void OnRightClickSplatSelect(string selected) { if (firstSelectSplat) { firstSelectSplat = false; } else { Destroy(splatRightClick.gameObject); switch (selected) { case "del": { DeleteSelectedNodes(); } break; case "group": { //delete the extra links like in copy //group nodes and delete GroupNodeVisual nv = (GroupNodeVisual)NodeVisual.Create(typeof(GroupNodeVisual), this, new Vector2(Input.mousePosition.x / Screen.width, Input.mousePosition.y / Screen.height), editorUI, false); nv.node = nv.GetNode(); GroupNode groupNode = (GroupNode)nv.node; nv.initClip = clipboard; nv.initClipPos = clipboardPos; VisualEditor.BackEnd.Input[] ins; VisualEditor.BackEnd.Output[] outs; Type[] inTypes; Vector2[] inPos; Vector2[] outPos; CopySelectedNodesForGrouping(out ins, out outs, out inTypes, out inPos, out outPos); List <VisualEditor.BackEnd.Node> clipTmp = new List <VisualEditor.BackEnd.Node>(clipboard); List <Vector2> clipPosTmp = new List <Vector2>(clipboardPos); //create inputs and outputs group nodes for (int i = 0; i < ins.Length; i++) { //TODO quand la node a un input adaptatif ca marche po GroupInputNode node = new GroupInputNode(); node.BeginSetup(); node.SetDataType(inTypes[i]); if (node.outputs[0].ConnectToDiscreet(ins[i])) { clipTmp.Add(node); Vector2 pos = inPos[i] - new Vector2(500f, 0f); while (clipPosTmp.Contains(pos)) //prevent nodes from being on top of each other { pos -= new Vector2(0f, 150f); } clipPosTmp.Add(pos); } else { Debug.Log("in not good"); node.Delete(); } } for (int i = 0; i < outs.Length; i++) { GroupOutputNode node = new GroupOutputNode(); node.BeginSetup(); if (outs[i].ConnectToDiscreet(node.inputs[0])) { clipTmp.Add(node); Vector2 pos = outPos[i] + new Vector2(500f, 0f); while (clipPosTmp.Contains(pos)) { pos -= new Vector2(0f, 150f); } clipPosTmp.Add(pos); } else { Debug.Log("out not good"); node.Delete(); } } InputManager.clipboard = clipTmp.ToArray(); InputManager.clipboardPos = clipPosTmp.ToArray(); groupNode.BeginSetup(); //manually startup the node //delete selected since they have been placed in the group RectTransform[] copy = selectedNodes.ToArray(); for (int i = 0; i < copy.Length; i++) { copy[i].GetComponent <NodeVisual>().Delete(); } } break; case "dis": { for (int i = 0; i < selectedNodes.Count; i++) { NodeVisual n = selectedNodes[i].GetComponent <NodeVisual>(); n.SetEnable(!n.node.enabled); } } break; } } }