maya.utils.converter.helpers

Blessed helper expansion registry.

Blessed helpers are tik.maya methods that represent stable, well-understood semantic operations that can be safely expanded into known sequences of cmds (or OpenMaya) calls.

Each helper expansion must: - Declare the tik.maya method name - Declare its cmds expansion - Be testable in isolation

Attributes

Classes

HelperExpansion

Definition of a blessed helper expansion.

HelperRegistry

Registry for blessed helper expansions.

UnsupportedMethod

Represents an unsupported method that cannot be converted.

Functions

check_method_support(→ bool)

Check if a method call is supported for conversion.

create_default_registry(→ HelperRegistry)

Create and populate the default helper registry.

get_default_registry(→ HelperRegistry)

Get the default helper registry (lazy initialization).

get_unsupported_reason(→ Optional[str])

Get the reason why a method is unsupported.

Module Contents

class HelperExpansion

Definition of a blessed helper expansion.

Attributes:

method_name: The tik.maya method name (e.g., “unlock_normals”). type_name: The tik.maya type this method belongs to (e.g., “Mesh”). description: Human-readable description of what this helper does. cmds_template: Template or callable for generating cmds code. requires_openmaya: Whether the expansion uses OpenMaya calls. notes: Additional notes about the expansion.

expand(node_expr: str, args: List[str], kwargs: Dict[str, str]) str

Expand this helper into cmds code.

Args:

node_expr: The expression for the node (e.g., “my_mesh”). args: Positional arguments passed to the method. kwargs: Keyword arguments passed to the method.

Returns:

The expanded cmds code string.

cmds_template: str
description: str
method_name: str
notes: str | None = None
requires_openmaya: bool = False
type_name: str
class HelperRegistry

Registry for blessed helper expansions.

The registry maintains a collection of helper expansions that have been explicitly approved for automatic conversion. Only helpers registered here will be expanded; all others will be flagged as unsupported.

get(type_name: str, method_name: str) HelperExpansion | None

Get a helper expansion by type and method name.

Args:

type_name: The tik.maya type name. method_name: The method name.

Returns:

The HelperExpansion if registered, None otherwise.

is_blessed(type_name: str, method_name: str) bool

Check if a method is a blessed helper.

Args:

type_name: The tik.maya type name. method_name: The method name.

Returns:

True if the method is registered as a blessed helper.

list_helpers() List[HelperExpansion]

List all registered helpers.

Returns:

List of all registered HelperExpansion instances.

register(method_name: str, type_name: str, description: str, cmds_template: str, requires_openmaya: bool = False, notes: str | None = None) HelperRegistry

Register a new blessed helper expansion.

Args:

method_name: The tik.maya method name. type_name: The tik.maya type this method belongs to. description: Human-readable description. cmds_template: Template for generating cmds code. requires_openmaya: Whether OpenMaya is used. notes: Additional notes.

Returns:

Self for method chaining.

class UnsupportedMethod

Represents an unsupported method that cannot be converted.

line_number: int
method_name: str
original_code: str
reason: str
type_name: str | None
check_method_support(type_name: str | None, method_name: str, registry: HelperRegistry | None = None) bool

Check if a method call is supported for conversion.

A method is supported if: 1. It’s handled by a built-in rule, OR 2. It’s registered as a blessed helper

Args:

type_name: The tik.maya type name (if known). method_name: The method name. registry: Helper registry to check (uses default if None).

Returns:

True if the method is supported for conversion.

create_default_registry() HelperRegistry

Create and populate the default helper registry.

This contains the initial set of blessed helpers that are safe for automatic expansion.

Returns:

A populated HelperRegistry instance.

get_default_registry() HelperRegistry

Get the default helper registry (lazy initialization).

Returns:

The default HelperRegistry instance.

get_unsupported_reason(method_name: str) str | None

Get the reason why a method is unsupported.

Args:

method_name: The method name.

Returns:

The reason string if known, None otherwise.

UNSUPPORTED_METHODS: Dict[str, str]