MAYA Script Editor
- Open the MAYA Script Editor
- upper pane = recording
- lower pane = Input
- select text from the recording
- drag with middle mouse button to the input
- execute with control-Enter
UltraEdit
- start UltraEdit (or another appropriate Editor)
- Open an empty file
- copy and paste code from the upper pane of the MAYA Script Editor
- clean up the code
- save regularly
Testing
Either:
- copy bits of code into the Input Area
- Control-Enter to execute the code
or:
- open the saved mel-script in the script editor
File > Open Script ...
Read the error messages carefully (if there are any)
and improve your code respectively
Don't forget the ";" at the end of the line;
|
|
Improve the Code
1) erase superfluous code and make it compact
move -r 0.23 0.45 0.1;
move -r -0.23 0.55 1;
move -r 0 0.2 -0.1;
can be summarized to:
move -r 0 1.2 1;
2) introduce names
polyCube -name trinity;
polyCone -r 3 -h 0.3 -name neo;
3) add comments
// after two slashes you can write comments until the end of the line
4) replace commands and get a feeling for the options
instead of the absolute translation:
select trinity;
move -a 1.234 0 0;
select -cl;
use the name:
move -a 1.234 0 0 trinity;
instead of move set the attribute:
setAttr trinity.translateX 1.234;
5) first line
file -f -new; //
to clean the scene including materials
6) last line
DisplayShaded; //
to switch to Smooth Shade all
|
|
Materials and Lights
Materials are created and assigned as follows:
shadingNode -asShader lambert -name neoMat;
sets -renderable true -noSurfaceShader true -empty -name neoMatSG;
connectAttr -f neoMat.outColor neoMatSG.surfaceShader;
setAttr "neoMat.color" -type double3 0.5 0.345765 0.103;
select -r neo;
sets -e -forceElement neoMatSG;
or
string $colorname = "my_shader";
shadingNode -asShader phong -n $colorname;
sets -renderable true -noSurfaceShader true -empty -name ($colorname +
"SG");
connectAttr -f ($colorname + ".outColor") ($colorname + "SG.surfaceShader");
setAttr ($colorname + ".colorR") 0.9;
setAttr ($colorname + ".colorG") 0.3;
setAttr ($colorname + ".colorB") 0.2;
setAttr ($colorname + ".transparencyR") 0.8;
setAttr ($colorname + ".transparencyG") 0.8;
setAttr ($colorname + ".transparencyB") 0.8;
setDefaultShadingGroup ($colorname + "SG");
and the next primitves will use this shader until you
set another default
Lights are created and used as follows:
pointLight -name rampLight;
move 0 1.234 0 rampLight;
setAttr rampLight.colorR 0.2;
|