Esempio n. 1
0
 private void RegisterOperators(VFXViewController viewController)
 {
     for (int i = 0; i < newOperators.Count; ++i)
     {
         newControllers[OperatorFlag | (uint)i] = viewController.GetNodeController(newOperators[i], 0);
     }
 }
Esempio n. 2
0
        private void RegisterParameterNodes(VFXViewController viewController)
        {
            for (int i = 0; i < newParameters.Count; ++i)
            {
                viewController.GetParameterController(newParameters[i].Key).ApplyChanges();

                for (int j = 0; j < newParameters[i].Value.Count; j++)
                {
                    var nodeController = viewController.GetNodeController(newParameters[i].Key, newParameters[i].Value[j]) as VFXParameterNodeController;
                    newControllers[GetParameterNodeID((uint)i, (uint)j)] = nodeController;
                }
            }
        }
Esempio n. 3
0
        private void RegisterContexts(VFXViewController viewController)
        {
            for (int i = 0; i < newContexts.Count; ++i)
            {
                if (newContexts[i].Key != null)
                {
                    VFXContextController controller = viewController.GetNodeController(newContexts[i].Key, 0) as VFXContextController;
                    newControllers[ContextFlag | (uint)i] = controller;

                    for (int j = 0; j < newContexts[i].Value.Count; ++j)
                    {
                        var block = newContexts[i].Value[j];
                        if (block != null)
                        {
                            VFXBlockController blockController = controller.blockControllers.First(t => t.model == block);
                            if (blockController != null)
                            {
                                newControllers[GetBlockID((uint)i, (uint)j)] = blockController;
                            }
                        }
                    }
                }
            }
        }
Esempio n. 4
0
        void PasteAll(VFXViewController viewController, Vector2 center, ref SerializableGraph serializableGraph, VFXView view, VFXGroupNodeController groupNode, List <VFXNodeController> nodesInTheSameOrder)
        {
            newControllers.Clear();

            m_NodesInTheSameOrder = new VFXNodeID[serializableGraph.controllerCount];

            var graph = viewController.graph;

            pasteOffset = (serializableGraph.bounds.width > 0 && serializableGraph.bounds.height > 0) ? center - serializableGraph.bounds.center : Vector2.zero;
            MakePasteOffsetUnique(viewController, serializableGraph);

            // Paste all nodes
            PasteContexts(viewController, ref serializableGraph);
            PasteOperators(viewController, ref serializableGraph);
            PasteParameters(viewController, ref serializableGraph);

            // Create controllers for all new nodes
            viewController.LightApplyChanges();

            // Register all nodes for usage in groupNodes and edges
            RegisterContexts(viewController);
            RegisterOperators(viewController);
            RegisterParameterNodes(viewController);

            VFXUI ui = viewController.graph.UIInfos;

            firstCopiedGroup      = -1;
            firstCopiedStickyNote = ui.stickyNoteInfos != null ? ui.stickyNoteInfos.Length : 0;

            //Paste Everything else
            PasteGroupNodes(ref serializableGraph, ui);
            PasteStickyNotes(ref serializableGraph, ui);

            PasteDatas(ref serializableGraph); // TODO Data settings should be pasted at context creation. This can lead to issues as blocks are added before data is initialized
            PasteDataEdges(ref serializableGraph);
            PasteFlowEdges(ref serializableGraph);

            // Create all ui based on model
            viewController.LightApplyChanges();

            if (nodesInTheSameOrder != null)
            {
                nodesInTheSameOrder.Clear();
                nodesInTheSameOrder.AddRange(m_NodesInTheSameOrder.Select(t => t.model == null ? null : viewController.GetNodeController(t.model, t.id)));
            }

            if (view != null)
            {
                SelectCopiedElements(view, groupNode);
            }
        }
Esempio n. 5
0
        void PasteAll(VFXViewController viewController, Vector2 center, ref SerializableGraph serializableGraph, VFXView view, VFXGroupNodeController groupNode, List <VFXNodeController> nodesInTheSameOrder)
        {
            newControllers.Clear();

            m_NodesInTheSameOrder = new VFXNodeID[serializableGraph.controllerCount];

            // Can't paste context within subgraph block/operator
            if (viewController.model.visualEffectObject is VisualEffectSubgraphOperator || viewController.model.visualEffectObject is VisualEffectSubgraphBlock)
            {
                if (serializableGraph.contexts != null)
                {
                    var count = serializableGraph.contexts.Count();
                    if (count != 0)
                    {
                        Debug.LogWarningFormat("{0} context{1} been skipped during the paste operation. Contexts aren't available in this kind of subgraph.", count, count > 1 ? "s have" : " has");
                    }
                }
            }
            else
            {
                PasteContexts(viewController, center, ref serializableGraph);
            }

            PasteOperators(viewController, center, ref serializableGraph);
            PasteParameters(viewController, ref serializableGraph, center);

            // Create controllers for all new nodes
            viewController.LightApplyChanges();

            // Register all nodes for usage in groupNodes and edges
            RegisterContexts(viewController);
            RegisterOperators(viewController);
            RegisterParameterNodes(viewController);

            VFXUI ui = viewController.graph.UIInfos;

            firstCopiedGroup      = -1;
            firstCopiedStickyNote = ui.stickyNoteInfos != null ? ui.stickyNoteInfos.Length : 0;

            //Paste Everything else
            PasteGroupNodes(ref serializableGraph, center, ui);
            PasteStickyNotes(ref serializableGraph, center, ui);

            PasteDatas(ref serializableGraph); // TODO Data settings should be pasted at context creation. This can lead to issues as blocks are added before data is initialized
            PasteDataEdges(ref serializableGraph);
            PasteFlowEdges(ref serializableGraph);

            // Create all ui based on model
            viewController.LightApplyChanges();

            if (nodesInTheSameOrder != null)
            {
                nodesInTheSameOrder.Clear();
                nodesInTheSameOrder.AddRange(m_NodesInTheSameOrder.Select(t => t.model == null ? null : viewController.GetNodeController(t.model, t.id)));
            }

            if (view != null)
            {
                SelectCopiedElements(view, groupNode);
            }
        }