On this page | |
Inheritance |
|
This class provides a common interface to all drawable classes.
Tips and notes ¶
-
Houdini supports various drawables such as hou.SimpleDrawable, hou.GeometryDrawable and hou.TextDrawable.
-
hou.SimpleDrawable and hou.GeometryDrawable represent extra geometry to draw in the viewer alongside user content (for example, as guide geometry).
-
hou.SimpleDrawable is the most basic Houdini drawable class, it is easy to use as you just need to attach a geometry, enable it and Houdini will take care of drawing the geometry.
-
hou.GeometryDrawable, hou.GadgetDrawable and hou.GeometryDrawableGroup also draw guide geometries but provide an API with advanced drawing capabilities.
-
hou.GadgetDrawable is similar to hou.GeometryDrawable but also allows you to identify located and picked geometries.
-
hou.TextDrawable draws text in the viewport.
-
Drawables are mostly used with custom python states, you will generally store a reference to drawable objects on the state implementation object.
-
When you create a drawable object, it is hidden. You need to call
show(True)
for the attached element to appear. hou.SimpleDrawable requires an extra call to hou.SimpleDrawable.enable for the geometry to appear. -
The drawable element will appear in the viewer until the drawable object is hidden or deleted. If there are no references to the object, Python will automatically delete it during garbage collection, and the attached element will disappear. So, you need to make sure to keep a live reference to the object as long as you want it to appear.
Methods ¶
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.
See also |