This object can exist in one of two modes. One mode does not allow editing of the overrides other than to save and load the entire object. An object is created in this mode either using the default constructor, or by calling hou.LopNetwork.copyViewportOverrides which makes a read-only copy of either the current viewport overrides, or a saved set of overrides.
In its other mode, this object is a context manager. You can create one using
hou.LopNetwork.viewportOverrides. At the end of the with block, the
notification of the session edits is propagated to viewer panes.
Methods ¶
__init__()
Creates an empty, read-only set of viewport overrides. This constructor is
necessary to allow loading the contents of a binary string previsouly with
the dumps method.
addSoloGeometry(prims)
Adds geometry primitives to the set of activated geometry in the scene.
prims
A hou.LopSelectionRule object that specifies which USD geometry primitives should be added to the set of solo visible geometry.
addSoloLights(prims)
Adds lights to the set of activated lights in the scene.
prims
A hou.LopSelectionRule object that specifies which USD light primitives should be added to the set of solo active lights.
clear(layer_id = None, from_prim = None)
Clears one or all viewport overrides layers.
layer_id
A hou.lopViewportOverridesLayer value to clear a specific
overrides layer, or None to clear all layers.
from_prim
A path to the primitive that is the root of the portion of the scene
graph tree from which the overrides should be cleared. Set to None
to clear overrides for the whole scene graph.
dumps()
→ hou.BinaryString
Generates a binary string that contains a serialized copy of this object. The format of this serialization is opaque and should not be directly inspected or modified. The output should only be used to persist this object for later reuse in another process.
layer()
→ pxr.Sdf.Layer
Return the pxr.Sdf.Layer object that contains current custom or viewport
state session edits to the scene graph. These edits are accessible using
the hou.lopViewportOverridesLayer.Custom or
hou.lopViewportOverridesLayer.ViewportState depending on the
active_layer value passed to hou.LopNetwork.viewportOverrides.
This layer does not include opinions set using built in Houdini panels.
This layer only hold opinions authored through the layer returned by this
method. This object can be modified using the pxr.Sdf.Layer API to make
further session modifications to the scene graph.
loads(overrides_str)
Loads the contents of a binary string into this object. The provided data
must have been generated by calling the dumps method. This method can
only be called either on a read-only object created by calling the default
constructor method, or on an object returned by
hou.LopNetwork.viewportOverrides.
removeSoloGeometry(prims)
Remove geometry from the set of visible geometry in the scene. If all geometry are removed from the solo geometry group, all geometry in the scene will be made visible.
prims
A hou.LopSelectionRule object that specifies which USD geometry primitives should be removed from the set of solo visible geometry.
removeSoloLights(prims)
Remove lights from the set of activated lights in the scene. If all lights are removed from the solo lights group, all lights in the scene will be activated.
prims
A hou.LopSelectionRule object that specifies which USD light primitives should be removed from the set of solo active lights.
setActive(prims, active)
Change the active state of USD primitives by editing the session layer of a LOP Network. Deactivated primitives do not appear in the viewport, and cannot be expanded in the scene graph tree. The LOP Network to edit is determined by looking at the LOP node used to create this session editor object.
prims
A hou.LopSelectionRule object that specifies which USD primitives should be affected.
active
A boolean value indicating the new activation state of the USD primitives.
setDisplayOpacity(prims, opacity)
Change the display opacity of USD primitives by editing the session layer of a LOP Network. The LOP Network to edit is determined by looking at the LOP node used to create this session editor object.
prims
A hou.LopSelectionRule object that specifies which USD primitives should be affected.
opacity
A float value between 0 (fully transparent) and 1 (fully opaque).
setDrawMode(prims, drawmode)
Change the draw mode of USD primitives by editing the session layer of a LOP Network. The draw mode of a primitive is only respected if the primitive is part of a valid, contiguous USD model hierarchy. The LOP Network to edit is determined by looking at the LOP node used to create this session editor object.
prims
A hou.LopSelectionRule object that specifies which USD primitives should be affected.
drawmode
A string value indicating the new draw mode for the USD primitives.
Only primitives that are part of a valid USD model hierarchy can have
their draw mode changed. The allowed values for this string are
default (draw the full geometry), origin (draw a set of axes at
the origin of the primitive), bounds (draw a bounding box around the
primitive), and cards (draw three axis-aligned cards that fill the
primitive’s bounding box).
setSelectable(prims, selectable, solo = False)
Change the selectability of USD primitives by editing the session layer of a LOP Network. Unselectable primitives are ignored when performing a selection operation in the viewport. The LOP Network to edit is determined by looking at the LOP node used to create this session editor object. All descendants of an unselectable primitive are also unselectable, even if they are explicitly set as selectable. An unselectable setting on and ancestor primitive takes precedence.
prims
A hou.LopSelectionRule object that specifies which USD primitives should be affected.
selectable
A boolean value indicating the new selectable value of the USD primitives.
solo
A boolean value indicating that the supplied set of primitives should be the only primitives in the scene that are selectable (or not selectable). This may involve modifying the selectable attribute on many primitives across the scene, not just the specified primitives.
setSoloGeometry(prims)
Turns off the visibility of any geometry not specified by the prims
parameter.
prims
A hou.LopSelectionRule object that specifies which USD geometry
primitives should be remain visible after running this method. Any
descendants of the specified primitives will also be made visible.
This parameter can also be None to disable any existing soloing of
geometry.
setSoloLights(prims)
Deactivates any lights not specified by the prims parameter.
prims
A hou.LopSelectionRule object that specifies which USD light
primitives should be remain active after running this method. Or can
be None to disable any existing soloing of lights.
setVisible(prims, visible)
Change the visibility of USD primitives by editing the session layer of a LOP Network. Invisible primitives are not drawn in the viewport, but still appear in the scene graph tree. The LOP Network to edit is determined by looking at the LOP node used to create this session editor object.
prims
A hou.LopSelectionRule object that specifies which USD primitives should be affected.
visible
A boolean value indicating whether the USD primitives should be visible.
setXforms(selected_paths, global_xform, handle_xform, pivot, pivot_rotate, set_pivot_on_primary_prim, delta)
→ hou.Geometry
This method is used by the viewport state of the Edit LOP to apply transforms to prims or point instances in the viewport overrides layer. Its use is tied very closely to that Edit LOP state, but may be useful in other scenarios.
selected_paths
A list or str of the currently selected prims that should be
transformed. These may be primitive paths or point instancer prim
paths followed by an instance index provided in square brackets.
global_xform
A bool indicating if the transform should be applied in global space
or in the local space of each prim.
handle_xform
A hou.Matrix4 that should be used to transform the selected prims.
pivot
A hou.Vector3 indicating the pivot position of the transform handle.
This value is used when global_xform is False to determine the
local pivot around which each prim is transformed. It is also the
value used to author to the primary prim when
set_pivot_on_primary_prim is True.
pivot_rotate
A hou.Vector3 indicating the pivot rotation of the transform handle.
This value is used when global_xform is False to determine the
local pivot around which each prim is transformed. It is also the
value used to author to the primary prim when
set_pivot_on_primary_prim is True.
set_pivot_on_primary_prim
A bool indicating if the pivot and pivot rotate values provided
should be set on the first prim in the selected_paths list. Pivots
cannot be preserved on point instances.
delta
A hou.Geometry with points holding attributes that describe “base”
transforms that should be applied to prims in the viewport overrides
layer. The other parameters to this method describe an additional set
of transforms that are applied on top of the transforms described in
this geometry parameter.
Returns a modified version of the passed in delta geometry that also
includes the additional transforms described by the other method parameters.
This allows the delta geometry to be built up over a series of interactive
transform operations.
showPurpose(prims, purpose)
Show the selected purpose for a geometry primitive if it exists. Other purposes for the same geometry are hidden from the viewport.
prims
A hou.LopSelectionRule object that specifies which USD geometry primitives' purpose should be isolated and displayed.
purpose
A string value indicating the purpose(render/proxy/guide) to display.
soloGeometry()
→ tuple
of pxr.Sdf.Path
Return a set containing the paths to all solo visible geometry primitives.
soloLights()
→ tuple
of pxr.Sdf.Path
Return a set containing the paths to all solo active light primitives.
stage()
→ pxr.Sdf.Stage
Return the pxr.Usd.Stage object that contains all the current session
edits to the scene graph. This object can be modified using the
pxr.Usd.Stage API to make further session modifications to the scene
graph. These edits are authored to the
hou.lopViewportOverridesLayer.Custom or
hou.lopViewportOverridesLayer.ViewportState depending on the
active_layer value passed to hou.LopNetwork.viewportOverrides.