code of the day cotd maya mel

Code of the Day: JP Transfer Anim

JP Transfer Anim 1.5 script by arcsecond:

JP Transfer Anim 1.5 is a quick tool for copying animation or custom attributes from one object to another.

Language: MEL
Type: Maya Editor Script
Script Files: 1
Number of lines: 324

Functionality: 7
The functionality allows copying of user defined attributes and transferring animations from one object to another. The window allows selections of Transforms, Rotation or Scales (X, Y or Z) values, Visibility or User Defined attributes to be copied. There are also option for copying the Whole Curves or Current Values.

Design: 7
The code is small and compact, and is straightforward in its design. There are only three functions, but what is there is separated logically into UI, transferring animation or copying attributes. The code does make use of a number of silent catches, and there is a bit of duplication between the copy and transfer functions. The code is tightly coupled to the interface and does not have any parameters to any of the functions.

Style: 5.5
The code formatting is a little inconsistent, and bracket scoping are not consistent. There are a few areas of commented out code and a few places where the function names are a bit confusing (function names “jpTransferAnim” and” jpTransAnim“). There are a lot of the same array indexing instead of creating a temporary variable for the same value, which could be renamed something like source and destination to make it clearer than animObj[0] and animObj[1].

Documentation: 7
The code documentation is sparse in places, but the code itself is pretty straightforward so is not necessary. The code header is useful, as are mentioning the current limitations is always nice to see in the documentation.

Reusability: 7
The transfer code is too tightly coupled to the interface to be reusable, but the copy attribute only relies on having a selection so that could be separately called. The code is tiny however, so it would not be too difficult to maintain, extend or refactor as necessary.

Overall: 7
The code is short and simple, but gives a powerful little feature set to quickly copy attributes from one object to another. It is limited in that it can only copy one object at a time, but still would have its uses in certain areas. A few more options would be nice to have, but overall it is quick and fairly effective.

Until next time,
Michael Hubbard

Leave a Reply

Your email address will not be published. Required fields are marked *