furtap Posted June 9, 2009 Share Posted June 9, 2009 Hello, This is probably easy to do but I haven't done any scripting in houdini before, just C++ & OpenGl. I want to make a tool that has nice but simple user interaction. At the moment I just want a primitive to be extruded but I would like the primitive selection be decided at run time by the user. So instead of entering the primitive number, they can just click a built in button on the tool, then selection the primitive, then press enter and the primitive becomes a part of the group that will be extruded. Looking at the pictures below, basically I would like the pattern which is currently '2' of extrude_grp to have a nice interactive button so it can be chosen with the process described above. I hope that is clear enough, if not or any questions just ask. Perhaps there is a far simpler way of doing this than I have realized, but eventually I would like this to be a part of a much large fairly professional looking tool - hence the need for a simple interactive button. fur. Quote Link to comment Share on other sites More sharing options...
mrice Posted June 10, 2009 Share Posted June 10, 2009 Take a look at some of the shelf tools that do things similar to this, like the polyextrude tool. You'll probably want to import toolutils and use a member function to handle the viewport selection like many of the shelf tools do. Hope that helps, be sure to ask if you get stuck! Quote Link to comment Share on other sites More sharing options...
furtap Posted June 10, 2009 Author Share Posted June 10, 2009 Thanks mrice, I will look into this but maybe not for a few days - pretty busy with alsorts right now. I think I will find it hard going at first, I haven't done any real scripting in houdini before Take a look at some of the shelf tools that do things similar to this, like the polyextrude tool. You'll probably want to import toolutils and use a member function to handle the viewport selection like many of the shelf tools do.Hope that helps, be sure to ask if you get stuck! Quote Link to comment Share on other sites More sharing options...
RuschFX Posted August 10, 2009 Share Posted August 10, 2009 I'm creating a tool that takes an object, like a car, that has several seperate geos merged together and I'd like to have a button on my tool that asks for a selection. The user can then select single sections of the car, like the tires, the hood and windshield, and hit 'enter'. The tool would then take the selected polys and add them to a group node. The closest I've gotten is this: import toolutils scene_view = toolutils.sceneViewer() prompt = toolutils.selectionPrompt(hou.sopNodeTypeCategory()) select_objects = list(scene_view.selectGeometry(prompt) but when I run it I get an error that says "geometry selection object is not iterable", or it only lets me select the car as a whole (obj level), and other times the interface just seems to freeze up and won't let me select anything at all. Anybody have any idea what I'm doing wrong?! Thanks in advance! Quote Link to comment Share on other sites More sharing options...
Dennis Sedov Posted September 7, 2009 Share Posted September 7, 2009 Are you doing this at SOP level. It seams like you're at /obj and trying to get primitive selection working. I'm creating a tool that takes an object, like a car, that has several seperate geos merged together and I'd like to have a button on my tool that asks for a selection. The user can then select single sections of the car, like the tires, the hood and windshield, and hit 'enter'. The tool would then take the selected polys and add them to a group node. The closest I've gotten is this: import toolutils scene_view = toolutils.sceneViewer() prompt = toolutils.selectionPrompt(hou.sopNodeTypeCategory()) select_objects = list(scene_view.selectGeometry(prompt) but when I run it I get an error that says "geometry selection object is not iterable", or it only lets me select the car as a whole (obj level), and other times the interface just seems to freeze up and won't let me select anything at all. Anybody have any idea what I'm doing wrong?! Thanks in advance! Quote Link to comment Share on other sites More sharing options...
graham Posted September 8, 2009 Share Posted September 8, 2009 (edited) The problem is that hou.SceneViewer.selectGeometry() does not return a list or anything that is iterable; it returns a hou.GeometrySelection object. This object allows you to do various things, like getting a space separated entity selection string. Unfortunately it's not possible to tell the selector to select connected geometry, but that can be overcome by a member function of the selection. The following is an excerpt from some old code I found that adds a selection of polygons to an existing group string. It should show you how to do what you want to do. import toolutilsactivepane = toolutils.activePane(kwargs)if not isinstance(activepane, hou.SceneViewer): raise hou.Error("No scene viewer found.")geometry = activepane.selectGeometry("Select polygons to add to the group and press Enter to complete.", geometry_types=(hou.geometryType.Primitives,), use_existing_selection=False)geometry.setConnectivity(hou.connectivityType.Position)if len(geometry.nodes()) > 1: raise hou.Error("Multiple source nodes detected.")geo_node = geometry.nodes()[0]if geo_node is not None: geo_node.parm("pattern").set(geo_node.evalParm("pattern") + geometry.mergedSelectionString()) Edited September 8, 2009 by graham 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.