Skip to content
weSkelDOCUMENTATION
Documentation/Scripting/SVD & snapshots

SVD & snapshots

Read, capture and restore plug and wrapper state.

SVDSnapshots

SVD stands for Source / Value / Destinations. weSkel uses this model to describe a plug’s state: what drives it, its value and what it feeds. A snapshot captures data from a plug, selected attributes or a node, within the scope supported by its format. A wrapper snapshot can then be applied to the node again.

Component Meaning
Source The upstream plug driving the value, or no source.
Value The value read from the plug. A live view can read the evaluated value even when a source exists; during replay, a local value does not replace an active driver.
Destinations The downstream plugs fed by this plug.

A wrapper capture walks its own and inherited specs to record plug values, incoming connections and outgoing connections, then adds class-specific data. It retains the state supported by that wrapper; some runtime entries are omitted.

Use Syntax and result
Live view node.svd(plug) → SVDView: each read queries the current plug. The view does not capture a copy.
Single-plug capture svd_from_plug(plug) → SVDPlug: one plug’s data at capture time, including connection names.
Targeted capture node.snapshot_svd(attrs) → SVDSnapshot: SVD data for explicitly requested Maya attributes, keyed by long path. Unresolved attributes are skipped; check the captured keys.
Node state node.snapshot() → A wrapper-specific state dictionary, built from its specs and class-specific additions. This is the format used by finalize(snapshot).

The two snapshot formats are not interchangeable. A SVDSnapshot has no replay method and cannot be passed directly to finalize(). A capture no longer follows scene changes, but is not necessarily a fully immutable Python object.

node.finalize(snapshot) applies selected operations to the existing node. Entry flags help select those operations. The DG base replays them in this order:

Order Operation
1 · Sources Restore requested incoming connections.
2 · Values Apply values to undriven plugs; inputs already driven are skipped.
3 · Destinations Restore requested outgoing connections.

apply_values and apply_connections select value and connection operations. Function-set operations are separate and disabled by default through apply_fset=False. Some wrappers add their own restoration steps. DAG parenting is requested explicitly through set_parent().

With strict=True, DG replay stops at the first error. By default, it emits a Maya warning and continues. Operations already applied are not rolled back automatically.

Aspect Behavior
Covered data Scope depends on the wrapper’s specs and additions. A custom attribute without a spec is not automatically included in node.snapshot(); a targeted capture can request it through snapshot_svd(attrs).
Connections and indices Replay does not globally remove connections or array indices absent from the capture, and does not forcibly replace an existing incoming source.
Captured names External plug names must still identify the intended targets at replay time. They are not persistent UUID references.
Saving to disk JSON export requires serializable data and suitable conversion of OM2 objects. A Transform snapshot contains an MTransformationMatrix, for example: json.dumps(snapshot) alone cannot serialize it. Loading must also restore the types expected by replay.

References: SVDView · SVDPlug · SVDSnapshot · DGNode. Property declarations are covered in How it works.