Last active
April 27, 2019 21:15
-
-
Save jm991/29cc46b5b8e5fa4709ee4be0a7911095 to your computer and use it in GitHub Desktop.
Extensions for the default mel print statements to add new lines (println) and enable single line, formatted array printing (printarray)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//--------------------------------------------------------------------------------- | |
// Source: https://gist.github.com/jm991/ | |
// print methods for Maya 2017 | |
// Author: John Mac | |
// Date: 10-29-2017 | |
// | |
// Description: | |
// Extensions for the default mel print statements to add new lines (println) and enable single line, formatted array printing (printarray) | |
// https://help.autodesk.com/cloudhelp/2018/ENU/Maya-Tech-Docs/Commands/print.html | |
// Installation: | |
// 1. Copy printextensions.mel to C:\Users\[USER]\Documents\maya\[MAYAVERSION]\prefs\scripts\jm991 | |
// 2. Restart maya | |
global proc printarray( string $options[] ) | |
{ | |
int $i = 0; | |
int $numOptions = size($options); | |
print "["; | |
for ($option in $options) | |
{ | |
print ($option); | |
if ($i < $numOptions - 1) | |
{ | |
print ", "; | |
} | |
$i++; | |
} | |
print "]"; | |
print "\r\n"; | |
} | |
global proc println( string $option ) | |
{ | |
print $option; | |
print "\r\n"; | |
} | |
/* | |
// MEL examples | |
$allDescendents = `listRelatives -allDescendents $node`; | |
print $allDescendents; | |
// head_geo | |
// body_geo | |
// legs_geo | |
printarray($allDescendents); | |
// [head_geo, body_geo, legs_geo] | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Remove the ".c" from the filename when you download this (git doesn't support .mel syntax highlighting)