Exemplo n.º 1
0
        public void RemoveBlock(VFXBlock block)
        {
            model.RemoveChild(block);

            VFXSlot slotToClean = null;

            do
            {
                slotToClean = block.inputSlots.Concat(block.outputSlots).FirstOrDefault(o => o.HasLink(true));
                if (slotToClean)
                {
                    slotToClean.UnlinkAll(true, true);
                }
            }while (slotToClean != null);
        }
Exemplo n.º 2
0
        public void UnlinkAll()
        {
            const int NB_INPUTS = 10;

            VFXSlot output = VFXSlot.Create(new VFXProperty(typeof(float), "test"), VFXSlot.Direction.kOutput);

            for (int i = 0; i < NB_INPUTS; ++i)
            {
                output.Link(VFXSlot.Create(new VFXProperty(typeof(float), "test"), VFXSlot.Direction.kInput));
            }

            Assert.AreEqual(NB_INPUTS, output.GetNbLinks());

            output.UnlinkAll();

            Assert.AreEqual(0, output.GetNbLinks());
        }
Exemplo n.º 3
0
        public void CheckExpression()
        {
            VFXSlot sphereSlot = VFXSlot.Create(new VFXProperty(typeof(Sphere), "sphere"), VFXSlot.Direction.kInput);
            VFXSlot floatSlot  = VFXSlot.Create(new VFXProperty(typeof(float), "float"), VFXSlot.Direction.kOutput);

            sphereSlot[0][0].Link(floatSlot);
            sphereSlot[1].Link(floatSlot);

            var expr = sphereSlot[0][0].GetExpression();

            Assert.IsInstanceOf <VFXExpressionExtractComponent>(expr);
            Assert.AreEqual(floatSlot.GetExpression(), expr.parents[0].parents[0]);
            Assert.AreEqual(floatSlot.GetExpression(), sphereSlot[1].GetExpression());

            floatSlot.UnlinkAll();
            expr = sphereSlot[0][0].GetExpression();
            Assert.IsInstanceOf <VFXExpressionExtractComponent>(expr);
            Assert.AreNotEqual(floatSlot.GetExpression(), expr.parents[0].parents[0]);
            Assert.AreNotEqual(floatSlot.GetExpression(), sphereSlot[1].GetExpression());
        }