Render Anmations in Autodesk Maya

This part describes the methods/classes we apply to render animations in Autodesk Maya.

class render.maya.utils.MayaController(PORT=12345)[source]

Bases: object

This is controller to remotely control Maya to make character animations. The default local host is 127.0.0.1

Parameters

PORT (int) – port to connect to the local socket server, defaults to 0

Variables

client – socket client

Close()[source]

Close socket client

GetAllObjects()[source]

Get all the objects from Maya scene

Return recv_message

a list of object names

Return type

list

GetBodyInformation(joint_list: list)[source]

Get a list of information of the joint list

Parameters

joint_list (list) – a list of joint names

Returns

a list with joint positions

Return type

list

GetObjectAttribute(object_name: str, attr_name: str)[source]

Get attribute value of an object

Parameters
  • object_name (str) – name of the object

  • attr_name (str) – name of the attribute

Returns

attribute value

Return type

float

GetObjectLocalRoation(object_name: str)[source]

Get object local rotation

Parameters

object_name (str) – name of the object

Returns

cordindate [x,y,z] of the object

Return type

list

GetObjectWorldTransform(object_name: str)[source]

Get object world location

Parameters

object_name (str) – name of the object

Returns

cordindate [x,y,z] of the object

Return type

list

GetTimeSliderRange()[source]

Get the range of time slider

Returns

[min, max] representing the minimum and maximum values of the timeline

Return type

list

MoveObjectWorldRelative(object_name: str, location: list)[source]

Move an object relatively with location [x, y, z]

Parameters
  • object_name (str) – the name of the object in hierarchy view

  • location (list) – location in list [x, y, z]

ScreenShot(save_file: str, camera='persp', width=1024, height=1024)[source]

Take maya screen shot and save to picture

Parameters
  • save_file (str) – save file name

  • camera (str, optional) – camera name in the Maya scene, default “persp”

  • width (int, optional) – screenshot width, default 1024

  • height (int, optional) – screenshot height, default 1024

SendCommand(command: str)[source]

Send a string command to the socket server (Maya side)

Parameters

command (str) – a string command

SendPythonCommand(command: str)[source]

Send a string command to the socket server (Maya side)

Parameters

command (str) – a string command

SetCurrentKeyFrameForAttribute(object_name: str, attr_name: str)[source]

Set keyframe for object attribute

Parameters
  • object_name (str) – name of the object in hierarchy view

  • attr_name (list) – name of attribute

SetCurrentKeyFrameForObjects(object_list)[source]

Set keyframe for a list of objects

Parameters

object_list (list) – a list of object names

SetCurrentKeyFrameForPositionAndRotation(object_name: str)[source]

Set keyframe for object position and rotation

Parameters

object_name (str) – name of the object in hierarchy view

SetCurrentTimeFrame(time_frame: int)[source]

Set timeline in the Maya scene

Parameters

time_frame (int) – key frame

SetNewScene()[source]

Set new Maya empty scene

SetObjectAttribute(object_name: str, attr_name: str, value: float)[source]

Set object attriture with value

Parameters
  • object_name (str) – name of the object

  • attr_name (float) – attribute of the object

  • value – attribute value

SetObjectLocalRotation(object_name: str, rotation: list)[source]

Set world absolute location for object with rotation [x,y] or [x, y, z] in degree

Parameters
  • object_name (str) – the name of the object in hierarchy view

  • location (list) – location in list [x, y, z]

SetObjectLocalTransform(object_name: str, location: list)[source]

Set world absolute location for object with location [x,y] or [x, y, z]

Parameters
  • object_name (str) – the name of the object in hierarchy view

  • location (list) – location in list [x, y, z]

SetObjectWorldTransform(object_name: str, location: list)[source]

Set world absolute location for object with location [x, y, z]

Parameters
  • object_name (str) – the name of the object in hierarchy view

  • location (list) – location in list [x, y, z]

Undo()[source]

Send undo command to socket server (Maya)

UndoToBeginning(max_step=200)[source]

Undo Maya file to beginning

Parameters

max_step (int, optional) – max undo steps, default 200