Ejemplo n.º 1
0
        public void Link_Success_From_Update_To_Update()
        {
            var from = ScriptableObject.CreateInstance <VFXBasicUpdate>();
            var to   = ScriptableObject.CreateInstance <VFXBasicUpdate>();

            Assert.IsTrue(VFXContext.CanLink(from, to));
        }
Ejemplo n.º 2
0
        public void Link_Fail_From_GPUEvent_To_Spawn()
        {
            var from = ScriptableObject.CreateInstance <VFXBasicGPUEvent>();
            var to   = ScriptableObject.CreateInstance <VFXBasicSpawner>();

            Assert.IsFalse(VFXContext.CanLink(from, to));
        }
Ejemplo n.º 3
0
        [Test] //see fogbugz 1269756
        public void Link_Fail_From_Event_To_OutputEvent()
        {
            var from = ScriptableObject.CreateInstance <VFXBasicEvent>();
            var to   = ScriptableObject.CreateInstance <VFXOutputEvent>();

            Assert.IsFalse(VFXContext.CanLink(from, to));
        }
Ejemplo n.º 4
0
        public void Link_Fail_From_Event_To_Initialize()
        {
            //For now, we can't use direct link from event to initialize context.
            var from = ScriptableObject.CreateInstance <VFXBasicEvent>();
            var to   = ScriptableObject.CreateInstance <VFXBasicInitialize>();

            Assert.IsTrue(VFXContext.CanLink(from, to));
        }
        static public bool CanLink(VFXFlowAnchorController from, VFXFlowAnchorController to)
        {
            var flowAncestor = GetFlowAncestor(from.owner);

            if (flowAncestor.Contains(to.owner))
            {
                return(false); //Avoid loop in graph
            }
            return(VFXContext.CanLink(from.owner, to.owner, from.slotIndex, to.slotIndex));
        }
Ejemplo n.º 6
0
        bool ProviderFilter(VFXNodeProvider.Descriptor d)
        {
            if (!(d.modelDescriptor is VFXModelDescriptor <VFXContext>))
            {
                return(false);
            }

            var desc = d.modelDescriptor as VFXModelDescriptor <VFXContext>;

            if (direction == Direction.Input)
            {
                return(VFXContext.CanLink(desc.model, controller.context.model));
            }
            else
            {
                return(VFXContext.CanLink(controller.context.model, desc.model));
            }
        }
Ejemplo n.º 7
0
        public void Link_Mixing_Spawn_And_GPUEvent_To_Init()
        {
            var fromA = ScriptableObject.CreateInstance <VFXBasicGPUEvent>();
            var fromB = ScriptableObject.CreateInstance <VFXBasicSpawner>();
            var to    = ScriptableObject.CreateInstance <VFXBasicInitialize>();

            Assert.IsTrue(VFXContext.CanLink(fromA, to));
            Assert.IsTrue(VFXContext.CanLink(fromB, to));

            to.LinkFrom(fromB);
            Assert.AreEqual(1u, to.inputFlowSlot[0].link.Count());
            Assert.IsTrue(VFXContext.CanLink(fromA, to));

            //Expected disconnection of previous link in that case
            to.LinkFrom(fromA);
            Assert.IsTrue(VFXContext.CanLink(fromB, to));
            Assert.AreEqual(1u, to.inputFlowSlot[0].link.Count());
            Assert.AreEqual(fromA, to.inputFlowSlot[0].link.First().context);
        }
Ejemplo n.º 8
0
        public void Subgraph_Event_Link_To_Spawn()
        {
            VFXViewWindow window = VFXViewWindow.GetWindow <VFXViewWindow>();

            window.LoadAsset(AssetDatabase.LoadAssetAtPath <VisualEffectAsset>(testAssetName), null);

            //Create Spawner in subgraph
            {
                var spawner = ScriptableObject.CreateInstance <VFXBasicSpawner>();
                m_ViewController.graph.AddChild(spawner);
                m_ViewController.LightApplyChanges();

                var controller = window.graphView.Query <VFXContextUI>().ToList().Select(t => t.controller).Cast <Controller>();
                Assert.AreEqual(1, controller.Count());
                VFXConvertSubgraph.ConvertToSubgraphContext(window.graphView, controller, Rect.zero, testSubgraphSubAssetName);
            }

            var subGraphController = m_ViewController.allChildren.OfType <VFXContextController>().FirstOrDefault(o => o.model is VFXSubgraphContext);

            Assert.IsNotNull(subGraphController);

            //Create Event Context & Link the two input flow
            var subGraphContext = subGraphController.model;
            var eventContext    = ScriptableObject.CreateInstance <VFXBasicEvent>();

            Assert.IsTrue(VFXContext.CanLink(eventContext, subGraphContext, 0, 0));
            Assert.IsTrue(VFXContext.CanLink(eventContext, subGraphContext, 0, 1));

            eventContext.LinkTo(subGraphContext, 0, 0);
            eventContext.LinkTo(subGraphContext, 0, 1);

            var flow = eventContext.outputFlowSlot.First().link;

            Assert.AreEqual(2, flow.Count());
            Assert.IsTrue(flow.All(o => o.context == subGraphContext));
            Assert.IsTrue(flow.Any(o => o.slotIndex == 0));
            Assert.IsTrue(flow.Any(o => o.slotIndex == 1));

            window.graphView.controller = null;
        }