Skip to content

collect_maya_units

CollectMayaUnits

Bases: MayaContextPlugin

Collect Maya's scene units.

Source code in client/ayon_maya/plugins/publish/collect_maya_units.py
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
class CollectMayaUnits(plugin.MayaContextPlugin):
    """Collect Maya's scene units."""

    label = "Maya Units"
    order = pyblish.api.CollectorOrder

    def process(self, context):

        # Get the current linear units
        units = cmds.currentUnit(query=True, linear=True)

        # Get the current angular units ('deg' or 'rad')
        units_angle = cmds.currentUnit(query=True, angle=True)

        # Get the current time units
        # Using the mel command is simpler than using
        # `cmds.currentUnit(q=1, time=1)`. Otherwise we
        # have to parse the returned string value to FPS
        fps = mel.eval('currentTimeUnitToFPS()')

        context.data['linearUnits'] = units
        context.data['angularUnits'] = units_angle
        context.data['fps'] = fps