-
Notifications
You must be signed in to change notification settings - Fork 75
Expand file tree
/
Copy pathAngleLimitsPropertyInfo.cs
More file actions
executable file
·96 lines (80 loc) · 3.45 KB
/
AngleLimitsPropertyInfo.cs
File metadata and controls
executable file
·96 lines (80 loc) · 3.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
using UnityEditor;
using UnityEngine;
namespace Unity.Animations.SpringBones
{
namespace Inspector
{
public class AngleLimitPropertyInfo : PropertyInfo
{
bool isEngLang => !EditorPrefs.GetBool("UCSB_JLM");
public AngleLimitPropertyInfo(string newName, string labelText)
: base(newName, labelText)
{
minSlider = new FloatSlider(isEngLang ? "Minimum Limit" : "下限", 0f, -180f);
maxSlider = new FloatSlider(isEngLang ? "Maximum Limit" : "上限", 0f, 180f);
}
public override void Show()
{
GUILayout.Space(14f);
GUILayout.BeginVertical("box");
var propertyIterator = serializedProperty.Copy();
if (propertyIterator.NextVisible(true))
{
EditorGUILayout.PropertyField(propertyIterator, label, true, null);
}
SerializedProperty minProperty = null;
SerializedProperty maxProperty = null;
if (propertyIterator.NextVisible(true))
{
minProperty = propertyIterator.Copy();
}
if (propertyIterator.NextVisible(true))
{
maxProperty = propertyIterator.Copy();
}
if (minProperty != null
&& maxProperty != null)
{
const float SubSpacing = 3f;
GUILayout.Space(SubSpacing);
var minChanged = minSlider.Show(minProperty);
GUILayout.Space(SubSpacing);
var maxChanged = maxSlider.Show(maxProperty);
GUILayout.Space(SubSpacing);
GUILayout.BeginHorizontal();
updateValuesTogether = GUILayout.Toggle(updateValuesTogether, isEngLang ? "Sync Limit" : "同時に変更");
if (updateValuesTogether)
{
if (minChanged)
{
maxProperty.floatValue = -minProperty.floatValue;
}
else if (maxChanged)
{
minProperty.floatValue = -maxProperty.floatValue;
}
}
if (GUILayout.Button(isEngLang ? "Minimum" : "下限に統一"))
{
maxProperty.floatValue = -minProperty.floatValue;
}
if (GUILayout.Button(isEngLang ? "Maximum" : "上限に統一"))
{
minProperty.floatValue = -maxProperty.floatValue;
}
if (GUILayout.Button(isEngLang ? "Flip" : "反転"))
{
var minValue = minProperty.floatValue;
minProperty.floatValue = -maxProperty.floatValue;
maxProperty.floatValue = -minValue;
}
GUILayout.EndHorizontal();
}
GUILayout.EndVertical();
}
private FloatSlider minSlider;
private FloatSlider maxSlider;
private bool updateValuesTogether = false;
}
}
}