Notifications
Clear all
[Closed] how to save object self,in Attributes?
Oct 19, 2009 3:43 am
if use
TestAtt = Attributes “TestAtt”
(
Parameters Main
(
thisNode Type:#Node
)
)
TheBox = Box()
CustAttributes.Add TheBox TestAtt
TheBox.Testatt.ThisNode = TheBox
then
– Runtime error: Assignment failed, possible dependency loop,
3 Replies
Oct 19, 2009 3:43 am
Not sure if there’s a way to set #node directly to itself but you could always use weak references:
TestAtt = Attributes "TestAtt"
(
Parameters Main
(
thisNode Type:#maxObject
)
)
TheBox = Box()
CustAttributes.Add TheBox TestAtt
TheBox.Testatt.thisNode = (nodeTransformMonitor node:theBox)
Access it by:
TheBox.testAtt.thisNode.node
Maybe someone else has a solution with #node
Oct 19, 2009 3:43 am
AFAIK #maxObject with weakreference is the only and the best way, without creating circular dependencies.
-Johan