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
import maya.cmds as cmds | |
def bevelSelected(): | |
selection = cmds.ls( selection=True ) | |
for select in selection: | |
cmds.polyBevel(mesh, offset=0.1, angleTolerance=0) | |
def unBevelSelected(): | |
selection = cmds.ls (selection=True) | |
for select in selection: |
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
# Get Maya scene filepath and name | |
sceneFilepath = cmds.file(q=True, sn=True) | |
sceneName = os.path.basename( sceneFilepath ) | |
sceneNameNoExtension = os.path.splitext(sceneName)[0] | |
sceneNameExtensionOnly = os.path.splitext(sceneName)[1] | |
# Get Maya project | |
mayaProject = cmds.workspace(q=True, rd=True) | |
# internalVar returns internal variables on a user level, more info: http://download.autodesk.com/global/docs/maya2014/en_us/CommandsPython/internalVar.html |
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
import maya.cmds as cmds | |
def toggleOrthoPersp(): | |
if cmds.getAttr('perspShape.orthographic') == 1: | |
cmds.setAttr('perspShape.orthographic', 0) | |
print('Orto disabled on Persp view.') | |
else: | |
cmds.setAttr('perspShape.orthographic', 1) | |
print('Orto enabled on Persp view.') |
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
import maya.cmds as cmds | |
import maya.mel as mel | |
import sys | |
input = sys.stdin.readline() | |
selection = cmds.ls( selection=True ) | |
for object in selection: | |
try: |
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
class Example(object): | |
def run(self): | |
print "Hello, world!" | |
if __name__ == '__main__': | |
Example().run() |
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
if(!`about -batch`) { | |
// GUI commands go in here and are skipped in batch mode | |
} |
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
// Loop through all render layers | |
for ($layer in `ls -type "renderLayer"`){ | |
// Find the ones which are renderable | |
if ((`getAttr ($layer+".renderable")` == 1)){ | |
string $buffer[] ; | |
$buffer = stringToStringArray($layer, ":"); | |
// Don't count renderlayers from references | |
if(size($buffer) < 2){ | |
editRenderLayerGlobals -currentRenderLayer $layer; | |
string $renderer = (`getAttr "defaultRenderGlobals.currentRenderer"`); |
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
while(`match "_ZZZrender" $alf` == "_ZZZrender"){ | |
$alf = `substitute "_ZZZrender" $alf "_Srender"`; | |
} |
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
float $tmpFloat[] = (`memory -phy`); | |
int $gigs = (int)$tmpFloat[0]; | |
int $assignMem= $gigs-($gigs/3); | |
vraySettings.sys_rayc_dynMemLimit = $assignMem; | |
// Set V-Ray's number of passes to amount of cores | |
vraySettings.numPasses = `threadCount -q -n`; | |
// Set V-Ray's subdivs (under Light cache) to image width | |
vraySettings.subdivs = getAttr("defaultResolution.width"); |
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
command = '...' | |
p = subprocess.Popen( command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) | |
sys.stdout.flush() | |
for line in iter(p.stdout.readline, b''): | |
sys.stdout.flush() | |
print(">>> " + line.rstrip()) |