diff options
Diffstat (limited to 'Assets/Plugins/Editor/AdvancedInspector/FieldEditors')
44 files changed, 0 insertions, 2527 deletions
diff --git a/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/AnimationCurveEditor.cs b/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/AnimationCurveEditor.cs deleted file mode 100644 index e5514427..00000000 --- a/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/AnimationCurveEditor.cs +++ /dev/null @@ -1,29 +0,0 @@ -using UnityEngine; -using UnityEditor; -using System; -using System.Collections; - -namespace AdvancedInspector -{ - public class AnimationCurveEditor : FieldEditor - { - public override Type[] EditedTypes - { - get { return new Type[] { typeof(AnimationCurve) }; } - } - - public override void Draw(InspectorField field, GUIStyle style) - { - AnimationCurve curve = GetValue(field) as AnimationCurve; - if (curve == null && !field.Mixed) - curve = new AnimationCurve(); - - EditorGUI.BeginChangeCheck(); - - AnimationCurve result = EditorGUILayout.CurveField(curve); - - if (EditorGUI.EndChangeCheck()) - field.SetValue(result); - } - } -} diff --git a/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/AnimationCurveEditor.cs.meta b/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/AnimationCurveEditor.cs.meta deleted file mode 100644 index 5a6ec81d..00000000 --- a/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/AnimationCurveEditor.cs.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 175374f05b4f81243bd565df4b3842ac -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: diff --git a/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/BooleanEditor.cs b/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/BooleanEditor.cs deleted file mode 100644 index f4d25a86..00000000 --- a/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/BooleanEditor.cs +++ /dev/null @@ -1,30 +0,0 @@ -using UnityEngine; -using UnityEditor; -using System; -using System.Collections; - -namespace AdvancedInspector -{ - public class BooleanEditor : FieldEditor - { - public override Type[] EditedTypes - { - get { return new Type[] { typeof(bool) }; } - } - - public override void Draw(InspectorField field, GUIStyle style) - { - object value = GetValue(field); - - EditorGUI.BeginChangeCheck(); - bool result; - if (style != null) - result = EditorGUILayout.Toggle((bool)value, style); - else - result = EditorGUILayout.Toggle((bool)value); - - if (EditorGUI.EndChangeCheck()) - field.SetValue(result); - } - } -}
\ No newline at end of file diff --git a/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/BooleanEditor.cs.meta b/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/BooleanEditor.cs.meta deleted file mode 100644 index 7013dc4e..00000000 --- a/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/BooleanEditor.cs.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 3ed44e8dcffbde44eb2efd1c009248c6 -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: diff --git a/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/BoundsEditor.cs b/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/BoundsEditor.cs deleted file mode 100644 index 773201e1..00000000 --- a/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/BoundsEditor.cs +++ /dev/null @@ -1,134 +0,0 @@ -using UnityEngine; -using UnityEditor; -using System; -using System.Collections; - -namespace AdvancedInspector -{ - public class BoundsEditor : FieldEditor - { - public override bool Expandable - { - get { return false; } - } - - public override Type[] EditedTypes - { - get { return new Type[] { typeof(Bounds) }; } - } - - public override void Draw(InspectorField field, GUIStyle style) - { - float labelWidth = EditorGUIUtility.labelWidth; - EditorGUIUtility.labelWidth = VECTOR_FIELD_WIDTH; - - Bounds[] values = field.GetValues<Bounds>(); - - float[] centerX = new float[values.Length]; - float[] centerY = new float[values.Length]; - float[] centerZ = new float[values.Length]; - float[] extendX = new float[values.Length]; - float[] extendY = new float[values.Length]; - float[] extendZ = new float[values.Length]; - - for (int i = 0; i < values.Length; i++) - { - centerX[i] = values[i].center.x; - centerY[i] = values[i].center.y; - centerZ[i] = values[i].center.z; - extendX[i] = values[i].extents.x; - extendY[i] = values[i].extents.y; - extendZ[i] = values[i].extents.z; - } - - GUILayout.BeginHorizontal(); - float result; - EditorGUILayout.LabelField("Center: ", GUILayout.Width(48)); - if (FloatEditor.DrawFloat("X", centerX, style, out result)) - { - Undo.RecordObjects(field.SerializedInstances, "Edit " + field.Name + " Center X"); - - for (int i = 0; i < field.Instances.Length; i++) - { - Vector3 center = values[i].center; - center.x = result; - values[i].center = center; - field.SetValue(field.Instances[i], values[i]); - } - } - - if (FloatEditor.DrawFloat("Y", centerY, style, out result)) - { - Undo.RecordObjects(field.SerializedInstances, "Edit " + field.Name + " Center Y"); - - for (int i = 0; i < field.Instances.Length; i++) - { - Vector3 center = values[i].center; - center.y = result; - values[i].center = center; - field.SetValue(field.Instances[i], values[i]); - } - } - - if (FloatEditor.DrawFloat("Z", centerZ, style, out result)) - { - Undo.RecordObjects(field.SerializedInstances, "Edit " + field.Name + " Center Z"); - - for (int i = 0; i < field.Instances.Length; i++) - { - Vector3 center = values[i].center; - center.z = result; - values[i].center = center; - field.SetValue(field.Instances[i], values[i]); - } - } - GUILayout.EndHorizontal(); - - GUILayout.BeginHorizontal(); - EditorGUILayout.LabelField("Extend: ", GUILayout.Width(48)); - if (FloatEditor.DrawFloat("X", extendX, style, out result)) - { - Undo.RecordObjects(field.SerializedInstances, "Edit " + field.Name + " Extend X"); - - for (int i = 0; i < field.Instances.Length; i++) - { - Vector3 extents = values[i].extents; - extents.x = result; - values[i].extents = extents; - field.SetValue(field.Instances[i], values[i]); - } - } - - if (FloatEditor.DrawFloat("Y", extendY, style, out result)) - { - Undo.RecordObjects(field.SerializedInstances, "Edit " + field.Name + " Extend Y"); - - for (int i = 0; i < field.Instances.Length; i++) - { - Vector3 extents = values[i].extents; - extents.y = result; - values[i].extents = extents; - field.SetValue(field.Instances[i], values[i]); - } - } - - if (FloatEditor.DrawFloat("Z", extendZ, style, out result)) - { - Undo.RecordObjects(field.SerializedInstances, "Edit " + field.Name + " Extend Z"); - - for (int i = 0; i < field.Instances.Length; i++) - { - Vector3 extents = values[i].extents; - extents.z = result; - values[i].extents = extents; - field.SetValue(field.Instances[i], values[i]); - } - } - GUILayout.EndHorizontal(); - - EditorGUILayout.Space(); - - EditorGUIUtility.labelWidth = labelWidth; - } - } -}
\ No newline at end of file diff --git a/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/BoundsEditor.cs.meta b/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/BoundsEditor.cs.meta deleted file mode 100644 index a51cf2ca..00000000 --- a/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/BoundsEditor.cs.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 1c18b641c92f5f44eb38e807d2feed74 -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: diff --git a/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/CharEditor.cs b/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/CharEditor.cs deleted file mode 100644 index 2a82f0ea..00000000 --- a/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/CharEditor.cs +++ /dev/null @@ -1,40 +0,0 @@ -using UnityEngine; -using UnityEditor; -using System; -using System.Collections; - -namespace AdvancedInspector -{ - public class CharEditor : FieldEditor - { - public override Type[] EditedTypes - { - get { return new Type[] { typeof(char) }; } - } - - public override void Draw(InspectorField field, GUIStyle style) - { - GUILayout.BeginHorizontal(); - - object value = GetValue(field); - string text = ""; - if (value != null) - text = value.ToString(); - - EditorGUI.BeginChangeCheck(); - - string result = EditorGUILayout.TextField(text); - - char c; - if (result.Length == 0) - c = '\0'; - else - c = result[0]; - - if (EditorGUI.EndChangeCheck()) - field.SetValue(c); - - GUILayout.EndHorizontal(); - } - } -}
\ No newline at end of file diff --git a/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/CharEditor.cs.meta b/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/CharEditor.cs.meta deleted file mode 100644 index e9be5d8b..00000000 --- a/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/CharEditor.cs.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: b97d572b1c98e564f91d1a16c55cabc3 -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: diff --git a/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/ColorEditor.cs b/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/ColorEditor.cs deleted file mode 100644 index c8974082..00000000 --- a/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/ColorEditor.cs +++ /dev/null @@ -1,49 +0,0 @@ -using UnityEngine; -using UnityEditor; -using System; -using System.Collections; - -namespace AdvancedInspector -{ - public class ColorEditor : FieldEditor - { - public override bool Expandable - { - get { return false; } - } - - public override Type[] EditedTypes - { - get { return new Type[] { typeof(Color), typeof(Color32) }; } - } - - public override void Draw(InspectorField field, GUIStyle style) - { - object o = GetValue(field); - Type type = o.GetType(); - - Color color; - if (type == typeof(Color32)) - { - Color32 color32 = (Color32)o; - color = color32; - } - else - color = (Color)o; - - EditorGUI.BeginChangeCheck(); - color = EditorGUILayout.ColorField(color); - - if (EditorGUI.EndChangeCheck()) - { - if (type == typeof(Color32)) - { - Color32 color32 = color; - field.SetValue(color32); - } - else - field.SetValue(color); - } - } - } -}
\ No newline at end of file diff --git a/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/ColorEditor.cs.meta b/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/ColorEditor.cs.meta deleted file mode 100644 index e2813cf6..00000000 --- a/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/ColorEditor.cs.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 95ebae573d4fa724eb1787d862581a82 -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: diff --git a/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/DateTimeEditor.cs b/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/DateTimeEditor.cs deleted file mode 100644 index de120b87..00000000 --- a/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/DateTimeEditor.cs +++ /dev/null @@ -1,69 +0,0 @@ -using UnityEngine; -using UnityEditor; -using System; -using System.Collections; - -using UniToolsEditor; - -namespace AdvancedInspector -{ - public class DateTimeEditor : FieldEditor, IModal - { - private InspectorField field; - - public override Type[] EditedTypes - { - get { return new Type[] { typeof(DateTime) }; } - } - - private static Texture calendar; - - internal static Texture Calendar - { - get - { - if (calendar == null) - calendar = Helper.Load(EditorResources.Calendar); - - return calendar; - } - } - - public override void Draw(InspectorField field, GUIStyle style) - { - DateTime time = field.GetValue<DateTime>(); - if (time == DateTime.MinValue) - time = DateTime.Now; - - string title = time.ToString(); - if (field.Mixed) - title = " - - - "; - - EditorGUILayout.BeginHorizontal(); - EditorGUILayout.Space(); - if (GUILayout.Button(Calendar, GUIStyle.none, GUILayout.Width(18), GUILayout.Height(18))) - { - this.field = field; - DateTimeDialog.Create(this, time, GUIUtility.GUIToScreenPoint(Event.current.mousePosition)); - } - - TextAnchor anchor = GUI.skin.label.alignment; - GUI.skin.label.alignment = TextAnchor.MiddleLeft; - GUILayout.Label(title); - GUI.skin.label.alignment = anchor; - - GUILayout.FlexibleSpace(); - EditorGUILayout.EndHorizontal(); - } - - public void ModalRequest(bool shift) { } - - public void ModalClosed(ModalWindow window) - { - if (window.Result != WindowResult.Ok) - return; - - field.SetValue(((DateTimeDialog)window).Time); - } - } -}
\ No newline at end of file diff --git a/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/DateTimeEditor.cs.meta b/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/DateTimeEditor.cs.meta deleted file mode 100644 index f247aa3f..00000000 --- a/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/DateTimeEditor.cs.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: e4176afc2bf64fb4cb22c40d470180a7 -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: diff --git a/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/EnumEditor.cs b/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/EnumEditor.cs deleted file mode 100644 index 627aba7c..00000000 --- a/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/EnumEditor.cs +++ /dev/null @@ -1,192 +0,0 @@ -using UnityEngine; -using UnityEditor; -using System; -using System.Collections; -using System.Collections.Generic; -using System.Linq; - -namespace AdvancedInspector -{ - public class EnumEditor : FieldEditor - { - public override bool EditDerived - { - get { return true; } - } - - public override bool Expandable - { - get { return false; } - } - - public override Type[] EditedTypes - { - get { return new Type[] { typeof(Enum) }; } - } - - public override void Draw(InspectorField field, GUIStyle style) - { - EnumAttribute display = field.GetAttribute<EnumAttribute>(); - - EditorGUI.showMixedValue = field.Mixed; - - EditorGUI.BeginChangeCheck(); - - object result = null; - long value = Convert.ToInt64(GetValue(field)); - if (display == null || !display.Masked) - { - if (display == null || display.Display == EnumDisplay.DropDown) - result = DrawDropDown(field.Type, value, style, false); - else if (display.Display == EnumDisplay.Button) - result = DrawEnum(field.Type, value, display.MaxItemsPerRow, style == null ? EditorStyles.toolbarButton : style); - else if (display.Display == EnumDisplay.Checkbox) - result = DrawEnum(field.Type, value, display.MaxItemsPerRow, style == null ? EditorStyles.toggle : style); - } - else - { - if (display == null || display.Display == EnumDisplay.DropDown) - result = DrawDropDown(field.Type, value, style, true); - else if (display.Display == EnumDisplay.Button) - result = DrawMasked(field.Type, value, display.MaxItemsPerRow, style == null ? EditorStyles.toolbarButton : style); - else if (display.Display == EnumDisplay.Checkbox) - result = DrawMasked(field.Type, value, display.MaxItemsPerRow, style == null ? EditorStyles.toggle : style); - } - - if (EditorGUI.EndChangeCheck()) - field.SetValue(result); - } - - private int SelectedIndex(Array values, long value) - { - for (int i = 0; i < values.Length; i++) - if (Convert.ToInt64(values.GetValue(i)) == value) - return i; - - return 0; - } - - private string[] GetNames(Type type) - { - Array values = Enum.GetValues(type); - List<string> names = Enum.GetNames(type).ToList(); - - for (int i = 0; i < names.Count; i++) - { - DescriptorAttribute descriptor = ((Enum)values.GetValue(i)).GetAttribute<DescriptorAttribute>(); - if (descriptor != null && !string.IsNullOrEmpty(descriptor.Name)) - names[i] = descriptor.Name; - else - names[i] = ObjectNames.NicifyVariableName(names[i]); - } - - return names.ToArray(); - } - - private object DrawDropDown(Type type, long value, GUIStyle style, bool masked) - { - string[] names = GetNames(type); - Array values = Enum.GetValues(type); - - if (masked) - { - if (style == null) - value = EditorGUILayout.MaskField(Convert.ToInt32(value), names); - else - value = EditorGUILayout.MaskField(Convert.ToInt32(value), names, style); - - return Enum.ToObject(type, value); - } - else - { - int selected = SelectedIndex(values, value); - - if (style == null) - selected = EditorGUILayout.Popup(selected, names); - else - selected = EditorGUILayout.Popup(selected, names, style); - - return Enum.ToObject(type, values.GetValue(selected)); - } - } - - private object DrawEnum(Type type, long value, int max, GUIStyle style) - { - if (max < 1) - max = 6; - - string[] names = GetNames(type); - Array values = Enum.GetValues(type); - - int rows = Mathf.CeilToInt((float)names.Length / (float)max); - int count = (names.Length / rows); - if (count * rows < names.Length) - count++; - - int selected = SelectedIndex(values, value); - - GUILayout.BeginVertical(); - - for (int i = 0; i < rows; i++) - { - GUILayout.BeginHorizontal(); - - for (int j = count * i; j < count * (i + 1); j++) - { - if (j >= names.Length) - break; - - if (selected == j) - GUILayout.Toggle(true, names[j], style); - else if (GUILayout.Toggle(false, names[j], style)) - selected = j; - } - - GUILayout.EndHorizontal(); - } - - GUILayout.EndVertical(); - - return Enum.ToObject(type, values.GetValue(selected)); - } - - private object DrawMasked(Type type, long value, int max, GUIStyle style) - { - if (max < 1) - max = 6; - - Array values = Enum.GetValues(type); - string[] names = GetNames(type); - - int rows = Mathf.CeilToInt((float)names.Length / (float)max); - int count = (names.Length / rows); - if (count * rows < names.Length) - count++; - - int result = 0; - - GUILayout.BeginVertical(); - - for (int i = 0; i < rows; i++) - { - GUILayout.BeginHorizontal(); - - for (int j = count * i; j < count * (i + 1); j++) - { - if (j >= names.Length) - break; - - int v = (int)values.GetValue(j); - if (GUILayout.Toggle(((int)value & v) == v, names[j], style)) - result |= v; - } - - GUILayout.EndHorizontal(); - } - - GUILayout.EndVertical(); - - return Enum.ToObject(type, result); - } - } -}
\ No newline at end of file diff --git a/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/EnumEditor.cs.meta b/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/EnumEditor.cs.meta deleted file mode 100644 index e8d95004..00000000 --- a/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/EnumEditor.cs.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 60d56c7709f5e334c837239c33327bbd -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: diff --git a/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/FloatEditor.cs b/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/FloatEditor.cs deleted file mode 100644 index d139c02f..00000000 --- a/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/FloatEditor.cs +++ /dev/null @@ -1,208 +0,0 @@ -using UnityEngine; -using UnityEditor; -using System; -using System.Collections; - -namespace AdvancedInspector -{ - public class FloatEditor : FieldEditor - { - public override Type[] EditedTypes - { - get { return new Type[] { typeof(float), typeof(decimal), typeof(double) }; } - } - - public override void OnLabelDraw(InspectorField field, Rect rect) - { - if (InspectorPreferences.IsDragControl(InspectorPreferences.ValueScroll)) - EditorGUIUtility.AddCursorRect(rect, MouseCursor.ResizeHorizontal); - } - - public override void OnLabelClick(InspectorField field) - { - EditorGUIUtility.SetWantsMouseJumping(1); - } - - public override void OnLabelDragged(InspectorField field) - { - if (InspectorPreferences.IsDragControl(InspectorPreferences.ValueScroll)) - { - object result = field.GetValues()[0]; - double sensitivity = CalculateDragSensitivity(result); - result = Convert.ToDouble(result) + (double)(sensitivity * HandleUtility.niceMouseDelta); - - RangeValueAttribute rangeValue = field.GetAttribute<RangeValueAttribute>(); - if (rangeValue != null) - result = Math.Min(Math.Max((double)result, rangeValue.Min), rangeValue.Max); - - RangeAttribute range = field.GetAttribute<RangeAttribute>(); - if (range != null) - result = Math.Min(Math.Max((double)result, range.min), range.max); - - try - { - result = Convert.ChangeType(result, field.Type); - field.SetValue(result); - } - catch (Exception) - { - return; - } - } - } - - private static double CalculateDragSensitivity(object value) - { - double number = Convert.ToDouble(value); - - if (!double.IsInfinity(number) && !double.IsNaN(number)) - return (Math.Max(1d, Math.Pow(Math.Abs(number), 0.5d)) * 0.03d); - - return 0d; - } - - public override void Draw(InspectorField field, GUIStyle style) - { - RangeValueAttribute rangeValue = field.GetAttribute<RangeValueAttribute>(); - RangeAttribute range = field.GetAttribute<RangeAttribute>(); - - if (range != null && rangeValue == null) - rangeValue = new RangeValueAttribute(range.min, range.max); - - AngleAttribute angle = field.GetAttribute<AngleAttribute>(); - - object result; - if (DrawFloatingNumber(new GUIContent(""), field.GetValues(), rangeValue, angle, style, out result)) - field.SetValue(result); - } - - public static bool DrawFloat(string label, float[] values, out float result, params GUILayoutOption[] options) - { - return DrawFloat(label, values, null, null, null, out result, options); - } - - public static bool DrawFloat(string label, float[] values, GUIStyle style, out float result, params GUILayoutOption[] options) - { - return DrawFloat(label, values, null, null, style, out result, options); - } - - public static bool DrawFloat(string label, float[] values, RangeValueAttribute range, AngleAttribute angle, GUIStyle style, out float result, params GUILayoutOption[] options) - { - object genericResult; - object[] genericValues = new object[values.Length]; - for (int i = 0; i < values.Length; i++) - genericValues[i] = values[i]; - - bool changed = DrawFloatingNumber(new GUIContent(label), genericValues, range, angle, style, out genericResult, options); - - try - { - result = (float)genericResult; - } - catch (Exception) - { - result = values[0]; - return false; - } - - return changed; - } - - public static bool DrawFloatingNumber(GUIContent label, object[] values, RangeValueAttribute range, AngleAttribute angle, GUIStyle style, out object result, params GUILayoutOption[] options) - { - result = 0; - - EditorGUI.showMixedValue = false; - result = values[0]; - Type type = result.GetType(); - for (int i = 1; i < values.Length; i++) - { - if (values[i].Equals(result)) - continue; - - EditorGUI.showMixedValue = true; - break; - } - - EditorGUI.BeginChangeCheck(); - EditorGUILayout.BeginHorizontal(); - - if (!string.IsNullOrEmpty(label.text)) - { - int size = (int)GUI.skin.label.CalcSize(label).x; - if (size > 4) - size = Mathf.Max(size, 15); - - GUILayout.Label(label, GUI.skin.label, GUILayout.Width(size)); - - Event e = Event.current; - Rect labelRect = GUILayoutUtility.GetLastRect(); - int id = EditorGUIUtility.GetControlID(FocusType.Passive, labelRect); - - if (InspectorPreferences.IsDragControl(InspectorPreferences.ValueScroll)) - { - if (e.type == EventType.Repaint) - { - EditorGUIUtility.AddCursorRect(labelRect, MouseCursor.ResizeHorizontal); - } - else if (e.type == EventType.MouseDown && labelRect.Contains(e.mousePosition) && e.button == 0) - { - GUIUtility.hotControl = id; - GUIUtility.keyboardControl = id; - EditorGUIUtility.SetWantsMouseJumping(1); - e.Use(); - } - else if (e.type == EventType.MouseDrag && GUIUtility.hotControl == id) - { - double sensitivity = CalculateDragSensitivity(result); - result = Convert.ToDecimal(result) + (decimal)(sensitivity * HandleUtility.niceMouseDelta); - - if (range != null) - result = Math.Min(Math.Max((double)result, (double)range.Min), (double)range.Max); - - GUI.changed = true; - e.Use(); - } - else if (e.type == EventType.MouseUp && GUIUtility.hotControl == id) - { - GUIUtility.hotControl = 0; - EditorGUIUtility.SetWantsMouseJumping(0); - e.Use(); - } - } - } - - if (angle != null) - { - if (range != null) - result = ExtraGUILayout.FloatAngle((float)result, angle.Snap, range.Min, range.Max); - else - result = ExtraGUILayout.FloatAngle((float)result, angle.Snap); - } - else - { - if (range != null) - result = EditorGUILayout.Slider((float)result, range.Min, range.Max, options); - else - { - if (style != null) - result = EditorGUILayout.TextField(result.ToString(), style, options); - else - result = EditorGUILayout.TextField(result.ToString(), options); - } - } - - try - { - result = Convert.ChangeType(result, type); - } - catch (Exception) - { - return false; - } - - EditorGUILayout.EndHorizontal(); - return EditorGUI.EndChangeCheck(); - } - } -}
\ No newline at end of file diff --git a/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/FloatEditor.cs.meta b/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/FloatEditor.cs.meta deleted file mode 100644 index edfb7b23..00000000 --- a/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/FloatEditor.cs.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 4724a82f5fd3d9e44a50d524deae4259 -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: diff --git a/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/GradientEditor.cs b/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/GradientEditor.cs deleted file mode 100644 index 09910618..00000000 --- a/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/GradientEditor.cs +++ /dev/null @@ -1,36 +0,0 @@ -using UnityEngine; -using UnityEditor; -using System; -using System.Collections; -using System.Reflection; - -namespace AdvancedInspector -{ - public class GradientEditor : FieldEditor - { - private static MethodInfo gradientField; - - public GradientEditor() - { - // Because Unity does not expose this EditorGUI. - gradientField = typeof(EditorGUILayout).GetMethod("GradientField", BindingFlags.NonPublic | BindingFlags.Static, null, new Type[] { typeof(Gradient), typeof(GUILayoutOption).MakeArrayType() }, null); - } - - public override Type[] EditedTypes - { - get { return new Type[] { typeof(Gradient) }; } - } - - public override void Draw(InspectorField field, GUIStyle style) - { - object value = GetValue(field); - - try - { - //Always throw "ExitGUIException" - gradientField.Invoke(null, new object[] { value, null }); - } - catch (Exception) { } - } - } -}
\ No newline at end of file diff --git a/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/GradientEditor.cs.meta b/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/GradientEditor.cs.meta deleted file mode 100644 index 275d4027..00000000 --- a/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/GradientEditor.cs.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 96cba1c5f2f4273468699cb64ae8726e -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: diff --git a/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/GuidEditor.cs b/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/GuidEditor.cs deleted file mode 100644 index 43fd51c9..00000000 --- a/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/GuidEditor.cs +++ /dev/null @@ -1,25 +0,0 @@ -using UnityEngine; -using UnityEditor; -using System; -using System.Collections; - -namespace AdvancedInspector -{ - public class GuidEditor : FieldEditor - { - public override Type[] EditedTypes - { - get { return new Type[] { typeof(Guid) }; } - } - - public override void Draw(InspectorField field, GUIStyle style) - { - // GetValue returns null if multi-selection and different values - Guid id = field.GetValue<Guid>(); - if (id == Guid.Empty) - GUILayout.Label("GUID: --------------"); - else - GUILayout.Label("GUID: " + id.ToString()); - } - } -}
\ No newline at end of file diff --git a/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/GuidEditor.cs.meta b/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/GuidEditor.cs.meta deleted file mode 100644 index 15843f11..00000000 --- a/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/GuidEditor.cs.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 054dd34a1ddeb8b46848fcc673189bab -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: diff --git a/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/IntegerEditor.cs b/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/IntegerEditor.cs deleted file mode 100644 index c88f59f2..00000000 --- a/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/IntegerEditor.cs +++ /dev/null @@ -1,195 +0,0 @@ -using UnityEngine; -using UnityEditor; -using System; -using System.Collections; - -namespace AdvancedInspector -{ - public class IntegerEditor : FieldEditor - { - public override Type[] EditedTypes - { - get { return new Type[] { typeof(int), typeof(byte), typeof(short), typeof(long), typeof(uint), typeof(ushort), typeof(ulong), typeof(sbyte) }; } - } - - public override void OnLabelDraw(InspectorField field, Rect rect) - { - if (InspectorPreferences.IsDragControl(InspectorPreferences.ValueScroll)) - EditorGUIUtility.AddCursorRect(rect, MouseCursor.ResizeHorizontal); - } - - public override void OnLabelClick(InspectorField field) - { - EditorGUIUtility.SetWantsMouseJumping(1); - } - - public override void OnLabelDragged(InspectorField field) - { - if (InspectorPreferences.IsDragControl(InspectorPreferences.ValueScroll)) - { - object result = field.GetValues()[0]; - long value = Convert.ToInt64(result); - result = (long)Math.Round(value + (CalculateDragSensitivity(value) * HandleUtility.niceMouseDelta * 0.1f)); - - RangeValueAttribute rangeValue = field.GetAttribute<RangeValueAttribute>(); - if (rangeValue != null) - result = Math.Min(Math.Max((long)result, (long)rangeValue.Min), (long)rangeValue.Max); - - RangeAttribute range = field.GetAttribute<RangeAttribute>(); - if (range != null) - result = Math.Min(Math.Max((long)result, (long)range.min), (long)range.max); - - try - { - result = Convert.ChangeType(result, field.Type); - field.SetValue(result); - } - catch (Exception) - { - return; - } - } - } - - private static double CalculateDragSensitivity(object value) - { - return Math.Max(1, Math.Pow(Math.Abs((long)value), 0.5d) * 0.03d); - } - - public override void Draw(InspectorField field, GUIStyle style) - { - AngleAttribute angle = field.GetAttribute<AngleAttribute>(); - - RangeValueAttribute rangeValue = field.GetAttribute<RangeValueAttribute>(); - RangeAttribute range = field.GetAttribute<RangeAttribute>(); - - if (range != null && rangeValue == null) - rangeValue = new RangeValueAttribute(range.min, range.max); - - object result; - if (DrawIntegerNumber(GUIContent.none, field.GetValues(), rangeValue, angle, style, out result)) - field.SetValue(result); - } - - public static bool DrawInt(string label, int[] values, out int result, params GUILayoutOption[] options) - { - return DrawInt(label, values, null, out result, options); - } - - public static bool DrawInt(string label, int[] values, GUIStyle style, out int result, params GUILayoutOption[] options) - { - object genericResult; - object[] genericValues = new object[values.Length]; - for (int i = 0; i < values.Length; i++) - genericValues[i] = values[i]; - - bool changed = DrawIntegerNumber(new GUIContent(label), genericValues, null, null, style, out genericResult, options); - - try - { - result = (int)genericResult; - } - catch (Exception) - { - result = values[0]; - return false; - } - - return changed; - } - - public static bool DrawIntegerNumber(GUIContent label, object[] values, RangeValueAttribute range, AngleAttribute angle, GUIStyle style, out object result, params GUILayoutOption[] options) - { - EditorGUI.showMixedValue = false; - result = values[0]; - Type type = result.GetType(); - for (int i = 1; i < values.Length; i++) - { - if (values[i].Equals(result)) - continue; - - EditorGUI.showMixedValue = true; - break; - } - - EditorGUI.BeginChangeCheck(); - EditorGUILayout.BeginHorizontal(); - - if (!string.IsNullOrEmpty(label.text)) - { - int size = (int)GUI.skin.label.CalcSize(label).x; - if (size > 4) - size = Mathf.Max(size, 15); - - GUILayout.Label(label, GUI.skin.label, GUILayout.Width(size)); - - Event e = Event.current; - Rect labelRect = GUILayoutUtility.GetLastRect(); - int id = EditorGUIUtility.GetControlID(FocusType.Passive, labelRect); - - if (InspectorPreferences.IsDragControl(InspectorPreferences.ValueScroll)) - { - if (e.type == EventType.Repaint) - { - EditorGUIUtility.AddCursorRect(labelRect, MouseCursor.ResizeHorizontal); - } - else if (e.type == EventType.MouseDown && labelRect.Contains(e.mousePosition) && e.button == 0) - { - GUIUtility.hotControl = id; - GUIUtility.keyboardControl = id; - EditorGUIUtility.SetWantsMouseJumping(1); - e.Use(); - } - else if (e.type == EventType.MouseDrag && GUIUtility.hotControl == id) - { - long value = Convert.ToInt64(result); - result = (long)Math.Round(value + (CalculateDragSensitivity(value) * HandleUtility.niceMouseDelta * 0.1f)); - if (range != null) - result = Math.Min(Math.Max((long)result, (long)range.Min), (long)range.Max); - - GUI.changed = true; - e.Use(); - } - else if (e.type == EventType.MouseUp && GUIUtility.hotControl == id) - { - GUIUtility.hotControl = 0; - EditorGUIUtility.SetWantsMouseJumping(0); - e.Use(); - } - } - } - - if (angle != null) - { - if (range != null) - result = ExtraGUILayout.IntAngle((int)result, (int)angle.Snap, (int)range.Min, (int)range.Max); - else - result = ExtraGUILayout.IntAngle((int)result, (int)angle.Snap); - } - else - { - if (range != null) - result = EditorGUILayout.IntSlider((int)result, (int)range.Min, (int)range.Max, options); - else - { - if (style != null) - result = EditorGUILayout.TextField(result.ToString(), style, options); - else - result = EditorGUILayout.TextField(result.ToString(), options); - } - } - - try - { - result = Convert.ChangeType(result, type); - } - catch (Exception) - { - return false; - } - - EditorGUILayout.EndHorizontal(); - return EditorGUI.EndChangeCheck(); - } - } -}
\ No newline at end of file diff --git a/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/IntegerEditor.cs.meta b/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/IntegerEditor.cs.meta deleted file mode 100644 index 21f570b6..00000000 --- a/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/IntegerEditor.cs.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 2c1396463f395614b976eb98c848bfa5 -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: diff --git a/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/LayerMaskEditor.cs b/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/LayerMaskEditor.cs deleted file mode 100644 index a007f1b6..00000000 --- a/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/LayerMaskEditor.cs +++ /dev/null @@ -1,104 +0,0 @@ -using UnityEngine; -using UnityEditor; -using System; -using System.Collections; -using System.Collections.Generic; - -namespace AdvancedInspector -{ - public class LayerMaskEditor : FieldEditor - { - private static List<string> names; - private static List<int> masks; - - public override Type[] EditedTypes - { - get { return new Type[] { typeof(LayerMask) }; } - } - - public override void Draw(InspectorField field, GUIStyle style) - { - names = new List<string>(); - masks = new List<int>(); - - for (int i = 0; i < 32; i++) - { - string name = LayerMask.LayerToName(i); - - if (!string.IsNullOrEmpty(name)) - { - names.Add(name); - masks.Add(1 << i); - } - } - - object value = field.GetValue(); - - bool isMask = value is LayerMask; - - int mask; - if (isMask) - mask = (int)(LayerMask)value; - else - mask = (int)value; - - int result; - if (DrawLayerMaskField(mask, style, out result)) - { - if (isMask) - field.SetValue((LayerMask)result); - else - field.SetValue(result); - } - } - - public static bool DrawLayerMaskField(int aMask, GUIStyle style, out int result) - { - int val = aMask; - int maskVal = 0; - for (int i = 0; i < names.Count; i++) - { - if (masks[i] != 0) - { - if ((val & masks[i]) == masks[i]) - maskVal |= 1 << i; - } - else if (val == 0) - maskVal |= 1 << i; - } - - EditorGUI.BeginChangeCheck(); - - int newMaskVal; - if (style != null) - newMaskVal = EditorGUILayout.MaskField(maskVal, names.ToArray(), style); - else - newMaskVal = EditorGUILayout.MaskField(maskVal, names.ToArray()); - - int changes = maskVal ^ newMaskVal; - - for (int i = 0; i < masks.Count; i++) - { - if ((changes & (1 << i)) != 0) - { - if ((newMaskVal & (1 << i)) != 0) - { - if (masks[i] == 0) - { - val = 0; - break; - } - else - val |= masks[i]; - } - else - val &= ~masks[i]; - } - } - - result = val; - - return EditorGUI.EndChangeCheck(); - } - } -}
\ No newline at end of file diff --git a/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/LayerMaskEditor.cs.meta b/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/LayerMaskEditor.cs.meta deleted file mode 100644 index 404c93c3..00000000 --- a/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/LayerMaskEditor.cs.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 8da80cb340d7b8b4b817f05fbae4e554 -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: diff --git a/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/MonoEditor.cs b/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/MonoEditor.cs deleted file mode 100644 index 92083794..00000000 --- a/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/MonoEditor.cs +++ /dev/null @@ -1,78 +0,0 @@ -using UnityEngine; -using UnityEditor; -using System; -using System.Collections; -using System.Collections.Generic; -using System.Reflection; - -using UniToolsEditor; - -namespace AdvancedInspector -{ - public class MonoEditor : FieldEditor - { - public override bool EditDerived - { - get { return false; } - } - - public override Type[] EditedTypes - { - get { return new Type[] { typeof(UnityEditor.MonoScript) }; } - } - - public override void Draw(InspectorField field, GUIStyle style) - { - if (field.SerializedProperty == null || field.SerializedProperty.serializedObject == null) - return; - - Type type = field.SerializedInstances[0].GetType(); - if (typeof(ComponentMonoBehaviour).IsAssignableFrom(type)) - GUILayout.Label(type.Name); - else - { - EditorGUI.BeginChangeCheck(); - - field.SerializedProperty.serializedObject.Update(); - EditorGUILayout.PropertyField(field.SerializedProperty, new GUIContent("")); - field.SerializedProperty.serializedObject.ApplyModifiedProperties(); - - if (EditorGUI.EndChangeCheck()) - { - if (field.Parent != null) - field.Parent.RefreshFields(); - else - AdvancedInspectorControl.Editor.Instances = new object[] { field.SerializedProperty.serializedObject.targetObject }; - } - } - - DrawObjectSelector(field); - } - - private void DrawObjectSelector(InspectorField field) - { - MonoBehaviour behaviour = field.GetValue() as MonoBehaviour; - if (behaviour == null) - return; - - List<Component> components = new List<Component>(behaviour.gameObject.GetComponents(field.BaseType)); - if (components.Count == 1) - return; - - int index = components.IndexOf(behaviour); - string[] texts = new string[components.Count]; - - for (int i = 0; i < components.Count; i++) - texts[i] = i.ToString() + " : " + components[i].ToString(); - - EditorGUILayout.BeginHorizontal(); - int selection = EditorGUILayout.Popup(index, texts); - EditorGUILayout.EndHorizontal(); - - if (selection == index) - return; - - field.SetValue(components[selection]); - } - } -}
\ No newline at end of file diff --git a/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/MonoEditor.cs.meta b/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/MonoEditor.cs.meta deleted file mode 100644 index d796dee7..00000000 --- a/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/MonoEditor.cs.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: b9fbe9f800efcf241b78c75454f58a12 -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: diff --git a/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/ObjectEditor.cs b/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/ObjectEditor.cs deleted file mode 100644 index ddfe8b55..00000000 --- a/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/ObjectEditor.cs +++ /dev/null @@ -1,192 +0,0 @@ -using UnityEngine; -using UnityEditor; -using System; -using System.Collections; -using System.Collections.Generic; -using System.Reflection; - -using UniToolsEditor; - -namespace AdvancedInspector -{ - public class ObjectEditor : FieldEditor - { - private static Texture picker; - - private static Texture pickerPro; - - private static Texture Picker - { - get - { - if (EditorGUIUtility.isProSkin) - { - if (pickerPro == null) - pickerPro = Helper.Load(EditorResources.PickerPro); - - return pickerPro; - } - else - { - if (picker == null) - picker = Helper.Load(EditorResources.Picker); - - return picker; - } - } - } - - private static int s_ObjectFieldHash = "s_ObjectFieldHash".GetHashCode(); - private static Type validator = null; - private static MethodInfo doObjectField = null; - - public override bool EditDerived - { - get { return true; } - } - - public override Type[] EditedTypes - { - get { return new Type[] { typeof(UnityEngine.Object) }; } - } - - public override void Draw(InspectorField field, GUIStyle style) - { - if (field.GetAttribute<NoPicker>() != null) - { - object obj = field.GetValue(); - if (field.Mixed) - GUILayout.Label("---"); - else if (obj == null) - GUILayout.Label("None"); - else if (field.OverloadToString) - GUILayout.Label(obj.ToString()); - else if (field.Type != null) - GUILayout.Label(field.Type.Name); - - return; - } - - if (field.DisplayAsParent) - return; - - if (validator == null) - validator = typeof(EditorGUI).GetNestedType("ObjectFieldValidator", BindingFlags.NonPublic); - - if (doObjectField == null) - doObjectField = typeof(EditorGUI).GetMethod("DoObjectField", BindingFlags.NonPublic | BindingFlags.Static, null, new Type[] { typeof(Rect), typeof(Rect), typeof(int), - typeof(UnityEngine.Object), typeof(Type), typeof(SerializedProperty), validator, typeof(bool), typeof(GUIStyle) }, null); - - DontAllowSceneObjectAttribute dontAllow = field.GetAttribute<DontAllowSceneObjectAttribute>(); ; - - UnityEngine.Object value = (UnityEngine.Object)GetValue(field); - - EditorGUILayout.BeginHorizontal(); - EditorGUI.BeginChangeCheck(); - - Type type = field.Type; - - UnityEngine.Object result = null; - - if (type.IsInterface) - { - Rect position = EditorGUILayout.GetControlRect(false, 16f); - int id = GUIUtility.GetControlID(s_ObjectFieldHash, EditorGUIUtility.native, position); - Delegate validation = Delegate.CreateDelegate(validator, typeof(ObjectEditor).GetMethod("ValidateObjectFieldAssignment", BindingFlags.NonPublic | BindingFlags.Static)); - - result = doObjectField.Invoke(null, new object[] { position, position, id, value, type, null, validation, dontAllow == null, EditorStyles.objectField } ) as UnityEngine.Object; - } - else - result = EditorGUILayout.ObjectField(value, type, dontAllow == null); - - if (EditorGUI.EndChangeCheck()) - field.SetValue(result); - - if (dontAllow == null && (field.Type == typeof(GameObject) || - typeof(Component).IsAssignableFrom(field.Type) || field.Type.IsAssignableFrom(typeof(Component)))) - if (GUILayout.Button(Picker, GUIStyle.none, GUILayout.Width(18), GUILayout.Height(18))) - InspectorEditor.StartPicking(Picked, field); - - EditorGUILayout.EndHorizontal(); - - DrawObjectSelector(field); - } - - private static UnityEngine.Object ValidateObjectFieldAssignment(UnityEngine.Object[] references, Type objType, SerializedProperty property) - { - if (references.Length > 0) - { - if (((references[0] != null) && (references[0].GetType() == typeof(GameObject)))) - { - foreach (UnityEngine.Object obj in ((GameObject)references[0]).GetComponents(typeof(Component))) - { - if ((obj != null) && objType.IsAssignableFrom(obj.GetType())) - { - return obj; - } - } - } - } - - return null; - } - - private void Picked(GameObject go, object tag) - { - InspectorField field = tag as InspectorField; - if (field == null) - return; - - if (field.Type == typeof(GameObject)) - field.SetValue(go); - else if (typeof(Component).IsAssignableFrom(field.Type)) - field.SetValue(go.GetComponent(field.Type)); - } - - public override void OnLabelDoubleClick(InspectorField field) - { - UnityEngine.Object target = field.GetValue() as UnityEngine.Object; - if (target == null) - return; - - if (!string.IsNullOrEmpty(AssetDatabase.GetAssetPath(target))) - EditorGUIUtility.PingObject(target); - else - { - SceneView view = SceneView.lastActiveSceneView; - Quaternion rotation = view.camera.transform.rotation; - - if (target is GameObject) - SceneView.lastActiveSceneView.LookAt(((GameObject)target).transform.position, rotation, 10); - else if (target is Component) - SceneView.lastActiveSceneView.LookAt(((Component)target).transform.position, rotation, 10); - } - } - - private void DrawObjectSelector(InspectorField field) - { - MonoBehaviour behaviour = field.GetValue() as MonoBehaviour; - if (behaviour == null) - return; - - List<Component> components = new List<Component>(behaviour.gameObject.GetComponents(field.BaseType)); - if (components.Count == 1) - return; - - int index = components.IndexOf(behaviour); - string[] texts = new string[components.Count]; - - for (int i = 0; i < components.Count; i++) - texts[i] = i.ToString() + " : " + components[i].ToString(); - - EditorGUILayout.BeginHorizontal(); - int selection = EditorGUILayout.Popup(index, texts); - EditorGUILayout.EndHorizontal(); - - if (selection == index) - return; - - field.SetValue(components[selection]); - } - } -}
\ No newline at end of file diff --git a/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/ObjectEditor.cs.meta b/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/ObjectEditor.cs.meta deleted file mode 100644 index b975cbcc..00000000 --- a/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/ObjectEditor.cs.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 1c38d144247c0f9448c0c285b7c255fc -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: diff --git a/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/QuaternionEditor.cs b/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/QuaternionEditor.cs deleted file mode 100644 index 789ebbb6..00000000 --- a/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/QuaternionEditor.cs +++ /dev/null @@ -1,168 +0,0 @@ -using UnityEngine; -using UnityEditor; -using System; -using System.Collections; - -namespace AdvancedInspector -{ - public class QuaternionEditor : FieldEditor - { - public override bool Expandable - { - get { return false; } - } - - public override Type[] EditedTypes - { - get { return new Type[] { typeof(Quaternion) }; } - } - - public override void Draw(InspectorField field, GUIStyle style) - { - float width = EditorGUIUtility.labelWidth; - EditorGUIUtility.labelWidth = VECTOR_FIELD_WIDTH; - - Quaternion[] values = field.GetValues<Quaternion>(); - if (AdvancedInspectorControl.Level <= InspectorLevel.Advanced) - { - float[] x = new float[values.Length]; - float[] y = new float[values.Length]; - float[] z = new float[values.Length]; - - for (int i = 0; i < values.Length; i++) - { - Vector3 euler = values[i].eulerAngles; - x[i] = euler.x; - y[i] = euler.y; - z[i] = euler.z; - } - - GUILayout.BeginHorizontal(); - - float result; - if (FloatEditor.DrawFloat("X", x, style, out result)) - { - Undo.RecordObjects(field.SerializedInstances, "Edit " + field.Name + " X"); - - for (int i = 0; i < field.Instances.Length; i++) - { - Vector3 v = field.GetValue<Quaternion>(field.Instances[i]).eulerAngles; - v.x = result; - field.SetValue(field.Instances[i], Quaternion.Euler(v)); - } - } - - if (FloatEditor.DrawFloat("Y", y, style, out result)) - { - Undo.RecordObjects(field.SerializedInstances, "Edit " + field.Name + " Y"); - - for (int i = 0; i < field.Instances.Length; i++) - { - Vector3 v = field.GetValue<Quaternion>(field.Instances[i]).eulerAngles; - v.y = result; - field.SetValue(field.Instances[i], Quaternion.Euler(v)); - } - } - - if (FloatEditor.DrawFloat("Z", z, style, out result)) - { - Undo.RecordObjects(field.SerializedInstances, "Edit " + field.Name + " Z"); - - for (int i = 0; i < field.Instances.Length; i++) - { - Vector3 v = field.GetValue<Quaternion>(field.Instances[i]).eulerAngles; - v.z = result; - field.SetValue(field.Instances[i], Quaternion.Euler(v)); - } - } - - GUILayout.EndHorizontal(); - } - else - { - float[] x = new float[values.Length]; - float[] y = new float[values.Length]; - float[] z = new float[values.Length]; - float[] w = new float[values.Length]; - - for (int i = 0; i < values.Length; i++) - { - x[i] = values[i].x; - y[i] = values[i].y; - z[i] = values[i].z; - w[i] = values[i].w; - } - - GUILayout.BeginHorizontal(); - - float result; - if (FloatEditor.DrawFloat("X", x, style, out result)) - { - Undo.RecordObjects(field.SerializedInstances, "Edit " + field.Name + " X"); - - for (int i = 0; i < field.Instances.Length; i++) - { - Quaternion v = field.GetValue<Quaternion>(field.Instances[i]); - v.x = result; - field.SetValue(field.Instances[i], v); - } - } - - if (FloatEditor.DrawFloat("Y", y, style, out result)) - { - Undo.RecordObjects(field.SerializedInstances, "Edit " + field.Name + " Y"); - - for (int i = 0; i < field.Instances.Length; i++) - { - Quaternion v = field.GetValue<Quaternion>(field.Instances[i]); - v.y = result; - field.SetValue(field.Instances[i], v); - } - } - - GUILayout.EndHorizontal(); - GUILayout.BeginHorizontal(); - - if (FloatEditor.DrawFloat("Z", z, style, out result)) - { - Undo.RecordObjects(field.SerializedInstances, "Edit " + field.Name + " Z"); - - for (int i = 0; i < field.Instances.Length; i++) - { - Quaternion v = field.GetValue<Quaternion>(field.Instances[i]); - v.z = result; - field.SetValue(field.Instances[i], v); - } - } - - if (FloatEditor.DrawFloat("W", w, style, out result)) - { - Undo.RecordObjects(field.SerializedInstances, "Edit " + field.Name + " W"); - - for (int i = 0; i < field.Instances.Length; i++) - { - Quaternion v = field.GetValue<Quaternion>(field.Instances[i]); - v.w = result; - field.SetValue(field.Instances[i], v); - } - } - - GUILayout.EndHorizontal(); - } - - EditorGUIUtility.labelWidth = width; - } - - public override void OnContextualClick(InspectorField field, GenericMenu menu) - { - menu.AddItem(new GUIContent("Identity"), false, Identity); - - menu.AddSeparator(""); - } - - private void Identity() - { - AdvancedInspectorControl.Field.SetValue(Quaternion.identity); - } - } -}
\ No newline at end of file diff --git a/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/QuaternionEditor.cs.meta b/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/QuaternionEditor.cs.meta deleted file mode 100644 index 96defe29..00000000 --- a/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/QuaternionEditor.cs.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 4fd00569d2e889248bedf34a4e50c078 -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: diff --git a/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/RangeEditor.cs b/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/RangeEditor.cs deleted file mode 100644 index 0f540c19..00000000 --- a/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/RangeEditor.cs +++ /dev/null @@ -1,109 +0,0 @@ -using UnityEngine; -using UnityEditor; -using System; -using System.Collections; - -namespace AdvancedInspector -{ - public class RangeIntEditor : FieldEditor - { - public override Type[] EditedTypes - { - get { return new Type[] { typeof(RangeInt) }; } - } - - public override void Draw(InspectorField field, GUIStyle style) - { - RangeValueAttribute range = field.GetAttribute<RangeValueAttribute>(); - if (range == null) - return; - - EditorGUILayout.BeginHorizontal(); - - RangeInt[] ranges = field.GetValues<RangeInt>(); - - int[] mins = new int[ranges.Length]; - int[] maxs = new int[ranges.Length]; - int min = ranges[0].min; - int max = ranges[0].max; - bool different = false; - - for (int i = 0; i < ranges.Length; i++) - { - mins[i] = ranges[i].min; - maxs[i] = ranges[i].max; - if (ranges[i].min != min || ranges[0].max != max) - different = true; - } - - if (IntegerEditor.DrawInt("", mins, out min, GUILayout.Width(64))) - for (int i = 0; i < field.Instances.Length; i++) - field.SetValue(field.Instances[i], new RangeInt(min, ranges[i].max)); - - EditorGUI.BeginChangeCheck(); - float fMin = min; - float fMax = max; - EditorGUI.showMixedValue = different; - EditorGUILayout.MinMaxSlider(ref fMin, ref fMax, range.Min, range.Max); - if (EditorGUI.EndChangeCheck() && min < max) - for (int i = 0; i < field.Instances.Length; i++) - field.SetValue(field.Instances[i], new RangeInt((int)fMin, (int)fMax)); - - if (IntegerEditor.DrawInt("", maxs, out max, GUILayout.Width(64))) - for (int i = 0; i < field.Instances.Length; i++) - field.SetValue(field.Instances[i], new RangeInt(ranges[i].min, max)); - - EditorGUILayout.EndHorizontal(); - } - } - - public class RangeFloatEditor : FieldEditor - { - public override Type[] EditedTypes - { - get { return new Type[] { typeof(RangeFloat) }; } - } - - public override void Draw(InspectorField field, GUIStyle style) - { - RangeValueAttribute range = field.GetAttribute<RangeValueAttribute>(); - if (range == null) - return; - - EditorGUILayout.BeginHorizontal(); - - RangeFloat[] ranges = field.GetValues<RangeFloat>(); - - float[] mins = new float[ranges.Length]; - float[] maxs = new float[ranges.Length]; - float min = ranges[0].min; - float max = ranges[0].max; - bool different = false; - - for (int i = 0; i < ranges.Length; i++) - { - mins[i] = ranges[i].min; - maxs[i] = ranges[i].max; - if (ranges[i].min != min || ranges[0].max != max) - different = true; - } - - if (FloatEditor.DrawFloat("", mins, out min, GUILayout.Width(64))) - for (int i = 0; i < field.Instances.Length; i++) - field.SetValue(field.Instances[i], new RangeFloat(min, ranges[i].max)); - - EditorGUI.BeginChangeCheck(); - EditorGUI.showMixedValue = different; - EditorGUILayout.MinMaxSlider(ref min, ref max, range.Min, range.Max); - if (EditorGUI.EndChangeCheck() && min < max) - for (int i = 0; i < field.Instances.Length; i++) - field.SetValue(field.Instances[i], new RangeFloat(min, max)); - - if (FloatEditor.DrawFloat("", maxs, out max, GUILayout.Width(64))) - for (int i = 0; i < field.Instances.Length; i++) - field.SetValue(field.Instances[i], new RangeFloat(ranges[i].min, max)); - - EditorGUILayout.EndHorizontal(); - } - } -}
\ No newline at end of file diff --git a/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/RangeEditor.cs.meta b/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/RangeEditor.cs.meta deleted file mode 100644 index 0701b335..00000000 --- a/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/RangeEditor.cs.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 94080e99d0e3f994a8415cc19062dbde -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: diff --git a/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/RectEditor.cs b/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/RectEditor.cs deleted file mode 100644 index ee3e61e4..00000000 --- a/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/RectEditor.cs +++ /dev/null @@ -1,165 +0,0 @@ -using UnityEngine; -using UnityEditor; -using System; -using System.Collections; - -namespace AdvancedInspector -{ - public class RectEditor : FieldEditor - { - public override bool Expandable - { - get { return false; } - } - - public override Type[] EditedTypes - { - get { return new Type[] { typeof(Rect), typeof(RectOffset) }; } - } - - public override void Draw(InspectorField field, GUIStyle style) - { - Type type = field.BaseType; - - float labelWidth = EditorGUIUtility.labelWidth; - EditorGUIUtility.labelWidth = VECTOR_FIELD_WIDTH; - - if (type == typeof(Rect)) - { - Rect[] values = field.GetValues<Rect>(); - - float[] x = new float[values.Length]; - float[] y = new float[values.Length]; - float[] height = new float[values.Length]; - float[] width = new float[values.Length]; - - for (int i = 0; i < values.Length; i++) - { - x[i] = values[i].x; - y[i] = values[i].y; - height[i] = values[i].height; - width[i] = values[i].width; - } - - GUILayout.BeginHorizontal(); - float result; - if (FloatEditor.DrawFloat("X", x, style, out result)) - { - Undo.RecordObjects(field.SerializedInstances, "Edit " + field.Name + " X"); - - for (int i = 0; i < field.Instances.Length; i++) - { - values[i].x = result; - field.SetValue(field.Instances[i], values[i]); - } - } - - if (FloatEditor.DrawFloat("Y", y, style, out result)) - { - Undo.RecordObjects(field.SerializedInstances, "Edit " + field.Name + " Y"); - - for (int i = 0; i < field.Instances.Length; i++) - { - values[i].y = result; - field.SetValue(field.Instances[i], values[i]); - } - } - GUILayout.EndHorizontal(); - - GUILayout.BeginHorizontal(); - if (FloatEditor.DrawFloat("W", width, style, out result)) - { - Undo.RecordObjects(field.SerializedInstances, "Edit " + field.Name + " Width"); - - for (int i = 0; i < field.Instances.Length; i++) - { - values[i].width = result; - field.SetValue(field.Instances[i], values[i]); - } - } - - if (FloatEditor.DrawFloat("H", height, style, out result)) - { - Undo.RecordObjects(field.SerializedInstances, "Edit " + field.Name + " Height"); - - for (int i = 0; i < field.Instances.Length; i++) - { - values[i].height = result; - field.SetValue(field.Instances[i], values[i]); - } - } - GUILayout.EndHorizontal(); - } - else if (type == typeof(RectOffset)) - { - RectOffset[] values = field.GetValues<RectOffset>(); - - int[] left = new int[values.Length]; - int[] right = new int[values.Length]; - int[] top = new int[values.Length]; - int[] bottom = new int[values.Length]; - - for (int i = 0; i < values.Length; i++) - { - left[i] = values[i].left; - right[i] = values[i].right; - top[i] = values[i].top; - bottom[i] = values[i].bottom; - } - - GUILayout.BeginHorizontal(); - int result; - if (IntegerEditor.DrawInt("L", left, style, out result)) - { - Undo.RecordObjects(field.SerializedInstances, "Edit " + field.Name + " Left"); - - for (int i = 0; i < field.Instances.Length; i++) - { - values[i].left = result; - field.SetValue(field.Instances[i], values[i]); - } - } - - if (IntegerEditor.DrawInt("R", right, style, out result)) - { - Undo.RecordObjects(field.SerializedInstances, "Edit " + field.Name + " Right"); - - for (int i = 0; i < field.Instances.Length; i++) - { - values[i].right = result; - field.SetValue(field.Instances[i], values[i]); - } - } - GUILayout.EndHorizontal(); - - GUILayout.BeginHorizontal(); - if (IntegerEditor.DrawInt("T", top, style, out result)) - { - Undo.RecordObjects(field.SerializedInstances, "Edit " + field.Name + " Top"); - - for (int i = 0; i < field.Instances.Length; i++) - { - values[i].top = result; - field.SetValue(field.Instances[i], values[i]); - } - } - - if (IntegerEditor.DrawInt("B", bottom, style, out result)) - { - Undo.RecordObjects(field.SerializedInstances, "Edit " + field.Name + " Bottom"); - - for (int i = 0; i < field.Instances.Length; i++) - { - values[i].bottom = result; - field.SetValue(field.Instances[i], values[i]); - } - } - GUILayout.EndHorizontal(); - } - - EditorGUILayout.Space(); - - EditorGUIUtility.labelWidth = labelWidth; - } - } -}
\ No newline at end of file diff --git a/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/RectEditor.cs.meta b/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/RectEditor.cs.meta deleted file mode 100644 index aaf7d190..00000000 --- a/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/RectEditor.cs.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: fccb35960df296244b543fc8b0adbb98 -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: diff --git a/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/RigidbodyConstraints2DEditor.cs b/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/RigidbodyConstraints2DEditor.cs deleted file mode 100644 index 4e54cbaa..00000000 --- a/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/RigidbodyConstraints2DEditor.cs +++ /dev/null @@ -1,60 +0,0 @@ -using UnityEngine; -using UnityEditor; -using System; -using System.Collections; - -namespace AdvancedInspector -{ - public class RigidbodyConstraints2DEditor : FieldEditor - { - private const int LABEL_WIDTH = 96; - private const int TOGGLE_WIDTH = 28; - - public override bool EditDerived - { - get { return false; } - } - - public override bool Expandable - { - get { return true; } - } - - public override Type[] EditedTypes - { - get { return new Type[] { typeof(RigidbodyConstraints2D) }; } - } - - public override void Draw(InspectorField field, GUIStyle style) - { - field.Expandable = true; - if (!field.Expanded) - return; - - EditorGUI.showMixedValue = field.Mixed; - - EditorGUI.BeginChangeCheck(); - - RigidbodyConstraints2D value = (RigidbodyConstraints2D)GetValue(field); - int newValue = 0; - - EditorGUILayout.BeginHorizontal(); - GUILayout.Label("Freeze Position ", GUILayout.Width(LABEL_WIDTH)); - if (GUILayout.Toggle(value.Has(RigidbodyConstraints2D.FreezePositionX), "X", GUILayout.Width(TOGGLE_WIDTH))) - newValue += (int)RigidbodyConstraints2D.FreezePositionX; - - if (GUILayout.Toggle(value.Has(RigidbodyConstraints2D.FreezePositionY), "Y", GUILayout.Width(TOGGLE_WIDTH))) - newValue += (int)RigidbodyConstraints2D.FreezePositionY; - EditorGUILayout.EndHorizontal(); - - EditorGUILayout.BeginHorizontal(); - GUILayout.Label("Freeze Rotation ", GUILayout.Width(LABEL_WIDTH)); - if (GUILayout.Toggle(value.Has(RigidbodyConstraints2D.FreezeRotation), "Z", GUILayout.Width(TOGGLE_WIDTH))) - newValue += (int)RigidbodyConstraints2D.FreezeRotation; - EditorGUILayout.EndHorizontal(); - - if (EditorGUI.EndChangeCheck()) - field.SetValue(Enum.ToObject(typeof(RigidbodyConstraints2D), newValue)); - } - } -}
\ No newline at end of file diff --git a/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/RigidbodyConstraints2DEditor.cs.meta b/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/RigidbodyConstraints2DEditor.cs.meta deleted file mode 100644 index 7e23526b..00000000 --- a/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/RigidbodyConstraints2DEditor.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 4d2541cd5af63614a837b0ad6801c1ed -timeCreated: 1433909068 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/RigidbodyConstraintsEditor.cs b/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/RigidbodyConstraintsEditor.cs deleted file mode 100644 index 781c92b8..00000000 --- a/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/RigidbodyConstraintsEditor.cs +++ /dev/null @@ -1,69 +0,0 @@ -using UnityEngine; -using UnityEditor; -using System; -using System.Collections; - -namespace AdvancedInspector -{ - public class RigidbodyConstraintsEditor : FieldEditor - { - private const int LABEL_WIDTH = 96; - private const int TOGGLE_WIDTH = 28; - - public override bool EditDerived - { - get { return false; } - } - - public override bool Expandable - { - get { return true; } - } - - public override Type[] EditedTypes - { - get { return new Type[] { typeof(RigidbodyConstraints) }; } - } - - public override void Draw(InspectorField field, GUIStyle style) - { - field.Expandable = true; - if (!field.Expanded) - return; - - EditorGUI.showMixedValue = field.Mixed; - - EditorGUI.BeginChangeCheck(); - - RigidbodyConstraints value = (RigidbodyConstraints)GetValue(field); - int newValue = 0; - - EditorGUILayout.BeginHorizontal(); - GUILayout.Label("Freeze Position ", GUILayout.Width(LABEL_WIDTH)); - if (GUILayout.Toggle(value.Has(RigidbodyConstraints.FreezePositionX), "X", GUILayout.Width(TOGGLE_WIDTH))) - newValue += (int)RigidbodyConstraints.FreezePositionX; - - if (GUILayout.Toggle(value.Has(RigidbodyConstraints.FreezePositionY), "Y", GUILayout.Width(TOGGLE_WIDTH))) - newValue += (int)RigidbodyConstraints.FreezePositionY; - - if (GUILayout.Toggle(value.Has(RigidbodyConstraints.FreezePositionZ), "Z", GUILayout.Width(TOGGLE_WIDTH))) - newValue += (int)RigidbodyConstraints.FreezePositionZ; - EditorGUILayout.EndHorizontal(); - - EditorGUILayout.BeginHorizontal(); - GUILayout.Label("Freeze Rotation ", GUILayout.Width(LABEL_WIDTH)); - if (GUILayout.Toggle(value.Has(RigidbodyConstraints.FreezeRotationX), "X", GUILayout.Width(TOGGLE_WIDTH))) - newValue += (int)RigidbodyConstraints.FreezeRotationX; - - if (GUILayout.Toggle(value.Has(RigidbodyConstraints.FreezeRotationY), "Y", GUILayout.Width(TOGGLE_WIDTH))) - newValue += (int)RigidbodyConstraints.FreezeRotationY; - - if (GUILayout.Toggle(value.Has(RigidbodyConstraints.FreezeRotationZ), "Z", GUILayout.Width(TOGGLE_WIDTH))) - newValue += (int)RigidbodyConstraints.FreezeRotationZ; - EditorGUILayout.EndHorizontal(); - - if (EditorGUI.EndChangeCheck()) - field.SetValue(Enum.ToObject(typeof(RigidbodyConstraints), newValue)); - } - } -}
\ No newline at end of file diff --git a/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/RigidbodyConstraintsEditor.cs.meta b/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/RigidbodyConstraintsEditor.cs.meta deleted file mode 100644 index 1121e382..00000000 --- a/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/RigidbodyConstraintsEditor.cs.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 1aa0c3b940b87d14cbb9705339f378b3 -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: diff --git a/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/StringEditor.cs b/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/StringEditor.cs deleted file mode 100644 index 573450d9..00000000 --- a/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/StringEditor.cs +++ /dev/null @@ -1,89 +0,0 @@ -using UnityEngine; -using UnityEditor; -using System; -using System.Collections; - -namespace AdvancedInspector -{ - public class StringEditor : FieldEditor - { - public override Type[] EditedTypes - { - get { return new Type[] { typeof(string) }; } - } - - public override void Draw(InspectorField field, GUIStyle style) - { - GUILayout.BeginHorizontal(); - - float width = EditorGUIUtility.labelWidth; - EditorGUIUtility.labelWidth = 0; - - TextFieldAttribute text = field.GetAttribute<TextFieldAttribute>(); - MultilineAttribute multiline = field.GetAttribute<MultilineAttribute>(); - TextAreaAttribute area = field.GetAttribute<TextAreaAttribute>(); - - object value = GetValue(field); - - EditorGUI.BeginChangeCheck(); - GUIUtility.GetControlID(field.Path.GetHashCode(), FocusType.Passive); - - string result = ""; - if ((text == null && multiline == null && area == null) || (text != null && text.Type == TextFieldType.Standard)) - { - if (style != null) - result = EditorGUILayout.TextField((string)value, style); - else - result = EditorGUILayout.TextField((string)value); - } - else if (multiline != null || area != null || text.Type == TextFieldType.Area) - { - if (style != null) - result = EditorGUILayout.TextArea((string)value, style); - else - result = EditorGUILayout.TextArea((string)value); - } - else if (text.Type == TextFieldType.Password) - { - if (style != null) - result = EditorGUILayout.PasswordField((string)value, style); - else - result = EditorGUILayout.PasswordField((string)value); - } - else if (text.Type == TextFieldType.Tag) - { - if (style != null) - result = EditorGUILayout.TagField((string)value, style); - else - result = EditorGUILayout.TagField((string)value); - } - else if (text.Type == TextFieldType.File) - { - if (GUILayout.Button("...", GUILayout.Height(BUTTON_HEIGHT), GUILayout.Width(BUTTON_HEIGHT * 2))) - result = EditorUtility.OpenFilePanel(text.Title, text.Path, text.Extension); - - if (field.Mixed) - GUILayout.Label("---"); - else - GUILayout.Label((string)value); - } - else if (text.Type == TextFieldType.Folder) - { - if (GUILayout.Button("...", GUILayout.Height(BUTTON_HEIGHT), GUILayout.Width(BUTTON_HEIGHT * 2))) - result = EditorUtility.OpenFolderPanel(text.Title, "", ""); - - if (field.Mixed) - GUILayout.Label("---"); - else - GUILayout.Label((string)value); - } - - if (EditorGUI.EndChangeCheck()) - field.SetValue(result); - - EditorGUIUtility.labelWidth = width; - - GUILayout.EndHorizontal(); - } - } -}
\ No newline at end of file diff --git a/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/StringEditor.cs.meta b/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/StringEditor.cs.meta deleted file mode 100644 index 4154c0d7..00000000 --- a/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/StringEditor.cs.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 90da81dc74f23b44c85a60181928af9b -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: diff --git a/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/TimeSpanEditor.cs b/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/TimeSpanEditor.cs deleted file mode 100644 index fa720ce7..00000000 --- a/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/TimeSpanEditor.cs +++ /dev/null @@ -1,98 +0,0 @@ -using UnityEngine; -using UnityEditor; -using System; -using System.Collections; - -namespace AdvancedInspector -{ - public class TimeSpanEditor : FieldEditor - { - private InspectorField field; - - public override Type[] EditedTypes - { - get { return new Type[] { typeof(TimeSpan) }; } - } - - public override void Draw(InspectorField field, GUIStyle style) - { - int[] days = new int[field.Instances.Length]; - int[] hours = new int[field.Instances.Length]; - int[] mins = new int[field.Instances.Length]; - int[] secs = new int[field.Instances.Length]; - for (int i = 0; i < field.Instances.Length; i++) - { - TimeSpan span = field.GetValue<TimeSpan>(field.Instances[i]); - days[i] = span.Days; - hours[i] = span.Hours; - mins[i] = span.Minutes; - secs[i] = span.Seconds; - } - - float labelWidth = EditorGUIUtility.labelWidth; - EditorGUIUtility.labelWidth = 42; - GUILayout.BeginHorizontal(); - - int result; - if (IntegerEditor.DrawInt("Days", days, style, out result)) - { - result = Mathf.Clamp(result, 0, int.MaxValue); - Undo.RecordObjects(field.SerializedInstances, "Edit " + field.Name + " Days"); - - for (int i = 0; i < field.Instances.Length; i++) - { - TimeSpan span = field.GetValue<TimeSpan>(field.Instances[i]); - span = new TimeSpan(result, span.Hours, span.Minutes, span.Seconds); - field.SetValue(field.Instances[i], span); - } - } - - if (IntegerEditor.DrawInt("Hours", hours, style, out result)) - { - result = Mathf.Clamp(result, 0, int.MaxValue); - Undo.RecordObjects(field.SerializedInstances, "Edit " + field.Name + " Hours"); - - for (int i = 0; i < field.Instances.Length; i++) - { - TimeSpan span = field.GetValue<TimeSpan>(field.Instances[i]); - span = new TimeSpan(span.Days, result, span.Minutes, span.Seconds); - field.SetValue(field.Instances[i], span); - } - } - - GUILayout.EndHorizontal(); - GUILayout.BeginHorizontal(); - - if (IntegerEditor.DrawInt("Mins", mins, style, out result)) - { - result = Mathf.Clamp(result, 0, int.MaxValue); - Undo.RecordObjects(field.SerializedInstances, "Edit " + field.Name + " Minutes"); - - for (int i = 0; i < field.Instances.Length; i++) - { - TimeSpan span = field.GetValue<TimeSpan>(field.Instances[i]); - span = new TimeSpan(span.Days, span.Hours, result, span.Seconds); - field.SetValue(field.Instances[i], span); - } - } - - if (IntegerEditor.DrawInt("Secs", secs, style, out result)) - { - result = Mathf.Clamp(result, 0, int.MaxValue); - Undo.RecordObjects(field.SerializedInstances, "Edit " + field.Name + " Seconds"); - - for (int i = 0; i < field.Instances.Length; i++) - { - TimeSpan span = field.GetValue<TimeSpan>(field.Instances[i]); - span = new TimeSpan(span.Days, span.Hours, span.Minutes, result); - field.SetValue(field.Instances[i], span); - } - } - - GUILayout.EndHorizontal(); - EditorGUILayout.Space(); - - EditorGUIUtility.labelWidth = labelWidth; - } - } -}
\ No newline at end of file diff --git a/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/TimeSpanEditor.cs.meta b/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/TimeSpanEditor.cs.meta deleted file mode 100644 index e0d700c4..00000000 --- a/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/TimeSpanEditor.cs.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: a8e1b583a89c0f2468b87c50783399f9 -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: diff --git a/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/VectorEditor.cs b/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/VectorEditor.cs deleted file mode 100644 index 00b9bb3e..00000000 --- a/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/VectorEditor.cs +++ /dev/null @@ -1,208 +0,0 @@ -using UnityEngine; -using UnityEditor; -using System; -using System.Collections; - -namespace AdvancedInspector -{ - public class VectorEditor : FieldEditor - { - public override bool Expandable - { - get { return false; } - } - - public override Type[] EditedTypes - { - get { return new Type[] { typeof(Vector2), typeof(Vector3), typeof(Vector4) }; } - } - - public override void Draw(InspectorField field, GUIStyle style) - { - Type type = field.BaseType; - - float width = EditorGUIUtility.labelWidth; - EditorGUIUtility.labelWidth = VECTOR_FIELD_WIDTH; - - GUILayout.BeginHorizontal(); - if (type == typeof(Vector2)) - { - Vector2[] values = field.GetValues<Vector2>(); - - float[] x = new float[values.Length]; - float[] y = new float[values.Length]; - - for (int i = 0; i < values.Length; i++) - { - x[i] = values[i].x; - y[i] = values[i].y; - } - - float result; - if (FloatEditor.DrawFloat("X", x, style, out result)) - { - Undo.RecordObjects(field.SerializedInstances, "Edit " + field.Name + " X"); - - for (int i = 0; i < field.Instances.Length; i++) - { - values[i].x = result; - field.SetValue(field.Instances[i], values[i]); - } - } - - if (FloatEditor.DrawFloat("Y", y, style, out result)) - { - Undo.RecordObjects(field.SerializedInstances, "Edit " + field.Name + " Y"); - - for (int i = 0; i < field.Instances.Length; i++) - { - values[i].y = result; - field.SetValue(field.Instances[i], values[i]); - } - } - } - else if (type == typeof(Vector3)) - { - Vector3[] values = field.GetValues<Vector3>(); - - float[] x = new float[values.Length]; - float[] y = new float[values.Length]; - float[] z = new float[values.Length]; - - for (int i = 0; i < values.Length; i++) - { - x[i] = values[i].x; - y[i] = values[i].y; - z[i] = values[i].z; - } - - float result; - if (FloatEditor.DrawFloat("X", x, style, out result)) - { - Undo.RecordObjects(field.SerializedInstances, "Edit " + field.Name + " X"); - - for (int i = 0; i < field.Instances.Length; i++) - { - values[i].x = result; - field.SetValue(field.Instances[i], values[i]); - } - } - - if (FloatEditor.DrawFloat("Y", y, style, out result)) - { - Undo.RecordObjects(field.SerializedInstances, "Edit " + field.Name + " Y"); - - for (int i = 0; i < field.Instances.Length; i++) - { - values[i].y = result; - field.SetValue(field.Instances[i], values[i]); - } - } - - if (FloatEditor.DrawFloat("Z", z, style, out result)) - { - Undo.RecordObjects(field.SerializedInstances, "Edit " + field.Name + " Z"); - - for (int i = 0; i < field.Instances.Length; i++) - { - values[i].z = result; - field.SetValue(field.Instances[i], values[i]); - } - } - } - else if (type == typeof(Vector4)) - { - Vector4[] values = field.GetValues<Vector4>(); - - float[] x = new float[values.Length]; - float[] y = new float[values.Length]; - float[] z = new float[values.Length]; - float[] w = new float[values.Length]; - - for (int i = 0; i < values.Length; i++) - { - x[i] = values[i].x; - y[i] = values[i].y; - z[i] = values[i].z; - w[i] = values[i].w; - } - - float result; - if (FloatEditor.DrawFloat("X", x, style, out result)) - { - Undo.RecordObjects(field.SerializedInstances, "Edit " + field.Name + " X"); - - for (int i = 0; i < field.Instances.Length; i++) - { - values[i].x = result; - field.SetValue(field.Instances[i], values[i]); - } - } - - if (FloatEditor.DrawFloat("Y", y, style, out result)) - { - Undo.RecordObjects(field.SerializedInstances, "Edit " + field.Name + " Y"); - - for (int i = 0; i < field.Instances.Length; i++) - { - values[i].y = result; - field.SetValue(field.Instances[i], values[i]); - } - } - - if (FloatEditor.DrawFloat("Z", z, style, out result)) - { - Undo.RecordObjects(field.SerializedInstances, "Edit " + field.Name + " Z"); - - for (int i = 0; i < field.Instances.Length; i++) - { - values[i].z = result; - field.SetValue(field.Instances[i], values[i]); - } - } - - if (FloatEditor.DrawFloat("W", w, style, out result)) - { - Undo.RecordObjects(field.SerializedInstances, "Edit " + field.Name + " W"); - - for (int i = 0; i < field.Instances.Length; i++) - { - values[i].w = result; - field.SetValue(field.Instances[i], values[i]); - } - } - } - GUILayout.EndHorizontal(); - - EditorGUIUtility.labelWidth = width; - } - - public override void OnContextualClick(InspectorField field, GenericMenu menu) - { - menu.AddItem(new GUIContent("Zero"), false, Zero); - menu.AddItem(new GUIContent("One"), false, One); - - menu.AddSeparator(""); - } - - private void Zero() - { - if (AdvancedInspectorControl.Field.Type == typeof(Vector2)) - AdvancedInspectorControl.Field.SetValue(Vector2.zero); - else if (AdvancedInspectorControl.Field.Type == typeof(Vector3)) - AdvancedInspectorControl.Field.SetValue(Vector3.zero); - else if (AdvancedInspectorControl.Field.Type == typeof(Vector4)) - AdvancedInspectorControl.Field.SetValue(Vector4.zero); - } - - private void One() - { - if (AdvancedInspectorControl.Field.Type == typeof(Vector2)) - AdvancedInspectorControl.Field.SetValue(Vector2.one); - else if (AdvancedInspectorControl.Field.Type == typeof(Vector3)) - AdvancedInspectorControl.Field.SetValue(Vector3.one); - else if (AdvancedInspectorControl.Field.Type == typeof(Vector4)) - AdvancedInspectorControl.Field.SetValue(Vector4.one); - } - } -}
\ No newline at end of file diff --git a/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/VectorEditor.cs.meta b/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/VectorEditor.cs.meta deleted file mode 100644 index 79d8e5d8..00000000 --- a/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/VectorEditor.cs.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 851a4084094a34f439dc7c658c5343bb -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: |