Skip to content
weSkelDOCUMENTATION
Documentation/API reference/Plug

Plug

Values, structure and connections of a Maya attribute.

ClassAPI 2.0SDK

Plug wraps an existing attribute. It provides typed reads, child and multi access, and explicit connections. To create an attribute, use Plugs.

om.MPlugPlug
from weSkel.src.core.node.extensions.plugs_lib import Plug

Run in Maya with weSkel available. om.* types refer to maya.api.OpenMaya.

Item Value
Class Plug
Module weSkel.src.core.node.extensions.plugs_lib
Direct parent om.MPlug
Kind Maya API 2.0 subclass
Spec properties None.

This reference documents members defined by this class. Standard Python mechanisms and native inherited members are outside its member counts.

Native inherited members: om.MPlug — Autodesk.

Plug(arg1: Union[om.MPlug, om.MObject, str], arg2: Optional[Union[om.MObject, str]]=None) → Plug

Parameter Type Default
arg1 Union[om.MPlug, om.MObject, str] required
arg2 Optional[Union[om.MObject, str]] None

Accepted forms: Plug(mplug), Plug("node.attr"), Plug(node_mobject, attr_mobject) or Plug(node_mobject, "attr.path[3]"). Names must resolve; no node or attribute is created. Plug() without an argument is not accepted; use Plug(om.MPlug()) for a null plug. Incompatible types: TypeError; resolution may raise ValueError or a Maya error.

Own members. R = read only; R/W = read and write.

Property Return type Access Purpose
value Any R/W Current plug value; assignment calls set().
long_name str R Name including node and full attribute path.
short_name str R Name including node, without the full compound path.
long_attribute_name str R Full attribute path without the node prefix.
short_attribute_name str R Attribute name without node or full compound path.
is_null bool R The native plug is null.
src Optional[Plug] R Incoming logical source, or None.
dst PlugArray R Outgoing logical destinations; empty collection when absent.
is_default_value bool R The value matches the native attribute default.
default_value Union[bool, int, float] Limited R/W Scalar attribute default, independent of its current value.
is_free_to_change int R Native integer state: compare with om.MPlug.kFreeToChange.
keyable bool R/W Channel keyable flag.
channel_box bool R/W Channel Box display flag.
locked bool R/W Local plug lock flag.
attribute_object om.MObject R Maya object defining the attribute.
attribute_fn om.MFnAttribute R Function set attached to the current attribute.
categories Tuple[str, ...] R Categories declared on the Maya attribute.
nice_name Optional[str] R/W Explicit nice-name override, or None.
attribute_type int R API attribute type identifier.
is_numeric bool R The attribute supports a numeric function set.
is_typed bool R The attribute holds typed data.
is_matrix bool R The attribute is a native matrix attribute.
is_enum bool R The attribute is an enum.
is_unit bool R The attribute represents an angle, distance or time unit.
is_compound bool R The plug has a compound structure.
is_array bool R The plug is a multi-attribute root.
is_dynamic bool R The attribute was added dynamically to the node.
parent Optional[Plug] R Parent of a compound child; requires a child plug.
children List[Plug] R Compound children as plugs.
children_names List[str] R Long child names without the node prefix.
elements List[Plug] R Materialized multi elements in physical order.
logical_indices List[int] R Existing logical indices of the multi.
next_free_logical_index Optional[int] R Unavailable call on the tested Maya versions; see the limitation.
connected bool R The plug participates in at least one connection.

plug.valueRead / write

Return type Contract
Any Current plug value; assignment calls set().

The type depends on the attribute: Python scalar, tuple for a compound, list for a multi, None for message, om.MMatrix for a matrix, om.MAngle/MDistance/MTime for units. Geometry data remains om.MObject. A multi list contains existing element values in physical order: it does not retain their logical indices. A null plug reads as None; deleted identity may raise RuntimeError. Reading a destination returns its evaluated value.

Assignment accepts Any.

plug.long_nameRead only

Return type Contract
str Name including node and full attribute path.

The short_* variants shorten the compound path but still use long attribute names. They are not necessarily Maya aliases such as sx.

plug.short_nameRead only

Return type Contract
str Name including node, without the full compound path.

