Ejemplo n.º 1
0
        public override IEnumerable <EditorCurveBinding> GetSourceCurveBindings(RigBuilder rigBuilder, DampedTransform constraint)
        {
            var bindings = new List <EditorCurveBinding>();

            EditorCurveBindingUtils.CollectTRBindings(rigBuilder.transform, constraint.data.sourceObject, bindings);

            return(bindings);
        }
Ejemplo n.º 2
0
        public override IEnumerable <EditorCurveBinding> GetConstrainedCurveBindings(RigBuilder rigBuilder, MultiParentConstraint constraint)
        {
            var bindings = new List <EditorCurveBinding>();

            EditorCurveBindingUtils.CollectPositionBindings(rigBuilder.transform, constraint.data.constrainedObject, bindings);
            EditorCurveBindingUtils.CollectRotationBindings(rigBuilder.transform, constraint.data.constrainedObject, bindings);
            return(bindings);
        }
        public override IEnumerable <EditorCurveBinding> GetSourceCurveBindings(RigBuilder rigBuilder, ChainIKConstraint constraint)
        {
            var bindings = new List <EditorCurveBinding>();

            EditorCurveBindingUtils.CollectTRBindings(rigBuilder.transform, constraint.data.target, bindings);

            return(bindings);
        }
        public override IEnumerable <EditorCurveBinding> GetConstrainedCurveBindings(RigBuilder rigBuilder, OverrideTransform constraint)
        {
            var bindings = new List <EditorCurveBinding>();

            EditorCurveBindingUtils.CollectTRSBindings(rigBuilder.transform, constraint.data.constrainedObject, bindings);

            return(bindings);
        }
Ejemplo n.º 5
0
        public override IEnumerable <EditorCurveBinding> GetConstrainedCurveBindings(RigBuilder rigBuilder, MultiReferentialConstraint constraint)
        {
            var bindings = new List <EditorCurveBinding>();

            var transform = constraint.data.sourceObjects[0];

            EditorCurveBindingUtils.CollectTRBindings(rigBuilder.transform, transform, bindings);

            return(bindings);
        }
        public override IEnumerable <EditorCurveBinding> GetConstrainedCurveBindings(RigBuilder rigBuilder, TwistCorrection constraint)
        {
            var bindings = new List <EditorCurveBinding>();

            foreach (var node in constraint.data.twistNodes)
            {
                EditorCurveBindingUtils.CollectRotationBindings(rigBuilder.transform, node.transform, bindings);
            }

            return(bindings);
        }
Ejemplo n.º 7
0
        public override IEnumerable <EditorCurveBinding> GetSourceCurveBindings(RigBuilder rigBuilder, MultiReferentialConstraint constraint)
        {
            var bindings = new List <EditorCurveBinding>();

            var sources = constraint.data.sourceObjects;

            for (int i = 1; i < sources.Count; ++i)
            {
                EditorCurveBindingUtils.CollectTRBindings(rigBuilder.transform, sources[i], bindings);
            }

            return(bindings);
        }
        public override IEnumerable <EditorCurveBinding> GetSourceCurveBindings(RigBuilder rigBuilder, TwoBoneIKConstraint constraint)
        {
            var bindings = new List <EditorCurveBinding>();

            EditorCurveBindingUtils.CollectTRBindings(rigBuilder.transform, constraint.data.target, bindings);

            if (constraint.data.hint != null)
            {
                EditorCurveBindingUtils.CollectPositionBindings(rigBuilder.transform, constraint.data.hint, bindings);
            }

            return(bindings);
        }
