Skip to content

Commit 4df61db

Browse files
committed
Drop support of Tri-drawn properties in Odin editors
1 parent 5dc7178 commit 4df61db

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

Editor.Integrations/Odin/OdinFieldDrawer.cs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
using Sirenix.Utilities.Editor;
44
using UnityEngine;
55

6-
#if !TRIINSPECTOR_DISABLE_ODIN_FIELDS_INJECTOR
6+
#if TRIINSPECTOR_ODIN_FIELDS_INJECTOR
77

88
namespace TriInspector.Editor.Integrations.Odin
99
{
@@ -43,8 +43,13 @@ protected override bool CanDrawValueProperty(InspectorProperty property)
4343

4444
for (var parent = property.Parent; parent != null; parent = parent.Parent)
4545
{
46-
var parentType = parent.ValueEntry.TypeOfValue;
47-
if (TriOdinUtility.IsDrawnByTri(parentType))
46+
var valueEntry = parent.ValueEntry;
47+
if (valueEntry == null)
48+
{
49+
continue;
50+
}
51+
52+
if (TriOdinUtility.IsDrawnByTri(valueEntry.TypeOfValue))
4853
{
4954
return false;
5055
}

Editor.Integrations/Odin/OdinFieldValidator.cs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
using Sirenix.OdinInspector.Editor.Validation;
44
using TriInspector.Editor.Integrations.Odin;
55

6-
#if !TRIINSPECTOR_DISABLE_ODIN_FIELDS_INJECTOR
6+
#if TRIINSPECTOR_ODIN_FIELDS_INJECTOR
77

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

@@ -43,8 +43,13 @@ public override bool CanValidateProperty(InspectorProperty property)
4343

4444
for (var parent = property.Parent; parent != null; parent = parent.Parent)
4545
{
46-
var parentType = parent.Info.TypeOfValue;
47-
if (TriOdinUtility.IsDrawnByTri(parentType))
46+
var valueEntry = parent.ValueEntry;
47+
if (valueEntry == null)
48+
{
49+
continue;
50+
}
51+
52+
if (TriOdinUtility.IsDrawnByTri(valueEntry.TypeOfValue))
4853
{
4954
return false;
5055
}

0 commit comments

Comments
 (0)