public VFXParameterNodeController(VFXParameterController controller, VFXParameter.Node infos, VFXViewController viewController) : base(controller.model, viewController)
 {
     m_ParentController = controller;
     m_Id = infos.id;
 }
Exemplo n.º 2
0
        void AddLinkedNode(VFXNodeProvider.Descriptor d, Vector2 mPos)
        {
            var mySlot = controller.model;

            VFXView           view           = GetFirstAncestorOfType <VFXView>();
            VFXViewController viewController = controller.viewController;

            if (view == null)
            {
                return;
            }

            var newNodeController = view.AddNode(d, mPos);

            if (newNodeController == null)
            {
                return;
            }

            IEnumerable <Type> validTypes = null;

            var op = controller.sourceNode.model as VFXOperatorNumericCascadedUnified;

            if (mySlot == null && op != null)
            {
                validTypes = op.validTypes;
            }

            // If linking to a new parameter, copy the slot value and space
            if (direction == Direction.Input && controller.model != null) //model will be null for upcomming which won't have a value
            {
                if (newNodeController is VFXOperatorController)
                {
                    var inlineOperator = (newNodeController as VFXOperatorController).model as VFXInlineOperator;
                    if (inlineOperator != null)
                    {
                        var    value          = controller.model.value;
                        object convertedValue = null;
                        if (VFXConverter.TryConvertTo(value, inlineOperator.type, out convertedValue))
                        {
                            inlineOperator.inputSlots[0].value = convertedValue;
                        }

                        if (inlineOperator.inputSlots[0].spaceable && controller.model.spaceable)
                        {
                            inlineOperator.inputSlots[0].space = controller.model.space;
                        }
                    }
                }
            }

            var ports = direction == Direction.Input ? newNodeController.outputPorts : newNodeController.inputPorts;
            int count = ports.Count();

            for (int i = 0; i < count; ++i)
            {
                var port = ports[i];
                if (mySlot != null)
                {
                    if (viewController.CreateLink(direction == Direction.Input ? controller : port, direction == Direction.Input ? port : controller))
                    {
                        break;
                    }
                }
                else if (validTypes != null)
                {
                    if (validTypes.Contains(port.model.property.type))
                    {
                        if (viewController.CreateLink(controller, port))
                        {
                            break;
                        }
                    }
                }
            }
        }
Exemplo n.º 3
0
        private void MakePasteOffsetUnique(VFXViewController viewController, SerializableGraph serializableGraph)
        {
            // look if pasting there will result in the first element beeing exactly on top of other
            while (true)
            {
                bool foundSamePosition = false;
                if (serializableGraph.contexts != null && serializableGraph.contexts.Length > 0)
                {
                    foreach (var existingContext in viewController.graph.children.OfType <VFXContext>())
                    {
                        if ((serializableGraph.contexts[0].node.position + pasteOffset - existingContext.position).sqrMagnitude < 1)
                        {
                            foundSamePosition = true;
                            break;
                        }
                    }
                }
                else if (serializableGraph.operators != null && serializableGraph.operators.Length > 0)
                {
                    foreach (var existingSlotContainer in viewController.graph.children.Where(t => t is IVFXSlotContainer))
                    {
                        if ((serializableGraph.operators[0].position + pasteOffset - existingSlotContainer.position).sqrMagnitude < 1)
                        {
                            foundSamePosition = true;
                            break;
                        }
                    }
                }
                else if (serializableGraph.parameters != null && serializableGraph.parameters.Length > 0 && serializableGraph.parameters[0].nodes.Length > 0)
                {
                    foreach (var existingSlotContainer in viewController.graph.children.Where(t => t is IVFXSlotContainer))
                    {
                        if ((serializableGraph.parameters[0].nodes[0].position + pasteOffset - existingSlotContainer.position).sqrMagnitude < 1)
                        {
                            foundSamePosition = true;
                            break;
                        }
                    }
                }
                else if (serializableGraph.stickyNotes != null && serializableGraph.stickyNotes.Length > 0)
                {
                    foreach (var stickyNote in viewController.stickyNotes)
                    {
                        if ((serializableGraph.stickyNotes[0].position.position + pasteOffset - stickyNote.position.position).sqrMagnitude < 1)
                        {
                            foundSamePosition = true;
                            break;
                        }
                    }
                }
                else if (serializableGraph.groupNodes != null && serializableGraph.groupNodes.Length > 0)
                {
                    foreach (var gn in viewController.groupNodes)
                    {
                        if ((serializableGraph.groupNodes[0].infos.position.position + pasteOffset - gn.position.position).sqrMagnitude < 1)
                        {
                            foundSamePosition = true;
                            break;
                        }
                    }
                }

                if (foundSamePosition)
                {
                    pasteOffset += Vector2.one * 30;
                }
                else
                {
                    break;
                }
            }
        }
