Avoids TriProperty updating when possible

This commit is contained in:
VladV 2022-05-29 18:10:35 +03:00
parent 2d13c6421e
commit 48afdfa625
2 changed files with 18 additions and 1 deletions

View File

@ -54,7 +54,9 @@ namespace TriInspector.Drawers
public override void OnGUI(Rect position)
{
var value = (Enum) _property.Value;
var value = _property.TryGetSerializedProperty(out var serializedProperty)
? (Enum) Enum.ToObject(_property.FieldType, serializedProperty.intValue)
: (Enum) _property.Value;
var controlId = GUIUtility.GetControlID(FocusType.Passive);
position = EditorGUI.PrefixLabel(position, controlId, _property.DisplayNameContent);

View File

@ -208,6 +208,11 @@ namespace TriInspector
{
get
{
if (PropertyType != TriPropertyType.Reference)
{
return _definition.FieldType;
}
UpdateIfRequired();
return _valueType;
}
@ -217,6 +222,11 @@ namespace TriInspector
{
get
{
if (PropertyTree.TargetsCount == 1)
{
return false;
}
UpdateIfRequired();
return _isValueMixed;
}
@ -239,6 +249,11 @@ namespace TriInspector
{
get
{
if (_childrenProperties != null && PropertyType == TriPropertyType.Generic)
{
return _childrenProperties;
}
UpdateIfRequired();
return PropertyType == TriPropertyType.Generic || PropertyType == TriPropertyType.Reference