Exemplo n.º 1
0
        public static void MigrateTConeFromCone(VFXSlot to, VFXSlot from, bool hasLink = false)
        {
            var to_center     = to[0][0];
            var to_baseRadius = to[1];
            var to_topRadius  = to[2];
            var to_height     = to[3];

            var refSlot = from.refSlot;

            VFXSlot.CopySpace(to, refSlot, true);

            if (from.HasLink(false) || hasLink)
            {
                var parentCenter     = refSlot[0];
                var parentBaseRadius = refSlot[1];
                var parentTopRadius  = refSlot[2];
                var parentHeight     = refSlot[3];

                to_center.Link(parentCenter, true);
                to_baseRadius.Link(parentBaseRadius, true);
                to_topRadius.Link(parentTopRadius, true);
                to_height.Link(parentHeight, true);
            }
            else
            {
                var center     = from[0];
                var baseRadius = from[1];
                var topRadius  = from[2];
                var height     = from[3];

                var value = new TCone()
                {
                    transform = new Transform()
                    {
                        position = (Vector3)center.value,
                        scale    = Vector3.one
                    },

                    baseRadius = (float)baseRadius.value,
                    topRadius  = (float)topRadius.value,
                    height     = (float)height.value
                };

                to.value = value;
                VFXSlot.CopyLinksAndValue(to_center, center, true);
                VFXSlot.CopyLinksAndValue(to_baseRadius, baseRadius, true);
                VFXSlot.CopyLinksAndValue(to_topRadius, topRadius, true);
                VFXSlot.CopyLinksAndValue(to_height, height, true);
            }
        }
Exemplo n.º 2
0
        public static void MigrateTTorusFromTorus(VFXSlot to, VFXSlot from, bool hasLink = false)
        {
            var to_center      = to[0][0];
            var to_majorRadius = to[1];
            var to_minorRadius = to[2];
            var refSlot        = from.refSlot;

            VFXSlot.CopySpace(to, refSlot, true);

            if (from.HasLink(false) || hasLink)
            {
                var parentCenter      = refSlot[0];
                var parentMajorRadius = refSlot[1];
                var parentMinorRadius = refSlot[2];

                to_center.Link(parentCenter, true);
                to_majorRadius.Link(parentMajorRadius, true);
                to_minorRadius.Link(parentMinorRadius, true);
            }
            else
            {
                var center      = from[0];
                var majorRadius = from[1];
                var minorRadius = from[2];

                var value = new TTorus()
                {
                    transform = new Transform()
                    {
                        position = (Vector3)center.value,
                        scale    = Vector3.one
                    },

                    majorRadius = (float)majorRadius.value,
                    minorRadius = (float)minorRadius.value
                };

                to.value = value;
                VFXSlot.CopyLinksAndValue(to_center, center, true);
                VFXSlot.CopyLinksAndValue(to_majorRadius, majorRadius, true);
                VFXSlot.CopyLinksAndValue(to_minorRadius, minorRadius, true);
            }
        }
Exemplo n.º 3
0
        public static void MigrateTSphereFromSphere(VFXSlot to, VFXSlot from, bool forceHasLink = false)
        {
            var to_center = to[0][0];
            var to_radius = to[1];

            var refSlot = from.refSlot;

            VFXSlot.CopySpace(to, refSlot, true);
            if (from.HasLink(false) || forceHasLink)
            {
                //TODO : This behavior leads to an UX issue with if the parent owner of refslot is VFXParameter
                //This is the same issue than OnCopyLinksMySlot/OnCopyLinksOtherSlot needed in VFXSlot.CopyLinks
                var parentCenter = refSlot[0];
                var parentRadius = refSlot[1];

                to_center.Link(parentCenter, true);
                to_radius.Link(parentRadius, true);
            }
            else
            {
                var center = from[0];
                var radius = from[1];

                var value = new TSphere()
                {
                    transform = new Transform()
                    {
                        position = (Vector3)center.value,
                        scale    = Vector3.one
                    },
                    radius = (float)radius.value
                };

                to.value = value;
                VFXSlot.CopyLinksAndValue(to_center, center, true);
                VFXSlot.CopyLinksAndValue(to_radius, radius, true);
            }
        }