Exemplo n.º 4
0
 public VFXGroupNodeController(VFXViewController viewController, VFXUI ui, int index) : base(viewController, ui, index)
 {
 }
 public VFXUniformOperatorController(VFXOperator model, VFXViewController viewController) : base(model, viewController)
 {
 }
Exemplo n.º 6
0
        void IEdgeConnectorListener.OnDropOutsidePort(Edge edge, Vector2 position)
        {
            VFXView           view           = this.GetFirstAncestorOfType <VFXView>();
            VFXViewController viewController = view.controller;


            VFXContextUI endContext = null;

            foreach (var node in view.GetAllContexts())
            {
                if (node.worldBound.Contains(position))
                {
                    endContext = node;
                }
            }

            VFXFlowEdge flowEdge = edge as VFXFlowEdge;
            bool        exists   = false;

            if (flowEdge.controller != null)
            {
                view.controller.RemoveElement(flowEdge.controller);
                exists = true;
            }

            if (endContext != null)
            {
                VFXContextController nodeController = endContext.controller;

                var compatibleAnchors = viewController.GetCompatiblePorts(controller, null);

                if (controller.direction == Direction.Input)
                {
                    foreach (var outputAnchor in nodeController.flowOutputAnchors)
                    {
                        if (compatibleAnchors.Contains(outputAnchor))
                        {
                            VFXFlowEdgeController edgeController = new VFXFlowEdgeController(controller, outputAnchor);

                            viewController.AddElement(edgeController);
                            break;
                        }
                    }
                }
                else
                {
                    foreach (var inputAnchor in nodeController.flowInputAnchors)
                    {
                        if (compatibleAnchors.Contains(inputAnchor))
                        {
                            VFXFlowEdgeController edgeController = new VFXFlowEdgeController(inputAnchor, controller);

                            viewController.AddElement(edgeController);
                            break;
                        }
                    }
                }
            }
            else if (!exists)
            {
                VFXFilterWindow.Show(VFXViewWindow.currentWindow, Event.current.mousePosition - new Vector2(376 * 0.5f * VFXViewWindow.currentWindow.graphView.scale, 0), view.ViewToScreenPosition(Event.current.mousePosition), new VFXNodeProvider(viewController, AddLinkedContext, ProviderFilter, new Type[] { typeof(VFXContext) }));
            }
        }
 public VFXContextOnlyVFXNodeProvider(VFXViewController controller, Action <Descriptor, Vector2> onAddBlock, Func <Descriptor, bool> filter) :
     base(controller, onAddBlock, filter, new Type[] { typeof(VFXContext) })
 {
 }
 public VFXUnifiedConstraintOperatorController(VFXModel model, VFXViewController viewController) : base(model, viewController)
 {
 }
 public VFXCascadedOperatorController(VFXModel model, VFXViewController viewController) : base(model, viewController)
 {
 }
