Jump to content

How to use and export different takes of the same geometry


anicg

Recommended Posts

I have a node graph that generates a geometry.
tweaked a few parameters and created a few takes, each take is a version (different design) of the same geometry. I manually click to see each take on the take list.

Now I want to use this geometry:

A - inside Houdini, several times in the same scene but ask it to be take 1 here, and take 2 there, take 3 somewhere else...

B - Outside Houdini: Export all the takes (each as a separate obj) without doing it manually one by one?

Any idea how I can do A, and how I can do B?

Edited by anicg
Link to comment
Share on other sites

There's no straight forward way to do A. You can hack it with python, but it's likely not the most practical approach. Your best bet is to export the geometry and reload it after wards, which is what you want in B anyway.

Unfortunately there's also no support for something like that out-of-the-box. But you can script it, here's a way


 

node = hou.pwd()
geo = node.geometry()


## PARAMETERS ##
rop = node.parm("rop_node").evalAsNode() # Get the node you want to export your geometry from
rop_output_template = rop.parm("sopoutput").unexpandedString()
network_destination = hou.node("/out") # Where it will create the ROPs to export
rop_type = "geometry" # The type of node used to export. Usually 'geometry'


## FUNCTION ##
for take in hou.takes.takes():
    new_rop_name = "{}_exporter".format(take.name())
    if not network_destination.node(new_rop_name):
        new_rop = network_destination.createNode(rop_type, new_rop_name) # Create rop nodes
        new_rop_output_path = rop_output_template.replace("\$ACTIVETAKE", take.name())
        new_rop_output_path = new_rop_output_path.replace("\$OS", rop.name())
        new_rop.setParms({"soppath": rop.path(),
                         "sopoutput": new_rop_output_path,
                         "take": take.name()})
                         
                         
    # Now that we have exporters, we'll have to read them back
    new_read_name = new_rop_name.replace("exporter", "reader")
    if not node.parent().node(new_read_name):
        new_read = node.parent().createNode("filecache", new_rop_name.replace("exporter", "reader"))
        read_file_name = rop_output_template.replace("\$OS", new_read.name())
        new_read.setParms({"take": take.name(),
                           "file": new_rop_output_path,
                           "loadfromdisk": 1})  

In the example file I'm using it on a python sop, but you can put it on a shelf tool.

 

 

take_export_of.hip

Link to comment
Share on other sites

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...