how can i pass a python object from one node to another:
Example:
python_C want's to get a python object from each node python_A and python_B. whats the best way?
Python Node accessing Python Object
2256 3 0- mandrake0
- Member
- 644 posts
- Joined: 6月 2006
- Offline
- bonsak
- Member
- 459 posts
- Joined: 10月 2011
- Offline
- blair_p
- Member
- 28 posts
- Joined: 1月 2010
- Offline
You don't have access to each node's code, so the code itself would have to store python objects in the node's user data.
You can specify strings in userData, or objects in cachedUserData. So you could have the following in nodeA
class Foo(object):
pass
node.setCachedUserData('foo', Foo())
node.setUserData('bar', ‘baz’)
and then access it in nodeC with the following:
nodeA = node.inputs()
foo = nodeA.cachedUserData('foo')
bar = nodeA.userData('bar')
Keep in mind that userData is volatile, it gets deleted once the scene is closed. cachedUserData is stored in the file itself, and thus never deleted.
You can specify strings in userData, or objects in cachedUserData. So you could have the following in nodeA
class Foo(object):
pass
node.setCachedUserData('foo', Foo())
node.setUserData('bar', ‘baz’)
and then access it in nodeC with the following:
nodeA = node.inputs()
foo = nodeA.cachedUserData('foo')
bar = nodeA.userData('bar')
Keep in mind that userData is volatile, it gets deleted once the scene is closed. cachedUserData is stored in the file itself, and thus never deleted.
Blair Pierpont @ weta digital
- mandrake0
- Member
- 644 posts
- Joined: 6月 2006
- Offline
sounds good blair_p :-)
thanks for the information.
bonsak
well my target was to play a bit with OCC:http://www.pythonocc.org/ [pythonocc.org]
to use multiple nodes is much simpler then just using one node. :-)
thanks for the wonderful support :-)
thanks for the information.
bonsak
well my target was to play a bit with OCC:http://www.pythonocc.org/ [pythonocc.org]
to use multiple nodes is much simpler then just using one node. :-)
thanks for the wonderful support :-)
-
- Quick Links