lops
lops
¶
MCP tools for LOPs / USD stage inspection and manipulation.
Functions:
| Name | Description |
|---|---|
create_light |
Create a USD light in a LOP network. |
create_light_rig |
Create a preset lighting rig in a LOP network. |
create_lop_node |
Create a new LOP node. |
find_usd_prims |
Search USD prims by path pattern. |
get_last_modified_prims |
Get prims modified by the last LOP node cook. |
get_stage_info |
Get USD stage info from a LOP node, or from a LOP network. |
get_usd_attribute |
Read a USD attribute value from a prim. |
get_usd_attributes |
Read the same attributes across many prims as one table. |
get_usd_bound_material |
The material each prim renders with, resolved the way the renderer |
get_usd_composition |
Get composition arcs for a USD prim. |
get_usd_layers |
List all layers in a USD stage. |
get_usd_materials |
List all USD materials on a stage. |
get_usd_prim |
Get detailed info about a USD prim. |
get_usd_prim_stats |
Get prim counts by USD type under a root path. |
get_usd_variants |
Get variant sets and selections for a USD prim. |
get_usd_world_transform |
World transform of USD prims at one or more frames. |
inspect_usd_layer |
Inspect a USD layer by index. |
list_lights |
List all USD lights on a LOP stage. |
list_usd_prims |
List USD prims on a stage with filtering. |
set_light_properties |
Set properties on a USD light prim via an inline Python LOP. |
set_usd_attribute |
Set a USD attribute value via an inline Python LOP. |
Functions:¶
create_light
async
¶
create_light(
ctx: Context,
parent_path: str = "/stage",
light_type: str = "dome",
name: str | None = None,
intensity: float = 1.0,
color: list[float] | None = None,
position: list[float] | None = None,
) -> dict
Create a USD light in a LOP network.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
Parent LOP network path. |
'/stage'
|
|
str
|
"dome", "distant", "rect", "sphere", "disk", or "cylinder". |
'dome'
|
|
str | None
|
Light node name. |
None
|
|
float
|
Light intensity. |
1.0
|
|
list[float] | None
|
[r, g, b] color values. |
None
|
|
list[float] | None
|
[x, y, z] world position. |
None
|
create_light_rig
async
¶
create_light_rig(
ctx: Context,
parent_path: str = "/stage",
preset: str = "three_point",
intensity_mult: float = 1.0,
) -> dict
create_lop_node
async
¶
create_lop_node(
ctx: Context,
parent_path: str,
lop_type: str,
name: str | None = None,
prim_path: str | None = None,
) -> dict
Create a new LOP node.
Before using this, call list_node_types(context='Lop', filter='
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
Parent node path. |
required |
|
str
|
LOP node type (e.g. "sphere", "sublayer", "merge"). |
required |
|
str | None
|
Node name. |
None
|
|
str | None
|
USD prim path to set on the node. |
None
|
find_usd_prims
async
¶
find_usd_prims(
ctx: Context,
node_path: str,
pattern: str,
traverse_instance_proxies: bool = False,
) -> dict
Search USD prims by path pattern.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
LOP node path. |
required |
|
str
|
Glob pattern (supports , *) or substring. |
required |
|
bool
|
Search prims under instanceable prototypes too; the default walk never visits them. |
False
|
get_last_modified_prims
async
¶
get_stage_info
async
¶
Get USD stage info from a LOP node, or from a LOP network.
Given a network such as "/stage", the answer is about what that network
displays: display_node (and render_node) name it, resolved_from is
"display_node", viewport_delegate names the Hydra delegate the Scene
Viewer draws with, and frame is the current frame.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
LOP node or LOP network path (default "/stage"). |
'/stage'
|
get_usd_attribute
async
¶
get_usd_attribute(
ctx: Context,
node_path: str,
prim_path: str,
attr_name: str,
time: float | None = None,
full: bool = False,
offset: int = 0,
limit: int = 64,
all_samples: bool = False,
) -> dict
Read a USD attribute value from a prim.
A long array (over 16 elements) answers with value as a summary (size,
element_type, head, min/max) plus slice: the elements from offset,
at most limit of them (default the first 64), with has_more. Walk a
big array by raising offset; pass full=True to get every element in
value at once.
A time-sampled attribute (a PointInstancer's positions, protoIndices)
has nothing in its default slot: read with no time it answers null. With
no time given, the current frame is read instead, and the reply carries
time, time_source, time_samples and time_range, so value: null
never stands unexplained next to is_authored: true. A time-sampled
attribute also lists its sample_times (motion blur's subframes
included): up to 64, past that sample_times_truncated and the 64 around
the time read, from index sample_times_start. all_samples=True adds the
value at each of them.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
LOP node path. |
required |
|
str
|
USD prim path. |
required |
|
str
|
Attribute name. |
required |
|
float | None
|
Time code (frame number). Omitted on a time-sampled attribute, the current frame is used (the first sample outside the range). |
None
|
|
bool
|
Return the whole array as |
False
|
|
int
|
First element of the window for a long array. |
0
|
|
int
|
Window size for a long array. |
64
|
|
bool
|
Also return |
False
|
get_usd_attributes
async
¶
get_usd_attributes(
ctx: Context,
node_path: str,
prims: list[str],
attr_patterns: list[str] | None = None,
prim_type: str | None = None,
relationships: bool = True,
time: float | None = None,
full: bool = False,
traverse_instance_proxies: bool = False,
limit: int = 500,
) -> dict
Read the same attributes across many prims as one table.
One row per prim and attribute: {prim, prim_type, name, type, value,
time_samples?} or, for a relationship, {prim, prim_type, name,
relationship: true, targets}. The call for "sourceName of every
RenderVar", "lpetag of every light", "the camera of the render
settings" -- instead of one get_usd_prim per prim. matched counts every
row found; truncated says the limit cut some off.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
LOP node path. |
required |
|
list[str]
|
Prim paths or globs: |
required |
|
list[str] | None
|
Glob patterns on attribute and relationship names (["sourceName"], ["*lpetag"]); default all. |
None
|
|
str | None
|
Keep only prims of this type (glob, e.g. "*Light"). |
None
|
|
bool
|
Include relationships as rows. |
True
|
|
float | None
|
Time code (frame) to read at; default the current frame. |
None
|
|
bool
|
Return array values in full instead of summarised. |
False
|
|
bool
|
Let globs match prims inside instances. |
False
|
|
int
|
Row cap. |
500
|
get_usd_bound_material
async
¶
get_usd_bound_material(
ctx: Context, node_path: str, prim_paths: list[str], purpose: str = "full"
) -> dict
The material each prim renders with, resolved the way the renderer
resolves it (ComputeBoundMaterials), and where the binding comes from:
direct on the prim, inherited from which ancestor, or which
collection. A binding to a material prim that does not exist is
reported in missing_material, not as unbound.
Batched: pass every prim of interest in one call.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
LOP node whose stage to read. |
required |
|
list[str]
|
Prim paths to resolve. |
required |
|
str
|
"full" (default; what Karma renders, falling back to an all-purpose binding), "preview", or "all" (all-purpose bindings only). |
'full'
|
get_usd_composition
async
¶
get_usd_layers
async
¶
get_usd_materials
async
¶
List all USD materials on a stage.
Each material reports surface_shaders keyed by render context: "surface" is the universal output, a UsdPreviewSurface for viewports and Storm, and "mtlx" is the MaterialX shader Karma renders. surface_shader is the mtlx one when present, so it agrees with get_material_info on the same material.
bound_to lists the prims a binding is authored on. rendered_on (up
to 50 paths) and rendered_on_count are the geometry that resolves to
the material for rendering, including geometry bound through a parent
or a collection; get_usd_bound_material says why for a given prim.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
LOP node path. |
required |
get_usd_prim
async
¶
get_usd_prim(
ctx: Context,
node_path: str,
prim_path: str,
full: bool = False,
traverse_instance_proxies: bool = False,
time: float | None = None,
attr_patterns: list[str] | None = None,
) -> dict
Get detailed info about a USD prim.
Array attributes longer than 16 elements (points, faceVertexIndices,
primvars:st, ...) come back as a summary: size, element_type, the first 8
as head, and min/max for numeric data. That is what a mesh question
needs; the full arrays of a building ran to 6.6 million characters. Pass
full=True for every element, or read one array in windows with
get_usd_attribute(offset=, limit=).
Values are read at time, or at the current frame when it is not given
-- what a render of that frame sees; the reply names both as time and
time_source. An attribute with time samples carries time_samples:
its value differs at other frames. Relationships (a RenderSettings'
camera) are listed with their targets. For the same attributes
across many prims, get_usd_attributes reads them in one call.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
LOP node path. |
required |
|
str
|
USD prim path. |
required |
|
bool
|
Return array attributes in full instead of summarised. |
False
|
|
bool
|
List the children that live on an
instanceable prim's prototype. Without it such a prim answers
|
False
|
|
float | None
|
Time code (frame) to read at; default the current frame. |
None
|
|
list[str] | None
|
Glob patterns on attribute and relationship names (e.g. ["resolution", "karma:global:*"]); default all. |
None
|
get_usd_prim_stats
async
¶
get_usd_prim_stats(
ctx: Context,
node_path: str,
prim_path: str = "/",
traverse_instance_proxies: bool = False,
) -> dict
Get prim counts by USD type under a root path.
Instanced geometry counts once per prototype, not per instance:
instanceable_prims says how many prims were counted without their
contents, and traverse_instance_proxies counts what is under them.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
LOP node path. |
required |
|
str
|
Root prim path to gather stats from. |
'/'
|
|
bool
|
Count prims under instanceable prototypes. |
False
|
get_usd_variants
async
¶
get_usd_world_transform
async
¶
get_usd_world_transform(
ctx: Context,
node_path: str,
prim_paths: list[str],
frames: list[float] | None = None,
) -> dict
World transform of USD prims at one or more frames.
get_usd_prim gives local xformOps; this composes every parent, so an animated parent shows. Per prim and frame: translate, rotate (XYZ degrees), scale and the row-major matrix. Each frame recooks the stage there, so LOP-parm animation reads right, and the playbar is restored.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
LOP node whose stage to read. |
required |
|
list[str]
|
Prim paths, e.g. ["/world/cam"]. |
required |
|
list[float] | None
|
Frames to read at, at most 500. Default: the current frame. |
None
|
inspect_usd_layer
async
¶
inspect_usd_layer(ctx: Context, node_path: str, layer_index: int = 0) -> dict
list_lights
async
¶
list_usd_prims
async
¶
list_usd_prims(
ctx: Context,
node_path: str,
root_path: str = "/",
prim_type: str | None = None,
kind: str | None = None,
depth: int | None = None,
traverse_instance_proxies: bool = False,
) -> dict
List USD prims on a stage with filtering.
Instanced geometry is invisible to the default walk: an instanceable prim has no children of its own, they belong to its prototype. Set traverse_instance_proxies to list the prims under it.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
LOP node path. |
required |
|
str
|
Root prim path to list from. |
'/'
|
|
str | None
|
USD type filter (e.g. "Mesh", "Xform"). |
None
|
|
str | None
|
Kind filter (e.g. "component", "group"). |
None
|
|
int | None
|
Max traversal depth. |
None
|
|
bool
|
Descend into instanceable prims and list the prims under their prototypes. |
False
|