View Full Version : python question:

10 October 2011, 10:36 PM
ok i'm not even totaly sure how to word this question properly

but how do i make this work correctly?
for node in self.baseCurve.inScene.get().split('+'):
self.node = PyNode(node)

inScene is a string attr that has a bunch of node names sepereated but '+'
i want the for loop to assign the objects like this

'self.nodeName' bassed of the string thats in the var 'node'
but all the objects are currently geting assigned to 'self.node'

how do i fix this?
i would try googleing the question but like i said, i'm not even sure how to word it :(

10 October 2011, 11:19 PM
ok so i got somthing working like this.

nodes = self.baseCurve.inScene.get().split('+')
for node in nodes:
exec('self.%s = PyNode(\'%s\')' % (node, node))

still not sure if this is the best way of doing things but it works

CGTalk Moderation
10 October 2011, 11:19 PM
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.