Jump to content

Automating rops with python


Recommended Posts

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
Link to comment
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.

Link to comment
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

Link to comment
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
Link to comment
Share on other sites

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
Link to comment
Share on other sites

  • 2 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...