3/6/2009 Scripting Tutorials:
1:
snowman creation
just grab commands from script history
apply town movement script.
variable
for loops
lists
$person = "pCone1";
$vehicle ="pSphere1";
select -r $person;
select -add $vehicle;
parent;
select -r $vehicle;
move -r -os -wd 0 0 -24.636282;
select -r $person;
parent -w;
select -r $vehicle;
move -r -os -wd 0 0 24.636282;
$people = `ls -sl`;
$person = $people[0];
$vehicle ="pSphere1";
select -r $person;
select -add $vehicle;
parent;
select -r $vehicle;
move -r -os -wd 0 0 -24.636282;
select -r $person;
parent -w;
select -r $vehicle;
move -r -os -wd 0 0 24.636282;
$people = `ls -sl`;
for($person in $people){
$vehicle ="pSphere1";
select -r $person;
select -add $vehicle;
parent;
select -r $vehicle;
move -r -os -wd 0 0 -24.636282;
select -r $person;
parent -w;
select -r $vehicle;
move -r -os -wd 0 0 24.636282;
}
2:
equivalent in python
import maya.cmds as mc
people = mc.ls(sl=1)
vehicle = "pSphere1"
for person in people:
mc.select(person)
mc.select(vehicle, add=1)
mc.parent()
mc.select(vehicle)
mc.move(0, 0, -24.636282, r=1)#not os? wd? but relative
mc.select(person)
mc.parent(world=1)
mc.select(vehicle)
mc.move(0, 0, 24.636282, r=1)