Ejemplo n.º 1
0
        public void AddNode(string nodeName, string nodeNamespace, ConstellationEditorEvents.EditorEvents editorEvent)
        {
            editorEvent(ConstellationEditorEvents.EditorEventType.AddToUndo, "Add node");
            var nodeData    = TypeConst.AddNode(NodeFactory, nodeName, nodeNamespace, ConstellationScript.script);
            var newNodeView = new NodeView(nodeData);

            Nodes.Add(newNodeView);
            newNodeView.UpdateNodeSize(0, 0, EditorData.GetConstellationEditorConfig());
            newNodeView.SetPosition(ScrollPosition.x + (windowSizeX * 0.5f), ScrollPosition.y + (windowSizeY * 0.5f));
            newNodeView.LockNodePosition();
            SetNodeToFirst(newNodeView);
            editorEvent(ConstellationEditorEvents.EditorEventType.NodeAdded, nodeData.Guid);
        }
Ejemplo n.º 2
0
        public void AddNode(string nodeName, string nodeNamespace, ConstellationEditorEvents.EditorEvents callback)
        {
            var newNode  = NodeFactory.GetNode(nodeName, nodeNamespace);
            var nodeData = new NodeData(newNode);

            nodeData           = ConstellationScript.AddNode(nodeData);
            nodeData.XPosition = 0;
            nodeData.YPosition = 0;
            var newNodeView = new NodeView(nodeData);

            Nodes.Add(newNodeView);
            newNodeView.UpdateNodeSize(0, 0);
            newNodeView.SetPosition(ScrollPosition.x + (windowSizeX * 0.5f), ScrollPosition.y + (windowSizeY * 0.5f));
            newNodeView.LockNodePosition();
            callback(ConstellationEditorEvents.EditorEventType.NodeAdded, nodeData.Guid);
            SetNodeToFirst(newNodeView);
        }