maya.utils.converter.engine¶
Core conversion engine for tik.maya → maya.cmds transformation.
This module orchestrates the conversion process: 1. Parse source code into AST 2. Analyze and track tik.maya usage patterns 3. Apply conversion rules 4. Expand blessed helpers 5. Generate output code 6. Produce conversion report
Classes¶
Tracks state during AST traversal and conversion. |
|
Main converter class for tik.maya → maya.cmds transformation. |
Functions¶
|
Convenience function to convert tik.maya code to maya.cmds. |
Module Contents¶
- class ConversionState¶
Tracks state during AST traversal and conversion.
Maintains information about: - Variable types (tracking tik.maya object assignments) - Import statements - Converted nodes (to avoid double-processing)
- get_variable_type(name: str) str | None¶
Get the tracked type for a variable.
- Args:
name: Variable name.
- Returns:
The type name if tracked, None otherwise.
- is_converted(node: ast.AST) bool¶
Check if an AST node has been converted.
- Args:
node: The AST node to check.
- Returns:
True if already converted.
- mark_converted(node: ast.AST) None¶
Mark an AST node as converted.
- Args:
node: The AST node that was converted.
- track_variable(name: str, type_name: str) None¶
Track a variable’s tik.maya type.
- Args:
name: Variable name. type_name: The tik.maya type (e.g., “Transform”).
- converted_nodes: Set[int]¶
- imports: Dict[str, str]¶
- tik_imports_found: bool = False¶
- variable_types: Dict[str, str]¶
- class Converter(rules: List[maya.utils.converter.rules.ConversionRule] | None = None, helper_registry: maya.utils.converter.helpers.HelperRegistry | None = None, add_imports: bool = True, add_header: bool = True, preserve_comments: bool = True)¶
Main converter class for tik.maya → maya.cmds transformation.
The converter performs semantic expansion of tik.maya code into explicit maya.cmds equivalents. It does not introspect tik.maya internals or rely on runtime behavior.
- Usage:
converter = Converter() result = converter.convert(source_code) print(result.converted_code) print(result.summary())
- convert(source_code: str) maya.utils.converter.report.ConversionReport¶
Convert tik.maya source code to maya.cmds.
- Args:
source_code: Python source code using tik.maya.
- Returns:
ConversionReport with converted code and metadata.
- TIK_TYPES¶
- add_header = True¶
- add_imports = True¶
- helper_registry = None¶
- preserve_comments = True¶
- rules¶
- convert(source_code: str, add_imports: bool = True, add_header: bool = True) maya.utils.converter.report.ConversionReport¶
Convenience function to convert tik.maya code to maya.cmds.
- Args:
source_code: Python source code using tik.maya. add_imports: Whether to add maya.cmds import. add_header: Whether to add header comment.
- Returns:
ConversionReport with results.