Exemplo n.º 10
0
        void IEdgeConnectorListener.OnDropOutsidePort(Edge edge, Vector2 position)
        {
            VFXSlot startSlot = controller.model;

            VFXView           view           = this.GetFirstAncestorOfType <VFXView>();
            VFXViewController viewController = view.controller;


            List <VisualElement> picked = new List <VisualElement>();

            panel.PickAll(position, picked);
            VFXNodeUI endNode = null;

            foreach (var element in picked)
            {
                if (element is VFXNodeUI node)
                {
                    endNode = node;
                    break;
                }
            }


            VFXDataEdge dataEdge = edge as VFXDataEdge;
            bool        exists   = false;

            if (dataEdge.controller != null)
            {
                exists = true;
                view.controller.RemoveElement(dataEdge.controller);
            }

            if (endNode != null)
            {
                VFXNodeController nodeController = endNode.controller;

                if (nodeController != null)
                {
                    IVFXSlotContainer slotContainer = nodeController.slotContainer;
                    if (controller.direction == Direction.Input)
                    {
                        foreach (var output in nodeController.outputPorts.Where(t => t.model == null || t.model.IsMasterSlot()))
                        {
                            if (viewController.CreateLink(controller, output))
                            {
                                break;
                            }
                        }
                    }
                    else
                    {
                        foreach (var input in nodeController.inputPorts.Where(t => t.model == null || t.model.IsMasterSlot() && !t.model.HasLink(true)))
                        {
                            if (viewController.CreateLink(input, controller))
                            {
                                break;
                            }
                        }
                    }
                }
            }
            else if (controller.direction == Direction.Input && Event.current.modifiers == EventModifiers.Alt)
            {
                VFXModelDescriptorParameters parameterDesc = VFXLibrary.GetParameters().FirstOrDefault(t => t.name == controller.portType.UserFriendlyName());
                if (parameterDesc != null)
                {
                    Vector2      pos       = view.contentViewContainer.GlobalToBound(position) - new Vector2(140, 20);
                    VFXParameter parameter = viewController.AddVFXParameter(pos, parameterDesc, false);
                    parameter.SetSettingValue("m_Exposed", true);
                    startSlot.Link(parameter.outputSlots[0]);

                    CopyValueToParameter(parameter);

                    viewController.AddVFXModel(pos, parameter);
                }
            }
            else if (!exists)
            {
                if (direction == Direction.Input || viewController.model.visualEffectObject is VisualEffectSubgraphOperator || viewController.model.visualEffectObject is VisualEffectSubgraphBlock) // no context for subgraph operators.
                {
                    VFXFilterWindow.Show(VFXViewWindow.currentWindow, Event.current.mousePosition, view.ViewToScreenPosition(Event.current.mousePosition), new VFXNodeProvider(viewController, AddLinkedNode, ProviderFilter, new Type[] { typeof(VFXOperator), typeof(VFXParameter) }));
                }
                else
                {
                    VFXFilterWindow.Show(VFXViewWindow.currentWindow, Event.current.mousePosition, view.ViewToScreenPosition(Event.current.mousePosition), new VFXNodeProvider(viewController, AddLinkedNode, ProviderFilter, new Type[] { typeof(VFXOperator), typeof(VFXParameter), typeof(VFXContext) }));
                }
            }
        }
Exemplo n.º 11
0
 public VFXUnifiedOperatorControllerBase(VFXModel model, VFXViewController viewController) : base(model, viewController)
 {
 }
