PDG - Python list to work items

   1420   4   1
User Avatar
Member
146 posts
Joined: June 2016
Offline
PDG beginner here, I have a list of files in my python script, i want to create workitem or output them as attribute to process them further, please help.

Thanks!
Mohan Pugaz
movfx
https://www.instagram.com/movfx/ [www.instagram.com]
https://www.youtube.com/channel/@_movfx
User Avatar
Member
1803 posts
Joined: May 2006
Offline
This should work in a python processor top:

import hou

paths = [
'$HFS/houdini/pic/butterfly1.pic',
'$HFS/houdini/pic/butterfly2.pic',
'$HFS/houdini/pic/butterfly3.pic',
'$HFS/houdini/pic/butterfly4.pic'
]

for p in paths:
    new_item = item_holder.addWorkItem()
    new_item.setStringAttrib('texpath', hou.text.expandString(p))
http://www.tokeru.com/cgwiki [www.tokeru.com]
https://www.patreon.com/mattestela [www.patreon.com]
User Avatar
Member
146 posts
Joined: June 2016
Offline
Wow, Thanks a lot Matt. I was so close,and not aware of this function hou.text.expandString()
. I will try and get back.
Mohan Pugaz
movfx
https://www.instagram.com/movfx/ [www.instagram.com]
https://www.youtube.com/channel/@_movfx
User Avatar
Member
1803 posts
Joined: May 2006
Offline
Well, I only needed it to expand $HFS to a path, if you're using regular paths its not required.
http://www.tokeru.com/cgwiki [www.tokeru.com]
https://www.patreon.com/mattestela [www.patreon.com]
User Avatar
Member
146 posts
Joined: June 2016
Offline
mestela
import hou

paths = [
'$HFS/houdini/pic/butterfly1.pic',
'$HFS/houdini/pic/butterfly2.pic',
'$HFS/houdini/pic/butterfly3.pic',
'$HFS/houdini/pic/butterfly4.pic'
]

for p in paths:
new_item = item_holder.addWorkItem()
new_item.setStringAttrib('texpath', hou.text.expandString(p))

This works perfect, the mistake I did was using the partitioner instead of the processor. silly me.

Thanks a lot for your valuable time!
Mohan Pugaz
movfx
https://www.instagram.com/movfx/ [www.instagram.com]
https://www.youtube.com/channel/@_movfx
  • Quick Links