On this page | |
Inheritance |
|
Overview ¶
A gadget is a specialized geometry drawable with support for picking and locating its underlying geometry.
With gadget drawables you can specify a color to highlight the underlying geometry when the
gadget is picked (pick_color
) or when the mouse is over the gadget (locate_color
). You can of course
specify a drawing color (draw_color
) which Houdini uses to draw the gadget when it’s neither picked or located.
Gadgets are used, for instance, as graphical components to provide the picking and locating functionality for manipulating a Python handle. This saves the python handle creator from writing code to implement this complex functionality. Gadgets can also be used to support picking and locating in Python states as well.
Houdini takes care of managing the creation of this type of object, you do not create gadgets yourself.
List of parameters specific to gadget drawables
Parameter |
Type |
Description |
---|---|---|
|
Vector representing an |
|
|
Vector representing an |
|
|
Vector representing an |
Default values per gadget type
The table below lists the gadget parameters default values for a given usage context. The color parameters are set with the specific color from the current viewport color scheme, see hou.GeometryViewportSettings.colorFromName for details.
Parameter |
Value |
Context |
---|---|---|
|
|
State |
|
Handle |
|
|
|
State |
|
Handle |
|
|
|
State |
|
Handle |
|
|
hou.drawableHighlightMode.MatteOverGlow if located. |
Handle |
|
3.0 |
Handle |
|
0.8 |
|
|
Parameter |
Value |
Context |
---|---|---|
|
|
|
|
|
|
|
|
|
|
hou.drawableHighlightMode.MatteOverGlow if located. |
|
|
3.0 |
|
|
0.8 |
|
|
hou.drawableGeometryType.Point
Parameter |
Value |
Context |
---|---|---|
|
|
State |
|
Handle |
|
|
|
State |
|
Handle |
|
|
|
State |
|
Handle |
|
|
hou.drawableHighlightMode.MatteOverGlow if located. |
|
|
3.0 |
|
|
0.2 |
|
|
¶
Methods from hou.Drawable ¶
name()
The name of this drawable.
label()
The label of this drawable.
setLabel(label)
Set the label for this drawable.
show(value)
Displays or hides the element attached to this drawable in the viewport. The element will appear the next time the viewer redraws.
value
True
to show the element or False
to hide it.
visible()
→ bool
Returns True if the drawable is visible or not.
setTransform(xform)
Sets the transform matrix of the element attached to this drawable. The changes will appear the next time the viewer redraws.
xform
A hou.Matrix4 transformation matrix to set the element’s translation, rotation, and scale.
transform()
: → hou.Matrix4
Returns the transform matrix of the element attached to the drawable.
Methods from hou.AdvancedDrawable ¶
setParams(params)
Sets the parameters of the drawable. The settings will take effect in the viewport the next time hou.AdvancedDrawable.draw is called.
params
A dictionary of parameters for setting the drawable options. Each drawable type uses a specific set of parameters, detailed information can be found in the drawable derived class params documentation such as GeometryDrawable and TextDrawable.
The following are parameters common to all hou.AdvancedDrawable
types:
|
Vector representing an For hou.TextDrawable, |
|
|
Vector representing an For instance, |
|
|
double |
Value used as the occlusion factor of the overlay in areas occluded by the existing geometry as determined by the depth buffer. A fade factor of 1.0 means no distinction must be made and a value of 0.0 completely hides occluded parts. Defaults to 0. |
|
int |
Sets the glow width value. For instance, this changes the glow width of line segments or text. Defaults to 0. |
|
Sets the mode for highlighting the generated matte of the drawable. Defaults to hou.drawableHighlightMode.Matte. |
|
|
hou.Vector3 or sequence of 3 doubles |
Position of the geometry in 3D space. For hou.TextDrawable, it’s the position of the text to display in viewport coordinates. Defaults to hou.Vector3(0, 0, 0). |
|
hou.Vector3 or sequence of 3 doubles |
Rotation vector in degrees. Defaults to hou.Vector3(0, 0, 0). |
|
hou.Vector3 or sequence of 3 doubles |
Scaling vector. Defaults to hou.Vector3(1, 1, 1). |
|
Sequence of doubles or ints |
Assigns a 2D window to the viewport, in viewport coordinates, for drawing a geometry. The sequence defines the location and size of the window, and must contain the following values:
|
|
Bool |
Specifies if the drawable should use the |
|
Bool |
Specifies if the drawable should use the |
draw(handle, params=None)
Method implemented by leaf classes to support the drawing of elements in a viewport. This method should normally be called from the python state onDraw or onDrawInterrupt event to render the drawable in the current viewport.
handle
This is an opaque value created by Houdini to render the drawable. This handle
value is passed
to the python state onDraw
callback by Houdini and should be passed directly to the drawable object’s draw
method.
params
An optional dictionary of parameters for setting the drawable parameters. These are the same parameters hou.AdvancedDrawable.setParams is using.
Methods from hou.GeometryDrawable ¶
__init__(scene_viewer, geo_type, name, label=None, geometry=None, params=None)
Creates a new drawable object of a given highlight type. The new drawable is hidden by default.
scene_viewer
A hou.SceneViewer reference to the viewer the guide geometry will appear in.
geo_type
A hou.drawableGeometryType value for specifying the kind of drawable to create.
name
A string to identify this drawable object.
label
An optional string for the drawable label. Defaults to empty.
geometry
An optional hou.Geometry object containing the geometry to draw.
params
An optional parameter dictionary for setting the drawable parameters. The parameters contained
in params
must match the geo_type
drawable being created or they will be ignored. These
are the same parameters you can use with hou.AdvancedDrawable.setParams and
hou.AdvancedDrawable.draw.
Other common parameters are listed in hou.AdvancedDrawable.setParams.
Common parameter |
Type |
Description |
---|---|---|
|
hou.Vector4 or sequence of 4 doubles |
Vector representing a clip plane in world coordinates. |
Line parameter |
Type |
Description |
|
double |
Sets the line width value. Defaults to 1.0. |
|
hou.drawableGeometryLineStyle or sequence of 2 doubles |
Sets the line style to draw: solid, dashed, or dotted. When passing in 2 doubles, the first value is the length of the dash in pixels and the second is the length of the gap between dashes in pixels. Defaults to hou.drawableGeometryLineStyle.Plain. |
Face parameter |
Type |
Description |
|
Bool |
Enable or disable backface culling. Defaults to the current viewport Remove Backfaces display option. |
|
Sets the drawable with a color ramp object. If the ramp is enabled (i.e. The ramp works as a transformation on values from the The way it works is that the ramp ends up being a 1-dimensional OpenGL texture (512 pixels long). The drawable takes
each component (R, G, B) of each fragment color and maps it linearly (using the If the value ends up out of min-max range, then depending on the |
|
|
double |
A scale value for the face patterns. Default to 1.0. |
|
sequence of int |
A list of indices representing the geometry faces to draw. All geometry faces are drawn by default. |
|
double |
A value for displaying faces in patterns based on the |
|
Sets the face style to draw. Defaults to hou.drawableGeometryFaceStyle.Plain. |
|
|
Sets the ramp clamp type for |
|
|
Sets the minimum and maximum ramp value for |
|
|
Bool |
Pick which side of a face to remove when backface culling is active. Defaults to False; |
|
Bool |
Enable the use of the color ramp if one is set on the drawable. Defaults to False. |
Point parameter |
Type |
Description |
|
Sets the falloff range value. Defaults to hou.Vector2(0, 0). |
|
|
sequence of int |
A list of polygon point indices, only the points of the corresponding indices are drawn. If no indices are provided, all geometry points are drawn by default. |
|
int |
Sets the number of rings around the point. Works with hou.drawableGeometryPointStyle.RingsCircle or hou.drawableGeometryPointStyle.RingsSquare. Defaults to 0. |
|
double |
Sets the point radius value. Defaults to 0.05. |
|
Sets the point style to draw. Ring styles work better when the max |
|
Vector parameter |
Type |
Description |
|
sequence of int |
A list of polygon point indices, only the vectors for the points of the corresponding indices are drawn. If no indices are provided, all vectors are drawn by default. |
|
Bool |
Draws the vector segment with an arrow on both end. Defaults to False. |
|
double |
Sets the length of the vector segment. Defaults to 1.0. |
|
int |
Sets the width of the vector segment in pixel units. Defaults to 0. |
|
Bool |
Draws the vector segment with an arrow on one end. Defaults to False. |
|
double |
Fades the entire vector by this factor if the base point of the vector is occluded. Can be used in conjunction with |
geometry()
→ hou.Geometry
Returns the drawable’s geometry object. The returned geometry is read-only
.
setGeometry(geometry)
Sets the drawable with a new geometry. The changes will appear the next time the viewer redraws.
geometry
A hou.Geometry object.
type()
→ hou.drawableGeometryType
Returns the type of drawable as specified at creation time.
useClipPlane(value)
Enable or disable the clip plane while rendering this drawable. It is disabled by default.
value
True
to enable the clip plane and False
to disable it.
See also |