1
0
mirror of https://github.com/Siccity/xNode.git synced 2025-12-21 01:36:03 +08:00
xNode/Scripts/Editor/Drawers/Odin/InNodeEditorAttributeProcessor.cs
Thor Brigsted 43bcb54fda Odin inspector support (#182)
* Added Odin Inspector support
* Added support for ports
2019-09-02 00:41:57 +02:00

48 lines
1.1 KiB
C#

#if UNITY_EDITOR && ODIN_INSPECTOR
using System;
using System.Collections.Generic;
using System.Reflection;
using Sirenix.OdinInspector.Editor;
using UnityEngine;
using XNode;
namespace XNodeEditor {
internal class OdinNodeInGraphAttributeProcessor<T> : OdinAttributeProcessor<T> where T : Node {
public override bool CanProcessSelfAttributes(InspectorProperty property) {
return false;
}
public override bool CanProcessChildMemberAttributes(InspectorProperty parentProperty, MemberInfo member) {
if (!NodeEditor.inNodeEditor)
return false;
if (member.MemberType == MemberTypes.Field) {
switch (member.Name) {
case "graph":
case "position":
case "ports":
return true;
default:
break;
}
}
return false;
}
public override void ProcessChildMemberAttributes(InspectorProperty parentProperty, MemberInfo member, List<Attribute> attributes) {
switch (member.Name) {
case "graph":
case "position":
case "ports":
attributes.Add(new HideInInspector());
break;
default:
break;
}
}
}
}
#endif