You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
1.1 KiB
C#
38 lines
1.1 KiB
C#
|
3 years ago
|
using UnityEngine;
|
||
|
|
using UnityEngine.Formats.Alembic.Sdk;
|
||
|
|
using UnityEditor;
|
||
|
|
|
||
|
|
namespace UnityEditor.Formats.Alembic.Importer
|
||
|
|
{
|
||
|
|
[CustomPropertyDrawer(typeof(Bool))]
|
||
|
|
class BoolDrawer : PropertyDrawer
|
||
|
|
{
|
||
|
|
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
|
||
|
|
{
|
||
|
|
if (property == null)
|
||
|
|
{
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
|
||
|
|
EditorGUI.BeginProperty(position, label, property);
|
||
|
|
position = EditorGUI.PrefixLabel(position, GUIUtility.GetControlID(FocusType.Passive), label);
|
||
|
|
|
||
|
|
var indent = EditorGUI.indentLevel;
|
||
|
|
EditorGUI.indentLevel = 0;
|
||
|
|
|
||
|
|
var p = property.FindPropertyRelative("v");
|
||
|
|
bool value = p.intValue != 0;
|
||
|
|
|
||
|
|
EditorGUI.BeginChangeCheck();
|
||
|
|
value = EditorGUI.Toggle(position, value);
|
||
|
|
if (EditorGUI.EndChangeCheck())
|
||
|
|
{
|
||
|
|
p.intValue = value ? 1 : 0;
|
||
|
|
}
|
||
|
|
|
||
|
|
EditorGUI.indentLevel = indent;
|
||
|
|
EditorGUI.EndProperty();
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|