Exemplo n.º 12
0
 public VFXController(VFXViewController viewController, T model) : base(model)
 {
     m_ViewController = viewController;
     m_ViewController.RegisterNotification(model, OnModelChanged);
 }
        void ConvertContext(VFXNodeProvider.Descriptor d, Vector2 mPos)
        {
            VFXView           view           = GetFirstAncestorOfType <VFXView>();
            VFXViewController viewController = controller.viewController;

            if (view == null)
            {
                return;
            }

            mPos = view.contentViewContainer.ChangeCoordinatesTo(view, controller.position);

            var newNodeController    = view.AddNode(d, mPos);
            var newContextController = newNodeController as VFXContextController;

            //transfer blocks
            foreach (var block in controller.model.children.ToArray()) // To array needed as the IEnumerable content will change
            {
                newContextController.AddBlock(-1, block);
            }


            //transfer settings
            var contextType = controller.model.GetType();

            foreach (var setting in newContextController.model.GetSettings(true))
            {
                if (newContextController.model is VFXPlanarPrimitiveOutput && setting.field.Name == "primitiveType")
                {
                    continue;
                }

                if (!setting.valid || setting.field.GetCustomAttributes(typeof(VFXSettingAttribute), true).Length == 0)
                {
                    continue;
                }

                object value;
                if (VFXConverter.TryConvertTo(setting.value, setting.field.FieldType, out value))
                {
                    newContextController.model.SetSettingValue(setting.field.Name, value);
                }
            }

            //transfer flow edges
            if (controller.flowInputAnchors.Count == 1)
            {
                foreach (var output in controller.flowInputAnchors[0].connections.Select(t => t.output).ToArray())
                {
                    newContextController.model.LinkFrom(output.context.model, output.slotIndex);
                }
            }

            // Apply the slot changes that can be the result of settings changes
            newContextController.ApplyChanges();

            VFXSlot firstTextureSlot = null;

            //transfer master slot values
            foreach (var slot in newContextController.model.inputSlots)
            {
                VFXSlot mySlot = controller.model.inputSlots.FirstOrDefault(t => t.name == slot.name);
                if (mySlot == null)
                {
                    if (slot.valueType == VFXValueType.Texture2D && firstTextureSlot == null)
                    {
                        firstTextureSlot = slot;
                    }
                    continue;
                }

                object value;
                if (VFXConverter.TryConvertTo(mySlot.value, slot.property.type, out value))
                {
                    slot.value = value;
                }
            }
            //Hack to copy the first texture in the first texture slot if not found by name
            if (firstTextureSlot != null)
            {
                VFXSlot mySlot = controller.model.inputSlots.FirstOrDefault(t => t.valueType == VFXValueType.Texture2D);

                if (mySlot != null)
                {
                    firstTextureSlot.value = mySlot.value;
                }
            }

            foreach (var anchor in newContextController.inputPorts)
            {
                string path     = anchor.path;
                var    myAnchor = controller.inputPorts.FirstOrDefault(t => t.path == path);

                if (myAnchor == null || !myAnchor.HasLink())
                {
                    continue;
                }

                //There should be only one
                var output = myAnchor.connections.First().output;

                viewController.CreateLink(anchor, output);
            }

            // Apply the change so that it won't unlink the blocks links
            controller.ApplyChanges();

            viewController.RemoveElement(controller);
        }
Exemplo n.º 14
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);

            // 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, 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);
            }
        }
 public VFXNodeProvider(VFXViewController controller, Action <Descriptor, Vector2> onAddBlock, Func <Descriptor, bool> filter = null, IEnumerable <Type> acceptedTypes = null) : base(onAddBlock)
 {
     m_Filter        = filter;
     m_AcceptedTypes = acceptedTypes;
     m_Controller    = controller;
 }
Exemplo n.º 16
0
 public VFXNumericUniformOperatorController(VFXModel model, VFXViewController viewController) : base(model, viewController)
 {
 }
Exemplo n.º 17
0
        void Update()
        {
            if (graphView == null)
            {
                return;
            }

            if (m_OnUpdateAction != null)
            {
                m_OnUpdateAction();
                m_OnUpdateAction = null;
            }
            VFXViewController controller = graphView.controller;
            var filename = "No Asset";

            if (controller != null)
            {
                controller.NotifyUpdate();
                if (controller.model != null)
                {
                    var graph = controller.graph;
                    if (graph != null)
                    {
                        filename = controller.name;

                        if (!graph.saved)
                        {
                            filename += "*";
                        }
                        if (autoCompile && graph.IsExpressionGraphDirty() && !graph.GetResource().isSubgraph)
                        {
                            VFXGraph.explicitCompile = true;
                            graph.errorManager.ClearAllErrors(null, VFXErrorOrigin.Compilation);
                            using (var reporter = new VFXCompileErrorReporter(controller.graph.errorManager))
                            {
                                VFXGraph.compileReporter = reporter;
                                AssetDatabase.ImportAsset(AssetDatabase.GetAssetPath(graphView.controller.model));
                                VFXGraph.compileReporter = null;
                            }
                            VFXGraph.explicitCompile = false;
                        }
                        else
                        {
                            graph.RecompileIfNeeded(true, true);
                        }

                        controller.RecompileExpressionGraphIfNeeded();
                    }
                }
            }

            if (VFXViewModicationProcessorInternal.assetMoved)
            {
                graphView.AssetMoved();
                VFXViewModicationProcessorInternal.assetMoved = false;
            }
            titleContent.text = filename;

            if (graphView?.controller?.model?.visualEffectObject != null)
            {
                graphView.checkoutButton.visible = true;
                if (!AssetDatabase.IsOpenForEdit(graphView.controller.model.visualEffectObject,
                                                 StatusQueryOptions.UseCachedIfPossible) && Provider.isActive && Provider.enabled)
                {
                    graphView.checkoutButton.SetEnabled(true);
                }
                else
                {
                    graphView.checkoutButton.SetEnabled(false);
                }
            }
        }
