Tanoda
LeapBlendShapeDataDrawer.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 UnityEditor;
10
12
13 [CustomPropertyDrawer(typeof(LeapBlendShapeData))]
15
16 protected override void init(SerializedProperty property) {
17 base.init(property);
18
19 drawProperty("_amount");
20 drawProperty("_type");
21
22 var typeProp = property.FindPropertyRelative("_type");
23
24 drawConditionalType("_translation", typeProp, LeapBlendShapeData.BlendShapeType.Translation);
25 drawConditionalType("_rotation", typeProp, LeapBlendShapeData.BlendShapeType.Rotation);
26 drawConditionalType("_scale", typeProp, LeapBlendShapeData.BlendShapeType.Scale);
27 drawConditionalType("_transform", typeProp, LeapBlendShapeData.BlendShapeType.Transform);
28 }
29
30 private void drawConditionalType(string name, SerializedProperty typeProp, LeapBlendShapeData.BlendShapeType type) {
31 drawPropertyConditionally(name, () => {
32 return !typeProp.hasMultipleDifferentValues && typeProp.intValue == (int)type;
33 });
34 }
35 }
36}
void drawProperty(string name, bool includeChildren=true, bool disable=false)
void drawPropertyConditionally(string propertyName, string conditionalName, bool includeChildren=true)
override void init(SerializedProperty property)