Pymel / Python Coding

Author: admin

Run Command Line / .exe from Maya

I use midicsv, so for convenience I coded this up to run its command line from within maya gui. you run it , you pick input file, in this case a midi file (.mid) it does its thing and outputs a .csv file with the same name. import subprocess import EasyDialogs input_file = EasyDialogs.AskFileForOpen() wanted=unicode…

Global Mapping GUI


Features

Filter by capital/country
Filter by continent/region
Create custom locations
Save and Import Collections
Save Presets
Set color of curves
Set width of curves
Animation of curves based on length or fixed.
Start and End point custom geometry
Export locator data to After Effects.

project_01_large_a

project_01_large_b

Curve fix and setup for Renderman/3delight

coded this up in pymel and used qt designer for the GUI in maya. This GUI sets up the normals on curves for rendering in renderman / 3delight – and is used in conjunction with primitive variables on each curve and a curve shader.

As you can see in (1) a regular curve prior to be fixed is all kinds of wonky. With this technique the ‘Face Camera’ of the normals are disabled and they can be set to all face the direction selected.

GUI enables per item or selection
1 Fix
2 set direction
3 color
5 Animation of Curve based on curve length proportion or custom set. Start and end frames
can also be set.

6 Width for start and end can be adjusted

qt designer

http://dopesheet.co.uk/?p=91

maya

http://dopesheet.co.uk/?p=86

import pymel.core as pm
pm.shadingNode ('ramp',asTexture=True,n="curveRamp")
pm.shadingNode ('place2dTexture',asUtility=True,n="curveRamp_place2dTexture")
pm.connectAttr ("curveRamp_place2dTexture.outUV", "curveRamp.uv");
pm.connectAttr( "curveRamp_place2dTexture.outUvFilterSize", "curveRamp.uvFilterSize");
pm.disconnectAttr ("curveRamp_place2dTexture.outUV", "curveRamp.uvCoord");
if (pm.window('Normal_Curve_Creator',exists=True)):
    pm.deleteUI('Normal_Curve_Creator')
import curve_fixer
reload(curve_fixer)
dialog2 = pm.loadUI(f="C:/Users/luke/Documents/QTDESIGNER/rebuild_curve.ui")
allowedAreas = ['right', 'left']
pm.showWindow()
pm.dockControl(area='left',content=dialog2,allowedArea=allowedAreas,l='Normal_Curve_Creator')

pymel
http://dopesheet.co.uk/uncategorized/curve_fixer-py/

Output Maya Animation Data to .csv file

Coded this up to output animation data from maya into a comma separated.csv file. pymel script def textOut(): fileName = pm.fileDialog2(fileFilter=’*.csv’, caption=’Write to a csv file’) fileWrite = open(fileName[0], ‘w’) firstFrame = pm.intSlider(‘StartFrameSlider’, query=True, value=True) lastFrame = pm.intSlider(‘EndFrameSlider’, query=True, value=True) # animation time range animTimeRange = pm.checkBox(‘AnimBackRange_checkBox’, query=True, value=True) if animTimeRange == True: animStart =…