Jump to content
substep

resolve takes into main

Recommended Posts

Hi there, I've used takes to help setup a simulation. Now that I have the sim the way I want, I would like to just get rid of all the extra takes, but resolve the take parameters for a particular take into the main scene take. Does that make any sense?

I know I can just copy over the parameters manually, but there's gotta be a quicker way, and without missing a parameter.

I don't see a way to do this in the take manager, unless im missing something ;)

Thanks!

Share this post


Link to post
Share on other sites

hmmm, this doesnt seem to work for merging things into the "Main" take.

edit: nm, it seems the destination take must be the active take when merging.

Edited by substep

Share this post


Link to post
Share on other sites

Hi, I must be missing something very simple in the syntax:

Trying to merge take1 to main.

/ -> takemerge main take1
Unable to find destination take main

After that, I figured it must be the capitalization of Main..

/ -> takemerge Main take1
Couldn't merge source take take1

But still not working..

I tried looking for examples from other take commands that requires a <take> as an argument.. closest I got was for takename.

/ -> takename take1 take1b

That one works.

As a semi-workaround. I created a new take under Main, and renamed it "master".

/ -> takemerge master take1

Now the takemerge works.. but only for sibling takes.

Is it possible to merge a take to Main using takemerge?

On 8/6/2013 at 2:21 AM, substep said:

hmmm, this doesnt seem to work for merging things into the "Main" take.

edit: nm, it seems the destination take must be the active take when merging.

Were you able to merge it to the Main? If so, what syntax did you use? :)

Share this post


Link to post
Share on other sites

I got a python code working (so far). This collects the parameters set by the takes, then transfers those to the Main take.

Simply set to a take you want to resolve to main, then run the code.

mTake = hou.takes.rootTake()
cTake = hou.takes.currentTake()
if mTake.name == cTake.name:
    hou.ui.displayMessage('Please set to a Take other than the \'Main\' take.')
else:
    tParms = cTake.parmTuples()
    nodes, parms, value = [], [], []
    for p in tParms:
        nodes.append(p.node())
        parms.append(p.name())
        value.append(p.eval())
    hou.takes.setCurrentTake(mTake)
    for i in range(len(nodes)):
        nodes[i].parm(parms[i]).set(value[i][0])

Current limitation is that this will not include parent takes. I'll try and add recursion on my next free time.

Share this post


Link to post
Share on other sites

Hi Galagast, thanks for your take merge snippet. Unfortunately I had some issues with it, but I could fix it:

main_take = hou.takes.rootTake()
current_take = hou.takes.currentTake()
if main_take.name == current_take.name:
    hou.ui.displayMessage('Please set to a Take other than the \'Main\' take.')
else:
    parameter_tuples = current_take.parmTuples()
    parameter_value_dict = {}
    for parameter_tuple in parameter_tuples:
        for parameter_tuple in parameter_tuples:
            for parameter in  parameter_tuple:
                parameter_value_dict[parameter.path()] = parameter.eval()
    hou.takes.setCurrentTake(main_take)
    for key, value in parameter_value_dict.items():
        print 'setting current parameter %s == %s' % ( key, value)
        hou.parm( key ).set( value )
    print 'merged %s Take into Main' % current_take.name()


I was also to lazy to make it recursive, so it doesn't takes care of parent takes.

 

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

×