The short_* variants shorten the compound path but still use long attribute names. They are not necessarily Maya aliases such as sx.

plug.long_attribute_nameRead only

Return type Contract
str Full attribute path without the node prefix.

The short_* variants shorten the compound path but still use long attribute names. They are not necessarily Maya aliases such as sx.

plug.short_attribute_nameRead only

Return type Contract
str Attribute name without node or full compound path.

The short_* variants shorten the compound path but still use long attribute names. They are not necessarily Maya aliases such as sx.

plug.is_nullRead only

Return type Contract
bool The native plug is null.

plug.srcRead only

Return type Contract
Optional[Plug] Incoming logical source, or None.

These accessors use Maya logical connections: a conversion node may be skipped. Inherited OpenMaya methods sourceWithConversion() and destinationsWithConversions() remain available for exact native edges. A null plug produces False in both is_connected_* tests; a different argument type raises TypeError.

plug.dstRead only

Return type Contract
PlugArray Outgoing logical destinations; empty collection when absent.

These accessors use Maya logical connections: a conversion node may be skipped. Inherited OpenMaya methods sourceWithConversion() and destinationsWithConversions() remain available for exact native edges. A null plug produces False in both is_connected_* tests; a different argument type raises TypeError.

plug.is_default_valueRead only

Return type Contract
bool The value matches the native attribute default.

plug.default_valueLimited read / write

Return type Contract
Union[bool, int, float] Native scalar attribute default, distinct from value and the is_default_value test.
Access Conditions
Read Scalar numeric attribute (boolean, byte, short, int, float, double), enum or unit. Scalar compound children are readable outside multis.
Write Top-level dynamic scalar attribute only. The current value, connections and locks are preserved.
Units Angles in radians, distances in centimeters, time in seconds, for both reads and writes.
Accepted value Exact bool for a boolean; exact int for an integer or enum; finite int or float for a real number or unit. An enum requires a declared integer, including negative or sparse indices; labels are not accepted.
Rejections TypeError for a null plug, a compound, a multi, its elements or descendants, an unsupported type, or a write to a child. ValueError for a write to a non-dynamic attribute or an invalid value.

This property does not reset the current value to its default or replay SVD data.

plug.is_free_to_changeRead only

Return type Contract
int Native integer state: compare with om.MPlug.kFreeToChange.

Actual type: int, despite the bool annotation. 0 means free, 1 not free, 2 children not free. Use plug.is_free_to_change == om.MPlug.kFreeToChange; a truth-value test would invert the free case.

plug.keyableRead / write

Return type Contract
bool Channel keyable flag.

Assignment accepts bool.

plug.channel_boxRead / write

Return type Contract
bool Channel Box display flag.

Assignment accepts bool.

plug.lockedRead / write

Return type Contract
bool Local plug lock flag.

Assignment accepts bool.

plug.attribute_objectRead only

Return type Contract
om.MObject Maya object defining the attribute.

plug.attribute_fnRead only

Return type Contract
om.MFnAttribute Function set attached to the current attribute.

plug.categoriesRead only

Return type Contract
Tuple[str, ...] Categories declared on the Maya attribute.

plug.nice_nameRead / write

Return type Contract
Optional[str] Explicit nice-name override, or None.

Assignment accepts str.

plug.attribute_typeRead only

Return type Contract
int API attribute type identifier.

plug.is_numericRead only

Return type Contract
bool The attribute supports a numeric function set.

plug.is_typedRead only

Return type Contract
bool The attribute holds typed data.

plug.is_matrixRead only

Return type Contract
bool The attribute is a native matrix attribute.

plug.is_enumRead only

Return type Contract
bool The attribute is an enum.

plug.is_unitRead only

Return type Contract
bool The attribute represents an angle, distance or time unit.

plug.is_compoundRead only

Return type Contract
bool The plug has a compound structure.

plug.is_arrayRead only

Return type Contract
bool The plug is a multi-attribute root.

plug.is_dynamicRead only

Return type Contract
bool The attribute was added dynamically to the node.

plug.parentRead only

Return type Contract
Optional[Plug] Parent of a compound child; requires a child plug.

For a plug without a compound parent, Maya raises TypeError. Check plug.isChild first; do not rely on None. An element’s array parent is available through the native plug.array() method.