Exemplo n.º 4
0
        public static void MigrateTArcSphereFromArcSphere(VFXSlot to, VFXSlot from)
        {
            var to_sphere = to[0];
            var to_arc    = to[1];

            var refSlot     = from.refSlot;
            var from_sphere = refSlot[0];
            var from_arc    = refSlot[1];

            VFXSlot.CopySpace(to, refSlot, true);

            var hasDirectLink = from.HasLink(false);

            MigrateTSphereFromSphere(to_sphere, from_sphere, hasDirectLink);
            if (hasDirectLink)
            {
                to_arc.Link(from_arc, true);
            }
            else
            {
                to_arc.value = (float)from_arc.value; //The value transfer is only applied on masterslot
                VFXSlot.CopyLinksAndValue(to_arc, from_arc, true);
            }
        }
Exemplo n.º 5
0
        public static void MigrateTArcConeFromArcCone(VFXSlot to, VFXSlot from)
        {
            var to_cone = to[0];
            var to_arc  = to[1];

            var refSlot   = from.refSlot;
            var from_cone = refSlot; //The ArcCone wasn't a composition
            var from_arc  = refSlot[4];

            VFXSlot.CopySpace(to, refSlot, true);

            var hasDirectLink = from.HasLink(false);

            MigrateTConeFromCone(to_cone, from_cone, hasDirectLink);
            if (hasDirectLink)
            {
                to_arc.Link(from_arc, true);
            }
            else
            {
                to_arc.value = (float)from_arc.value; //The value transfer is only applied on masterslot
                VFXSlot.CopyLinksAndValue(to_arc, from_arc, true);
            }
        }
Exemplo n.º 6
0
        public static void MigrateTCircleFromCircle(VFXSlot to, VFXSlot from, bool forceHasLink = false)
        {
            var to_center = to[0][0];
            var to_radius = to[1];

            var refslot = from.refSlot;

            VFXSlot.CopySpace(to, refslot, true);

            if (from.HasLink(false) || forceHasLink)
            {
                var parentCenter = refslot[0];
                var parentRadius = refslot[1];

                to_center.Link(parentCenter, true);
                to_radius.Link(parentRadius, true);
            }
            else
            {
                var center = from[0];
                var radius = from[1];

                var value = new TCircle()
                {
                    transform = new Transform()
                    {
                        position = (Vector3)center.value,
                        scale    = Vector3.one
                    },
                    radius = (float)radius.value
                };
                to.value = value;
                VFXSlot.CopyLinksAndValue(to_center, center, true);
                VFXSlot.CopyLinksAndValue(to_radius, radius, true);
            }
        }
Exemplo n.º 7
0
        public static void MigrateTConeFromCylinder(VFXSlot to, VFXSlot from)
        {
            var lastModel = from.owner as VFXModel;

            while (!(lastModel.GetParent() is VFXGraph))
            {
                lastModel = lastModel.GetParent();
            }
            var basePosition = lastModel.position;
            var graph        = lastModel.GetParent() as VFXGraph;

            var to_center     = to[0][0];
            var to_baseRadius = to[1];
            var to_topRadius  = to[2];
            var to_height     = to[3];

            var refSlot = from.refSlot;

            VFXSlot.CopySpace(to, refSlot, true);

            if (from.HasLink(false))
            {
                var parentCenter = refSlot[0];
                var parentRadius = refSlot[1];
                var parentHeight = refSlot[2];

                var correctedPosition = CorrectPositionFromCylinderToCone(graph, basePosition, parentHeight, parentCenter);
                correctedPosition.Link(to_center);

                to_baseRadius.Link(parentRadius, true);
                to_topRadius.Link(parentRadius, true);
                to_height.Link(parentHeight, true);
            }
            else
            {
                var center = from[0];
                var radius = from[1];
                var height = from[2];

                var value = new TCone()
                {
                    transform = new Transform()
                    {
                        position = (Vector3)center.value - new Vector3(0, (float)height.value * 0.5f, 0),
                        scale    = Vector3.one
                    },
                    height     = (float)height.value,
                    baseRadius = (float)radius.value,
                    topRadius  = (float)radius.value,
                };
                to.value = value;

                if (from.HasLink(true))
                {
                    var correctedPosition = CorrectPositionFromCylinderToCone(graph, basePosition, height, center);
                    correctedPosition.Link(to_center);
                }

                VFXSlot.CopyLinksAndValue(to_baseRadius, radius, true);
                VFXSlot.CopyLinksAndValue(to_topRadius, radius, true);
                VFXSlot.CopyLinksAndValue(to_height, height, true);
            }
        }