private void DoCurveColorIndicator(Rect rect, AnimationWindowHierarchyNode node) { if (Event.current.type == EventType.Repaint) { Color color = GUI.color; if (!this.state.showCurveEditor) { GUI.color = k_KeyColorInDopesheetMode; } else if ((node.curves.Length == 1) && !node.curves[0].isPPtrCurve) { GUI.color = CurveUtility.GetPropertyColor(node.curves[0].binding.propertyName); } else { GUI.color = k_KeyColorForNonCurves; } bool flag = false; if (AnimationMode.InAnimationMode()) { foreach (AnimationWindowCurve curve in node.curves) { if (curve.m_Keyframes.Any <AnimationWindowKeyframe>(key => this.state.time.ContainsTime(key.time))) { flag = true; } } } Texture image = !flag?CurveUtility.GetIconCurve() : CurveUtility.GetIconKey(); rect = new Rect(((rect.xMax - 10f) - (image.width / 2)) - 5f, rect.yMin + 3f, (float)image.width, (float)image.height); GUI.DrawTexture(rect, image, ScaleMode.ScaleToFit, true, 1f); GUI.color = color; } }
private void DoCurveColorIndicator(Rect rect, AnimationWindowHierarchyNode node) { if (Event.current.type != EventType.Repaint) { return; } Color color = GUI.color; GUI.color = this.state.showCurveEditor ? (node.curves.Length != 1 || node.curves[0].isPPtrCurve ? AnimationWindowHierarchyGUI.k_KeyColorForNonCurves : CurveUtility.GetPropertyColor(node.curves[0].binding.propertyName)) : AnimationWindowHierarchyGUI.k_KeyColorInDopesheetMode; bool flag = false; if (AnimationMode.InAnimationMode()) { foreach (AnimationWindowCurve curve in node.curves) { if (curve.m_Keyframes.Any <AnimationWindowKeyframe>((Func <AnimationWindowKeyframe, bool>)(key => this.state.time.ContainsTime(key.time)))) { flag = true; } } } Texture image = !flag ? (Texture)CurveUtility.GetIconCurve() : (Texture)CurveUtility.GetIconKey(); rect = new Rect((float)((double)rect.xMax - 10.0 - (double)(image.width / 2) - 5.0), rect.yMin + 3f, (float)image.width, (float)image.height); GUI.DrawTexture(rect, image, ScaleMode.ScaleToFit, true, 1f); GUI.color = color; }
static void DoCurveColorIndicator(Rect rect, CurveTreeViewNode node) { if (node == null) { return; } if (Event.current.type != EventType.Repaint) { return; } Color originalColor = GUI.color; if (node.bindings.Length == 1 && !node.bindings[0].isPPtrCurve) { GUI.color = CurveUtility.GetPropertyColor(node.bindings[0].propertyName); } else { GUI.color = s_KeyColorForNonCurves; } Texture icon = CurveUtility.GetIconCurve(); rect = new Rect(rect.xMax - k_RowRightOffset - (k_CurveColorIndicatorIconSize / 2) - 5, rect.yMin + k_ColorIndicatorTopMargin + (rect.height - EditorGUIUtility.singleLineHeight) / 2, k_CurveColorIndicatorIconSize, k_CurveColorIndicatorIconSize); GUI.DrawTexture(rect, icon, ScaleMode.ScaleToFit, true, 1); GUI.color = originalColor; }
private void SetTangent(int leftRight, Skill.Editor.CurveUtility.TangentMode mode) { if (Selection.Count > 0) { foreach (CurveKey ki in Selection) { Keyframe key = ki.Keyframe; CurveUtility.SetKeyBroken(ref key, true); if (leftRight == 2) { CurveUtility.SetKeyTangentMode(ref key, 0, mode); CurveUtility.SetKeyTangentMode(ref key, 1, mode); } else { CurveUtility.SetKeyTangentMode(ref key, leftRight, mode); if (CurveUtility.GetKeyTangentMode(key, 1 - leftRight) == CurveUtility.TangentMode.Smooth) { CurveUtility.SetKeyTangentMode(ref key, 1 - leftRight, CurveUtility.TangentMode.Editable); } } if ((mode == CurveUtility.TangentMode.Stepped) && ((leftRight == 0) || (leftRight == 2))) { key.inTangent = float.PositiveInfinity; } if ((mode == CurveUtility.TangentMode.Stepped) && ((leftRight == 1) || (leftRight == 2))) { key.outTangent = float.PositiveInfinity; } ki.Curve.MoveKey(ki.Index, key); CurveUtility.UpdateTangentsFromModeSurrounding(ki.Curve, ki.Index); } } }
public void SetCurves(AnimationCurve[] curves, EditorCurveBinding[] bindings) { m_Curves = curves; if (m_Curves != null && m_Curves.Length > 0) { m_CurveWrappers = new CurveWrapper[m_Curves.Length]; for (int i = 0; i < m_Curves.Length; i++) { var cw = new CurveWrapper { renderer = new NormalCurveRenderer(m_Curves[i]), readOnly = false, color = EditorGUI.kCurveColor, id = curves[i].GetHashCode(), hidden = false, regionId = -1 }; cw.renderer.SetWrap(WrapMode.Clamp, WrapMode.Clamp); cw.renderer.SetCustomRange(0, 1); if (bindings != null) { cw.binding = bindings[i]; cw.color = CurveUtility.GetPropertyColor(bindings[i].propertyName); cw.id = bindings[i].GetHashCode(); } m_CurveWrappers[i] = cw; } UpdateSelectionColors(); m_CurveEditor.animationCurves = m_CurveWrappers; } }
public void SetCurves(AnimationCurve[] curves, EditorCurveBinding[] bindings) { this.m_Curves = curves; if (this.m_Curves != null && this.m_Curves.Length > 0) { this.m_CurveWrappers = new CurveWrapper[this.m_Curves.Length]; for (int i = 0; i < this.m_Curves.Length; i++) { CurveWrapper curveWrapper = new CurveWrapper(); curveWrapper.set_renderer(new NormalCurveRenderer(this.m_Curves[i])); curveWrapper.readOnly = false; curveWrapper.color = EditorGUI.kCurveColor; curveWrapper.id = curves[i].GetHashCode(); curveWrapper.hidden = false; curveWrapper.regionId = -1; CurveWrapper curveWrapper2 = curveWrapper; curveWrapper2.get_renderer().SetWrap(1, 1); curveWrapper2.get_renderer().SetCustomRange(0f, 1f); if (bindings != null) { curveWrapper2.binding = bindings[i]; curveWrapper2.color = CurveUtility.GetPropertyColor(bindings[i].propertyName); curveWrapper2.id = bindings[i].GetHashCode(); } this.m_CurveWrappers[i] = curveWrapper2; } this.UpdateSelectionColors(); this.m_CurveEditor.set_animationCurves(this.m_CurveWrappers); } }
public static AnimationWindowKeyframe AddKeyframeToCurve(AnimationWindowCurve curve, object value, Type type, AnimationKeyTime time) { AnimationWindowKeyframe animationWindowKeyframe = curve.FindKeyAtTime(time); AnimationWindowKeyframe result; if (animationWindowKeyframe != null) { animationWindowKeyframe.value = value; result = animationWindowKeyframe; } else { AnimationWindowKeyframe animationWindowKeyframe2 = null; if (curve.isPPtrCurve) { animationWindowKeyframe2 = new AnimationWindowKeyframe(); animationWindowKeyframe2.time = time.time; animationWindowKeyframe2.value = value; animationWindowKeyframe2.curve = curve; curve.AddKeyframe(animationWindowKeyframe2, time); } else if (type == typeof(bool) || type == typeof(float)) { animationWindowKeyframe2 = new AnimationWindowKeyframe(); AnimationCurve animationCurve = curve.ToAnimationCurve(); Keyframe key = new Keyframe(time.time, (float)value); if (type == typeof(bool)) { AnimationUtility.SetKeyLeftTangentMode(ref key, AnimationUtility.TangentMode.Constant); AnimationUtility.SetKeyRightTangentMode(ref key, AnimationUtility.TangentMode.Constant); AnimationUtility.SetKeyBroken(ref key, true); animationWindowKeyframe2.m_TangentMode = key.tangentMode; animationWindowKeyframe2.m_InTangent = float.PositiveInfinity; animationWindowKeyframe2.m_OutTangent = float.PositiveInfinity; } else { int num = animationCurve.AddKey(key); if (num != -1) { CurveUtility.SetKeyModeFromContext(animationCurve, num); animationWindowKeyframe2.m_TangentMode = animationCurve[num].tangentMode; } } animationWindowKeyframe2.time = time.time; animationWindowKeyframe2.value = value; animationWindowKeyframe2.curve = curve; curve.AddKeyframe(animationWindowKeyframe2, time); } result = animationWindowKeyframe2; } return(result); }
public void Clear() { CurveUtility.ClearCurve(posx); CurveUtility.ClearCurve(posy); CurveUtility.ClearCurve(posz); CurveUtility.ClearCurve(anglex); CurveUtility.ClearCurve(angley); CurveUtility.ClearCurve(anglez); CurveUtility.ClearCurve(rotx); CurveUtility.ClearCurve(roty); CurveUtility.ClearCurve(rotz); CurveUtility.ClearCurve(rotw); }
public void RemoveKey(float time) { CurveUtility.RemoveKey(posx, time); CurveUtility.RemoveKey(posy, time); CurveUtility.RemoveKey(posz, time); CurveUtility.RemoveKey(anglex, time); CurveUtility.RemoveKey(angley, time); CurveUtility.RemoveKey(anglez, time); CurveUtility.RemoveKey(rotx, time); CurveUtility.RemoveKey(roty, time); CurveUtility.RemoveKey(rotz, time); CurveUtility.RemoveKey(rotw, time); }
public static CurveWrapper GetCurveWrapper(AnimationWindowCurve curve, AnimationClip clip) { CurveWrapper curveWrapper = new CurveWrapper(); curveWrapper.renderer = (CurveRenderer) new NormalCurveRenderer(curve.ToAnimationCurve()); curveWrapper.renderer.SetWrap(WrapMode.Once, !clip.isLooping ? WrapMode.Once : WrapMode.Loop); curveWrapper.renderer.SetCustomRange(clip.startTime, clip.stopTime); curveWrapper.binding = curve.binding; curveWrapper.id = CurveUtility.GetCurveID(clip, curve.binding); curveWrapper.color = CurveUtility.GetPropertyColor(curve.propertyName); curveWrapper.hidden = false; return(curveWrapper); }
public static AnimationWindowKeyframe AddKeyframeToCurve(AnimationWindowCurve curve, object value, Type type, AnimationKeyTime time) { AnimationWindowKeyframe keyframe = curve.FindKeyAtTime(time); if (keyframe != null) { keyframe.value = value; return(keyframe); } AnimationWindowKeyframe key = new AnimationWindowKeyframe { time = time.time }; if (curve.isPPtrCurve) { key.value = value; key.curve = curve; curve.AddKeyframe(key, time); return(key); } if ((type == typeof(bool)) || (type == typeof(float))) { AnimationCurve curve2 = curve.ToAnimationCurve(); Keyframe keyframe3 = new Keyframe(time.time, (float)value); if (type == typeof(bool)) { CurveUtility.SetKeyTangentMode(ref keyframe3, 0, TangentMode.Stepped); CurveUtility.SetKeyTangentMode(ref keyframe3, 1, TangentMode.Stepped); CurveUtility.SetKeyBroken(ref keyframe3, true); key.m_TangentMode = keyframe3.tangentMode; key.m_InTangent = float.PositiveInfinity; key.m_OutTangent = float.PositiveInfinity; } else { int keyIndex = curve2.AddKey(keyframe3); if (keyIndex != -1) { CurveUtility.SetKeyModeFromContext(curve2, keyIndex); Keyframe keyframe4 = curve2[keyIndex]; key.m_TangentMode = keyframe4.tangentMode; } } key.value = value; key.curve = curve; curve.AddKeyframe(key, time); } return(key); }
public static AnimationWindowKeyframe AddKeyframeToCurve(AnimationWindowCurve curve, object value, System.Type type, AnimationKeyTime time) { AnimationWindowKeyframe keyAtTime = curve.FindKeyAtTime(time); if (keyAtTime != null) { keyAtTime.value = value; return(keyAtTime); } AnimationWindowKeyframe key1 = new AnimationWindowKeyframe(); key1.time = time.time; if (curve.isPPtrCurve) { key1.value = value; key1.curve = curve; curve.AddKeyframe(key1, time); } else if (type == typeof(bool) || type == typeof(float)) { AnimationCurve animationCurve = curve.ToAnimationCurve(); Keyframe key2 = new Keyframe(time.time, (float)value); if (type == typeof(bool)) { CurveUtility.SetKeyTangentMode(ref key2, 0, TangentMode.Stepped); CurveUtility.SetKeyTangentMode(ref key2, 1, TangentMode.Stepped); CurveUtility.SetKeyBroken(ref key2, true); key1.m_TangentMode = key2.tangentMode; key1.m_InTangent = float.PositiveInfinity; key1.m_OutTangent = float.PositiveInfinity; } else { int keyIndex = animationCurve.AddKey(key2); if (keyIndex != -1) { CurveUtility.SetKeyModeFromContext(animationCurve, keyIndex); key1.m_TangentMode = animationCurve[keyIndex].tangentMode; } } key1.value = value; key1.curve = curve; curve.AddKeyframe(key1, time); } return(key1); }
public List <float> GetFixedFrameTimes() { List <float> times = new List <float>(); foreach (Keyframe kf in posx.keys) { if (CurveUtility.IsKeyFrame(posy, kf.time) && CurveUtility.IsKeyFrame(posz, kf.time) && CurveUtility.IsKeyFrame(anglex, kf.time) && CurveUtility.IsKeyFrame(angley, kf.time) && CurveUtility.IsKeyFrame(anglez, kf.time) ) { times.Add(Mathf.Round(kf.time * 100) / 100); } } return(times); }
public void ModifyKey(float time, Vector3 position, Vector3 euler_angles) { CurveUtility.ModifyCurveKey(posx, time, position.x); CurveUtility.ModifyCurveKey(posy, time, position.y); CurveUtility.ModifyCurveKey(posz, time, position.z); CurveUtility.ModifyCurveKey(anglex, time, euler_angles.x); CurveUtility.ModifyCurveKey(angley, time, euler_angles.y); CurveUtility.ModifyCurveKey(anglez, time, euler_angles.z); Quaternion quat = Quaternion.identity; quat.eulerAngles = euler_angles; CurveUtility.ModifyCurveKey(rotx, time, quat.x); CurveUtility.ModifyCurveKey(roty, time, quat.y); CurveUtility.ModifyCurveKey(rotz, time, quat.z); CurveUtility.ModifyCurveKey(rotw, time, quat.w); }
public void ConfigureCurveWrapper(CurveWrapper wrapper) { var color = CurveUtility.GetPropertyColor(wrapper.binding.propertyName); wrapper.color = color; float h, s, v; Color.RGBToHSV(color, out h, out s, out v); wrapper.wrapColorMultiplier = Color.HSVToRGB(h, s * 0.33f, v * 1.15f); var curve = AnimationUtility.GetEditorCurve(proxyCurves, wrapper.binding); wrapper.renderer = new NormalCurveRenderer(curve); // Use curve length instead of animation clip length wrapper.renderer.SetCustomRange(0.0f, curve.keys.Last().time); }
private void DoCurveColorIndicator(Rect rect, AnimationWindowHierarchyNode node) { if (Event.current.type != EventType.Repaint) { return; } Color color = GUI.color; if (!this.state.m_ShowCurveEditor) { GUI.color = AnimationWindowHierarchyGUI.k_KeyColorInDopesheetMode; } else { if (node.curves.Length == 1 && !node.curves[0].isPPtrCurve) { GUI.color = CurveUtility.GetPropertyColor(node.curves[0].binding.propertyName); } else { GUI.color = AnimationWindowHierarchyGUI.k_KeyColorForNonCurves; } } bool flag = false; if (AnimationMode.InAnimationMode()) { AnimationWindowCurve[] curves = node.curves; for (int i = 0; i < curves.Length; i++) { AnimationWindowCurve animationWindowCurve = curves[i]; if (animationWindowCurve.m_Keyframes.Any((AnimationWindowKeyframe key) => this.state.time.ContainsTime(key.time))) { flag = true; } } } Texture texture = (!flag) ? CurveUtility.GetIconCurve() : CurveUtility.GetIconKey(); rect = new Rect(rect.xMax - 10f - (float)(texture.width / 2) - 5f, rect.yMin + 3f, (float)texture.width, (float)texture.height); GUI.DrawTexture(rect, texture, ScaleMode.ScaleToFit, true, 1f); GUI.color = color; }
private void DoCurveColorIndicator(Rect rect, AnimationWindowHierarchyNode node) { if (Event.current.type != EventType.Repaint) { return; } Color originalColor = GUI.color; if (!state.showCurveEditor) { GUI.color = k_KeyColorInDopesheetMode; } else if (node.curves.Length == 1 && !node.curves[0].isPPtrCurve) { GUI.color = CurveUtility.GetPropertyColor(node.curves[0].binding.propertyName); } else { GUI.color = k_KeyColorForNonCurves; } bool hasKey = false; if (state.previewing) { foreach (var curve in node.curves) { if (curve.m_Keyframes.Any(key => state.time.ContainsTime(key.time))) { hasKey = true; } } } Texture icon = hasKey ? CurveUtility.GetIconKey() : CurveUtility.GetIconCurve(); rect = new Rect(rect.xMax - k_RowRightOffset - (icon.width / 2) - 5, rect.yMin + k_ColorIndicatorTopMargin, icon.width, icon.height); GUI.DrawTexture(rect, icon, ScaleMode.ScaleToFit, true, 1); GUI.color = originalColor; }
public void SetBroken() { if (Selection.Count > 0) { foreach (CurveKey ki in Selection) { Keyframe key = ki.Keyframe; CurveUtility.SetKeyBroken(ref key, true); if (CurveUtility.GetKeyTangentMode(key, 1) == CurveUtility.TangentMode.Smooth) { CurveUtility.SetKeyTangentMode(ref key, 1, CurveUtility.TangentMode.Editable); } if (CurveUtility.GetKeyTangentMode(key, 0) == CurveUtility.TangentMode.Smooth) { CurveUtility.SetKeyTangentMode(ref key, 0, CurveUtility.TangentMode.Editable); } ki.Curve.MoveKey(ki.Index, key); CurveUtility.UpdateTangentsFromModeSurrounding(ki.Curve, ki.Index); } } }
private void DoCurveColorIndicator(Rect rect, CurveTreeViewNode node) { if (node != null) { if (Event.get_current().get_type() == 7) { Color color = GUI.get_color(); if (node.bindings.Length == 1 && !node.bindings[0].get_isPPtrCurve()) { GUI.set_color(CurveUtility.GetPropertyColor(node.bindings[0].propertyName)); } else { GUI.set_color(BindingTreeViewGUI.s_KeyColorForNonCurves); } Texture iconCurve = CurveUtility.GetIconCurve(); rect = new Rect(rect.get_xMax() - BindingTreeViewGUI.s_RowRightOffset - (float)iconCurve.get_width() * 0.5f - 5f, rect.get_yMin() + BindingTreeViewGUI.s_ColorIndicatorTopMargin, (float)iconCurve.get_width(), (float)iconCurve.get_height()); GUI.DrawTexture(rect, iconCurve, 2, true, 1f); GUI.set_color(color); } } }
private GenericMenu GenerateMenu(List <AnimationWindowHierarchyNode> interactedNodes) { List <AnimationWindowCurve> curvesAffectedByNodes1 = this.GetCurvesAffectedByNodes(interactedNodes, false); List <AnimationWindowCurve> curvesAffectedByNodes2 = this.GetCurvesAffectedByNodes(interactedNodes, true); bool flag1 = curvesAffectedByNodes1.Count == 1 && AnimationWindowUtility.ForceGrouping(curvesAffectedByNodes1[0].binding); GenericMenu genericMenu = new GenericMenu(); genericMenu.AddItem(new GUIContent(curvesAffectedByNodes1.Count > 1 || flag1 ? "Remove Properties" : "Remove Property"), false, new GenericMenu.MenuFunction(this.RemoveCurvesFromSelectedNodes)); bool flag2 = true; EditorCurveBinding[] curves = new EditorCurveBinding[curvesAffectedByNodes2.Count]; for (int index = 0; index < curvesAffectedByNodes2.Count; ++index) { curves[index] = curvesAffectedByNodes2[index].binding; } RotationCurveInterpolation.Mode interpolationMode = this.GetRotationInterpolationMode(curves); if (interpolationMode == RotationCurveInterpolation.Mode.Undefined) { flag2 = false; } else { using (List <AnimationWindowHierarchyNode> .Enumerator enumerator = interactedNodes.GetEnumerator()) { while (enumerator.MoveNext()) { if (!(enumerator.Current is AnimationWindowHierarchyPropertyGroupNode)) { flag2 = false; } } } } if (flag2) { string str = !this.state.activeAnimationClip.legacy ? string.Empty : " (Not fully supported in Legacy)"; genericMenu.AddItem(new GUIContent("Interpolation/Euler Angles" + str), interpolationMode == RotationCurveInterpolation.Mode.RawEuler, new GenericMenu.MenuFunction2(this.ChangeRotationInterpolation), (object)RotationCurveInterpolation.Mode.RawEuler); genericMenu.AddItem(new GUIContent("Interpolation/Euler Angles (Quaternion Approximation)"), interpolationMode == RotationCurveInterpolation.Mode.Baked, new GenericMenu.MenuFunction2(this.ChangeRotationInterpolation), (object)RotationCurveInterpolation.Mode.Baked); genericMenu.AddItem(new GUIContent("Interpolation/Quaternion"), interpolationMode == RotationCurveInterpolation.Mode.NonBaked, new GenericMenu.MenuFunction2(this.ChangeRotationInterpolation), (object)RotationCurveInterpolation.Mode.NonBaked); } if (AnimationMode.InAnimationMode()) { genericMenu.AddSeparator(string.Empty); bool flag3 = true; bool flag4 = true; bool flag5 = true; using (List <AnimationWindowCurve> .Enumerator enumerator = curvesAffectedByNodes1.GetEnumerator()) { while (enumerator.MoveNext()) { AnimationWindowCurve current = enumerator.Current; if (!current.HasKeyframe(this.state.time)) { flag3 = false; } else { flag4 = false; if (!current.isPPtrCurve) { flag5 = false; } } } } string text1 = "Add Key"; if (flag3) { genericMenu.AddDisabledItem(new GUIContent(text1)); } else { genericMenu.AddItem(new GUIContent(text1), false, new GenericMenu.MenuFunction2(this.AddKeysAtCurrentTime), (object)curvesAffectedByNodes1); } string text2 = "Delete Key"; if (flag4) { genericMenu.AddDisabledItem(new GUIContent(text2)); } else { genericMenu.AddItem(new GUIContent(text2), false, new GenericMenu.MenuFunction2(this.DeleteKeysAtCurrentTime), (object)curvesAffectedByNodes1); } if (!flag5) { genericMenu.AddSeparator(string.Empty); List <KeyIdentifier> keyIdentifierList = new List <KeyIdentifier>(); using (List <AnimationWindowCurve> .Enumerator enumerator = curvesAffectedByNodes1.GetEnumerator()) { while (enumerator.MoveNext()) { AnimationWindowCurve current = enumerator.Current; if (!current.isPPtrCurve) { int keyframeIndex = current.GetKeyframeIndex(this.state.time); if (keyframeIndex != -1) { CurveRenderer curveRenderer = CurveRendererCache.GetCurveRenderer(this.state.activeAnimationClip, current.binding); int curveId = CurveUtility.GetCurveID(this.state.activeAnimationClip, current.binding); keyIdentifierList.Add(new KeyIdentifier(curveRenderer, curveId, keyframeIndex)); } } } } } } return(genericMenu); }
public SelectionState GetSelectionState() { SelectionState state = new SelectionState(); state.SelectionCount = Selection.Count; bool hasSelected = Selection.Count > 0; state.Auto = hasSelected; state.FreeSmooth = hasSelected; state.Flat = hasSelected; state.Broken = hasSelected; state.LeftFree = hasSelected; state.LeftLinear = hasSelected; state.LeftConstant = hasSelected; state.RightFree = hasSelected; state.RightLinear = hasSelected; state.RightConstant = hasSelected; foreach (CurveKey ki in Selection) { Keyframe key = ki.Keyframe; CurveUtility.TangentMode keyTangentMode = CurveUtility.GetKeyTangentMode(key, 0); CurveUtility.TangentMode mode2 = CurveUtility.GetKeyTangentMode(key, 1); bool keyBroken = CurveUtility.GetKeyBroken(key); if ((keyTangentMode != CurveUtility.TangentMode.Smooth) || (mode2 != CurveUtility.TangentMode.Smooth)) { state.Auto = false; } if ((keyBroken || (keyTangentMode != CurveUtility.TangentMode.Editable)) || (mode2 != CurveUtility.TangentMode.Editable)) { state.FreeSmooth = false; } if ((keyBroken || (keyTangentMode != CurveUtility.TangentMode.Editable)) || (((key.inTangent != 0f) || (mode2 != CurveUtility.TangentMode.Editable)) || (key.outTangent != 0f))) { state.Flat = false; } if (!keyBroken) { state.Broken = false; } if (!keyBroken || (keyTangentMode != CurveUtility.TangentMode.Editable)) { state.LeftFree = false; } if (!keyBroken || (keyTangentMode != CurveUtility.TangentMode.Linear)) { state.LeftLinear = false; } if (!keyBroken || (keyTangentMode != CurveUtility.TangentMode.Stepped)) { state.LeftConstant = false; } if (!keyBroken || (mode2 != CurveUtility.TangentMode.Editable)) { state.RightFree = false; } if (!keyBroken || (mode2 != CurveUtility.TangentMode.Linear)) { state.RightLinear = false; } if (!keyBroken || (mode2 != CurveUtility.TangentMode.Stepped)) { state.RightConstant = false; } } return(state); }
protected virtual void ConfigureCurveWrapper(CurveWrapper wrapper) { wrapper.color = CurveUtility.GetPropertyColor(wrapper.binding.propertyName); wrapper.renderer = new NormalCurveRenderer(AnimationUtility.GetEditorCurve(animationClip, wrapper.binding)); wrapper.renderer.SetCustomRange(0.0f, animationClip.length); }
private GenericMenu GenerateMenu(List <AnimationWindowHierarchyNode> interactedNodes) { List <AnimationWindowCurve> curvesAffectedByNodes = this.GetCurvesAffectedByNodes(interactedNodes, false); List <AnimationWindowCurve> list2 = this.GetCurvesAffectedByNodes(interactedNodes, true); bool flag = (curvesAffectedByNodes.Count == 1) && AnimationWindowUtility.ForceGrouping(curvesAffectedByNodes[0].binding); GenericMenu menu = new GenericMenu(); menu.AddItem(new GUIContent(((curvesAffectedByNodes.Count <= 1) && !flag) ? "Remove Property" : "Remove Properties"), false, new GenericMenu.MenuFunction(this.RemoveCurvesFromSelectedNodes)); bool flag2 = true; EditorCurveBinding[] curves = new EditorCurveBinding[list2.Count]; for (int i = 0; i < list2.Count; i++) { curves[i] = list2[i].binding; } RotationCurveInterpolation.Mode rotationInterpolationMode = this.GetRotationInterpolationMode(curves); if (rotationInterpolationMode == RotationCurveInterpolation.Mode.Undefined) { flag2 = false; } else { foreach (AnimationWindowHierarchyNode node in interactedNodes) { if (!(node is AnimationWindowHierarchyPropertyGroupNode)) { flag2 = false; } } } if (flag2) { menu.AddItem(new GUIContent("Interpolation/Euler Angles"), rotationInterpolationMode == RotationCurveInterpolation.Mode.RawEuler, new GenericMenu.MenuFunction2(this.ChangeRotationInterpolation), RotationCurveInterpolation.Mode.RawEuler); menu.AddItem(new GUIContent("Interpolation/Euler Angles (Quaternion Approximation)"), rotationInterpolationMode == RotationCurveInterpolation.Mode.Baked, new GenericMenu.MenuFunction2(this.ChangeRotationInterpolation), RotationCurveInterpolation.Mode.Baked); menu.AddItem(new GUIContent("Interpolation/Quaternion"), rotationInterpolationMode == RotationCurveInterpolation.Mode.NonBaked, new GenericMenu.MenuFunction2(this.ChangeRotationInterpolation), RotationCurveInterpolation.Mode.NonBaked); } if (AnimationMode.InAnimationMode()) { menu.AddSeparator(string.Empty); bool flag3 = true; bool flag4 = true; bool flag5 = true; foreach (AnimationWindowCurve curve in curvesAffectedByNodes) { if (!curve.HasKeyframe(this.state.time)) { flag3 = false; } else { flag4 = false; if (!curve.isPPtrCurve) { flag5 = false; } } } string text = "Add Key"; if (flag3) { menu.AddDisabledItem(new GUIContent(text)); } else { menu.AddItem(new GUIContent(text), false, new GenericMenu.MenuFunction2(this.AddKeysAtCurrentTime), curvesAffectedByNodes); } text = "Delete Key"; if (flag4) { menu.AddDisabledItem(new GUIContent(text)); } else { menu.AddItem(new GUIContent(text), false, new GenericMenu.MenuFunction2(this.DeleteKeysAtCurrentTime), curvesAffectedByNodes); } if (flag5) { return(menu); } menu.AddSeparator(string.Empty); List <KeyIdentifier> list3 = new List <KeyIdentifier>(); foreach (AnimationWindowCurve curve2 in curvesAffectedByNodes) { if (!curve2.isPPtrCurve) { int keyframeIndex = curve2.GetKeyframeIndex(this.state.time); if (keyframeIndex != -1) { CurveRenderer curveRenderer = CurveRendererCache.GetCurveRenderer(this.state.activeAnimationClip, curve2.binding); int curveID = CurveUtility.GetCurveID(this.state.activeAnimationClip, curve2.binding); list3.Add(new KeyIdentifier(curveRenderer, curveID, keyframeIndex)); } } } } return(menu); }