PDA

View Full Version : how to save object self,in Attributes?


CGGD
10-19-2009, 02: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,

labbejason
10-19-2009, 03:40 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 :)

CGGD
10-19-2009, 04:37 AM
:thumbsup:
very thanks

JHN
10-19-2009, 07:27 AM
AFAIK #maxObject with weakreference is the only and the best way, without creating circular dependencies.

-Johan

CGTalk Moderation
10-19-2009, 07:27 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.