plug.childrenRead only

Return type Contract
List[Plug] Compound children as plugs.

plug.children_namesRead only

Return type Contract
List[str] Long child names without the node prefix.

plug.elementsRead only

Return type Contract
List[Plug] Materialized multi elements in physical order.

plug.logical_indicesRead only

Return type Contract
List[int] Existing logical indices of the multi.

plug.next_free_logical_indexRead only

Return type Contract
Optional[int] Unavailable call on the tested Maya versions; see the limitation.

Reproduced limitation in Maya 2025.3 and 2026.3: on a multi root, AttributeError because nextFreeLogicalIndex() does not exist. Returns None on another plug. To choose a slot, read logical_indices and explicitly select an unused index.

plug.connectedRead only

Return type Contract
bool The plug participates in at least one connection.

Own methods.

Method Return type Purpose
as_non_networked Plug Retain the same plug path without a networked proxy before a DG edit.
is_connected_to bool Check whether this plug is the exact logical source of the destination.
is_connected_from bool Check the exact logical source of this plug.
has_category bool Check membership of an attribute category.
add_category None Add a category only when missing.
remove_multi_element bool Remove an existing multi element; report whether removal occurred.
get Optional[Plug] Find a child by name or index; the default fallback is a null plug.
read Any Read and convert the current value according to its native type.
set None Write a compatible value; reject a plug with an incoming driver.
set_preserving_lock None Write the value and restore the affected local lock flags.
kind str Describe the type as a readable identifier.
connect_to None Connect this plug to one or more destinations.
connect_from None Connect a source to this plug.
disconnect_to None Disconnect the relationship to the given destinations.
disconnect_from None Disconnect the relationship from the given source.
disconnect_all_inputs None Disconnect the incoming logical source of this plug.
disconnect_all_outputs None Disconnect the outgoing logical destinations of this plug.
disconnect_all None Disconnect incoming then outgoing relationships of this plug.
enum_mapping dict[str, int] Map each enum label to its integer, including sparse enums.
as_matrix om.MMatrix Read the value through the om.MMatrix accessor.
set_matrix None Write a value compatible with om.MMatrix.
as_bool bool Read the value through the bool accessor.
set_bool None Write a value compatible with bool.
as_char int Read the value through the int accessor.
set_char None Write a value compatible with int.
as_double float Read the value through the float accessor.
set_double None Write a value compatible with float.
as_float float Read the value through the float accessor.
set_float None Write a value compatible with float.
as_int int Read the value through the int accessor.
set_int None Write a value compatible with int.
as_short int Read the value through the int accessor.
set_short None Write a value compatible with int.
as_string str Read the value through the str accessor.
set_string None Write a value compatible with str.
as_mangle om.MAngle Read the value through the om.MAngle accessor.
set_mangle None Write a value compatible with om.MAngle.
as_mdata_handle om.MDataHandle Read the value through the om.MDataHandle accessor.
set_mdata_handle None Write a value compatible with om.MDataHandle.
as_mdistance om.MDistance Read the value through the om.MDistance accessor.
set_mdistance None Write a value compatible with om.MDistance.
as_mobject om.MObject Read the value through the om.MObject accessor.
set_mobject None Write a value compatible with om.MObject.
as_mpxdata om.MPxData MPxData accessor unavailable in the tested Maya versions.
set_mpxdata None MPxData write unavailable in the tested Maya versions.
as_mtime om.MTime Read the value through the om.MTime accessor.
set_mtime None Write a value compatible with om.MTime.
upstream PlugArray Recursively follow source links between plugs.
downstream PlugArray Recursively follow destination links between plugs.
info dict[str, Any] Collect names, types, flags, structure and connections in a dictionary.
read_components list[tuple[str, list[int]]] Read a compact mesh component list, sorted and deduplicated by kind.
set_components None Write vertex, edge or face indices to a componentList.

plug.as_non_networked()Method

Returns Contract
Plug Same node and attribute identity, child path and logical indices, without a Maya networked proxy.

Call this before retaining a plug across DG edits, particularly a disconnection: these edits may destroy a Maya networked proxy. Copy construction alone is insufficient. A null or already non-networked plug returns self; a networked plug produces a new wrapper.

