Redshift Generate Sequential Numbering for OBJ ID

   3222   2   2
User Avatar
Member
6 posts
Joined: 1月 2017
Offline
I was watching a video from Greyscalegorilla in creating Redshift custom AOVs for control in the composite. About half way through the video, he made a sequential numbering for the object IDs based on the selected objects with an expression. I was wondering how to do this same task in Houdini to create a sequential numbering to change the object IDs for the objects in Houdini. This would be nice to know since I would not have to manually set each and every object for the object ID to have a matte in Redshift.

Link to video:
User Avatar
Member
39 posts
Joined: 12月 2013
Offline
A quick and dirty way would be to use Python to add sequential numbers to your nodes that you select.
Select what nodes you want to add the object id's to and open the python shell:
nodes = hou.selectedNodes()
for idx,item in enumerate(nodes):
    updateitem = item.parm("RS_objprop_ID").set(idx)

There is probably a better, more obvious way but this works ok.
Edited by Anthony Morrelle - 2020年1月2日 17:20:19
Anthony Morrelle
Hired Gun
User Avatar
Member
6 posts
Joined: 1月 2017
Offline
Anthony Morrelle
nodes = hou.selectedNodes()
for idx,item in enumerate(nodes):
updateitem = item.parm(“RS_objprop_ID”).set(idx)

Thanks Anthony! This code works pretty well. I agree that there is probably a better way is doing this. But for now, this will work.

Thanks a lot!
  • Quick Links