maya.core.registry

Registry for Maya node wrappers.

Attributes

Functions

is_registered(→ bool)

Check if a node type is registered in the registry.

register(→ Callable[[Type[T]], Type[T]])

Decorator for registering Maya node wrappers.

resolve(→ Any)

Return an instance of the correct Node subclass based on Maya node type.

resolve_node_class(name)

Return the most specific registered class for a given Maya node.

set_default_factory(→ None)

Set the fallback factory for unregistered node types.

Module Contents

is_registered(node_type: str) bool

Check if a node type is registered in the registry.

Args:

node_type: The Maya node type to check.

Returns:

bool: True if the node type has a registered wrapper, False otherwise.

register(node_type: str) Callable[[Type[T]], Type[T]]

Decorator for registering Maya node wrappers.

Args:

node_type: The Maya node type to register (e.g., ‘transform’, ‘joint’).

Returns:

A decorator function that registers the class.

Example:

@register(“transform”) class Transform(DagNode):

pass

resolve(name: str, class_name=None) Any

Return an instance of the correct Node subclass based on Maya node type.

Args:

name: Name of the Maya node, or an existing wrapper instance. class_name: Optional specific class name to use from registry.

Returns:

A wrapper instance for the node.

Raises:

LookupError: If class_name is specified but not registered.

resolve_node_class(name: str)

Return the most specific registered class for a given Maya node.

Args:

name: Name of the Maya node.

Returns:

Type: The registered wrapper class for the node.

Raises:

ValueError: If the node doesn’t exist. LookupError: If no wrapper is registered and no default factory is set.

set_default_factory(factory: Type[T]) None

Set the fallback factory for unregistered node types.

Args:
factory: The default wrapper class (typically Node) to use when no

specific wrapper is registered for a node type.

T
undocommit