Blendshape Mirror

Hi, I'm pretty new to this MEL but I still gave a shot at a script. I remember in college when I was working on some Blendshapes and found myself in a problem when I wanted to make some to open the eyes, and I quicly noticed that there was no quick way of making the second eye just like the first I did. So I ended up doing it vertex by vertex to get the same deformation.

Anyways..I made this little script that does just that and I'm looking for people to try it and give me some constructive criticism on it.

here is a link to the .rar, in there I put a readme.doc with alot of pics to explain what to do, hope its not too complicated.

Blendshape Mirror

oh and.. for the script simply open it in your favorite text program and copy/paste it in the script editor and execute it, the window should pop, and if you read the README.doc then you should know what to do

Thanks in advance

Hey, Nice Job.
To be picky. two things that I want to point out.

First, honestly,I have a little bit hard time to pick up all the points. Said there are multiple Facial Expression that I want to mirror, then I will have to do this over and over.

Second, your script will only work for the poly that you delete the half , then mirror and merge the vertice.
e.g. A default polysphere, I beleive, does not have the same point difference for the checkpoint information.

Just also want to point out that talking about Mirror for Blendshape
I strongly recommand you to take a look of David Keegan's flipShape.
He used Wrap Deformer. It's very impressive and intuitive.
I've learned a lot from that script.

But, hey, interesting method. Although it does not work in some aspects, it does work for your purpose. And, to me, that's what scripting all about, to make things work.

using wrap and then baking it out is perfectly valid, but there are other similliar scripts too (on highend). Wich work better. i dont think this ever realy was a problem per se its usualy one of those things where the workflow wasnt developped enough, to undertand that tools are available for download. (because theese scripts have been availablble atleast the entire 20th century)

Or if you work on face halves anyway then theres a better way. Because you can assemle the the entire full blend from those halves anyway. NOw teh benefit of this reassembling is if you need to go back at some stage to do tweaks then you can easily. Also you can easily have a file with halves and fullheads (reassembled haves for thos bleds that arent mirrors or smack in middle) then you wouldnt have to worry about possible missmatches form side to side.

the workfow is also better because it allows for the head to be attached to the body in the same automation cycle.

Also in maya 7 the entire issue is gone by now anyway for those of you who mirror anyway since you can paint in the halve to isolate it

for a interactive demo on this run in empty scene (ist not a script its a animationy):

CODE
file -f -new;
window -e- vis 0 $gCommandWindow;
polyCube -w 1 -h 1 -d 1 -sx 2 -sy 2 -sz 2 -ax 0 1 0 -tx 1 -ch 1;
viewFit;
annotate -tx "Think this is head!" -p 0 0.8 0;
setAttr "annotationShape1.displayArrow" 0;
refresh; pause -sec 1;
select -r pCube1.f[0]
         pCube1.f[2]
         pCube1.f[4]
         pCube1.f[6]
         pCube1.f[8]
         pCube1.f[10]
         pCube1.f[12]
         pCube1.f[14]
         pCube1.f[20:23];
refresh; pause -sec 1;
delete;
setAttr -type "string" annotationShape1.text "Think this is head! (now half a head)";
refresh; pause -sec 1;
select -r pCube1;
duplicate -rr;
move -r 2 0 0;
viewFit -all;
refresh; pause -sec 1;
duplicate -rr;
move -r 2 0 0;
viewFit -all;
refresh; pause -sec 1;
duplicate -rr;
move -r 2 0 0;
viewFit -all;

refresh; pause -sec 1;

select -r persp;
for ($i=0;$i<4;$i++){
move -r (0.758996/4) (-1.121061/4) (0.0817991/4);
refresh;
}

select -r pCube2.vtx[5] pCube2.vtx[7] pCube2.vtx[9];
refresh; pause -sec 1;
for ($i=0;$i<4;$i++){
move -r 0.05 0.05 0;
refresh; pause -sec 0;
}
pause -sec 1;
select -r pCube3.vtx[3] pCube3.vtx[11] pCube3.vtx[16];
refresh; pause -sec 1;
for ($i=0;$i<4;$i++){
move -r -0.067 0 0;
refresh; pause -sec 0;
}

pause -sec 1;
select -r pCube4.vtx[1];
refresh; pause -sec 1;
for ($i=0;$i<4;$i++){
move -r 0.056 -0.04 0.08;
refresh; pause -sec 0;
}

setAttr -type "string" annotationShape1.text "Lets reasemble ME!";
refresh; pause -sec 1;
setAttr -type "string" annotationShape1.text "Lets reasemble ME.";
refresh; pause -sec 1;
setAttr -type "string" annotationShape1.text "Lets reasemble ME!";
refresh; pause -sec 1;

select -r pCube1;
refresh; pause -sec 1;
duplicate -rr;
duplicate -rr;
duplicate -rr;
duplicate -rr; scale -1 1 1;
duplicate -rr;
duplicate -rr;
duplicate -rr;

refresh; pause -sec 1;
select -r pCube1;
refresh;
select -add pCube11;
refresh; pause -sec 1;
constructionHistory -toggle false; // we dont need the extra shapes
CombinePolygons
refresh; pause -sec 1;
select -r polySurface1.e[8]
         polySurface1.e[10]
         polySurface1.e[12]
         polySurface1.e[14]
         polySurface1.e[16]
         polySurface1.e[18]
         polySurface1.e[20]
         polySurface1.e[22]
         polySurface1.e[36]
         polySurface1.e[38]
         polySurface1.e[40]
         polySurface1.e[42]
         polySurface1.e[44]
         polySurface1.e[46]
         polySurface1.e[48]
         polySurface1.e[50];
