public CurveBindingGroup GetGroupBinding(string groupID) { if (this.m_groupings == null) { this.m_groupings = new Dictionary <string, CurveBindingGroup>(); } CurveBindingGroup curveBindingGroup = null; if (!this.m_groupings.TryGetValue(groupID, out curveBindingGroup)) { curveBindingGroup = new CurveBindingGroup(); curveBindingGroup.timeRange = new Vector2(3.40282347E+38f, -3.40282347E+38f); curveBindingGroup.valueRange = new Vector2(3.40282347E+38f, -3.40282347E+38f); List <CurveBindingPair> list = new List <CurveBindingPair>(); for (int i = 0; i < this.bindings.Length; i++) { if (this.bindings[i].GetGroupID() == groupID) { list.Add(new CurveBindingPair { binding = this.bindings[i], curve = this.curves[i] }); for (int j = 0; j < this.curves[i].get_keys().Length; j++) { Keyframe keyframe = this.curves[i].get_keys()[j]; curveBindingGroup.timeRange = new Vector2(Mathf.Min(keyframe.get_time(), curveBindingGroup.timeRange.x), Mathf.Max(keyframe.get_time(), curveBindingGroup.timeRange.y)); curveBindingGroup.valueRange = new Vector2(Mathf.Min(keyframe.get_value(), curveBindingGroup.valueRange.x), Mathf.Max(keyframe.get_value(), curveBindingGroup.valueRange.y)); } } } for (int k = 0; k < this.objectBindings.Length; k++) { if (this.objectBindings[k].GetGroupID() == groupID) { list.Add(new CurveBindingPair { binding = this.objectBindings[k], objectCurve = this.objectCurves[k] }); for (int l = 0; l < this.objectCurves[k].Length; l++) { ObjectReferenceKeyframe objectReferenceKeyframe = this.objectCurves[k][l]; curveBindingGroup.timeRange = new Vector2(Mathf.Min(objectReferenceKeyframe.time, curveBindingGroup.timeRange.x), Mathf.Max(objectReferenceKeyframe.time, curveBindingGroup.timeRange.y)); } } } curveBindingGroup.curveBindingPairs = (from x in list orderby AnimationWindowUtility.GetComponentIndex(x.binding.propertyName) select x).ToArray <CurveBindingPair>(); this.m_groupings.Add(groupID, curveBindingGroup); } return(curveBindingGroup); }
public void NormalizeCurveTime() { int i = 0; while (i < this.m_AniCurve.get_keys().Length) { Keyframe keyframe = this.m_AniCurve.get_Item(i); float num = Mathf.Max(0f, keyframe.get_time()); float num2 = Mathf.Min(1f, Mathf.Max(num, keyframe.get_time())); if (num2 != keyframe.get_time()) { Keyframe keyframe2 = new Keyframe(num2, keyframe.get_value(), keyframe.get_inTangent(), keyframe.get_outTangent()); this.m_AniCurve.RemoveKey(i); i = 0; this.m_AniCurve.AddKey(keyframe2); } else { i++; } } }