Skip to content

Commit

Permalink
Drop support of Tri-drawn properties in Odin editors
Browse files Browse the repository at this point in the history
  • Loading branch information
vanifatovvlad committed Jun 16, 2023
1 parent 5dc7178 commit 4df61db
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
11 changes: 8 additions & 3 deletions Editor.Integrations/Odin/OdinFieldDrawer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using Sirenix.Utilities.Editor;
using UnityEngine;

#if !TRIINSPECTOR_DISABLE_ODIN_FIELDS_INJECTOR
#if TRIINSPECTOR_ODIN_FIELDS_INJECTOR

namespace TriInspector.Editor.Integrations.Odin
{
Expand Down Expand Up @@ -43,8 +43,13 @@ protected override bool CanDrawValueProperty(InspectorProperty property)

for (var parent = property.Parent; parent != null; parent = parent.Parent)
{
var parentType = parent.ValueEntry.TypeOfValue;
if (TriOdinUtility.IsDrawnByTri(parentType))
var valueEntry = parent.ValueEntry;
if (valueEntry == null)
{
continue;
}

if (TriOdinUtility.IsDrawnByTri(valueEntry.TypeOfValue))
{
return false;
}
Expand Down
11 changes: 8 additions & 3 deletions Editor.Integrations/Odin/OdinFieldValidator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using Sirenix.OdinInspector.Editor.Validation;
using TriInspector.Editor.Integrations.Odin;

#if !TRIINSPECTOR_DISABLE_ODIN_FIELDS_INJECTOR
#if TRIINSPECTOR_ODIN_FIELDS_INJECTOR

[assembly: RegisterValidator(typeof(OdinFieldValidator<>))]

Expand Down Expand Up @@ -43,8 +43,13 @@ public override bool CanValidateProperty(InspectorProperty property)

for (var parent = property.Parent; parent != null; parent = parent.Parent)
{
var parentType = parent.Info.TypeOfValue;
if (TriOdinUtility.IsDrawnByTri(parentType))
var valueEntry = parent.ValueEntry;
if (valueEntry == null)
{
continue;
}

if (TriOdinUtility.IsDrawnByTri(valueEntry.TypeOfValue))
{
return false;
}
Expand Down

0 comments on commit 4df61db

Please sign in to comment.