a is an NcNode, without any attrs.
b is an NcAttrs, with the attribute tx.
b.ty is concatenated onto b.tx and gives b.tx.ty rather than replacing it with b.ty.
This looks like a design flaw but is actually crucial for supporting nested attributes, such as plusMinusAverage.input[0].inputX. If the inputX wouldn't be added to the rest, it would have no meaning: plusMinusAverage.inputX.
The problem is that I (think I) can't distinguish between these cases. In both an NcAttrs instance gets 2 getattr instructions. In one we want the concatenation and in the other we don't.
a = noca.locator("test")
b = a.tx
b.ty = 2
# Error: RuntimeError: file E:/Dropbox/__SoftwareSpecific__/Maya/scripts/node_calculator\node_calculator\om_util.py line 642: mplug test5.tx.ty doesn't seem to exist! #
In most cases this works ok, because we get NcNode instances back when using Operators and such. There it starts "fresh" the first time.
Even though we initialize the locator with the attribute tx - it's an NcNode instance.
Then, when accessing ty we get an NcAttrs instance back, which ignores the NcNode attribute.
a = noca.locator("test", attrs="tx")
a.ty = 2
# Works fine
Current conclusion: I can't think of a better solution.
ais an NcNode, without any attrs.bis an NcAttrs, with the attributetx.b.tyis concatenated ontob.txand givesb.tx.tyrather than replacing it withb.ty.This looks like a design flaw but is actually crucial for supporting nested attributes, such as
plusMinusAverage.input[0].inputX. If theinputXwouldn't be added to the rest, it would have no meaning:plusMinusAverage.inputX.The problem is that I (think I) can't distinguish between these cases. In both an NcAttrs instance gets 2 getattr instructions. In one we want the concatenation and in the other we don't.
In most cases this works ok, because we get NcNode instances back when using Operators and such. There it starts "fresh" the first time.
Even though we initialize the locator with the attribute
tx- it's an NcNode instance.Then, when accessing
tywe get an NcAttrs instance back, which ignores the NcNode attribute.Current conclusion: I can't think of a better solution.