Jump to content
Sign in to follow this  
Christoph_H

Automating rops with python

Recommended Posts

Posted (edited)

Hi,

Is it possible to render all existing rops and also rops in obj levels one after the other?
So without manual links?

It is a file with over 100 different rops.

Can i achieve in hscript that a rop in an obj level takes the name of the obj level?

thanks.

Edited by Christoph_H

Share this post


Link to post
Share on other sites

This page shows the principle:
http://www.tokeru.com/cgwiki/index.php?title=HoudiniPython#press_.27save_to_disk.27_on_a_rop

My problem is that I have no experience with python. I'm just starting to get along with vex.

It would be very nice to give me a hint.
How should the script look like, with which I manage to create my own “mantra rop” with “output path with object names” from the selected objects?
Could I set the scene floor to be added to each one?

thanks.

Share this post


Link to post
Share on other sites

here is a simple example to render all Mantra ROPs:

#find all nodes of type 'ifd' (Mantra) in the 'driver' context (ROP)
for i in hou.nodeTypeCategories()["Driver"].nodeTypes()["ifd"].instances():
    # display their full path
    print "render: " , i.path()
    # press the 'Render to Disk' Button
    i.parm("execute").pressButton()


render_all_mantra_rop_bunker.hipnc

Share this post


Link to post
Share on other sites

and this creates a mantra node per selected object and set the image output path based on the node name:

# before running the script, select "a,b,c" nodes
ropnet = hou.node('/obj/ropnet1')

# delete all nodes inside ropnet1
for i in ropnet.children():
    i.destroy()

# create a mantra node for each selected node
for i in hou.selectedNodes():
    n = i.name()
    m = ropnet.createNode("ifd")
    m.setName("mantra_"+n)
    m.parm("vm_picture").set("/tmp/myfilepath/"+n+".$"+"F4.exr")


render_all_mantra_rop_bunker2.hipnc
 

  • Like 1

Share this post


Link to post
Share on other sites
Posted (edited)

many thanks. very helpful.

How is it possbile to exclude the null object from script?

Edited by Christoph_H

Share this post


Link to post
Share on other sites
Posted (edited)

you can put that script on a shelf button if you prefer, same thing.
if you mean exclude the null from all the selected nodes, you can filter by node types:

# filter out all null nodes
for i in hou.selectedNodes():
  if i.type().name()!='null':
    m = ropnet.createNode("ifd")
    m.setName("mantra_"+n)
    m.parm("vm_picture").set("/tmp/myfilepath/"+n+".$"+"F4.exr")
    

Edited by bunker

Share this post


Link to post
Share on other sites

hi,
yes this is what i meant.
I added your new line but this will not work. What am I doing wrong?

thanks.

Share this post


Link to post
Share on other sites

hard to tell without a hip file.

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  

×