maya.utils.converter

tik.maya bidirectional code converter.

A rule-based code conversion tool that translates between tik.maya and maya.cmds through semantic expansion/lifting.

Directions: - tik.maya → maya.cmds: Semantic expansion (convert) - maya.cmds → tik.maya: Semantic lifting (convert_to_tik)

Submodules

Classes

ConversionEntry

A single entry in the conversion report.

ConversionReport

Complete report of a code conversion operation.

Converter

Main converter class for tik.maya → maya.cmds transformation.

ReverseConverter

Main converter class for maya.cmds → tik.maya transformation.

Functions

convert(→ maya.utils.converter.report.ConversionReport)

Convenience function to convert tik.maya code to maya.cmds.

convert_to_tik(...)

Convenience function to convert maya.cmds code to tik.maya.

Package Contents

class ConversionEntry

A single entry in the conversion report.

converted_code: str | None = None
entry_type: EntryType
line_number: int
message: str | None = None
original_code: str
rule_name: str | None = None
class ConversionReport

Complete report of a code conversion operation.

summary() str

Generate a human-readable summary of the conversion.

converted_code: str
entries: List[ConversionEntry] = []
property failure_count: int

Count of failed or unsupported conversions.

property helpers_expanded: List[ConversionEntry]

Return all entries where a blessed helper was expanded.

property rules_applied: List[ConversionEntry]

Return all entries where a rule was successfully applied.

source_code: str
property success_count: int

Count of successfully converted expressions.

property unsupported_operations: List[ConversionEntry]

Return all unsupported operations that were not converted.

property warnings: List[ConversionEntry]

Return all warning entries.

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
class ReverseConverter(rules: List[maya.utils.converter.rules_reverse.ReverseConversionRule] | None = None, add_imports: bool = True, add_header: bool = True, preserve_comments: bool = True)

Main converter class for maya.cmds → tik.maya transformation.

The converter performs semantic lifting of maya.cmds code into idiomatic tik.maya expressions. It compresses explicit cmds calls into the equivalent tik.maya API.

Usage:

converter = ReverseConverter() result = converter.convert(source_code) print(result.converted_code) print(result.summary())

convert(source_code: str) maya.utils.converter.report.ConversionReport

Convert maya.cmds source code to tik.maya.

Args:

source_code: Python source code using maya.cmds.

Returns:

ConversionReport with converted code and metadata.

add_header = True
add_imports = True
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.

convert_to_tik(source_code: str, add_imports: bool = True, add_header: bool = True) maya.utils.converter.report.ConversionReport

Convenience function to convert maya.cmds code to tik.maya.

Args:

source_code: Python source code using maya.cmds. add_imports: Whether to add tik.maya import. add_header: Whether to add header comment.

Returns:

ConversionReport with results.