This file contains hidden or 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
| // Add zero digit padding to an int value | |
| global proc string pvr_zeroPadding(int $num, int $padding){ | |
| // Tip from the blog post: http://ldunham.blogspot.ca/2012/01/melpython-adding-number-padding.html | |
| int $lengthNum=size(string($num)); | |
| string $padString; | |
| if($lengthNum<$padding){ | |
| for($i=0;$i<($padding-$lengthNum);$i++){ | |
| $padString=$padString+"0"; |
This file contains hidden or 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
| int $startFrame = `getAttr "defaultRenderGlobals.startFrame"`; | |
| int $endFrame = `getAttr "defaultRenderGlobals.endFrame"`; | |
| // The $frameStep variable is used to implement frame skipping using the "By Frame" render settings attribute. | |
| int $frameStep = `getAttr "defaultRenderGlobals.byFrameStep"`; | |
| string $progressText = ""; | |
| if($startFrame != $endFrame){ | |
| // Show a rendering progress bar |
This file contains hidden or 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
| // Windows | |
| system("echo %PATH%"); | |
| // Mac & Linux | |
| system("echo $PATH"); |
This file contains hidden or 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
| import os | |
| print '[System ENV PATH] ' + os.environ['PATH'] | |
| # Result: [System ENV PATH] /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin |
This file contains hidden or 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
| # Check if Maya is running in Batch mode or with a GUI | |
| # A return value of 1 means Batch Mode, 0 means GUI mode | |
| def checkMayaGuiBatchMode(): | |
| """ | |
| Maya tip on detecting Maya Batch mode is from Michael Scarpa's blog post "MEL Sillyness": | |
| http://www.scarpa.name/2010/12/16/mel-sillyness/ | |
| """ | |
| # Check if Maya is running in batch mode or with a GUI | |
| import maya.OpenMaya |
This file contains hidden or 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
| import os | |
| # File to check | |
| mxsFilePath = 'C:/Program Files/Next Limit/Maxwell 3/scripts/stereo/CubeX.mxs' | |
| # See if the file exists | |
| if os.path.exists(mxsFilePath): | |
| print('[MXS File] ' + mxsFilePath) | |
| else: | |
| print('[MXS File Not Found] ' + mxsFilePath) |
This file contains hidden or 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
| from pymaxwell import * | |
| # Maxwell .mxs scene file | |
| mxsFilePath = 'C:/Program Files/Next Limit/Maxwell 3/scripts/stereo/CubeX.mxs' | |
| # Load the mxs scene | |
| scene = Cmaxwell(mwcallback) | |
| scene.readMXS(mxsFilePath) | |
| # Read the active camera's name and resolution settings |
This file contains hidden or 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
| import datetime | |
| # Get the current time | |
| now = datetime.datetime.now() | |
| # Make a note of the date and time in a string | |
| # Example: 2015-12-05 12:34:24 PM | |
| textDocument = '# Scene Generated: ' + now.strftime('%Y-%m-%d %H:%M:%S %p') + '\n' | |
| print textDocument |
This file contains hidden or 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
| import os | |
| mxsFilePath = 'C:/Program Files/Next Limit/Maxwell 3/scripts/stereo/CubeX.mxs' | |
| # Find out the current scene file | |
| dirName = os.path.dirname(mxsFilePath) | |
| sceneName = os.path.basename(mxsFilePath) | |
| scenePathNoExt = os.path.splitext(mxsFilePath)[0] |
This file contains hidden or 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
| # Get the Color Space | |
| # Example: scene = Cmaxwell(mwcallback); colorSpace = mxa_getColorSpace(scene) | |
| def mxa_getColorSpace(scene): | |
| colorSpace = '' | |
| colorSpaceValue = scene.getColorSpace() | |
| if colorSpaceValue == COLOR_SPACE_SRGB: | |
| colorSpace = 'sRGB IEC61966-2.1' | |
| elif colorSpaceValue == COLOR_SPACE_ADOBE98: | |
| colorSpace = 'Adobe RGB' |