On this page | |
Inheritance |
|
Overview ¶
hou.GeometryDrawable
lets you draw guide geometries like hou.SimpleDrawable
, but offers more drawing options
with various kind of visualization effects. For instance, you can use a hou.GeometryDrawable
object for drawing the
faces of the attached geometry, drawing points in different shapes, drawing lines or vectors. You may also use a
glow matte effect to highlight faces, lines, point radius, etc…
Like hou.SimpleDrawable, hou.GeometryDrawable
uses mostly the same services for managing geometries in the
viewer without being part of the actual scene. Like hou.TextDrawable, hou.GeometryDrawable
is designed for
python states and requires the onDraw handler for drawing its
attached geometry.
Note
hou.GeometryDrawable
can only be used with polygon mesh geometries.
Methods ¶
__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.
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.
See also |