mirror of
https://github.com/Siccity/xNode.git
synced 2025-12-21 01:36:03 +08:00
Support inherited attributes (#116)
This commit is contained in:
parent
5acb7e4ba8
commit
43038cfcc1
@ -25,7 +25,7 @@ namespace XNodeEditor {
|
|||||||
|
|
||||||
public static bool GetAttrib<T>(object[] attribs, out T attribOut) where T : Attribute {
|
public static bool GetAttrib<T>(object[] attribs, out T attribOut) where T : Attribute {
|
||||||
for (int i = 0; i < attribs.Length; i++) {
|
for (int i = 0; i < attribs.Length; i++) {
|
||||||
if (attribs[i].GetType() == typeof(T)) {
|
if (attribs[i] is T){
|
||||||
attribOut = attribs[i] as T;
|
attribOut = attribs[i] as T;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -43,7 +43,7 @@ namespace XNodeEditor {
|
|||||||
attribOut = null;
|
attribOut = null;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
object[] attribs = field.GetCustomAttributes(typeof(T), false);
|
object[] attribs = field.GetCustomAttributes(typeof(T), true);
|
||||||
return GetAttrib(attribs, out attribOut);
|
return GetAttrib(attribs, out attribOut);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user