substep Posted August 5, 2013 Share Posted August 5, 2013 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! Quote Link to comment Share on other sites More sharing options...
Fabiano Berlim Posted August 5, 2013 Share Posted August 5, 2013 (edited) You can use Hscript 'takemerge' function. takemerge [-f] destination_take source_take1 [source_take2 ...] http://www.sidefx.com/docs/houdini12.5/commands/takemerge Edited August 5, 2013 by Fabiano Berlim Quote Link to comment Share on other sites More sharing options...
substep Posted August 5, 2013 Author Share Posted August 5, 2013 (edited) 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 August 8, 2013 by substep Quote Link to comment Share on other sites More sharing options...
galagast Posted August 13, 2016 Share Posted August 13, 2016 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? Quote Link to comment Share on other sites More sharing options...
galagast Posted January 14, 2017 Share Posted January 14, 2017 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. Quote Link to comment Share on other sites More sharing options...
tloeffler Posted May 8, 2018 Share Posted May 8, 2018 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. Quote Link to comment Share on other sites More sharing options...
tloeffler Posted November 22, 2019 Share Posted November 22, 2019 After some time has passed I figured out that Houdini offers a very handy solution to merge a take in to the main take. It's the addParmTuplesFromTake function: 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: hou.takes.setCurrentTake( main_take ) main_take.addParmTuplesFromTake(current_take) print 'merged %s Take into Main' % current_take.name() The only thing that I couldn't figure out was a solution to also merge the display, render and bypass flags into the main take. 1 Quote Link to comment Share on other sites More sharing options...
tloeffler Posted December 9, 2020 Share Posted December 9, 2020 Here a script that takes also display-,render- and bypass-flags into account: main_take = hou.takes.rootTake() current_take = hou.takes.currentTake() def getAllFlagStates(): flags_dict = {} for node in hou.node('/').allSubChildren(): flags_dict[ node.path() ] = {} flags_dict[ node.path() ]['Display'] = node.isGenericFlagSet(hou.nodeFlag.Display) flags_dict[ node.path() ]['Render'] = node.isGenericFlagSet(hou.nodeFlag.Render) flags_dict[ node.path() ]['Bypass'] = node.isGenericFlagSet(hou.nodeFlag.Bypass) return flags_dict if main_take.name == current_take.name: hou.ui.displayMessage('Please set to a Take other than the \'Main\' take.') else: flags_dict = getAllFlagStates() hou.takes.setCurrentTake( main_take ) main_take.addParmTuplesFromTake(current_take) for node_path in flags_dict: node = hou.node( node_path ) if node.isGenericFlagSet( hou.nodeFlag.Display ) != flags_dict[ node_path ]['Display']: node.setGenericFlag( hou.nodeFlag.Display, flags_dict[ node_path ]['Display'] ) if node.isGenericFlagSet( hou.nodeFlag.Render ) != flags_dict[ node_path ]['Render']: node.setGenericFlag( hou.nodeFlag.Render, flags_dict[ node_path ]['Render'] ) if node.isGenericFlagSet( hou.nodeFlag.Bypass ) != flags_dict[ node_path ]['Bypass']: node.setGenericFlag( hou.nodeFlag.Bypass, flags_dict[ node_path ]['Bypass'] ) print 'merged %s Take into Main' % current_take.name() 1 Quote Link to comment Share on other sites More sharing options...
Follyx Posted December 9, 2020 Share Posted December 9, 2020 Phantastic, thx a lot ;-) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.