The call changes neither values nor connections. Reads remain live and follow renames; this is not a snapshot. It does not repair a stale reference, and the original identity must still exist: protected accesses reject a deleted node or attribute (RuntimeError).

plug.is_connected_to(destination: Union['Plug', om.MPlug])Method

Parameter Type Default
destination Union[Plug, om.MPlug] required
Returns Contract
bool Check whether this plug is the exact logical source of the destination.

These accessors use Maya logical connections: a conversion node may be skipped. Inherited OpenMaya methods sourceWithConversion() and destinationsWithConversions() remain available for exact native edges. A null plug produces False in both is_connected_* tests; a different argument type raises TypeError.

plug.is_connected_from(source: Union['Plug', om.MPlug])Method

Parameter Type Default
source Union[Plug, om.MPlug] required
Returns Contract
bool Check the exact logical source of this plug.

These accessors use Maya logical connections: a conversion node may be skipped. Inherited OpenMaya methods sourceWithConversion() and destinationsWithConversions() remain available for exact native edges. A null plug produces False in both is_connected_* tests; a different argument type raises TypeError.

plug.has_category(category: str)Method

Parameter Type Default
category str required
Returns Contract
bool Check membership of an attribute category.

plug.add_category(category: str)Method

Parameter Type Default
category str required
Returns Contract
None Add a category only when missing.

plug.remove_multi_element(logical_index: Optional[int]=None, *, break_connections: bool=False)Method

Parameter Type Default
logical_index Optional[int] None
break_connections bool False
Returns Contract
bool Remove an existing multi element; report whether removal occurred.

On the root, provide logical_index; on an element, omit it. False means the index did not exist. break_connections=False protects connections; True allows them to be broken. Invalid call form or negative index: ValueError. Native failure: RuntimeError.

plug.get(keyname: Union[int, str], default: Optional['Plug']=None)Method

Parameter Type Default
keyname Union[int, str] required
default Optional[Plug] None
Returns Contract
Optional[Plug] Find a child by name or index; the default fallback is a null plug.

Use on a compound or multi root. A name searches direct children by long or short name. An integer selects a logical multi index or child position. When absent, a non-null default is returned; otherwise the result is a null Plug, not None. A scalar call may raise TypeError before fallback.

plug.read()Method

Returns Contract
Any Read and convert the current value according to its native type.

The type depends on the attribute: Python scalar, tuple for a compound, list for a multi, None for message, om.MMatrix for a matrix, om.MAngle/MDistance/MTime for units. Geometry data remains om.MObject. A multi list contains existing element values in physical order: it does not retain their logical indices. A null plug reads as None; deleted identity may raise RuntimeError. Reading a destination returns its evaluated value.

plug.set(value: Any)Method

Parameter Type Default
value Any required
Returns Contract
None Write a compatible value; reject a plug with an incoming driver.

An already connected input is rejected (RuntimeError). An enum accepts its integer or label, with a case-insensitive fallback; an unknown label raises ValueError. Prefer {index: value} for sparse multis: omitted elements are not removed. A compound accepts a sequence or child dictionary. A null plug does nothing. Incompatible types may raise TypeError. Specify units with om.MAngle, om.MDistance and om.MTime.

plug.set_preserving_lock(value: Any)Method

Parameter Type Default
value Any required
Returns Contract
None Write the value and restore the affected local lock flags.

An already connected input is rejected (RuntimeError). An enum accepts its integer or label, with a case-insensitive fallback; an unknown label raises ValueError. Prefer {index: value} for sparse multis: omitted elements are not removed. A compound accepts a sequence or child dictionary. A null plug does nothing. Incompatible types may raise TypeError. Specify units with om.MAngle, om.MDistance and om.MTime. Unlike set(), this method temporarily unlocks the affected plugs and restores their flags through protected cleanup, including after failure. This does not promise rollback of every compound value if a later write fails.

plug.kind()Method

Returns Contract
str Describe the type as a readable identifier.

plug.connect_to(dest: Union['Plug', om.MPlug, 'PlugArray', om.MPlugArray], force: bool=False)Method

Parameter Type Default
dest Union[Plug, om.MPlug, PlugArray, om.MPlugArray] required
force bool False
Returns Contract
None Connect this plug to one or more destinations.

