mirror of
https://github.com/codewriter-packages/Tri-Inspector.git
synced 2025-01-22 08:18:49 -05:00
Add value modification tracking
This commit is contained in:
parent
ac5c8b6792
commit
bdc01494ee
@ -66,7 +66,14 @@ namespace TriInspector.Drawers
|
||||
|
||||
public override void OnGUI(Rect position)
|
||||
{
|
||||
EditorGUI.BeginChangeCheck();
|
||||
|
||||
EditorGUI.PropertyField(position, _serializedProperty, _property.DisplayNameContent);
|
||||
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
_property.NotifyValueChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -27,7 +27,14 @@ namespace TriInspector.Elements
|
||||
|
||||
public override void OnGUI(Rect position)
|
||||
{
|
||||
EditorGUI.BeginChangeCheck();
|
||||
|
||||
_propertyHandler.OnGUI(position, _serializedProperty, _property.DisplayNameContent, true);
|
||||
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
_property.NotifyValueChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -122,6 +122,7 @@ namespace TriInspector.Elements
|
||||
if (_property.TryGetSerializedProperty(out _))
|
||||
{
|
||||
ReorderableList.defaultBehaviours.DoAddButton(reorderableList);
|
||||
_property.NotifyValueChanged();
|
||||
return;
|
||||
}
|
||||
|
||||
@ -157,6 +158,7 @@ namespace TriInspector.Elements
|
||||
if (_property.TryGetSerializedProperty(out _))
|
||||
{
|
||||
ReorderableList.defaultBehaviours.DoRemoveButton(reorderableList);
|
||||
_property.NotifyValueChanged();
|
||||
return;
|
||||
}
|
||||
|
||||
@ -187,6 +189,7 @@ namespace TriInspector.Elements
|
||||
{
|
||||
if (_property.TryGetSerializedProperty(out _))
|
||||
{
|
||||
_property.NotifyValueChanged();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -67,8 +67,6 @@ namespace TriInspector
|
||||
{
|
||||
Profiler.EndSample();
|
||||
}
|
||||
|
||||
EditorGUI.BeginChangeCheck();
|
||||
|
||||
EditorStack.Push(this);
|
||||
Profiler.BeginSample("TriInspector.DoLayout()");
|
||||
@ -82,11 +80,6 @@ namespace TriInspector
|
||||
EditorStack.Pop();
|
||||
}
|
||||
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
_inspector.RequestValidation();
|
||||
}
|
||||
|
||||
if (serializedObject.ApplyModifiedProperties())
|
||||
{
|
||||
_inspector.RequestValidation();
|
||||
|
@ -267,7 +267,17 @@ namespace TriInspector
|
||||
PropertyTree.ForceUpdateSerializedObject();
|
||||
Update();
|
||||
|
||||
PropertyTree.RequestValidation();
|
||||
NotifyValueChanged();
|
||||
}
|
||||
|
||||
public void NotifyValueChanged()
|
||||
{
|
||||
((ITriPropertyParent) this).NotifyValueChanged(this);
|
||||
}
|
||||
|
||||
void ITriPropertyParent.NotifyValueChanged(TriProperty property)
|
||||
{
|
||||
_parent.NotifyValueChanged(property);
|
||||
}
|
||||
|
||||
internal void Update()
|
||||
@ -561,6 +571,8 @@ namespace TriInspector
|
||||
public interface ITriPropertyParent
|
||||
{
|
||||
object GetValue(int targetIndex);
|
||||
|
||||
void NotifyValueChanged(TriProperty property);
|
||||
}
|
||||
|
||||
public enum TriPropertyType
|
||||
|
@ -116,6 +116,11 @@ namespace TriInspector
|
||||
}
|
||||
}
|
||||
|
||||
public void NotifyValueChanged(TriProperty property)
|
||||
{
|
||||
RequestValidation();
|
||||
}
|
||||
|
||||
public void RequestRepaint()
|
||||
{
|
||||
RepaintRequired = true;
|
||||
|
Loading…
Reference in New Issue
Block a user