private void SetAnimationCurves() { this.m_AnimatedCurves = new Hashtable(); this.m_AnimatedPaths = new Hashtable(); this.m_LeftoverCurves = new Hashtable(); if (this.clip != null) { EditorCurveBinding[] curveBindings = AnimationUtility.GetCurveBindings(this.clip); EditorCurveBinding[] array = curveBindings; for (int i = 0; i < array.Length; i++) { EditorCurveBinding editorCurveBinding = array[i]; int curveID = CurveUtility.GetCurveID(this.clip, editorCurveBinding); this.m_AnimatedCurves[curveID] = true; if (!this.CheckIfPropertyExists(editorCurveBinding)) { this.m_LeftoverCurves[editorCurveBinding] = editorCurveBinding; } else { this.m_AnimatedPaths[CurveUtility.GetPathAndTypeID(editorCurveBinding.path, editorCurveBinding.type)] = true; string text = editorCurveBinding.path; while (true) { int hashCode = text.GetHashCode(); if (this.m_AnimatedPaths.Contains(hashCode)) { break; } this.m_AnimatedPaths[hashCode] = true; if (text.Length == 0) { break; } int num = text.LastIndexOf('/'); if (num > 0) { text = text.Substring(0, num); } else { text = string.Empty; } } } } } }
public static CurveRenderer GetCurveRenderer(AnimationClip clip, EditorCurveBinding curveBinding) { if (curveBinding.type == typeof(Transform) && curveBinding.propertyName.StartsWith("localEulerAngles.")) { int curveIndexFromName = RotationCurveInterpolation.GetCurveIndexFromName(curveBinding.propertyName); string key = CurveUtility.GetCurveGroupID(clip, curveBinding).ToString(); EulerCurveCombinedRenderer eulerCurveCombinedRenderer = (EulerCurveCombinedRenderer)CurveRendererCache.m_CombiRenderers[key]; if (eulerCurveCombinedRenderer == null) { eulerCurveCombinedRenderer = new EulerCurveCombinedRenderer(AnimationUtility.GetEditorCurve(clip, EditorCurveBinding.FloatCurve(curveBinding.path, typeof(Transform), "m_LocalRotation.x")), AnimationUtility.GetEditorCurve(clip, EditorCurveBinding.FloatCurve(curveBinding.path, typeof(Transform), "m_LocalRotation.y")), AnimationUtility.GetEditorCurve(clip, EditorCurveBinding.FloatCurve(curveBinding.path, typeof(Transform), "m_LocalRotation.z")), AnimationUtility.GetEditorCurve(clip, EditorCurveBinding.FloatCurve(curveBinding.path, typeof(Transform), "m_LocalRotation.w")), AnimationUtility.GetEditorCurve(clip, EditorCurveBinding.FloatCurve(curveBinding.path, typeof(Transform), "localEulerAngles.x")), AnimationUtility.GetEditorCurve(clip, EditorCurveBinding.FloatCurve(curveBinding.path, typeof(Transform), "localEulerAngles.y")), AnimationUtility.GetEditorCurve(clip, EditorCurveBinding.FloatCurve(curveBinding.path, typeof(Transform), "localEulerAngles.z"))); CurveRendererCache.m_CombiRenderers.Add(key, eulerCurveCombinedRenderer); } return(new EulerCurveRenderer(curveIndexFromName, eulerCurveCombinedRenderer)); } string key2 = CurveUtility.GetCurveID(clip, curveBinding).ToString(); NormalCurveRenderer normalCurveRenderer = (NormalCurveRenderer)CurveRendererCache.m_NormalRenderers[key2]; if (normalCurveRenderer == null) { normalCurveRenderer = new NormalCurveRenderer(AnimationUtility.GetEditorCurve(clip, curveBinding)); CurveRendererCache.m_NormalRenderers.Add(key2, normalCurveRenderer); } return(normalCurveRenderer); }
public int GetID() { return(CurveUtility.GetCurveID(this.clip, this.m_CurveBinding)); }