pbowmar Posted September 7, 2008 Share Posted September 7, 2008 Hi, So I'm trying to remove spare parameters via HOM. They always are in a known folder name so I do: # clear out the spare folder called "Output Controls" try: oldParmsToClear = mantra_node.parmsInFolder(["Output Controls"]) for curParm in oldParmsToClear: mantra_node.removeSpareParmTuple((curParm.name(),)) except: pass # no parms to clear In the above, the oldParmsToClear is almost successfully filled with the list of parms. I saw almost because all the Separator parms do not show up Bug? However, iterating over them and trying to remove them does nothing. The error is: TypeError: in method 'Node_removeSpareParmTuple', argument 2 of type 'HOM_ParmTuple &' So, I need to cast to HOM_ParmTuple?? Or what exactly? Cheers, Peter B Quote Link to comment Share on other sites More sharing options...
graham Posted September 7, 2008 Share Posted September 7, 2008 (edited) You do have to get the hou.ParmTuple for the parm: mantra_node.removeSpareParmTuple(curParm.tuple()) This prevents you trying to do weird things with parms that have a size > 1. It wouldn't make sense for you to be able to do something like geo = hou.node('/obj/geo1') geo.removeSpareParmTuple(geo.parm('tx')) You would be changing how the 't' parameter exists so you have to get the whole parm. Though an even better thing to do would be to do oldParmsToClear = mantra_node.parmsTuplesInFolder(["Output Controls"]) This means you don't have to get the tuple, as well as you won't get all sorts of exceptions because it has 3 parms in a vector for example, but calling .tuple() on it then removes the, thus causing problems with trying to delete parms already deleted now. Also, what some people don't know is that you can do a for loop on a hou.ParmTuple object you get all the parms in the tuple. for parm in geo.parmTuple('t'): print parm.name() tx ty tz Edited September 7, 2008 by graham Quote Link to comment Share on other sites More sharing options...
pbowmar Posted September 7, 2008 Author Share Posted September 7, 2008 Hey Graham, Cool, thanks! I was trying to do: oldParmsToClear = mantra_node.parmsTuplesInFolder(["Output Controls"]) but the Separator parms don't show up in the list returned by parmsTuplesInFolder I'm using opspare and it's working OK but I'd prefer the Folder way once it's working. Cheers, Peter B 1 Quote Link to comment Share on other sites More sharing options...
graham Posted September 7, 2008 Share Posted September 7, 2008 Yeah, I ran into that a long time ago trying to do some things Quote Link to comment Share on other sites More sharing options...
pbowmar Posted September 14, 2008 Author Share Posted September 14, 2008 And of course, it's crashing constantly 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.