force=False preserves an existing input: if another source occupies the destination, the call may do nothing. force=True replaces it, including an animation connection. An identical connection is skipped. Destination locks are restored. Check the result with is_connected_to() or is_connected_from() when needed.

plug.connect_from(src: Union['Plug', om.MPlug], force: bool=False)Method

Parameter Type Default
src Union[Plug, om.MPlug] required
force bool False
Returns Contract
None Connect a source to this plug.

force=False preserves an existing input: if another source occupies the destination, the call may do nothing. force=True replaces it, including an animation connection. An identical connection is skipped. Destination locks are restored. Check the result with is_connected_to() or is_connected_from() when needed.

plug.disconnect_to(dest: Union['Plug', om.MPlug, 'PlugArray', om.MPlugArray])Method

Parameter Type Default
dest Union[Plug, om.MPlug, PlugArray, om.MPlugArray] required
Returns Contract
None Disconnect the relationship to the given destinations.

Only the targeted relationships are removed; an absent relationship does nothing. Destination locks are restored. No conversion node is deleted. These operations alone do not guarantee an entry in Maya’s Undo queue.

plug.disconnect_from(src: Union['Plug', om.MPlug])Method

Parameter Type Default
src Union[Plug, om.MPlug] required
Returns Contract
None Disconnect the relationship from the given source.

Only the targeted relationships are removed; an absent relationship does nothing. Destination locks are restored. No conversion node is deleted. These operations alone do not guarantee an entry in Maya’s Undo queue.

plug.disconnect_all_inputs()Method

Returns Contract
None Disconnect the incoming logical source of this plug.

Only the targeted relationships are removed; an absent relationship does nothing. Destination locks are restored. No conversion node is deleted. These operations alone do not guarantee an entry in Maya’s Undo queue.

plug.disconnect_all_outputs()Method

Returns Contract
None Disconnect the outgoing logical destinations of this plug.

Only the targeted relationships are removed; an absent relationship does nothing. Destination locks are restored. No conversion node is deleted. These operations alone do not guarantee an entry in Maya’s Undo queue.

plug.disconnect_all()Method

Returns Contract
None Disconnect incoming then outgoing relationships of this plug.

Only the targeted relationships are removed; an absent relationship does nothing. Destination locks are restored. No conversion node is deleted. These operations alone do not guarantee an entry in Maya’s Undo queue.

plug.enum_mapping()Method

Returns Contract
dict[str, int] Map each enum label to its integer, including sparse enums.

Requires an enum (RuntimeError otherwise). Negative values and gaps are retained; do not infer values from label positions.

plug.as_matrix()Method

Returns Contract
om.MMatrix Read the value through the om.MMatrix accessor.

plug.set_matrix(value: Union[om.MMatrix, om.MTransformationMatrix, list])Method

Parameter Type Default
value Union[om.MMatrix, om.MTransformationMatrix, list] required
Returns Contract
None Write a value compatible with om.MMatrix.

Convert through the matrix adapter and write native data. This shortcut does not use the same incoming-connection guard as set(). For general writing with that guard prefer set(matrix); to preserve locks use set_preserving_lock(matrix).

plug.as_bool()Method

Returns Contract
bool Read the value through the bool accessor.

plug.set_bool(value: bool)Method

Parameter Type Default
value bool required
Returns Contract
None Write a value compatible with bool.

Immediate typed write without automatic unlocking. Connected inputs are rejected (RuntimeError); already equal values are skipped. Use set_preserving_lock() when lock flags must be preserved around a write.

plug.as_char()Method

Returns Contract
int Read the value through the int accessor.

plug.set_char(value: int)Method

Parameter Type Default
value int required
Returns Contract
None Write a value compatible with int.

Immediate typed write without automatic unlocking. Connected inputs are rejected (RuntimeError); already equal values are skipped. Use set_preserving_lock() when lock flags must be preserved around a write.

plug.as_double()Method

Returns Contract
float Read the value through the float accessor.

plug.set_double(value: float)Method

Parameter Type Default
value float required
Returns Contract
None Write a value compatible with float.

