mirror of
https://github.com/Siccity/xNode.git
synced 2026-02-18 04:51:49 +08:00
use string.substring instead of string.split that creates a array
This commit is contained in:
parent
6684d8336c
commit
5d3fa35067
@ -125,10 +125,11 @@ namespace XNode {
|
|||||||
// Ports flagged as "dynamicPortList = true" end up having a "backing port" and a name with an index, but we have
|
// Ports flagged as "dynamicPortList = true" end up having a "backing port" and a name with an index, but we have
|
||||||
// no guarantee that a dynamic port called "output 0" is an element in a list backed by a static "output" port.
|
// no guarantee that a dynamic port called "output 0" is an element in a list backed by a static "output" port.
|
||||||
// Thus, we need to check for attributes... (but at least we don't need to look at all fields this time)
|
// Thus, we need to check for attributes... (but at least we don't need to look at all fields this time)
|
||||||
string[] fieldNameParts = port.fieldName.Split(' ');
|
int fieldNameSpaceIndex = port.fieldName.IndexOf(' ');
|
||||||
if (fieldNameParts.Length != 2) return false;
|
if (fieldNameSpaceIndex < 0) return false;
|
||||||
|
string fieldNamePart = port.fieldName.Substring(0, fieldNameSpaceIndex);
|
||||||
|
|
||||||
FieldInfo backingPortInfo = port.node.GetType().GetField(fieldNameParts[0]);
|
FieldInfo backingPortInfo = port.node.GetType().GetField(fieldNamePart);
|
||||||
if (backingPortInfo == null) return false;
|
if (backingPortInfo == null) return false;
|
||||||
|
|
||||||
object[] attribs = backingPortInfo.GetCustomAttributes(true);
|
object[] attribs = backingPortInfo.GetCustomAttributes(true);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user