magneto Posted December 25, 2011 Share Posted December 25, 2011 (edited) I am talking about the Group field that allows you to type into but also have a drop down where Houdini provides you with all the available groups. Is it possible to have the same control in custom OPs/DAs so I can limit my OP to a particular group? Thanks Edited December 25, 2011 by magneto Quote Link to comment Share on other sites More sharing options...
graham Posted December 25, 2011 Share Posted December 25, 2011 (edited) Depending on what you are doing you can usually get that information for free. If your asset has nodes internally that need to accept a group and have the normal prim/point Group parameter with the menu, the easiest thing to do is to just promote that parameter directly to your asset. It will create a String menu parameter that has its menu script using opmenu -l and pointing to that node/parameter. This basically asks that group parm for its contents and displays it up one level. However, if you are using something that doesn't have that (say a Python SOP), you'll have to build the menu yourself by doing something like this in the menu script section of the parameter: sopnode = hou.pwd() # List of tokens/labels to return. menu = [] # Make sure there is an input node before asking for its geometry. if sopnode.inputs(): # Optionally add in '*' for all groups. menu.extend(("*", "*")) geo = sopnode.inputs()[0] for group in geo.pointGroups(): name = group.name() menu.extend((name, name)) return menu Edited December 25, 2011 by graham 1 Quote Link to comment Share on other sites More sharing options...
TheUsualAlex Posted December 25, 2011 Share Posted December 25, 2011 (edited) Still checking the net while on vacation??? (ahem.. shame on me) Edited December 25, 2011 by TheUsualAlex Quote Link to comment Share on other sites More sharing options...
magneto Posted December 25, 2011 Author Share Posted December 25, 2011 Depending on what you are doing you can usually get that information for free. If your asset has nodes internally that need to accept a group and have the normal prim/point Group parameter with the menu, the easiest thing to do is to just promote that parameter directly to your asset. It will create a String menu parameter that has its menu script using opmenu -l and pointing to that node/parameter. This basically asks that group parm for its contents and displays it up one level. However, if you are using something that doesn't have that (say a Python SOP), you'll have to build the menu yourself by doing something like this in the menu script section of the parameter: sopnode = hou.pwd() # List of tokens/labels to return. menu = [] # Make sure there is an input node before asking for its geometry. if sopnode.inputs(): # Optionally add in '*' for all groups. menu.extend(("*", "*")) geo = sopnode.inputs()[0] for group in geo.pointGroups(): name = group.name() menu.extend((name, name)) return menu Thanks Graham, just tried it but got no attribute called pointGroups on geo. Do I have to create an attribute with that name? I assume it's not the name of the parameter of my group control, right? Still checking the net while on vacation??? (ahem.. shame on me) No vacation for the wicked Quote Link to comment Share on other sites More sharing options...
graham Posted December 26, 2011 Share Posted December 26, 2011 My bad. It should be this for the 8th line: geo = sopnode.inputs()[0].geometry() 1 Quote Link to comment Share on other sites More sharing options...
magneto Posted December 27, 2011 Author Share Posted December 27, 2011 Thanks Graham, that's awesome. I just tried it, the menu at least pop-ups, but doesn't show any groups that I created upstream? Do I have to add in more code for that? Also I assume in the code I will have to get the name of the menu item clicked and set the text of the textbox to this value? Lastly how can I read this value back from the textbox? Is there a single function that can get points/prims whether the user typed in point/prim indices or a group name or just *, etc? Thanks again 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.