|
|
|
|
|
|
new GUIContent("Y"), |
|
|
|
new GUIContent("Z"), |
|
|
|
}; |
|
|
|
static readonly GUIContent[] k_DrawVector6Slider_LabelPositives = |
|
|
|
{ |
|
|
|
new GUIContent("+X"), |
|
|
|
new GUIContent("+Y"), |
|
|
|
new GUIContent("+Z"), |
|
|
|
}; |
|
|
|
static readonly GUIContent[] k_DrawVector6Slider_LabelNegatives = |
|
|
|
{ |
|
|
|
new GUIContent("-X"), |
|
|
|
new GUIContent("-Y"), |
|
|
|
new GUIContent("-Z"), |
|
|
|
}; |
|
|
|
public static void DrawVector6Slider(GUIContent label, SerializedProperty positive, SerializedProperty negative, Vector3 min, Vector3 max) |
|
|
|
{ |
|
|
|
GUILayout.BeginVertical(); |
|
|
|
EditorGUILayout.LabelField(label); |
|
|
|
++EditorGUI.indentLevel; |
|
|
|
|
|
|
|
var rect = GUILayoutUtility.GetRect(0, float.MaxValue, EditorGUIUtility.singleLineHeight, EditorGUIUtility.singleLineHeight); |
|
|
|
var v = positive.vector3Value; |
|
|
|
EditorGUI.BeginChangeCheck(); |
|
|
|
v = DrawVector3Slider(rect, k_DrawVector6Slider_LabelPositives, v, min, max); |
|
|
|
if (EditorGUI.EndChangeCheck()) |
|
|
|
positive.vector3Value = v; |
|
|
|
|
|
|
|
GUILayout.Space(EditorGUIUtility.standardVerticalSpacing); |
|
|
|
|
|
|
|
rect = GUILayoutUtility.GetRect(0, float.MaxValue, EditorGUIUtility.singleLineHeight, EditorGUIUtility.singleLineHeight); |
|
|
|
v = negative.vector3Value; |
|
|
|
EditorGUI.BeginChangeCheck(); |
|
|
|
v = DrawVector3Slider(rect, k_DrawVector6Slider_LabelNegatives, v, min, max); |
|
|
|
if (EditorGUI.EndChangeCheck()) |
|
|
|
negative.vector3Value = v; |
|
|
|
--EditorGUI.indentLevel; |
|
|
|
GUILayout.EndVertical(); |
|
|
|
} |
|
|
|
|
|
|
|
public static void DrawVector6(GUIContent label, SerializedProperty positive, SerializedProperty negative, Vector3 min, Vector3 max, Color[][] colors = null) |
|
|
|
{ |
|
|
|
|
|
|
negative.vector3Value = v; |
|
|
|
--EditorGUI.indentLevel; |
|
|
|
GUILayout.EndVertical(); |
|
|
|
} |
|
|
|
|
|
|
|
static Vector3 DrawVector3Slider(Rect rect, GUIContent[] labels, Vector3 value, Vector3 min, Vector3 max) |
|
|
|
{ |
|
|
|
// Use a corrected width due to the hacks used for layouting the slider properly below
|
|
|
|
rect.width -= 20; |
|
|
|
var fieldWidth = rect.width / 3f; |
|
|
|
|
|
|
|
for (var i = 0; i < 3; ++i) |
|
|
|
{ |
|
|
|
var c = new Rect(rect.x + fieldWidth * i, rect.y, fieldWidth, rect.height); |
|
|
|
var labelRect = new Rect(c.x, c.y, k_DrawVector6Slider_LabelSize, c.height); |
|
|
|
var sliderRect = new Rect(labelRect.x + labelRect.width, c.y, c.width - k_DrawVector6Slider_LabelSize - k_DrawVector6Slider_FieldSize + 45, c.height); |
|
|
|
var fieldRect = new Rect(sliderRect.x + sliderRect.width - 25, c.y, k_DrawVector6Slider_FieldSize, c.height); |
|
|
|
EditorGUI.LabelField(labelRect, labels[i]); |
|
|
|
value[i] = GUI.HorizontalSlider(sliderRect, value[i], min[i], max[i]); |
|
|
|
value[i] = EditorGUI.FloatField(fieldRect, value[i]); |
|
|
|
} |
|
|
|
return value; |
|
|
|
} |
|
|
|
|
|
|
|
static Vector3 DrawVector3(Rect rect, GUIContent[] labels, Vector3 value, Vector3 min, Vector3 max, bool addMinusPrefix, Color[] colors) |
|
|
|