Skip to content
weSkelDOCUMENTATION
Documentation/Scripting/How it works

How it works

Maya nodes and their Python properties.

WrappersSpecsAPI 2.0

A wrapper represents a Maya node in Python. Its specs describe attributes exposed as properties, alongside the properties and methods defined directly by the class.

Principle Behavior
Node types Each concrete wrapper corresponds to a supported Maya type. Base classes such as Node, DGNode and DAGNode form the architecture’s abstract foundations and provide shared behavior. They can still represent existing nodes.
Inheritance A class inherits its parents’ properties, methods and specs, then adds or overrides its own members.
Accepted inputs A node name (str) provides simple access, particularly for snippets in Maya. An already resolved OM2 object suits code working directly with scene objects. Each constructor documents its accepted types.
Resolution and reuse A str requires finding the Maya object by name. Reusing an already resolved MObject avoids this lookup at the wrapper’s input; identity checks and some internal conversions still apply.
Maya objects The wrapper also exposes its native objects: node.mobject returns its MObject, which can be used directly in an OM2 call.

An attribute defines data: its type, structure and characteristics. A plug represents that attribute on a specific node, or one of its children or elements. It provides access to values and connections, including when no connection exists.

Class Role
Plug Access to one value and its connections, based on om.MPlug.
PlugArray A collection of plugs, based on om.MPlugArray. This container is not a Maya multi attribute.
Plugs The manager available through node.plugs: plug lookup, inspection, and attribute creation or management.

For an existing Transform, with node = Transform("name"):

Use Syntax and behavior
Plug node.plugs["translateX"] — Returns the corresponding Plug; the short name "tx" is also accepted. Indexing takes place on node.plugs.
Reading plug.value — Queries the plug’s current value.
Writing plug.value = value — Assigns a value to the plug, according to its type and write conditions.
Outgoing connection source_plug >> destination_plug — Connects source to destination; equivalent to source_plug.connect_to(destination_plug).
Multiple destinations source_plug >> [plug_a, plug_b] — Connects the same source to each destination in the list.
Incoming connection destination_plug << source_plug — The same connection direction, written from the destination; equivalent to destination_plug.connect_from(source_plug).

For >>, the source is a weSkel Plug. The destination may be a Plug, an om.MPlug, a PlugArray, an om.MPlugArray, or a list / tuple of plugs. This is a collection of destinations, not automatic connection to the elements of a multi attribute.

For <<, the destination is a weSkel Plug and the source is a single Plug or om.MPlug. Both operators return None and cannot be chained. They retain the methods’ force=False behavior: an existing incoming source is not replaced automatically.

Each attribute covered by a spec becomes a wrapper property. Its Python name uses snake_case, while the Maya name stays unchanged: translateX is therefore accessible as translate_x. Inherited properties work the same way.

With node = Transform("name") for an existing node:

Access Result
Reading node.translate_x — Accesses the property and returns its proxy.
Writing node.translate_x = 5 — Writes translation X in the current UI distance unit, provided the plug is writable.
Python value node.translate_x.value — Returns this property’s Python value, a float here.
Python type type(node.translate_x.value) — Inspects the value’s type. type(node.translate_x) gives the proxy’s type, not the value’s type.

A spec describes the mapping in six fields:

Field Role
public_name Python property name.
plug_name Exact Maya attribute name or path.
cache_name Internal storage name declared by the spec.
kind Access type and structure: scalar, unit, matrix, compound, array…
default_value Declared default, used according to the resolution mechanism.
flags Attribute characteristics, used in particular to select values and connections for capture or replay.

Declared and inherited specs determine which properties exist. Declaring a spec does not itself create a Maya attribute. Attributes without a spec remain accessible through node.plugs. Function-set-only accessors are not plugs.

Properties are defined on the class; their data is resolved on demand. Initializing a wrapper does not load every property’s value.

Access Behavior
Reading Delegated properties first read the value from Maya. If a live read is unavailable, resolution may use a cached value, then the declared default. A fallback value therefore does not prove that a plug exists.
Value or proxy Depending on its kind, a property returns a value or a suitable proxy. Value proxies expose .value, .plug and .mplug; each reference documents the actual return type.
Writing A property with a setter passes its value to the corresponding write mechanism. For delegated properties, an unsuccessful write may leave a staged value in the cache: assignment alone does not prove that the scene changed.
Access conditions The setter, attribute type and Maya state determine what can be changed. A spec does not make a computed output or a driven plug freely writable.
Units Access through Plug.value may return MDistance, MAngle or MTime. Unit-spec properties may expose a converted number; their reference specifies the unit.
Structure Access
Compound Groups several children; its property may expose a compound value or a proxy providing access to those children.
Array / multi Elements use Maya logical indices, which may be sparse. Position in a value list does not replace a logical index.
Typed array Data containing an array, such as a doubleArray, is not a multi made of indexed plugs. Its kind determines the appropriate access.
Nested structures Paths, proxies and write capabilities depend on the native structure. The class reference documents limitations and alternative access paths.

The API reference separates own and inherited members, Python properties and spec properties. See SVD & snapshots for capturing and restoring their state.