usd_chunks.chunk_core
The base classes every chunk object derives from.
These classes are not meant to be instantiated; use the implementations in usd_chunks.chunk.
The attrs library gives every chunk class dataclass-like attributes. The attributes and methods attrs generates are inherited through the MRO, so a subclass only declares its fields and attrs builds init and the rest. Instead of @attrs.define, every chunk object uses AttributesMetaclass, which wraps each class in attrs.define with the right settings and adds custom validation and conversion.
All chunk objects inherit from ChunkCommon, which declares the fields every chunk object has, such as name. Every field that can change has an AttributeSender, and since AttributeSender is a ChunkNoticePropagator, attribute changes propagate up the hierarchy and send notices.
Checkbox
⚓︎
Checkbox(name='', label='', tooltip='', icon='', user_data={}, layout=0, state=0, flags=1, default_value=None, custom_widget=None)
Bases: ChunkParamBase[bool]
A checkbox param holding a bool.
Here rather than in chunk.py, which re-exports it, because the framework adds one itself: ChunkModule.create gives every chunk of a cache_cook module its cache_result toggle, and chunk_registry cannot import chunk.py, which imports it.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
|
''
|
label
|
str | None
|
|
''
|
tooltip
|
str | None
|
|
''
|
icon
|
str | None
|
|
''
|
user_data
|
dict[str, Any]
|
dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2) |
<class 'dict'>
|
layout
|
LayoutFlags
|
|
<LayoutFlags.HORIZONTAL: 0>
|
state
|
State
|
|
usd_chunks.chunk_flags.ChunkFlags.State(0)
|
flags
|
IntFlag
|
|
usd_chunks.chunk_flags.ChunkFlags.ParamFlags(1)
|
default_value
|
ValueT | None
|
|
None
|
custom_widget
|
ChunkParamWidgetBase | None
|
|
None
|
Attributes:
| Name | Type | Description |
|---|---|---|
driven_scale |
float
|
|
value |
ValueT
|
The value of this parameter |
ChunkBase
⚓︎
ChunkBase(name='', label='', tooltip='', icon='', user_data={}, layout=1, state=0, flags=0, widget_factory=None, prim_path=None)
Bases: ChunkGroupBase
Base class for Chunks. Similar to a group but meant to be the top level owner of other params.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
|
''
|
label
|
str | None
|
|
''
|
tooltip
|
str | None
|
|
''
|
icon
|
str | None
|
|
''
|
user_data
|
dict[str, Any]
|
dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2) |
<class 'dict'>
|
layout
|
LayoutFlags
|
|
<LayoutFlags.VERTICAL: 1>
|
state
|
State
|
|
usd_chunks.chunk_flags.ChunkFlags.State(0)
|
flags
|
IntFlag
|
|
0
|
widget_factory
|
ChunkWidgetFactoryBase | None
|
|
None
|
prim_path
|
str | None
|
|
None
|
Attributes:
| Name | Type | Description |
|---|---|---|
children |
NameSyncedContainer[ChunkCommon]
|
The container owning the child params |
__enter__
⚓︎
with chunk: -- where chunks created inside the block go is the scene's to say
(see SceneSender.enter_chunk).
can_cook
⚓︎
Whether this chunk's module defines execute(), i.e. whether cook() has anything to run.
A chunk without one (a chunkgroup) holds other chunks and authors nothing itself.
Source code in usd_chunks/chunk_core.py
disable
⚓︎
enable
⚓︎
get_chunk_module
⚓︎
The registered module this chunk's type names, or None.
Looked up in the registry by config.module -- the same name a saved file records as info:chunkType -- rather than held on the chunk. A chunk can therefore only ever run what a registered module defines, which is exactly what reopening the file will run: a saved file is the whole description of what the network does.
The registry's module is the copy chunks are built from. A chunk module can exist twice in sys.modules under different keys (its bare name, and a package path when its folder is importable), so it is found by the registry's name, never by import.
A dict lookup (ChunkRegistry.get_chunk_module does no discovery), so it is cheap enough for the gizmo hooks, which are asked per draw and per drag tick.
Returns:
| Type | Description |
|---|---|
ChunkModule | None
|
The ChunkModule, or None for a chunk no module made (a plain Chunk built in the |
ChunkModule | None
|
interpreter, a tab context) or whose module is not registered. |
Source code in usd_chunks/chunk_core.py
get_config
⚓︎
get_context
⚓︎
The nearest CONTEXT chunk at or above this one, or None.
Source code in usd_chunks/chunk_core.py
reauthor_driven_attrs
⚓︎
Author again the connection and value of every param of this chunk that drives a real prim attribute (connect_usd_attr).
Those live in the chunk's layer, but they are the params' state rather than what a cook produced: a param is bound once -- by the module, by show_attribute, or on being edited away from its default -- and stays bound whether or not the next cook binds it again. The framework clears the layer before every cook, so it puts them back after one. Only this chunk's own params: a chunk nested inside keeps its own.
remove
⚓︎
start_gizmo
⚓︎
Send GIZMO_START; a callback for when a host starts a drag.
Source code in usd_chunks/chunk_core.py
stop_gizmo
⚓︎
Send GIZMO_STOP; a callback for when a host ends a drag.
The drag's last write cooks first (GIZMO_STOP_HOOKS), so the chunk holds where the handle was let go by the time STOP goes out. Closed before that write, so it cooks what is below in full; a chunk that previewed and was not reached by it cooks in full after (preview_cook).
Source code in usd_chunks/chunk_core.py
trigger_on_create_callbacks
⚓︎
Trigger every on-create callback in this chunk's hierarchy.
Runs once the chunk is loaded and added to the scene, as a callback on CHUNK_LOADED. Outside the chunk's edit context: each callback triggered runs in its own owner's.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
notice
|
The notice, when called as a callback. |
None
|
|
sender
|
The sender, when called as a callback. |
None
|
Source code in usd_chunks/chunk_core.py
ChunkCommon
⚓︎
Bases: AttributesBase
Base class for all chunk objects, holding the attributes every one of them supports.
Not instantiated directly; concrete classes inherit from it.
Attributes:
| Name | Type | Description |
|---|
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
|
''
|
label
|
str | None
|
|
''
|
tooltip
|
str | None
|
|
''
|
icon
|
str | None
|
|
''
|
user_data
|
dict[str, Any]
|
dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2) |
<class 'dict'>
|
layout
|
LayoutFlags
|
|
<LayoutFlags.VERTICAL: 1>
|
state
|
State
|
|
usd_chunks.chunk_flags.ChunkFlags.State(0)
|
flags
|
IntFlag
|
|
0
|
can_delete
⚓︎
get_chunk
⚓︎
Get the owning Chunk if it exists.
Returns:
| Type | Description |
|---|---|
ChunkBase | None
|
ChunkBase | None: The chunk that owns this object |
Source code in usd_chunks/chunk_core.py
get_edit_context
⚓︎
The layer to author this object's stage edits in: its chunk's layer.
Every param uses the layer of the nearest ChunkBase above it, rather than a layer of its own::
with Usd.EditContext(stage, param.get_edit_context()):
... # modify the stage
Returns:
| Type | Description |
|---|---|
Layer | None
|
Sdf.Layer | None: The layer, or None when the layer manager is not initialized or |
Layer | None
|
the layer is muted |
Source code in usd_chunks/chunk_core.py
get_hash
⚓︎
Get the HashVal of this chunk object.
Useful for storing the object in a hash map without holding a reference to it.
Returns:
| Name | Type | Description |
|---|---|---|
HashVal |
HashVal
|
The hash value of this object |
Source code in usd_chunks/chunk_core.py
get_identifier
⚓︎
A dotted path from the top-most owner to this object, e.g. MyChunk.SomeGroup.MyParam.
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
The string identifier for this chunk object |
Source code in usd_chunks/chunk_core.py
get_label
⚓︎
Get the label of this chunk object, or its name if no label is set.
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
The label |
get_layer_identifier
⚓︎
Get the layer identifier used by the ChunkLayerManager.
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
the layer identifier for this param |
Source code in usd_chunks/chunk_core.py
get_scene
⚓︎
Easy access to the current chunk scene.
Returns:
| Name | Type | Description |
|---|---|---|
SceneSender |
SceneSender
|
The SceneSender of ChunkRegistry |
get_scene_stage
⚓︎
The scene's own stage, also inside a cook.
For the framework's work on the scene rather than a module's reading of it: muting a gate's branches, a chunk prim's bookkeeping, a unique name -- all of which a cook stage (get_stage inside a masked cook) would get wrong, holding only the cook's inputs.
Returns:
| Type | Description |
|---|---|
Stage | None
|
Usd.Stage: The stage held by the SceneSender of ChunkRegistry |
Source code in usd_chunks/chunk_core.py
get_stage
⚓︎
Easy access to the current UsdStage.
Inside a cook skip_cook runs on a stage of the chunk's inputs, this is that stage: it is all a module may read. See skip_cook.
Returns:
| Type | Description |
|---|---|
Stage | None
|
Usd.Stage: The stage held by the SceneSender of ChunkRegistry |
Source code in usd_chunks/chunk_core.py
has_flag
⚓︎
Check if a flag is enabled.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
flag
|
IntFlag
|
The flag to check |
required |
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
If the flag is enabled or not |
Source code in usd_chunks/chunk_core.py
has_state
⚓︎
is_deleting
⚓︎
Whether request_delete has been called on this object.
True from the start of the teardown onwards, and never reset: a deleted object is not reusable. Anything that holds on to a chunk past its own call -- a timer, a file watcher -- should check this before acting on it.
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True once deletion has started |
Source code in usd_chunks/chunk_core.py
request_delete
⚓︎
Ask the owners to delete this object; removing their references is their job.
If the object lies within a ChunkContainerBase, the container's remove_param_or_group is called with it. All callbacks are removed from the object and its owner is set to None.
Source code in usd_chunks/chunk_core.py
set_flag
⚓︎
set_selected
⚓︎
set_state
⚓︎
unset_flag
⚓︎
ChunkConfig
⚓︎
ChunkConfig(category='Chunks', icon='', description='Chunk description...', load_for_plugin=None, hosts=[], requirements=[], optional_requirements=[], required_modules=[], module='', interactive=False, cache_cook=False, cache_always=False, cook_on_open=False, new_values={}, cook_on_release=False, hidden=False, terminal=False, exec_inputs=1, dynamic_exec_inputs=False, cooks_when_wired_below=False, outputs=[], variants=[], gizmos=[])
Bases: AttributesBase
Base class for Configs. A config sets some load time configurations for a chunk.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
category
|
str
|
|
'Chunks'
|
icon
|
str
|
|
''
|
description
|
str
|
|
'Chunk description...'
|
load_for_plugin
|
str | None
|
|
None
|
hosts
|
list[str]
|
Built-in mutable sequence. If no argument is given, the constructor creates a new empty list. The argument must be an iterable if specified. |
<dynamic>
|
requirements
|
list[str]
|
Built-in mutable sequence. If no argument is given, the constructor creates a new empty list. The argument must be an iterable if specified. |
<dynamic>
|
optional_requirements
|
list[str]
|
Built-in mutable sequence. If no argument is given, the constructor creates a new empty list. The argument must be an iterable if specified. |
<dynamic>
|
required_modules
|
list[str]
|
Built-in mutable sequence. If no argument is given, the constructor creates a new empty list. The argument must be an iterable if specified. |
<dynamic>
|
module
|
str
|
|
''
|
interactive
|
bool
|
|
False
|
cache_cook
|
bool
|
|
False
|
cache_always
|
bool
|
|
False
|
cook_on_open
|
bool
|
|
False
|
new_values
|
dict
|
dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2) |
<class 'dict'>
|
cook_on_release
|
bool
|
|
False
|
hidden
|
bool
|
|
False
|
terminal
|
bool
|
|
False
|
exec_inputs
|
int
|
|
1
|
dynamic_exec_inputs
|
bool
|
|
False
|
cooks_when_wired_below
|
bool
|
|
False
|
outputs
|
list[tuple[str, str]]
|
Built-in mutable sequence. If no argument is given, the constructor creates a new empty list. The argument must be an iterable if specified. |
<dynamic>
|
variants
|
list[tuple[str, dict]] | Callable[[], list[tuple[str, dict]]]
|
Built-in mutable sequence. If no argument is given, the constructor creates a new empty list. The argument must be an iterable if specified. |
<dynamic>
|
gizmos
|
list[GizmoBase]
|
Built-in mutable sequence. If no argument is given, the constructor creates a new empty list. The argument must be an iterable if specified. |
<dynamic>
|
get_variants
⚓︎
The menu entries, building them first if they were declared lazily.
Memoised onto the field, so the callable runs once per process however many menus are drawn. Callers should use this rather than reading .variants, which may still be the callable.
Returns:
| Type | Description |
|---|---|
list
|
The variants, empty if building them failed. |
Source code in usd_chunks/chunk_core.py
ChunkContainerBase
⚓︎
ChunkContainerBase(name='', label='', tooltip='', icon='', user_data={}, layout=1, state=0, flags=0, widget_factory=None)
Bases: ChunkCommon
Base class for containers: Vectors, Groups and Chunks.
A container holds params (ChunkParamBase) and other containers.
Attributes:
| Name | Type | Description |
|---|---|---|
children |
NameSyncedContainer[ChunkCommon]
|
The container owning the child params |
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
|
''
|
label
|
str | None
|
|
''
|
tooltip
|
str | None
|
|
''
|
icon
|
str | None
|
|
''
|
user_data
|
dict[str, Any]
|
dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2) |
<class 'dict'>
|
layout
|
LayoutFlags
|
|
<LayoutFlags.VERTICAL: 1>
|
state
|
State
|
|
usd_chunks.chunk_flags.ChunkFlags.State(0)
|
flags
|
IntFlag
|
|
0
|
widget_factory
|
ChunkWidgetFactoryBase | None
|
|
None
|
check_hierarchy
⚓︎
A debug function for checking the hierarchy structure of a group.
Raises:
| Type | Description |
|---|---|
TypeError
|
An owner is not set to a child of this group |
TypeError
|
The owner of a child is not a ChunkNoticePropagator |
ValueError
|
The owner of a child does not itself hold the child |
NameError
|
Duplicate chunk in the hierarchy |
NameError
|
Duplicate name in the hierarchy |
Source code in usd_chunks/chunk_core.py
3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 | |
get_my_params
⚓︎
Get the params added directly to this container.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
predicate
|
Predicate[ValueT] | None
|
Only return params matching this. Defaults to None. |
None
|
Returns:
| Type | Description |
|---|---|
tuple[ChunkCommon, ...] | tuple[ValueT, ...]
|
tuple[ChunkCommon, ...]: The params |
Source code in usd_chunks/chunk_core.py
get_param
⚓︎
Find a param or group inside this container, by object, hash, name or dotted path.
For example::
my_chunk.get_param("groupA.groupB.param")
A bare name returns the first param with that name. A group requires unique names among its own children only, so several params in one hierarchy can share a name.
A predicate narrows and checks the result type::
p = my_chunk.get_param("a_slider", chunk.is_inst(chunk.Slider))
p.value = 10
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
param
|
ChunkCommon | str | HashVal
|
The param to find, or its name or path |
required |
predicate
|
Predicate[ValueT] | None
|
Only return the param if it matches this |
None
|
Returns:
| Type | Description |
|---|---|
ChunkCommon | None | ValueT
|
ChunkCommon | None: The param, or None if not found |
Source code in usd_chunks/chunk_core.py
get_params
⚓︎
Get every param in this container, nested ones included.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
predicate
|
Predicate[ValueT] | None
|
Only return params matching this. Defaults to None. |
None
|
Returns:
| Type | Description |
|---|---|
tuple[ChunkCommon, ...] | tuple[ValueT, ...]
|
tuple[ChunkCommon, ...]: The params |
Source code in usd_chunks/chunk_core.py
iter_hierarchy
⚓︎
Walk this container and everything under it, depth first.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
level
|
int
|
The depth of this container. Defaults to 0. |
0
|
Yields:
| Type | Description |
|---|---|
tuple[int, ChunkCommon]
|
tuple[int, ChunkCommon]: (depth, object), starting with this container |
Source code in usd_chunks/chunk_core.py
print_hierarchy
⚓︎
Print the container and its children as a tree, for debugging.
Source code in usd_chunks/chunk_core.py
remove_param_or_group
⚓︎
Remove a direct child of this container.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
param
|
ChunkCommon
|
The child to remove |
required |
Source code in usd_chunks/chunk_core.py
request_delete
⚓︎
Delete this container, and with it its children.
Source code in usd_chunks/chunk_core.py
ChunkContainerWidgetBase
⚓︎
Bases: Generic[GroupT]
Chunk is a base class for creating UI representation of chunk containers.
Source code in usd_chunks/chunk_core.py
276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 | |
group
property
⚓︎
The group this widget shows.
Raises:
| Type | Description |
|---|---|
ReferenceError
|
The group has been garbage collected. |
add_widget
abstractmethod
⚓︎
Add a child param's widget to the group's layout. Implemented by a subclass.
Called after the param has been added to the group.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
widget
|
ChunkContainerWidgetBase | ChunkParamWidgetBase
|
The widget to add |
required |
label
|
str
|
An optional label of the widget. Defaults to None. |
None
|
Raises:
| Type | Description |
|---|---|
NotImplementedError
|
A subclass does not implement it. |
Source code in usd_chunks/chunk_core.py
build_collapsable
abstractmethod
⚓︎
delete_self
abstractmethod
⚓︎
Delete this group widget. Implemented by a subclass.
Raises:
| Type | Description |
|---|---|
NotImplementedError
|
A subclass does not implement it. |
ensure_children_built
⚓︎
Build the child widgets a collapsed group deferred (see defer_collapsed_children).
Built from the group's params as they are now, so rows added while it was folded (a ListGroup grown by a load) arrive with the rest. Does nothing once built.
Source code in usd_chunks/chunk_core.py
get_widget_factory
abstractmethod
⚓︎
The widget factory that builds this group's param widgets.
Returns the group's own widget_factory; a UI plugin can override this to return its own.
Raises:
| Type | Description |
|---|---|
AttributeError
|
The group has no widget factory. |
Returns:
| Name | Type | Description |
|---|---|---|
ChunkWidgetFactoryBase |
ChunkWidgetFactoryBase
|
The factory that can create the valued parameters from ChunkParamBase objects |
Source code in usd_chunks/chunk_core.py
is_collapsed
⚓︎
Whether the group widget should be collapsed, because it or its parent is.
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if the group should be collapsed |
Source code in usd_chunks/chunk_core.py
remove_widget
abstractmethod
⚓︎
Remove a child param widget from this group widget. Implemented by a subclass.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
widget
|
Any
|
The widget to remove from the group widget |
required |
Raises:
| Type | Description |
|---|---|
NotImplementedError
|
A subclass does not implement it. |
Source code in usd_chunks/chunk_core.py
set_enabled
abstractmethod
⚓︎
Enable or disable the widget. Implemented by a subclass.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
val
|
bool
|
Whether to enable or disable the widget |
required |
Raises:
| Type | Description |
|---|---|
NotImplementedError
|
A subclass does not implement it. |
Source code in usd_chunks/chunk_core.py
set_expanded
abstractmethod
⚓︎
Expand the widget to show its child widgets, or collapse it to hide them.
Implemented by a subclass.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
checked
|
bool
|
Whether the group widget should be expanded or not |
required |
Raises:
| Type | Description |
|---|---|
NotImplementedError
|
A subclass does not implement it. |
Source code in usd_chunks/chunk_core.py
set_hidden
abstractmethod
⚓︎
Hide or show the widget. Implemented by a subclass.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
val
|
bool
|
Whether to hide or show the widget |
required |
Raises:
| Type | Description |
|---|---|
NotImplementedError
|
A subclass does not implement it. |
set_selected
abstractmethod
⚓︎
Show whether the group is selected. Does nothing by default.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
val
|
bool
|
Whether the group is selected |
required |
supports_widget
abstractmethod
⚓︎
Whether a widget belongs to this UI plugin's toolkit.
A Qt plugin, for example, returns isinstance(widget, QtWidgets.QWidget).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
widget
|
Any
|
The widget to check |
required |
Raises:
| Type | Description |
|---|---|
NotImplementedError
|
A subclass does not implement it. |
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if the widget is supported by the current ui plugin |
Source code in usd_chunks/chunk_core.py
update_from_flags
abstractmethod
⚓︎
Update the widget from the group's flags. Implemented by a subclass.
Raises:
| Type | Description |
|---|---|
NotImplementedError
|
A subclass does not implement it. |
update_from_layout
abstractmethod
⚓︎
update_from_state
abstractmethod
⚓︎
Apply the group's HIDDEN, DISABLED and SELECTED state to the widget.
A group is disabled only by its own DISABLED state. ParamFlags.OUTPUT means nothing for a group, and it shares a bit with GroupFlags.COLLAPSABLE, so testing it here would disable every collapsible group's children.
Source code in usd_chunks/chunk_core.py
update_label
abstractmethod
⚓︎
Update the label of this container.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str
|
The new label to display |
required |
update_param_label
abstractmethod
⚓︎
Correct a child's label in the layout when its name, label or LABELED flag changes.
If LABELED was unset, the label is removed and the widget spans the row; if it was set, the label is added; otherwise only the label text is updated. A UI plugin implements this to get labeled widgets.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
notice
|
Notice
|
The notice that was sent |
required |
sender
|
AttributeSender
|
The attribute that changed |
required |
Source code in usd_chunks/chunk_core.py
ChunkGroupBase
⚓︎
ChunkGroupBase(name='', label='', tooltip='', icon='', user_data={}, layout=1, state=0, flags=0, widget_factory=None)
Bases: ChunkContainerBase
Base class for dynamic containers, which can hold any number of children of any type.
Chunks and Groups are dynamic in that sense. Vectors are not, and do not subclass this.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
|
''
|
label
|
str | None
|
|
''
|
tooltip
|
str | None
|
|
''
|
icon
|
str | None
|
|
''
|
user_data
|
dict[str, Any]
|
dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2) |
<class 'dict'>
|
layout
|
LayoutFlags
|
|
<LayoutFlags.VERTICAL: 1>
|
state
|
State
|
|
usd_chunks.chunk_flags.ChunkFlags.State(0)
|
flags
|
IntFlag
|
|
0
|
widget_factory
|
ChunkWidgetFactoryBase | None
|
|
None
|
Attributes:
| Name | Type | Description |
|---|---|---|
children |
NameSyncedContainer[ChunkCommon]
|
The container owning the child params |
add_param
⚓︎
Add a param to this group's children.
Changes to the param propagate to this group, since they share the same hierarchy; see ChunkNoticePropagator. To add the same param several times, add clones::
group.add_param(param.clone())
group.add_params([param, param.clone(), param.clone()])
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
param
|
ChunkT
|
A parameter to add. May also be another ChunkContainer, which will nest the group |
required |
force_unique
|
bool
|
If a param already exists in the hierarchy, we most often do not want a direct duplicate. This enables the check, and if a duplicate exists, raises a ValueError. However, if the hash is unique but the name is a duplicate, this will resolve the name conflict by incrementing a numerical suffix. If set to False, this check is never performed, instead any duplicate will simply replace the old parameter. Defaults to True |
True
|
Returns:
| Name | Type | Description |
|---|---|---|
ChunkT |
ChunkT
|
The param |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the param is a direct duplicate (hash exists already) |
Source code in usd_chunks/chunk_core.py
add_params
⚓︎
Add several params, calling add_param on each.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
params
|
Iterable[ChunkCommon]
|
The chunk objects to add |
required |
force_unique
|
bool
|
Force unique param names. Defaults to True. |
True
|
clone
|
bool
|
Add clones instead of the params themselves. Defaults to False. |
False
|
Returns:
| Type | Description |
|---|---|
list[ChunkT]
|
list[ChunkCommon]: The added params, which differ from the input if clones were made |
Source code in usd_chunks/chunk_core.py
get_reserved_names
⚓︎
get_valid_child_name
⚓︎
A unique form of orig_name; see NameSyncedContainer.get_valid_child_name.
Delegated to self.children (the NameSyncedContainer that owns the authoritative
name map) rather than implemented here, so the per-prefix "next index to try"
cache lives in one place and applies to every path that renames a new or existing
child -- this one and ChunkCommon._unique_among_siblings's rename path alike.
Source code in usd_chunks/chunk_core.py
resolve_new_param
⚓︎
The param, renamed if its name conflicts with another child of this group.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
param
|
ChunkParamBase
|
A param or container |
required |
Returns:
| Name | Type | Description |
|---|---|---|
ChunkT |
ChunkT | None
|
The param, possibly with a new name |
Raises:
| Type | Description |
|---|---|
ValueError
|
The same param (same hash) is already here |
Source code in usd_chunks/chunk_core.py
ChunkListGroupBase
⚓︎
ChunkListGroupBase(name='', label='', tooltip='', icon='', user_data={}, layout=1, state=0, flags=0, widget_factory=None, size=0)
Bases: ChunkGroupBase
Base class for list containers, whose rows each hold proxies of the children.
Besides the container's children, the group holds one group per row, holding proxies of those children. A UI shows the rows (proxy_params) and hides the children. A proxy is practically identical to the param it references, except for its 'value': renaming the referenced param renames every proxy of it. Proxies are read and set like regular params, but reached through get_indexed_param() rather than get_param().
get_params() and get_my_params() return the proxies; get_param() does not, and returns from the 'children' container the proxies reference. So get_param() changes every row at once, and add_param() adds a param to every row.
Attributes:
| Name | Type | Description |
|---|---|---|
proxy_params |
list[ChunkGroupBase]
|
The groups holding each row's proxies. Managed internally, never modified from outside |
children |
NameSyncedContainer[ChunkCommon]
|
The container owning the child params |
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
|
''
|
label
|
str | None
|
|
''
|
tooltip
|
str | None
|
|
''
|
icon
|
str | None
|
|
''
|
user_data
|
dict[str, Any]
|
dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2) |
<class 'dict'>
|
layout
|
LayoutFlags
|
|
<LayoutFlags.VERTICAL: 1>
|
state
|
State
|
|
usd_chunks.chunk_flags.ChunkFlags.State(0)
|
flags
|
IntFlag
|
|
0
|
widget_factory
|
ChunkWidgetFactoryBase | None
|
|
None
|
size
|
int
|
|
0
|
get_indexed_param
⚓︎
The proxy of a param in one row.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
param
|
ChunkCommon | str | HashVal
|
The param to look for, or its name |
required |
index
|
int
|
The row, an index into proxy_params |
required |
predicate
|
Predicate[ValueT] | None
|
Only return the proxy if it matches this. Defaults to None |
None
|
Returns:
| Type | Description |
|---|---|
ChunkCommon | None | ValueT
|
ChunkCommon | None: The proxy of param in that row |
Raises:
| Type | Description |
|---|---|
IndexError
|
If the index is out of bounds |
Source code in usd_chunks/chunk_core.py
remove_index
⚓︎
Remove one row, reducing the size by 1.
The row's group gets request_delete(). An index out of range is logged and ignored.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
index
|
int
|
The row to remove |
required |
Source code in usd_chunks/chunk_core.py
ChunkParamBase
⚓︎
ChunkParamBase(name='', label='', tooltip='', icon='', user_data={}, layout=0, state=0, flags=0, default_value=None, custom_widget=None)
Bases: Generic[ValueT], ChunkCommon, ChunkUsdAttributeSupport
Base class for valued params.
Attributes:
| Name | Type | Description |
|---|---|---|
value |
ValueT
|
The value of this parameter |
driven_scale |
float
|
|
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
|
''
|
label
|
str | None
|
|
''
|
tooltip
|
str | None
|
|
''
|
icon
|
str | None
|
|
''
|
user_data
|
dict[str, Any]
|
dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2) |
<class 'dict'>
|
layout
|
LayoutFlags
|
|
<LayoutFlags.HORIZONTAL: 0>
|
state
|
State
|
|
usd_chunks.chunk_flags.ChunkFlags.State(0)
|
flags
|
IntFlag
|
|
0
|
default_value
|
ValueT | None
|
|
None
|
custom_widget
|
ChunkParamWidgetBase | None
|
|
None
|
raw_value
property
⚓︎
The stored value before expression evaluation. Use this for display purposes.
add_dependency
⚓︎
Add a DagNode input; refused across a chunk boundary.
A param-level dependency is in-memory only: ChunkStageSync._on_dependency_added authors inputs:chunk for ChunkBase pairs and returns early for anything else, so an edge between two params is never written to USD, draws no wire in the node graph, and is gone after a reload. Within one chunk that is exactly right -- this is the dirty/ordering edge behind set_function, and it can drive attributes (menu_items, a label, visibility) that no expression can reach. Across two chunks it is a connection nobody can see, and the solve no longer tells a chunk what reaches it across one (chunk_notice: chunks speak only through wires), so it would not even update. An expression is the wire that persists; connect_value redirects to one.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input
|
ChunkNoticePropagator
|
The propagator to depend on. |
required |
Returns:
| Type | Description |
|---|---|
int
|
The dependency index. |
Raises:
| Type | Description |
|---|---|
ValueError
|
input is a param of another chunk. |
Source code in usd_chunks/chunk_core.py
connect_value
⚓︎
Make this param's value follow another param's.
Across chunks this authors an expression instead of a DagNode edge, since an expression is written to USD, draws a wire and survives a reload.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
other
|
ChunkParamBase[ValueT]
|
The param to follow. |
required |
Raises:
| Type | Description |
|---|---|
ValueError
|
The two params' types are not compatible, or other is in another chunk and no @Node.param@ reaches it -- its name resolves to a different param of that chunk. |
Source code in usd_chunks/chunk_core.py
evaluate_type
⚓︎
The ParamType this param has right now.
If get_type() allows several types (FLOAT_SLIDER | INT_SLIDER), this decides which one is in use.
Returns:
| Type | Description |
|---|---|
ParamType
|
ChunkFlags.ParamType: The runtime type. get_type() by default |
Source code in usd_chunks/chunk_core.py
get_type
classmethod
⚓︎
The ParamType of this param class, which decides the widget a UI builds for it.
Required of every valued param. If this returns a combination of ParamTypes, the subclass also implements evaluate_type() to pick the one in use at runtime.
Returns:
| Type | Description |
|---|---|
ParamType
|
ChunkFlags.ParamType: The type. NONE by default; subclasses override it |
Source code in usd_chunks/chunk_core.py
network_namespace
⚓︎
The scene root every prim path this param names is relative to.
That is the namespaces of the network hosts enclosing it (chunk_stage.host_networks), outermost first, joined. Empty outside any namespaced host, which is the common case and costs a walk up the owner chain.
Returns:
| Type | Description |
|---|---|
str
|
The namespace, "" outside any namespaced host. |
Source code in usd_chunks/chunk_core.py
refresh_expression_value
⚓︎
Re-announce this param's value because what its expression reads has changed.
The raw text is untouched -- only what it resolves to moved -- so nothing would otherwise fire: widgets keep showing the old number and the USD attrs this param drives keep the old value. Used by an expression ref changing upstream and by a Stage Expression changing a variable.
Source code in usd_chunks/chunk_core.py
ChunkUsdAttributeSupport
⚓︎
Bases: AttributesBase
Mixin that lets a valued param be bound to a USD attribute.
A param can then be built from a Usd.Attribute, with the NoticeConnections that keep the param's value and the attribute in sync.
Attributes:
| Name | Type | Description |
|---|---|---|
driven_scale |
float
|
|
connect_usd_attr
⚓︎
Drive a real prim attribute from this param's storage attribute via a USD connection.
The storage attr becomes the connection source; the real attr is the target. If the real attr does not exist yet it is created in _author_driven_connections once the storage attr is known. If the storage attr is not yet known the whole operation is deferred until _connect_param_attr is called.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
attr
|
Property
|
The real prim attribute to drive (e.g. /cameras/Cam.focalLength). May be an invalid/non-existent attribute -- the path is stored and the attribute is created on demand. |
required |
var_selections
|
tuple
|
The (anchor_prim_path, vs_name, variant) tuples active when attr was resolved, if any -- see _driven_var_selections. chunk_stage._drive_from_storage passes the param's own _var_selections through here when it promotes a direct real-attr binding (show_attribute) into one the storage attr drives. |
()
|
Source code in usd_chunks/chunk_core.py
driven_value
⚓︎
The value as the driven attributes take it: a number times driven_scale.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
Any
|
The param's resolved value. |
required |
Returns:
| Type | Description |
|---|---|
Any
|
The value scaled, or unchanged when it is not a number or the scale is 1. |
Source code in usd_chunks/chunk_core.py
from_usd_attr
classmethod
⚓︎
Create a param from a Usd.Attribute, bound so the param's changes write the attribute.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
attr
|
Attribute
|
The attribute to represent as a param |
required |
*args
|
Passed to the param constructor. |
()
|
|
**kwargs
|
Passed to the param constructor; |
{}
|
Returns:
| Name | Type | Description |
|---|---|---|
ChunkUsdAttributeSupport |
ChunkUsdAttributeSupport
|
The new param |
Source code in usd_chunks/chunk_core.py
get_usd_prop
⚓︎
Return the storage attribute this param is bound to.
Returns:
| Type | Description |
|---|---|
Property | None
|
Usd.Property | None: The bound storage USD property, or None. |
Source code in usd_chunks/chunk_core.py
release_usd_attr
⚓︎
Stop driving attr (the undo of connect_usd_attr): this param no longer writes its value there. The connection already authored stays in the chunk's layer until its next cook, which starts that layer afresh.
Source code in usd_chunks/chunk_core.py
set_usd_prop
⚓︎
Bind this param to a specific USD property with an explicit sender (used for relationships).
Prefer _connect_param_attr for standard attribute binding.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
prop_path
|
str | Property
|
The property, or its path. |
required |
sender
|
AttributeSender
|
The AttributeSender whose changes are written to the property. |
required |
Source code in usd_chunks/chunk_core.py
update_usd_prop
abstractmethod
⚓︎
Write the param's change to the USD relationship it is bound to, if it is one.
Invoked when the 'value' AttributeSender changes. notice.data is that sender, never the property: an attribute is written by ChunkParamBase.data_changed (and a vector's by ChunkVectorBase.data_changed), so all that is left here is a relationship, which those cannot write -- they look the path up with GetAttributeAtPath.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
notice
|
AttributeChangeNotice
|
The value change |
required |
sender
|
AttributeSender
|
The sender of the notice |
required |
Source code in usd_chunks/chunk_core.py
usd_prop_changed
abstractmethod
⚓︎
Update the bound AttributeSender's value from the USD attribute after the attribute changes.
Source code in usd_chunks/chunk_core.py
ChunkVectorBase
⚓︎
ChunkVectorBase(name='', label='', tooltip='', icon='', user_data={}, layout=1, state=0, flags=0, widget_factory=None, param=None, length=0, suffixes=None, _default_value=None, is_output=False)
Bases: ChunkContainerBase, ChunkUsdAttributeSupport
Base class for vector params: a container with a fixed number of params.
A vector is used like a valued param, with 'value' reading and writing its children::
vec = chunk.Vector("my_vec", param=chunk.Slider(), length=3, suffixes="xyz")
vec[0] = 10
vec.x = 10
vec.value = (0, 1, 2)
Attributes:
| Name | Type | Description |
|---|---|---|
driven_scale |
float
|
|
children |
NameSyncedContainer[ChunkCommon]
|
The container owning the child params |
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
|
''
|
label
|
str | None
|
|
''
|
tooltip
|
str | None
|
|
''
|
icon
|
str | None
|
|
''
|
user_data
|
dict[str, Any]
|
dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2) |
<class 'dict'>
|
layout
|
LayoutFlags
|
|
<LayoutFlags.VERTICAL: 1>
|
state
|
State
|
|
usd_chunks.chunk_flags.ChunkFlags.State(0)
|
flags
|
IntFlag
|
|
0
|
widget_factory
|
ChunkWidgetFactoryBase | None
|
|
None
|
param
|
ChunkParamBase
|
|
None
|
length
|
int
|
|
0
|
suffixes
|
Sequence[str] | str | None
|
|
None
|
is_output
|
bool
|
|
False
|
raw_value
property
⚓︎
The stored expression string, or the tuple of children's raw values.
value
property
writable
⚓︎
The components' values as a tuple, or the resolved expression if one is set.
__getitem__
⚓︎
A component by index or name, e.g. vec[0] or vec["x"].
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key
|
str | int
|
name or index of the component |
required |
Raises:
| Type | Description |
|---|---|
KeyError
|
if key is not accessible |
Returns:
| Name | Type | Description |
|---|---|---|
ChunkParamBase |
ChunkParamBase
|
The component param |
Source code in usd_chunks/chunk_core.py
__setitem__
⚓︎
Set a component's value by index or name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key
|
str | int
|
The component's index or name. |
required |
val
|
Any
|
The new value. |
required |
Raises:
| Type | Description |
|---|---|
ValueError
|
The component is a container, not a valued param. |
Source code in usd_chunks/chunk_core.py
evaluate_type
⚓︎
get_type
⚓︎
has_flag
⚓︎
Check a flag, reading OUTPUT from is_output rather than from .flags.
A vector's flags are GroupFlags, and ParamFlags.OUTPUT shares a bit with one of them; see the is_output field. Everything else defers to the normal check.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
flag
|
IntFlag
|
The flag to check. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True if the flag is set. |
Source code in usd_chunks/chunk_core.py
HashVal
⚓︎
NameSyncedContainer
⚓︎
Bases: Generic[ChunkT], ChunkNoticePropagator
The container holding a chunk object's children, indexed by hash and by name.
Both maps are ChainMaps that also reach every nested NameSyncedContainer, so a nested child is found without iterating the hierarchy. The get_* methods search nested containers too; the get_my_* methods only this one.
params maps a hash to a ChunkCommon. ChunkCommon objects hash by their uuid, so a param can be looked up by the object itself or by obj._hashable; where a lookup is typed as taking a HashVal (get_param(), get_my_param()), passing the object works the same.
names maps each param's current (mutable) name to its hash, for fast lookup by name. It must be kept up to date whenever a name changes, which is why this class is a ChunkNoticePropagator: it sits in the object hierarchy and updates the mapping when a name changes.
Anything added with add() gets this container as its owner, so a chunk object holding one should own the container and never manage its params' ownership itself. The container sends no notices of its own; it only propagates its children's.
Source code in usd_chunks/chunk_core.py
__contains__
⚓︎
Whether obj is held here or anywhere nested, by identity (its hash).
The nested hierarchy is not materialised -- see resolve_new_param for why that matters.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
obj
|
ChunkCommon | ProxyParam
|
The chunk object. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True if it is held. |
Source code in usd_chunks/chunk_core.py
__copy__
⚓︎
A new container holding copies of this one's direct children, and its callbacks.
Source code in usd_chunks/chunk_core.py
__delitem__
⚓︎
Remove a child, sending PARAM_REMOVED and releasing its ownership.
Source code in usd_chunks/chunk_core.py
add
⚓︎
Add a chunk object to this container, which becomes its owner.
The object is stored in params and its name in names, so it can be found with get_param() and get_by_name(). The container maintains the name-to-object relationship, so never add to params or names directly; use this.
If the object is a ChunkContainerBase, its children are chained into this container's maps, which gives fast access to nested params.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
obj
|
ChunkCommon | ProxyParam
|
The object to add. Nothing is done to avoid duplication across layers. |
required |
send
|
bool
|
Send PARAM_ADDED for it. Defaults to True. |
True
|
Source code in usd_chunks/chunk_core.py
add_nested
⚓︎
Appends nested params to the ChainMap. This allows for fast lookups across the layers.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
nested
|
'NameSyncedContainer[ChunkT]'
|
The nested params to add |
required |
Source code in usd_chunks/chunk_core.py
clear
⚓︎
Clear all children from this container.
The children are not deleted explicitly, as references to them may be held elsewhere, but in practice they are, because other objects should only hold weakrefs to params.
Source code in usd_chunks/chunk_core.py
create_proxy
staticmethod
⚓︎
Fill target with a ProxyParam for each of source's direct children.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
NameSyncedContainer
|
The container to mirror. |
required |
target
|
NameSyncedContainer
|
The container to fill. |
required |
Returns:
| Type | Description |
|---|---|
|
|
Source code in usd_chunks/chunk_core.py
empty
⚓︎
get_by_name
⚓︎
Find a param by name, or by a dotted path through nested groups.
For example::
my_chunk.get_param("groupA.groupB.slider")
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The name or dotted path. |
required |
predicate
|
Predicate[ValueT] | None
|
Only return the param if it matches this. |
None
|
Returns:
| Type | Description |
|---|---|
ChunkT | None | ValueT
|
ChunkCommon | None: The param, or None if not found |
Source code in usd_chunks/chunk_core.py
get_my_names
⚓︎
get_my_params
⚓︎
Get the params at this level only.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
predicate
|
Predicate[ValueT] | None
|
Only return params matching this. |
None
|
Returns:
| Type | Description |
|---|---|
tuple[ChunkT, ...] | tuple[ValueT, ...]
|
tuple[ChunkCommon, ...]: The params |
Source code in usd_chunks/chunk_core.py
get_param
⚓︎
Find a param by hash, by object, or by name or dotted path.
A string that is a path to a param, such as aChunk.aGroup.aParam, finds the param at that path; a bare name finds the first param with that name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key
|
ChunkHash | str
|
A ChunkCommon (it hashes to its HashVal), a HashVal, or a name or path. |
required |
predicate
|
Predicate[ValueT] | None
|
Only return the param if it matches this. |
None
|
Returns:
| Type | Description |
|---|---|
ChunkT | None | ValueT
|
ChunkCommon | None: The param, or None if not found |
Source code in usd_chunks/chunk_core.py
get_params
⚓︎
Get every param at this level and all nested levels.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
predicate
|
Predicate[ValueT] | None
|
Only return params matching this. |
None
|
Returns:
| Type | Description |
|---|---|
tuple[ChunkT, ...] | tuple[ValueT, ...]
|
tuple[ChunkCommon, ...]: The params |
Source code in usd_chunks/chunk_core.py
get_valid_child_name
⚓︎
A unique form of orig_name, numbered so it does not clash with reserved_names.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
orig_name
|
str
|
The name to make valid |
required |
reserved_names
|
set[str]
|
The names already taken. The new name is added to it, so a group nested inside an already created group gets a unique name too |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
a unique name |
Source code in usd_chunks/chunk_core.py
name_changed
⚓︎
Re-key a renamed child in this level's names map.
The entry for old_name is replaced by the object's new name, so the child is found by its new name and no longer by its old one::
c = chunk.Slider("A")
g = chunk.Group("group")
g.add_param(c)
assert g.get_param("A") is not None
c.name = "B"
assert g.get_param("B") is not None and g.get_param("A") is None
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
old_name
|
str
|
The name the object was mapped under |
required |
Raises:
| Type | Description |
|---|---|
ValueError
|
The old_name was not found |
Source code in usd_chunks/chunk_core.py
pop
⚓︎
Remove and return the child at key.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key
|
ChunkHash
|
The chunk object to remove |
required |
Returns:
| Type | Description |
|---|---|
ChunkCommon | None
|
ChunkCommon | None: The removed object, or None if it is not here |
Source code in usd_chunks/chunk_core.py
send_added
⚓︎
Sends a PARAM_ADDED notice with the new obj as notice data and owner as the sender.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
obj
|
ChunkCommon | ProxyParam
|
the new parameter |
required |
Source code in usd_chunks/chunk_core.py
send_removed
⚓︎
Sends a PARAM_REMOVED notice with the new obj as notice data and owner as the sender.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
obj
|
ChunkCommon | ProxyParam
|
the removed parameter |
required |
Source code in usd_chunks/chunk_core.py
ProxyParam
⚓︎
Bases: ChunkNoticePropagator
A param that stands in for a concrete one, holding only its own value and children.
The proxy stores a unique value, and unique children if the param is a group. That is what list rows need: one original group dictates the content of every row, and each row holds its own values. Any attribute except 'value' can be changed on the original, and the proxies follow.
The proxy has its own hash; the original is its param_ref. ChunkCommon's _hashable attribute is not overridden, so ProxyParam._hashable evaluates to the referenced HashVal.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
param
|
ChunkCommon
|
The chunk object to stand in for |
required |
Source code in usd_chunks/chunk_core.py
PySyntaxHighlightMapping
⚓︎
Bases: SyntaxHighlightMapping
Highlighting for Python source: class and def lines, and comments.
Source code in usd_chunks/chunk_core.py
SyntaxHighlightMapping
⚓︎
Regex patterns mapped to the style of the text they match, for a code viewer.
Source code in usd_chunks/chunk_core.py
add_mapping
⚓︎
match_text
⚓︎
Every styled span in text.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str
|
The text to highlight. |
required |
Yields:
| Type | Description |
|---|---|
tuple[int, int, SyntaxHighlightStyle]
|
(start, end, style) for each match of each pattern. |
Source code in usd_chunks/chunk_core.py
SyntaxHighlightStyle
⚓︎
Bases: TypedDict
How highlighted text is drawn: a colour, optionally italic or bold.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
color
|
ForwardRef('Required[str]', module='usd_chunks.chunk_core')
|
|
required |
italic
|
ForwardRef('bool', module='usd_chunks.chunk_core')
|
|
required |
bold
|
ForwardRef('bool', module='usd_chunks.chunk_core')
|
|
required |
UnregisteredChunkTypeError
⚓︎
Bases: TypeError
A chunk whose class is defined outside the framework and outside its registered module.
Raised when such a chunk is added to a scene; see check_chunk_type.
UsdSyntaxHighlightMapping
⚓︎
Bases: SyntaxHighlightMapping
Highlighting for usda text: class, def and over lines.
Source code in usd_chunks/chunk_core.py
all_chunks
⚓︎
Every chunk inside the given ones, groups excluded, at any depth.
Source code in usd_chunks/chunk_core.py
check_chunk_type
⚓︎
Refuse a chunk whose behaviour a saved file could not bring back.
A chunk can't do anything its module doesn't define, so a saved file is always the whole description of what the network does: behaviour comes only from a registered chunk module, and data lives in USD. The one way round that is a chunk class -- a subclass of Chunk with methods, callbacks wired in init or overrides -- defined somewhere a reopen never runs: a script, the interpreter, a test. It would work for this session and come back from the file as its registered type (or a plain runtime chunk), silently without whatever the class added.
So a chunk entering a scene must be one of:
- a framework class (Chunk, ChunkBase, a context -- anything in usd_chunks). It has no behaviour of its own: its hooks are looked up in its registered module, and one with no module has none (a chunk built in the interpreter, a tab context). Callbacks a script adds to it are session-only by design, like a script editor's.
- a class defined in the registered module its config names. That is the module a reopen runs, so the class comes back with it.
Compared by the registry's module name, not by module object: a chunk module can exist twice in sys.modules under different keys (its bare name, and a package path), and both resolve to one registered module. ChunkBase nested inside c are checked too, against their own module or, lacking one, c's -- the module whose main() built them.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
c
|
ChunkBase
|
The chunk being added. |
required |
fallback
|
ChunkModule | None
|
The module c answers to when it has none of its own: that of the chunk it is being nested into, when that one is already in a scene. |
None
|
Raises:
| Type | Description |
|---|---|
UnregisteredChunkTypeError
|
c, or a chunk nested in it, has such a class. |
Source code in usd_chunks/chunk_core.py
group_parent_path
⚓︎
The prim path a group sits under: what decides which groups are its siblings.
A restored group knows its own prim path. A group being created does not yet, so it takes its parent group's path, or the /chunks scope for one with no parent.
Source code in usd_chunks/chunk_core.py
is_inst
⚓︎
Create a predicate that checks, and narrows the type of, an instance of cls.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cls
|
type[ValueT]
|
The type to check |
required |
Returns:
| Type | Description |
|---|---|
Predicate[ValueT]
|
Predicate[ValueT]: The predicate function |
Source code in usd_chunks/chunk_core.py
iter_params_and_rows
⚓︎
chunk.get_params(), plus every list-group row, which get_params leaves out.
Source code in usd_chunks/chunk_core.py
list_row_of
⚓︎
Row index of a list-group template param, or None if there is no such row.
What an @Node.param[index]@ expression names. A missing row is None rather than an error: rows come and go at runtime, and a ref to one that is gone reads the default the way a ref to a missing param does.
Source code in usd_chunks/chunk_core.py
list_row_ref
⚓︎
The name an expression reads row by -- "item[1]" -- or None if it is not a row.
Source code in usd_chunks/chunk_core.py
params_bound_to
⚓︎
The params currently bound to this USD property path (see _params_by_attr_path).
preview_cook
⚓︎
Whether this cook may be a cheap preview: a handle is being dragged in node's scene.
Asked from a slow chunk's execute(node), downstream of what is dragged -- an IK bake over a hundred frames behind a target's handle. True while the drag is on: the chunk cooks a rougher result that keeps up with the mouse, and the framework cooks it again in full when the last drag ends. False otherwise, and the cook is the real one.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
node
|
ChunkBase
|
The chunk cooking, as handed to execute(node). |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True when the chunk may cook a preview. |