Tanoda
CurveBounds.cs
Go to the documentation of this file.
1/******************************************************************************
2 * Copyright (C) Ultraleap, Inc. 2011-2020. *
3 * *
4 * Use subject to the terms of the Apache License 2.0 available at *
5 * http://www.apache.org/licenses/LICENSE-2.0, or another agreement *
6 * between Ultraleap and you, your company or other organization. *
7 ******************************************************************************/
8
9using System.Collections.Generic;
10#if UNITY_EDITOR
11using UnityEditor;
12#endif
13using UnityEngine;
14
15namespace Leap.Unity.Attributes {
16
23 public readonly Rect bounds;
24
26 this.bounds = bounds;
27 }
28
29 public CurveBoundsAttribute(float width, float height) {
30 bounds = new Rect(0, 0, width, height);
31 }
32
33#if UNITY_EDITOR
34 public void DrawProperty(Rect rect, SerializedProperty property, GUIContent label) {
35 EditorGUI.CurveField(rect, property, Color.green, bounds);
36 }
37
38 public override IEnumerable<SerializedPropertyType> SupportedTypes {
39 get {
40 yield return SerializedPropertyType.AnimationCurve;
41 }
42 }
43#endif
44 }
45
52 public UnitCurveAttribute() : base(new Rect(0, 0, 1, 1)) { }
53 }
54}
UnityEngine.Color Color
Definition: TestScript.cs:32
You can use this attribute to mark that an AnimationCurve can only have values that fall within speci...
Definition: CurveBounds.cs:22
CurveBoundsAttribute(float width, float height)
Definition: CurveBounds.cs:29
You can use this attribute to mark that an AnimationCurve can only have values that range from 0 to 1...
Definition: CurveBounds.cs:51