Пример #1
0
    //关键点的功能菜单
    private void ShowKeyframeContextMenu(CustomCurveWrapper animationCurve, int i)
    {
        GenericMenu           menu            = new GenericMenu();
        CustomKeyframeWrapper keyframeWrapper = animationCurve.GetKeyframeWrapper(i);
        KeyframeContext       userData        = new KeyframeContext(animationCurve, i, keyframeWrapper);
        Keyframe keyframe = animationCurve.GetKeyframe(i);

        menu.AddItem(new GUIContent("Delete Key"), false, new GenericMenu.MenuFunction2(this.DeleteKey), userData);
        menu.AddSeparator(string.Empty);

        menu.AddItem(new GUIContent("Auto"), animationCurve.IsAuto(i), new GenericMenu.MenuFunction2(this.SetKeyAuto), userData);
        menu.AddItem(new GUIContent("Free Smooth"), animationCurve.IsFreeSmooth(i), new GenericMenu.MenuFunction2(this.SetKeyFreeSmooth), userData);
        menu.AddItem(new GUIContent("Flat"), (animationCurve.IsFreeSmooth(i) && (keyframe.inTangent == 0f)) && (keyframe.outTangent == 0f), new GenericMenu.MenuFunction2(this.SetKeyFlat), userData);
        menu.AddItem(new GUIContent("Broken"), animationCurve.IsBroken(i), new GenericMenu.MenuFunction2(this.SetKeyBroken), userData);
        menu.AddSeparator(string.Empty);
        menu.AddItem(new GUIContent("Left Tangent/Free"), animationCurve.IsLeftFree(i), new GenericMenu.MenuFunction2(this.SetKeyLeftFree), userData);
        menu.AddItem(new GUIContent("Left Tangent/Linear"), animationCurve.IsLeftLinear(i), new GenericMenu.MenuFunction2(this.SetKeyLeftLinear), userData);
        menu.AddItem(new GUIContent("Left Tangent/Constant"), animationCurve.IsLeftConstant(i), new GenericMenu.MenuFunction2(this.SetKeyLeftConstant), userData);
        menu.AddItem(new GUIContent("Right Tangent/Free"), animationCurve.IsRightFree(i), new GenericMenu.MenuFunction2(this.SetKeyRightFree), userData);
        menu.AddItem(new GUIContent("Right Tangent/Linear"), animationCurve.IsRightLinear(i), new GenericMenu.MenuFunction2(this.SetKeyRightLinear), userData);
        menu.AddItem(new GUIContent("Right Tangent/Constant"), animationCurve.IsRightConstant(i), new GenericMenu.MenuFunction2(this.SetKeyRightConstant), userData);
        menu.AddItem(new GUIContent("Both Tangents/Free"), animationCurve.IsLeftFree(i) && animationCurve.IsRightFree(i), new GenericMenu.MenuFunction2(this.SetKeyBothFree), userData);
        menu.AddItem(new GUIContent("Both Tangents/Linear"), animationCurve.IsLeftLinear(i) && animationCurve.IsRightLinear(i), new GenericMenu.MenuFunction2(this.SetKeyBothLinear), userData);
        menu.AddItem(new GUIContent("Both Tangents/Constant"), animationCurve.IsLeftConstant(i) && animationCurve.IsRightConstant(i), new GenericMenu.MenuFunction2(this.SetKeyBothConstant), userData);
        menu.ShowAsContext();
    }
    //public bool IsFoldedOut = true;
    //public bool IsVisible = true;
    //public string PropertyName;
    //public UnityEngine.Texture Texture;
    //public string Type;
    public CustomMemberCurveWrapper()
    {
        CustomCurveWrapper wrapper2 = new CustomCurveWrapper(Color.red, new AnimationCurve(), 1);
        CustomCurveWrapper wrapper3 = new CustomCurveWrapper()
        {
            Curve = new AnimationCurve(),
            Color = Color.green,
            Id    = 2
        };
        CustomCurveWrapper wrapper4 = new CustomCurveWrapper()
        {
            Curve = new AnimationCurve(),
            Color = Color.blue,
            Id    = 3
        };

        AnimationCurves = new CustomCurveWrapper[] { wrapper2, wrapper3, wrapper4 };
    }
Пример #3
0
    public CustomGradient()
    {
        CustomCurveWrapper wrapper1 = new CustomCurveWrapper(Color.red, new AnimationCurve(), 1);
        CustomCurveWrapper wrapper2 = new CustomCurveWrapper()
        {
            Curve = new AnimationCurve(),
            Color = Color.green,
            Id    = 2
        };
        CustomCurveWrapper wrapper3 = new CustomCurveWrapper()
        {
            //new Keyframe(0.0f, 0.0f), new Keyframe(24f, 0.5f)
            Curve = new AnimationCurve(),
            Color = Color.blue,
            Id    = 3
        };

        AnimationCurves = new CustomCurveWrapper[] { wrapper1, wrapper2, wrapper3 };
    }
Пример #4
0
 public KeyframeContext(CustomCurveWrapper curveWrapper, int key, CustomKeyframeWrapper ckw)
 {
     this.curveWrapper = curveWrapper;
     this.key          = key;
     this.ckw          = ckw;
 }