Exemplo n.º 18
0
 public VFXBranchOperatorController(VFXModel model, VFXViewController viewController) : base(model, viewController)
 {
 }
Exemplo n.º 19
0
        void Update()
        {
            if (graphView == null)
            {
                return;
            }

            if (m_OnUpdateAction != null)
            {
                m_OnUpdateAction();
                m_OnUpdateAction = null;
            }
            VFXViewController controller = graphView.controller;
            var filename = "No Asset";

            if (controller != null)
            {
                controller.NotifyUpdate();
                if (controller.model != null)
                {
                    var graph = controller.graph;
                    if (graph != null)
                    {
                        filename = controller.name;

                        if (!graph.saved)
                        {
                            filename += "*";
                        }
                        if (autoCompile && graph.IsExpressionGraphDirty() && !graph.GetResource().isSubgraph)
                        {
                            VFXGraph.explicitCompile = true;
                            graph.errorManager.ClearAllErrors(null, VFXErrorOrigin.Compilation);
                            using (var reporter = new VFXCompileErrorReporter(controller.graph.errorManager))
                            {
                                VFXGraph.compileReporter = reporter;
                                AssetDatabase.ImportAsset(AssetDatabase.GetAssetPath(graphView.controller.model));
                                VFXGraph.compileReporter = null;
                            }
                            VFXGraph.explicitCompile = false;
                        }
                        else
                        {
                            graph.RecompileIfNeeded(true, true);
                        }

                        bool wasDirty = graph.IsExpressionGraphDirty();

                        controller.RecompileExpressionGraphIfNeeded();

                        // Hack to avoid infinite recompilation due to UI triggering a recompile TODO: Fix problematic cases that trigger that error
                        if (!wasDirty && graph.IsExpressionGraphDirty())
                        {
                            Debug.LogError("Expression graph was marked as dirty after compiling context for UI. Discard to avoid infinite compilation loop.");
                            graph.SetExpressionGraphDirty(false);
                        }
                    }
                }
            }

            if (VFXViewModificationProcessor.assetMoved)
            {
                graphView.AssetMoved();
                VFXViewModificationProcessor.assetMoved = false;
            }
            titleContent.text = filename;

            if (graphView?.controller?.model?.visualEffectObject != null)
            {
                graphView.checkoutButton.visible = true;
                if (!graphView.IsAssetEditable() && Provider.isActive && Provider.enabled)
                {
                    graphView.checkoutButton.SetEnabled(true);
                }
                else
                {
                    graphView.checkoutButton.SetEnabled(false);
                }
            }
        }
