Add RunValidationIfRequired api

This commit is contained in:
VladV 2023-03-22 11:49:53 +04:00
parent db3d60270a
commit 513a250c64
5 changed files with 14 additions and 20 deletions

View File

@ -66,11 +66,7 @@ namespace TriInspector.Editor.Integrations.Odin
}
_propertyTree.Update();
if (_propertyTree.ValidationRequired)
{
_propertyTree.RunValidation();
}
_propertyTree.RunValidationIfRequired();
_labelOverrideContext.Label = label ?? GUIContent.none;

View File

@ -65,11 +65,7 @@ namespace TriInspector.Editor.Integrations.Odin
}
_propertyTree.Update();
if (_propertyTree.ValidationRequired)
{
_propertyTree.RunValidation();
}
_propertyTree.RunValidationIfRequired();
using (TriGuiHelper.PushEditorTarget(ValueEntry.SmartValue))
{

View File

@ -94,11 +94,7 @@ namespace TriInspector.Editor.Samples
_currentSerializedObject.UpdateIfRequiredOrScript();
_currentPropertyTree.Update();
if (_currentPropertyTree.ValidationRequired)
{
_currentPropertyTree.RunValidation();
}
_currentPropertyTree.RunValidationIfRequired();
GUILayout.Space(10);
GUILayout.Label("Preview", EditorStyles.boldLabel);

View File

@ -53,11 +53,7 @@ namespace TriInspector
serializedObject.UpdateIfRequiredOrScript();
_inspector.Update();
if (_inspector.ValidationRequired)
{
_inspector.RunValidation();
}
_inspector.RunValidationIfRequired();
using (TriGuiHelper.PushEditorTarget(target))
{

View File

@ -40,6 +40,16 @@ namespace TriInspector
return false;
}
public void RunValidationIfRequired()
{
if (!ValidationRequired)
{
return;
}
RunValidation();
}
public void RunValidation()
{
ValidationRequired = false;