refresh;
performPolySewEdge 0;
refresh; pause -sec 1;
select -r pCube2;
setAttr "pCube2.translateX" 0;
duplicate -rr; scale -1 1 1;
select -r pCube5 pCube11;
CombinePolygons;
select -r polySurface2.e[8]
         polySurface2.e[10]
         polySurface2.e[12]
         polySurface2.e[14]
         polySurface2.e[16]
         polySurface2.e[18]
         polySurface2.e[20]
         polySurface2.e[22]
         polySurface2.e[36]
         polySurface2.e[38]
         polySurface2.e[40]
         polySurface2.e[42]
         polySurface2.e[44]
         polySurface2.e[46]
         polySurface2.e[48]
         polySurface2.e[50];
performPolySewEdge 0;
setAttr "polySurface2.translateX" -2;
refresh;
select -r pCube2 pCube8;
CombinePolygons;
select -r polySurface3.e[8]
         polySurface3.e[10]
         polySurface3.e[12]
         polySurface3.e[14]
         polySurface3.e[16]
         polySurface3.e[18]
         polySurface3.e[20]
         polySurface3.e[22]
         polySurface3.e[36]
         polySurface3.e[38]
         polySurface3.e[40]
         polySurface3.e[42]
         polySurface3.e[44]
         polySurface3.e[46]
         polySurface3.e[48]
         polySurface3.e[50];
performPolySewEdge 0;
setAttr "polySurface3.translateX" 2;
select -r pCube3;
setAttr "pCube3.translateX" 0;
duplicate -rr; scale -1 1 1;
select -r pCube6  pCube11;
CombinePolygons;
select -r polySurface4.e[8]
         polySurface4.e[10]
         polySurface4.e[12]
         polySurface4.e[14]
         polySurface4.e[16]
         polySurface4.e[18]
         polySurface4.e[20]
         polySurface4.e[22]
         polySurface4.e[36]
         polySurface4.e[38]
         polySurface4.e[40]
         polySurface4.e[42]
         polySurface4.e[44]
         polySurface4.e[46]
         polySurface4.e[48]
         polySurface4.e[50];
performPolySewEdge 0;
setAttr "polySurface4.translateX" -4;
select -r pCube3 pCube9;
CombinePolygons;
select -r polySurface5.e[8]
         polySurface5.e[10]
         polySurface5.e[12]
         polySurface5.e[14]
         polySurface5.e[16]
         polySurface5.e[18]
         polySurface5.e[20]
         polySurface5.e[22]
         polySurface5.e[36]
         polySurface5.e[38]
         polySurface5.e[40]
         polySurface5.e[42]
         polySurface5.e[44]
         polySurface5.e[46]
         polySurface5.e[48]
         polySurface5.e[50];
performPolySewEdge 0;
setAttr "polySurface5.translateX" 4;
select -r pCube4;
setAttr "pCube4.translateX" 0;
duplicate -rr; scale -1 1 1;
select -r pCube7 pCube11;
CombinePolygons;
select -r polySurface6.e[8]
         polySurface6.e[10]
         polySurface6.e[12]
         polySurface6.e[14]
         polySurface6.e[16]
         polySurface6.e[18]
         polySurface6.e[20]
         polySurface6.e[22]
         polySurface6.e[36]
         polySurface6.e[38]
         polySurface6.e[40]
         polySurface6.e[42]
         polySurface6.e[44]
         polySurface6.e[46]
         polySurface6.e[48]
         polySurface6.e[50];
performPolySewEdge 0;
setAttr "polySurface6.translateX" -6;
select -r pCube4 pCube10;
CombinePolygons;
select -r polySurface7.e[8]
         polySurface7.e[10]
         polySurface7.e[12]
         polySurface7.e[14]
         polySurface7.e[16]
         polySurface7.e[18]
         polySurface7.e[20]
         polySurface7.e[22]
         polySurface7.e[36]
         polySurface7.e[38]
         polySurface7.e[40]
         polySurface7.e[42]
         polySurface7.e[44]
         polySurface7.e[46]
         polySurface7.e[48]
         polySurface7.e[50];
performPolySewEdge 0;
setAttr "polySurface7.translateX" 6;
viewFit -all;
refresh; pause -sec 1;

setAttr -type "string" annotationShape1.text "Now some center symmetries!";
refresh; pause -sec 1;
setAttr -type "string" annotationShape1.text "Now some center symmetries.";
refresh; pause -sec 1;
setAttr -type "string" annotationShape1.text "Now some center symmetries!";
refresh; pause -sec 1;
select -r polySurface1;
duplicate -rr;
move -r 0 2 0;
refresh; pause -sec 1;
duplicate -rr;
move -r 0 2 0;
refresh; pause -sec 1;
select -r polySurface8.vtx[4] polySurface8.vtx[6] polySurface8.vtx[8];
move -r -ls -wd 0 0.414941 0;
refresh;
select -r polySurface9.vtx[2];
move -r -ls -wd 0 0 1.729639;

setAttr -type "string" annotationShape1.text "DONE! now blend";

the animation istelf shows the assembly one could easily just save the 4 halves, and teh 2 fullheads then one coudl easi

Wow!, Thanks alot for the info, I remember looking for some scripts to do this a while back but I could not get it to work, probably because I did not know enough about it.

As you might of seen the script was pretty basic and "Raw" I pretty much did it because I just wanted to do some MEL to get better at it. the whole point was to come up with a way to make it work and then find how to do it in mel

Well I greatly appreciate what you guys said, and I probably wont even use my own script

Thanks again for taking the time to help me out.

no prob but for you learning efforts its not all thet bad