Skip to content

Commit a60208b

Browse files
committed
Show fields if serializeField and showInInspector attribute
1 parent e521898 commit a60208b

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

Assets/com.alelievr.NodeGraphProcessor/Editor/Views/BaseNodeView.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -685,7 +685,8 @@ protected virtual void DrawDefaultInspector(bool fromInspector = false)
685685
}
686686

687687
//skip if the field is not serializable
688-
if((!field.IsPublic && field.GetCustomAttribute(typeof(SerializeField)) == null) || field.IsNotSerialized)
688+
bool serializeField = field.GetCustomAttribute(typeof(SerializeField)) != null;
689+
if((!field.IsPublic && !serializeField) || field.IsNotSerialized)
689690
{
690691
AddEmptyField(field, fromInspector);
691692
continue;
@@ -695,7 +696,7 @@ protected virtual void DrawDefaultInspector(bool fromInspector = false)
695696
bool hasInputAttribute = field.GetCustomAttribute(typeof(InputAttribute)) != null;
696697
bool hasInputOrOutputAttribute = hasInputAttribute || field.GetCustomAttribute(typeof(OutputAttribute)) != null;
697698
bool showAsDrawer = !fromInspector && field.GetCustomAttribute(typeof(ShowAsDrawer)) != null;
698-
if (field.GetCustomAttribute(typeof(SerializeField)) == null && hasInputOrOutputAttribute && !showAsDrawer)
699+
if (!serializeField && hasInputOrOutputAttribute && !showAsDrawer)
699700
{
700701
AddEmptyField(field, fromInspector);
701702
continue;
@@ -710,7 +711,7 @@ protected virtual void DrawDefaultInspector(bool fromInspector = false)
710711

711712
// Hide the field if we want to display in in the inspector
712713
var showInInspector = field.GetCustomAttribute<ShowInInspector>();
713-
if (showInInspector != null && !showInInspector.showInNode && !fromInspector)
714+
if (!serializeField && showInInspector != null && !showInInspector.showInNode && !fromInspector)
714715
{
715716
AddEmptyField(field, fromInspector);
716717
continue;

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
1010
- Fixed fields with [Settings] attribute not showing up with inheritance.
1111
- Fixed selection still active when selecting nodes without inspector fields.
1212

13+
### Changed
14+
- Fields with both attributes [SerializeField] and [ShowInInspector] are now visible in both the node and inspector.
15+
1316
## [1.3.0]
1417

1518
### Added

0 commit comments

Comments
 (0)