viewerstate package¶
Submodules¶
viewerstate.utils module¶
-
class
viewerstate.utils.
ByteStream
¶ Bases:
object
Byte stream class compatible with houdini bit stream format. Bytes are stored as hex strings.
-
data
()¶
-
pack_value
(fmt, val)¶
-
-
class
viewerstate.utils.
Logger
(flag=False)¶ Bases:
object
-
attrb
(obj, attrib_name, fmt='%s=%s', force=False)¶
-
enable
(flag)¶
-
marker
()¶
-
msg
(arg, fmt='%s %s', label='>>> ', force=False)¶
-
obj
(obj, force=False)¶
-
-
class
viewerstate.utils.
Menu
¶ Bases:
object
-
static
clear
()¶ Do some cleanup
-
static
debug
(state_typename, state_cat)¶
-
static
debug_handler
(menu_kwargs, **kwargs)¶
-
static
-
class
viewerstate.utils.
Selector
(name, geometry_types, prompt='Select components', primitive_types=(), group_parm_name=None, group_type_parm_name=None, input_index=0, input_required=True, allow_dragging=False, empty_string_selects_all=True, ordered=False, extra_info='')¶ Bases:
object
Closely mimics the interface of hou.Selector, which is created internally by Houdini. This acts as a placeholder for selection options to pass to SceneViewer.selectGeometry().
See the help for SopNodeType.addSelector() for more information.
-
allowDragging
()¶
-
emptyStringSelectsAll
()¶
-
extraInfo
()¶
-
geometryTypes
()¶
-
groupParmName
()¶
-
groupTypeParmName
()¶
-
inputIndex
()¶
-
inputRequired
()¶
-
name
()¶
-
ordered
()¶
-
primitiveTypes
()¶
-
prompt
()¶
-
-
class
viewerstate.utils.
Stopwatch
¶ Bases:
object
Simple stopwatch class
-
elapsed
¶
-
start
()¶
-
stop
()¶
-
total
¶
-
-
viewerstate.utils.
activePane
(kwargs)¶
-
viewerstate.utils.
activeSceneViewer
(pane)¶ Returns a hou.SceneViewer, based on the pane value passed to a tool script. If the tool script was called with a SceneViewer pane (or a ContextViewer pane that is viewing the scene), returns it, otherwise looks for any open scene viewer.
-
viewerstate.utils.
ancestorObject
(sop_node)¶
-
viewerstate.utils.
cplaneIntersection
(scene_viewer, ray_origin, ray_dir)¶
-
viewerstate.utils.
createFilterSop
(kwargs, nodetypename, container, selections)¶ Given a container and list of 1 or more GeometrySelection/Selector tuples (from run_selectors), creates a new node, wires it up, and fills in the group parameters on the node from the selections.
-
viewerstate.utils.
createGeneratorSop
(kwargs, nodetypename, prompt='Select position for object')¶
-
viewerstate.utils.
createSopContainer
(scene_viewer, name)¶ Creates (or finds) a SOP network in which to create a new generator SOP.
-
viewerstate.utils.
defaultPositionAndOrientation
(scene_viewer)¶ Returns a “default” position (at the origin) and orientation (up) taking into account any construction plane and/or parent transform. This is used as the default placement when the user Ctrl-/Cmd-clicks a tool.
-
viewerstate.utils.
enable_trace
(flag)¶
-
viewerstate.utils.
findSceneViewer
()¶ Returns a SceneViewer pane if one exists.
-
viewerstate.utils.
hotkey
(state_typename, name, key, label=None, descr=None, state_cat=<hou.NodeTypeCategory for Sop>)¶ Create a hotkey with context
-
viewerstate.utils.
pformat_obj
(obj)¶
-
viewerstate.utils.
pformat_val
(val)¶
-
viewerstate.utils.
register_pystate
(module_folder, module_name)¶ Internal function for registering python states
-
viewerstate.utils.
reload_state
(state_name, scene_viewer)¶ Reload a self-installed viewer state.
-
viewerstate.utils.
reload_states
(state_names, scene_viewer)¶ reload the self-installed viewer states contained in state_names
-
viewerstate.utils.
runSelectors
(scene_viewer, selectors, allow_obj_selection=True)¶ Asks the user for a section corresponding to each selector defined on a node. You can use this to “run” the selectors associated with a native Houdini node. This may be useful if you want your asset to ask for the same selections a node inside your asset would ask for natively.
if allow_obj_selection is True, if the viewer starts at the Object level, they can only click whole objects (not select components). If False, if the viewer starts at the object level, when the user clicks an object, the viewer will dive inside to allow them to select components.
Returns a tuple of a hou.Node representing the network containing the selection, and a list of (hou.GeometrySelection, hou.Selector) tuples.
-
viewerstate.utils.
sopGeometryIntersection
(geometry, ray_origin, ray_dir)¶
-
viewerstate.utils.
trace
(func)¶
-
viewerstate.utils.
triggerParmCallback
(*args, **kwargs)¶
-
viewerstate.utils.
upOrientation
()¶ Returns a 3x3 orientation matrix representing Houdini’s current “up” axis (e.g. Y-up or Z-up).