Skip to content
weSkelDOCUMENTATION
Documentation/API reference/Node

Node

Class reference · Wrapper identity, Maya object and validity.

ClassAPI 2.0Base

Node represents a Maya node’s identity: its native object, validity and API capabilities. It is the common base for weSkel wrappers.

objectNode
from weSkel.src.core.node.abstract.node.lib import Node

Run inside Maya with weSkel available. This single line is enough to import the class.

Item Value
Class Node
Module weSkel.src.core.node.abstract.node.lib
Python parent object; no weSkel parent class.
Metaclass NodeMeta; it participates in construction and is not a parent of Node.
Direct subclass in weSkel DGNode, which adds Dependency Graph operations.
Inherited weSkel members None; all members below are defined by Node.
Properties generated from specs None on this base class.

Node contains an MObject; it does not inherit from MObject. Node creation, plug access, snapshots and replay belong to specialized wrappers. To create a transform, see Transform.

Signature: Node(node) → Node or a compatible subclass already registered.

Parameter Accepted type Behavior
node str Maya name. An unresolved name produces a wrapper with no live node; it does not create anything.
node om.MObject Maya API 2.0 object representing the node. A null object produces an empty wrapper.
node om.MObjectHandle Handle whose object is used to construct or retrieve the wrapper.

The parameter is required and has no default. The constructor does not directly accept MPlug, MDagPath or another wrapper; use the appropriate node object, or other.mobject for a wrapper.

What does the constructor return? A Python wrapper for the Maya node. Calling Node(...) does not create a node in the scene.

Situation Result
Node already known For an already registered live node, another call retrieves the same compatible wrapper. It may therefore return a subclass of Node.
Name not found The wrapper can attach when that name becomes resolvable and mobject is read.
Node deleted after wrapping A previously attached wrapper does not automatically adopt a different node recreated with the same name.
Possible errors TypeError for an incompatible input or wrapper type; RuntimeError for an unregistrable native object or an identity conflict.

The Python entry points are __new__(cls, node) -> Node and __init__(self, node) -> None. Use Node(node) to run the complete construction and reuse mechanism.

All these properties are defined on Node. R/W means read and write; R means read only. Types prefixed with om. belong to maya.api.OpenMaya.

Property Return type Access Value or purpose
mobject om.MObject R/W Live Maya object, or a null object.
mobject_handle om.MObjectHandle R/W Handle associated with the node.
api_type int | None R Maya API type identifier.
api_type_str str R API type name, for example "kTime".
exists bool R The wrapper currently has a live node.
is_null bool R The returned Maya object is null.
is_alive bool R The object exists with a valid, live handle.
is_valid_handle bool R Validity of the stored handle.
is_dag_node bool R Compatibility with om.MFn.kDagNode.
hash_code int R Maya handle hash.

node.mobjectRead / write

Operation Type / result
node.mobject om.MObject; a null object if no live node is available.
node.mobject = value Accepts None, str or om.MObject.

Reads follow the native identity. Renaming the node preserves that identity. Assignment explicitly rebinds the wrapper; it does not rename, create or delete a Maya node.

None detaches the wrapper and clears its stored name. A null MObject also detaches it. A name passed to the setter must already exist, unlike a name passed to the constructor.

Setter exceptions: TypeError for an unsupported type, ValueError for an unresolved name, RuntimeError if another wrapper already owns that identity or the object cannot be registered.

node.mobject_handleRead / write

Operation Type / result
node.mobject_handle om.MObjectHandle, which may be invalid.
node.mobject_handle = value Accepts only a valid om.MObjectHandle and rebinds the wrapper’s object.

Setter exceptions: TypeError for another type, ValueError for an invalid handle. Rebinding may also raise the identity errors described under mobject.

node.api_typeRead only

Type returned When no live node is available
int | None None

Native MObject.apiType() value when exists is True, otherwise None. This is an API type identifier, not a DG type name such as "transform".

node.api_type_strRead only

Type returned When no live node is available
str "Unknown"

API name such as "kTime" or "kTransform". Returns "Unknown" when exists is False.

node.existsRead only

Type returned When no live node is available
bool False

True when the wrapper is alive and its object is not null. Check this property before working with a node that may have been deleted.

node.is_nullRead only

