|
|
|
|
|
|
using System; |
|
|
|
using UnityEngine; |
|
|
|
using UnityEngine.Experimental.Rendering; |
|
|
|
|
|
|
|
|
|
|
EditorGUI.BeginChangeCheck(); |
|
|
|
|
|
|
|
var rect = PrepareControlRect(); |
|
|
|
bool value = EditorGUI.Toggle(rect, CoreEditorUtils.GetContent(w.displayName), s.value); |
|
|
|
bool value = EditorGUI.Toggle(rect, CoreEditorUtils.GetContent(w.displayName), w.GetValue()); |
|
|
|
|
|
|
|
if (EditorGUI.EndChangeCheck()) |
|
|
|
Apply(w, s, value); |
|
|
|
|
|
|
|
|
|
|
var rect = PrepareControlRect(); |
|
|
|
int value = w.min != null && w.max != null |
|
|
|
? EditorGUI.IntSlider(rect, CoreEditorUtils.GetContent(w.displayName), s.value, w.min(), w.max()) |
|
|
|
: EditorGUI.IntField(rect, CoreEditorUtils.GetContent(w.displayName), s.value); |
|
|
|
? EditorGUI.IntSlider(rect, CoreEditorUtils.GetContent(w.displayName), w.GetValue(), w.min(), w.max()) |
|
|
|
: EditorGUI.IntField(rect, CoreEditorUtils.GetContent(w.displayName), w.GetValue()); |
|
|
|
|
|
|
|
if (EditorGUI.EndChangeCheck()) |
|
|
|
Apply(w, s, value); |
|
|
|
|
|
|
// No UIntField so we need to max to 0 ourselves or the value will wrap around
|
|
|
|
var rect = PrepareControlRect(); |
|
|
|
int tmp = w.min != null && w.max != null |
|
|
|
? EditorGUI.IntSlider(rect, CoreEditorUtils.GetContent(w.displayName), Mathf.Max(0, (int)s.value), Mathf.Max(0, (int)w.min()), Mathf.Max(0, (int)w.max())) |
|
|
|
: EditorGUI.IntField(rect, CoreEditorUtils.GetContent(w.displayName), Mathf.Max(0, (int)s.value)); |
|
|
|
? EditorGUI.IntSlider(rect, CoreEditorUtils.GetContent(w.displayName), Mathf.Max(0, (int)w.GetValue()), Mathf.Max(0, (int)w.min()), Mathf.Max(0, (int)w.max())) |
|
|
|
: EditorGUI.IntField(rect, CoreEditorUtils.GetContent(w.displayName), Mathf.Max(0, (int)w.GetValue())); |
|
|
|
|
|
|
|
uint value = (uint)Mathf.Max(0, tmp); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var rect = PrepareControlRect(); |
|
|
|
float value = w.min != null && w.max != null |
|
|
|
? EditorGUI.Slider(rect, CoreEditorUtils.GetContent(w.displayName), s.value, w.min(), w.max()) |
|
|
|
: EditorGUI.FloatField(rect, CoreEditorUtils.GetContent(w.displayName), s.value); |
|
|
|
? EditorGUI.Slider(rect, CoreEditorUtils.GetContent(w.displayName), w.GetValue(), w.min(), w.max()) |
|
|
|
: EditorGUI.FloatField(rect, CoreEditorUtils.GetContent(w.displayName), w.GetValue()); |
|
|
|
|
|
|
|
if (EditorGUI.EndChangeCheck()) |
|
|
|
Apply(w, s, value); |
|
|
|
|
|
|
|
|
|
|
EditorGUI.BeginChangeCheck(); |
|
|
|
|
|
|
|
int value = s.value; |
|
|
|
int value = w.GetValue(); |
|
|
|
if (w.enumNames == null || w.enumValues == null) |
|
|
|
{ |
|
|
|
EditorGUILayout.LabelField("Can't draw an empty enumeration."); |
|
|
|
|
|
|
var rect = PrepareControlRect(); |
|
|
|
value = EditorGUI.IntPopup(rect, CoreEditorUtils.GetContent(w.displayName), s.value, w.enumNames, w.enumValues); |
|
|
|
|
|
|
|
int index = Array.IndexOf(w.enumValues, w.GetValue()); |
|
|
|
|
|
|
|
// Fallback just in case, we may be handling sub/sectionned enums here
|
|
|
|
if (index < 0) |
|
|
|
value = w.enumValues[0]; |
|
|
|
|
|
|
|
value = EditorGUI.IntPopup(rect, CoreEditorUtils.GetContent(w.displayName), value, w.enumNames, w.enumValues); |
|
|
|
} |
|
|
|
|
|
|
|
if (EditorGUI.EndChangeCheck()) |
|
|
|
|
|
|
|
|
|
|
EditorGUI.BeginChangeCheck(); |
|
|
|
|
|
|
|
bool value = EditorGUILayout.Foldout(s.value, CoreEditorUtils.GetContent(w.displayName), true); |
|
|
|
bool value = EditorGUILayout.Foldout(w.GetValue(), CoreEditorUtils.GetContent(w.displayName), true); |
|
|
|
|
|
|
|
if (EditorGUI.EndChangeCheck()) |
|
|
|
Apply(w, s, value); |
|
|
|
|
|
|
EditorGUI.BeginChangeCheck(); |
|
|
|
|
|
|
|
var rect = PrepareControlRect(); |
|
|
|
var value = EditorGUI.ColorField(rect, CoreEditorUtils.GetContent(w.displayName), s.value, w.showPicker, w.showAlpha, w.hdr); |
|
|
|
var value = EditorGUI.ColorField(rect, CoreEditorUtils.GetContent(w.displayName), w.GetValue(), w.showPicker, w.showAlpha, w.hdr); |
|
|
|
|
|
|
|
if (EditorGUI.EndChangeCheck()) |
|
|
|
Apply(w, s, value); |
|
|
|
|
|
|
|
|
|
|
EditorGUI.BeginChangeCheck(); |
|
|
|
|
|
|
|
var value = EditorGUILayout.Vector2Field(w.displayName, s.value); |
|
|
|
var value = EditorGUILayout.Vector2Field(w.displayName, w.GetValue()); |
|
|
|
|
|
|
|
if (EditorGUI.EndChangeCheck()) |
|
|
|
Apply(w, s, value); |
|
|
|
|
|
|
|
|
|
|
EditorGUI.BeginChangeCheck(); |
|
|
|
|
|
|
|
var value = EditorGUILayout.Vector3Field(w.displayName, s.value); |
|
|
|
var value = EditorGUILayout.Vector3Field(w.displayName, w.GetValue()); |
|
|
|
|
|
|
|
if (EditorGUI.EndChangeCheck()) |
|
|
|
Apply(w, s, value); |
|
|
|
|
|
|
|
|
|
|
EditorGUI.BeginChangeCheck(); |
|
|
|
|
|
|
|
var value = EditorGUILayout.Vector4Field(w.displayName, s.value); |
|
|
|
var value = EditorGUILayout.Vector4Field(w.displayName, w.GetValue()); |
|
|
|
|
|
|
|
if (EditorGUI.EndChangeCheck()) |
|
|
|
Apply(w, s, value); |
|
|
|