Immediate typed write without automatic unlocking. Connected inputs are rejected (RuntimeError); already equal values are skipped. Use set_preserving_lock() when lock flags must be preserved around a write.

plug.as_float()Method

Returns Contract
float Read the value through the float accessor.

plug.set_float(value: float)Method

Parameter Type Default
value float required
Returns Contract
None Write a value compatible with float.

Immediate typed write without automatic unlocking. Connected inputs are rejected (RuntimeError); already equal values are skipped. Use set_preserving_lock() when lock flags must be preserved around a write.

plug.as_int()Method

Returns Contract
int Read the value through the int accessor.

plug.set_int(value: int)Method

Parameter Type Default
value int required
Returns Contract
None Write a value compatible with int.

Immediate typed write without automatic unlocking. Connected inputs are rejected (RuntimeError); already equal values are skipped. Use set_preserving_lock() when lock flags must be preserved around a write.

plug.as_short()Method

Returns Contract
int Read the value through the int accessor.

plug.set_short(value: int)Method

Parameter Type Default
value int required
Returns Contract
None Write a value compatible with int.

Immediate typed write without automatic unlocking. Connected inputs are rejected (RuntimeError); already equal values are skipped. Use set_preserving_lock() when lock flags must be preserved around a write.

plug.as_string()Method

Returns Contract
str Read the value through the str accessor.

plug.set_string(value: str)Method

Parameter Type Default
value str required
Returns Contract
None Write a value compatible with str.

Immediate typed write without automatic unlocking. Connected inputs are rejected (RuntimeError); already equal values are skipped. Use set_preserving_lock() when lock flags must be preserved around a write.

plug.as_mangle()Method

Returns Contract
om.MAngle Read the value through the om.MAngle accessor.

plug.set_mangle(value: Union[om.MAngle, float])Method

Parameter Type Default
value Union[om.MAngle, float] required
Returns Contract
None Write a value compatible with om.MAngle.

Immediate typed write without automatic unlocking. Connected inputs are rejected (RuntimeError); already equal values are skipped. Use set_preserving_lock() when lock flags must be preserved around a write. A numeric angle is constructed in radians; an explicit om.MAngle avoids ambiguity.

plug.as_mdata_handle()Method

Returns Contract
om.MDataHandle Read the value through the om.MDataHandle accessor.

plug.set_mdata_handle(value: om.MDataHandle)Method

Parameter Type Default
value om.MDataHandle required
Returns Contract
None Write a value compatible with om.MDataHandle.

Immediate typed write without automatic unlocking. Connected inputs are rejected (RuntimeError); already equal values are skipped. Use set_preserving_lock() when lock flags must be preserved around a write.

plug.as_mdistance()Method

Returns Contract
om.MDistance Read the value through the om.MDistance accessor.

plug.set_mdistance(value: om.MDistance)Method

Parameter Type Default
value om.MDistance required
Returns Contract
None Write a value compatible with om.MDistance.

Immediate typed write without automatic unlocking. Connected inputs are rejected (RuntimeError); already equal values are skipped. Use set_preserving_lock() when lock flags must be preserved around a write.

plug.as_mobject()Method

Returns Contract
om.MObject Read the value through the om.MObject accessor.

plug.set_mobject(value: om.MObject)Method

Parameter Type Default
value om.MObject required
Returns Contract
None Write a value compatible with om.MObject.

Immediate typed write without automatic unlocking. Connected inputs are rejected (RuntimeError); already equal values are skipped. Use set_preserving_lock() when lock flags must be preserved around a write.

plug.as_mpxdata()Method

Returns Contract
om.MPxData MPxData accessor unavailable in the tested Maya versions.

Reproduced limitation in Maya 2025.3 and 2026.3: AttributeError. Both wrappers access om.MPlug.asMPxData, which is absent from this API. The listed type describes the signature’s intent, not a working return value.

plug.set_mpxdata(value: om.MPxData)Method

Parameter Type Default
value om.MPxData required
Returns Contract
None MPxData write unavailable in the tested Maya versions.

Reproduced limitation in Maya 2025.3 and 2026.3: AttributeError. Both wrappers access om.MPlug.asMPxData, which is absent from this API. The listed type describes the signature’s intent, not a working return value.

plug.as_mtime()Method

