/// <returns>May be null.</returns> public IkConstraint FindIkConstraint(String constraintName) { if (constraintName == null) { throw new ArgumentNullException("constraintName", "constraintName cannot be null."); } ExposedList <IkConstraint> ikConstraints = this.ikConstraints; for (int i = 0, n = ikConstraints.Count; i < n; i++) { IkConstraint ikConstraint = ikConstraints.Items[i]; if (ikConstraint.data.name == constraintName) { return(ikConstraint); } } return(null); }
/// <summary>Sets the bones and constraints to their setup pose values.</summary> public void SetBonesToSetupPose() { var bonesItems = this.bones.Items; for (int i = 0, n = bones.Count; i < n; i++) { bonesItems[i].SetToSetupPose(); } var ikConstraintsItems = this.ikConstraints.Items; for (int i = 0, n = ikConstraints.Count; i < n; i++) { IkConstraint constraint = ikConstraintsItems[i]; constraint.bendDirection = constraint.data.bendDirection; constraint.mix = constraint.data.mix; } var transformConstraintsItems = this.transformConstraints.Items; for (int i = 0, n = transformConstraints.Count; i < n; i++) { TransformConstraint constraint = transformConstraintsItems[i]; TransformConstraintData data = constraint.data; constraint.rotateMix = data.rotateMix; constraint.translateMix = data.translateMix; constraint.scaleMix = data.scaleMix; constraint.shearMix = data.shearMix; } var pathConstraintItems = this.pathConstraints.Items; for (int i = 0, n = pathConstraints.Count; i < n; i++) { PathConstraint constraint = pathConstraintItems[i]; PathConstraintData data = constraint.data; constraint.position = data.position; constraint.spacing = data.spacing; constraint.rotateMix = data.rotateMix; constraint.translateMix = data.translateMix; } }