Jump to content
Sign in to follow this  
Atom

Store a Collection in a Node?

Recommended Posts

Hi All,

 

Is there any way to store a collection in a node? I checked the parameter list and there does not seem to be a list or collection property available.

 

IS there any other way to attach a list to a node?

 

Thanks

Edited by Atom

Share this post


Link to post
Share on other sites

You can turn a parameter into a menu and store values that way.

 

Or, I don't know if you want to use python for this but if you can you can pickle a list, store it as user data on the node and then unpickle and retreive it later.

import json
node = hou.node('/path/to/node')

my_list = range(1,10)

# store the list on the node
node.setUserData('my_list', json.dumps(my_list))

# get the list back
list_copy = json.loads(node.userData('my_list'))

print list
  • Like 1

Share this post


Link to post
Share on other sites

In the past I've used pickle for this. Looks like json does a similar thing?

 

https://docs.python.org/2/library/pickle.html

 

It can be done at the node instance level like the example jonp posted and it can also be done at the OTL level so the data is persistent.

 

http://www.sidefx.com/docs/houdini13.0/hom/hou/HDADefinition#setExtraInfo

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×