Type returned When no live node is available
bool True

Result of mobject.isNull(). Reading mobject may resolve the name of a wrapper that has never been attached.

node.is_aliveRead only

Type returned When no live node is available
bool False

False for a null object. Otherwise checks the handle’s validity and alive state through Maya’s API. This is a broader check than MObjectHandle.isAlive() alone.

node.is_valid_handleRead only

Type returned When no live node is available
bool Stored handle validity; False for a null handle.

Result of mobject_handle.isValid(). This handle check does not replace the full exists check; read mobject or exists to resolve a name that was absent during construction.

node.is_dag_nodeRead only

Type returned When no live node is available
bool False

Whether the object supports the DAG function set. A transform is a DAG node; the example’s time1 node is not. Returns False for a null object.

node.hash_codeRead only

Type returned When no live node is available
int 0 for a null handle.

Result of MObjectHandle.hashCode(); 0 for a null handle. This hash is neither a UUID nor a persistent identifier to save for locating the node in another session.

Method Kind Return Purpose
has_fn(fn_type) Instance bool Test compatibility with a Maya function set.
clear_node_registry() Class None Detach registered wrappers and clear their shared registry.

node.has_fn(fn_type: int) → boolInstance method

Item Description
fn_type An om.MFn constant, such as om.MFn.kDependencyNode or om.MFn.kDagNode. Required, with no default.
Return True if the node supports this function set; False otherwise, or if the wrapper has no live node.
Effect No scene changes.

The call does not create a function set or return an MFn*. Supply a valid MFn constant; Maya API type errors are not converted by this method.

Node.clear_node_registry() → NoneClass method

Item Description
Parameters None.
Return None.
Scope All wrappers in the shared registry, including subclass instances.
Effect Detaches registered wrappers and clears the registry. The Maya nodes themselves remain in the scene.

Global reset. This is not a scene cleanup command. Variables held by other tools may now contain detached wrappers. Reserve this call for a controlled reset of the wrapper environment.

Attribute Type Value on Node / purpose
NODE_TYPE str | None None; this base does not require a concrete Maya node type.
COMPATIBLE_MAYA_FN_TYPES tuple[int, ...] (om.MFn.kDependencyNode,); native compatibility accepted by the base.
NODE_REGISTRY weakref.WeakValueDictionary[str, Node] Shared registry indexed by Maya UUID, holding weak references to wrappers.

These attributes describe the class and its infrastructure. In usage scripts, inspect them without replacing them or directly modifying the registry. Fields and methods starting with _ are not part of this page’s public API; standard methods inherited from object are not repeated.

Situation Result
Two calls with the same live node Same compatible wrapper while it remains registered.
Renaming in Maya Wrapper identity is preserved.
Missing name at construction Unresolved wrapper; no automatic creation.
Node deleted, then another node created with the same name The old wrapper does not automatically adopt the new node.
Need name, plugs, create() or snapshot() These members are not defined on Node; use the appropriate specialized wrapper.

See How it works for general usage and SDK for availability.

Here, om is needed to access om.MFn.kDependencyNode, not to import Node.

In the Script Editor → Python, or in a .py file executed by Maya:

import maya.api.OpenMaya as om
from weSkel.src.core.node.abstract.node.lib import Node
node = Node("time1")
assert node.exists, "The example requires Maya's default time1 node."
print(node.api_type_str)
print(node.has_fn(om.MFn.kDependencyNode))
assert Node(node.mobject) is node
assert Node(node.mobject_handle) is node

Expected result: kTime, then True. The script inspects the existing time1 node in a standard Maya scene; it does not create any nodes. Replace "time1" with an existing node name to inspect it.

From a standalone script with mayapy

Use the Python interpreter shipped with Maya (mayapy), with weSkel available to that interpreter. Standard Python without the Maya libraries is not sufficient. The Node import path stays the same.

import maya.standalone
maya.standalone.initialize(name="python")
try:
from weSkel.src.core.node.abstract.node.lib import Node
node = Node("time1")
assert node.exists
print(node.api_type_str)
finally:
maya.standalone.uninitialize()

This block initializes a standalone session. In Maya’s Script Editor, use the previous example: the session is already initialized.

Source API · Examples checked in Maya 2025.3 and 2026.3. Compiled package validation is separate.