Exemplo n.º 20
0
 public VFXVariableOperatorController(VFXModel model, VFXViewController viewController) : base(model, viewController)
 {
 }
        void ConvertContext(VFXNodeProvider.Descriptor d, Vector2 mPos)
        {
            VFXView           view           = GetFirstAncestorOfType <VFXView>();
            VFXViewController viewController = controller.viewController;

            if (view == null)
            {
                return;
            }

            mPos = view.contentViewContainer.ChangeCoordinatesTo(view, controller.position);

            var newNodeController    = view.AddNode(d, mPos);
            var newContextController = newNodeController as VFXContextController;

            //transfer blocks
            foreach (var block in controller.model.children.ToArray()) // To array needed as the IEnumerable content will change
            {
                newContextController.AddBlock(-1, block);
            }

            //transfer settings
            var contextType = controller.model.GetType();

            foreach (var setting in newContextController.model.GetSettings(true))
            {
                FieldInfo myField = contextType.GetField(setting.Name, BindingFlags.Instance | BindingFlags.FlattenHierarchy | BindingFlags.Public | BindingFlags.NonPublic);
                if (myField == null || myField.GetCustomAttributes(typeof(VFXSettingAttribute), true).Length == 0)
                {
                    continue;
                }

                object value;
                if (VFXConverter.TryConvertTo(myField.GetValue(controller.model), setting.FieldType, out value))
                {
                    newContextController.model.SetSettingValue(setting.Name, value);
                }
            }

            //transfer flow edges
            if (controller.flowInputAnchors.Count == 1)
            {
                foreach (var output in controller.flowInputAnchors[0].connections.Select(t => t.output).ToArray())
                {
                    newContextController.model.LinkFrom(output.context.model, output.slotIndex);
                }
            }

            // Apply the slot changes that can be the result of settings changes
            newContextController.ApplyChanges();

            //transfer master slot values
            foreach (var slot in newContextController.model.inputSlots)
            {
                VFXSlot mySlot = controller.model.inputSlots.FirstOrDefault(t => t.name == slot.name);
                if (mySlot == null)
                {
                    continue;
                }

                object value;
                if (VFXConverter.TryConvertTo(mySlot.value, slot.property.type, out value))
                {
                    slot.value = value;
                }
            }

            foreach (var anchor in newContextController.inputPorts)
            {
                string path     = anchor.path;
                var    myAnchor = controller.inputPorts.FirstOrDefault(t => t.path == path);

                if (myAnchor == null || !myAnchor.HasLink())
                {
                    continue;
                }

                //There should be only one
                var output = myAnchor.connections.First().output;

                viewController.CreateLink(anchor, output);
            }

            // Apply the change so that it won't unlink the blocks links
            controller.ApplyChanges();

            viewController.RemoveElement(controller);
        }
Exemplo n.º 22
0
        void IEdgeConnectorListener.OnDropOutsidePort(Edge edge, Vector2 position)
        {
            VFXSlot startSlot = controller.model;

            VFXView           view           = this.GetFirstAncestorOfType <VFXView>();
            VFXViewController viewController = view.controller;


            VFXNodeUI endNode = null;

            foreach (var node in view.GetAllNodes())
            {
                if (node.worldBound.Contains(position))
                {
                    endNode = node;
                }
            }

            VFXDataEdge dataEdge = edge as VFXDataEdge;
            bool        exists   = false;

            if (dataEdge.controller != null)
            {
                exists = true;
                view.controller.RemoveElement(dataEdge.controller);
            }

            if (endNode != null)
            {
                VFXNodeController nodeController = endNode.controller;

                if (nodeController != null)
                {
                    IVFXSlotContainer slotContainer = nodeController.slotContainer;
                    if (controller.direction == Direction.Input)
                    {
                        foreach (var output in nodeController.outputPorts.Where(t => t.model == null || t.model.IsMasterSlot()))
                        {
                            if (viewController.CreateLink(controller, output))
                            {
                                break;
                            }
                        }
                    }
                    else
                    {
                        foreach (var input in nodeController.inputPorts.Where(t => t.model == null || t.model.IsMasterSlot()))
                        {
                            if (viewController.CreateLink(input, controller))
                            {
                                break;
                            }
                        }
                    }
                }
            }
            else if (controller.direction == Direction.Input && Event.current.modifiers == EventModifiers.Alt)
            {
                VFXModelDescriptorParameters parameterDesc = VFXLibrary.GetParameters().FirstOrDefault(t => t.name == controller.portType.UserFriendlyName());
                if (parameterDesc != null)
                {
                    VFXParameter parameter = viewController.AddVFXParameter(view.contentViewContainer.GlobalToBound(position) - new Vector2(360, 0), parameterDesc);
                    startSlot.Link(parameter.outputSlots[0]);

                    CopyValueToParameter(parameter);
                }
            }
            else if (!exists)
            {
                VFXFilterWindow.Show(VFXViewWindow.currentWindow, Event.current.mousePosition, view.ViewToScreenPosition(Event.current.mousePosition), new VFXNodeProvider(viewController, AddLinkedNode, ProviderFilter, new Type[] { typeof(VFXOperator), typeof(VFXParameter), typeof(VFXContext) }));
            }
        }
Exemplo n.º 23
0
 public VFXSystemController(VFXViewController viewController, VFXUI model) : base(model)
 {
     m_ViewController = viewController;
 }
Exemplo n.º 24
0
 public VFXStickyNoteController(VFXViewController viewController, VFXUI ui, int index) : base(viewController, ui, index)
 {
 }