Returns Contract
om.MTime Read the value through the om.MTime accessor.

plug.set_mtime(value: om.MTime)Method

Parameter Type Default
value om.MTime required
Returns Contract
None Write a value compatible with om.MTime.

Immediate typed write without automatic unlocking. Connected inputs are rejected (RuntimeError); already equal values are skipped. Use set_preserving_lock() when lock flags must be preserved around a write.

plug.upstream(max_depth: int | None=None, type_filter: Set[int] | None=None)Method

Parameter Type Default
max_depth int | None None
type_filter Set[int] | None None
Returns Contract
PlugArray Recursively follow source links between plugs.

Traversal follows plug connections, not internal dependencies between a node’s inputs and outputs. Immediate neighbors are included even with max_depth=0; the limit controls further recursion. type_filter filters results, not traversal.

plug.downstream(max_depth: int | None=None, type_filter: Set[int] | None=None)Method

Parameter Type Default
max_depth int | None None
type_filter Set[int] | None None
Returns Contract
PlugArray Recursively follow destination links between plugs.

Traversal follows plug connections, not internal dependencies between a node’s inputs and outputs. Immediate neighbors are included even with max_depth=0; the limit controls further recursion. type_filter filters results, not traversal.

plug.info()Method

Returns Contract
dict[str, Any] Collect names, types, flags, structure and connections in a dictionary.

On a multi root this call currently encounters the same error as next_free_logical_index. Read the required fields separately when that information is unnecessary.

plug.read_components(*, only_mesh: bool=True)Method

Parameter Type Default
only_mesh bool True
Returns Contract
list[tuple[str, list[int]]] Read a compact mesh component list, sorted and deduplicated by kind.

Returns [] outside componentList. vtx, edge and face entries are merged and sorted. Generic single is treated as vtx; only_mesh=False does not add double/triple-indexed components. This shortcut is therefore not a general component inventory.

plug.set_components(items: Union[dict[str, Iterable[int]], list[tuple[str, Iterable[int]]], list[dict]])Method

Parameter Type Default
items Union[dict[str, Iterable[int]], list[tuple[str, Iterable[int]]], list[dict]] required
Returns Contract
None Write vertex, edge or face indices to a componentList.

Accepts a kind → indices dictionary, a pair list, dictionaries from read(), or a native componentList om.MObject. Unknown kinds are ignored. Only simple mesh components are constructed by the shortcut.

Expression Returns Behavior
plug["childName"] Plug Direct compound child by long or short name. A missing child returns a null plug.
plug[index] Plug Logical index for a multi; position for a compound. An invalid child index can raise a Maya error.
str(plug) str Long plug name.

Names and values remain live; identity checks reject deleted objects on protected paths. A Plug is neither a value cache nor an Undo command. Prefer connect_to() and connect_from() for explicit connections.

For a multi, distinguish physical position in elements from logical index in logical_indices. Access by logical index may materialize an element; it is not a pure existence test.

from uuid import uuid4
from weSkel.src.core.node.dag.transform.lib import Transform
from weSkel.src.core.node.extensions.plugs_lib import Plug
suffix = uuid4().hex[:8]
driver = Transform("sdk_driver_" + suffix)
follower = Transform("sdk_follower_" + suffix)
try:
driver.create()
follower.create()
source = Plug(driver.mobject, "scaleX")
destination = follower.plugs["scaleX"]
source.value = 2.5
assert source.default_value == 1.0
weight = driver.plugs.add_numeric_plug("weight", default_value=0.25)
weight.value = 0.5
weight.locked = True
weight.default_value = 0.75
assert weight.default_value == 0.75
assert weight.value == 0.5 and weight.locked
destination.locked = True
source.connect_to(destination)
assert source.is_connected_to(destination)
assert destination.value == 2.5
retained_source = destination.src.as_non_networked()
assert not retained_source.isNetworked
source.disconnect_to(destination)
assert retained_source == source and retained_source.value == 2.5
assert destination.src is None and destination.locked
print("Plug: PASS")
finally:
follower.delete(snapshot=False)
driver.delete(snapshot=False)

Expected result: Plug: PASS. Temporary nodes are removed in finally.

See also: PlugArray · Plugs.