Ejemplo n.º 9
0
        public override IEnumerable <EditorCurveBinding> GetSourceCurveBindings(RigBuilder rigBuilder, MultiRotationConstraint constraint)
        {
            var bindings = new List <EditorCurveBinding>();

            for (int i = 0; i < constraint.data.sourceObjects.Count; ++i)
            {
                var sourceObject = constraint.data.sourceObjects[i];

                EditorCurveBindingUtils.CollectRotationBindings(rigBuilder.transform, sourceObject.transform, bindings);
                EditorCurveBindingUtils.CollectPropertyBindings(rigBuilder.transform, constraint, ((IMultiRotationConstraintData)constraint.data).sourceObjectsProperty + ".m_Item" + i + ".weight", bindings);
            }

            return(bindings);
        }
        public override IEnumerable <EditorCurveBinding> GetConstrainedCurveBindings(RigBuilder rigBuilder, TwistChainConstraint constraint)
        {
            var bindings = new List <EditorCurveBinding>();

            // Retrieve chain in-between root and tip transforms.
            Transform[] chain = ConstraintsUtils.ExtractChain(constraint.data.root, constraint.data.tip);

            for (int i = 0; i < chain.Length; ++i)
            {
                EditorCurveBindingUtils.CollectRotationBindings(rigBuilder.transform, chain[i], bindings);
            }

            return(bindings);
        }
        public override IEnumerable <EditorCurveBinding> GetConstrainedCurveBindings(RigBuilder rigBuilder, TwoBoneIKConstraint constraint)
        {
            var bindings = new List <EditorCurveBinding>();

            var root = constraint.data.root;
            var mid  = constraint.data.mid;
            var tip  = constraint.data.tip;

            EditorCurveBindingUtils.CollectRotationBindings(rigBuilder.transform, root, bindings);
            EditorCurveBindingUtils.CollectRotationBindings(rigBuilder.transform, mid, bindings);
            EditorCurveBindingUtils.CollectRotationBindings(rigBuilder.transform, tip, bindings);

            return(bindings);
        }
        public override IEnumerable <EditorCurveBinding> GetSourceCurveBindings(RigBuilder rigBuilder, OverrideTransform constraint)
        {
            var bindings = new List <EditorCurveBinding>();

            if (constraint.data.sourceObject != null)
            {
                EditorCurveBindingUtils.CollectTRBindings(rigBuilder.transform, constraint.data.sourceObject, bindings);
            }
            else
            {
                var data = (IOverrideTransformData)constraint.data;
                EditorCurveBindingUtils.CollectVector3Bindings(rigBuilder.transform, constraint, data.positionVector3Property, bindings);
                EditorCurveBindingUtils.CollectVector3Bindings(rigBuilder.transform, constraint, data.rotationVector3Property, bindings);
            }

            return(bindings);
        }
        public override IEnumerable <EditorCurveBinding> GetConstrainedCurveBindings(RigBuilder rigBuilder, BlendConstraint constraint)
        {
            var bindings    = new List <EditorCurveBinding>();
            var constrained = constraint.data.constrainedObject;

            if (constraint.data.blendPosition)
            {
                EditorCurveBindingUtils.CollectPositionBindings(rigBuilder.transform, constrained, bindings);
            }

            if (constraint.data.blendRotation)
            {
                EditorCurveBindingUtils.CollectRotationBindings(rigBuilder.transform, constrained, bindings);
            }

            return(bindings);
        }
        public override IEnumerable <EditorCurveBinding> GetConstrainedCurveBindings(RigBuilder rigBuilder, ChainIKConstraint constraint)
        {
            var bindings = new List <EditorCurveBinding>();

            var root = constraint.data.root;
            var tip  = constraint.data.tip;

            var tmp = tip;

            while (tmp != root)
            {
                EditorCurveBindingUtils.CollectRotationBindings(rigBuilder.transform, tmp, bindings);
                tmp = tmp.parent;
            }
            EditorCurveBindingUtils.CollectRotationBindings(rigBuilder.transform, root, bindings);

            return(bindings);
        }
Ejemplo n.º 15
0
        private static void CopyCurvesToClip(AnimationClip fromClip, AnimationClip toClip)
        {
            var rotationBinding = new EditorCurveBinding();
            var bindings        = AnimationUtility.GetCurveBindings(fromClip);

            foreach (var binding in bindings)
            {
                var curve = AnimationUtility.GetEditorCurve(fromClip, binding);

                if (EditorCurveBindingUtils.RemapRotationBinding(toClip, binding, ref rotationBinding))
                {
                    AnimationUtility.SetEditorCurve(toClip, rotationBinding, curve);
                }
                else
                {
                    AnimationUtility.SetEditorCurve(toClip, binding, curve);
                }
            }
        }
        public override IEnumerable <EditorCurveBinding> GetSourceCurveBindings(RigBuilder rigBuilder, BlendConstraint constraint)
        {
            var bindings = new List <EditorCurveBinding>();
            var sourceA  = constraint.data.sourceObjectA;
            var sourceB  = constraint.data.sourceObjectB;

            if (constraint.data.blendPosition)
            {
                EditorCurveBindingUtils.CollectPositionBindings(rigBuilder.transform, sourceA, bindings);
                EditorCurveBindingUtils.CollectPositionBindings(rigBuilder.transform, sourceB, bindings);
            }

            if (constraint.data.blendRotation)
            {
                EditorCurveBindingUtils.CollectRotationBindings(rigBuilder.transform, sourceA, bindings);
                EditorCurveBindingUtils.CollectRotationBindings(rigBuilder.transform, sourceB, bindings);
            }

            return(bindings);
        }
Ejemplo n.º 17
0
        private static void RemoveCurves(AnimationClip clip, IEnumerable <EditorCurveBinding> bindings)
        {
            if (clip == null)
            {
                throw new ArgumentNullException("The destination animation clip cannot be null.");
            }

            var rotationBinding = new EditorCurveBinding();

            foreach (var binding in bindings)
            {
                // Remove the correct editor curve binding for a rotation curves
                if (EditorCurveBindingUtils.RemapRotationBinding(clip, binding, ref rotationBinding))
                {
                    AnimationUtility.SetEditorCurve(clip, rotationBinding, null);
                }
                else
                {
                    AnimationUtility.SetEditorCurve(clip, binding, null);
                }
            }
        }