In a student film I am working on a house needed to be littered with picture frames. Instead of modeling them all one by one I decided to create a MEL scipt that would create multiple frames. The script will also allow users to control the frames.



Okay so the MEL Script is broken into three parts. This creates the look of the frame by moving its basic curves.
select -r TopLeft ;
move -r 0 0 $v; //$TLZ ;
select -r TopRight ;
move -r 0 0 $TRZ ;
move -r $TRX 0 0 ;
select -r BottomRight ;
move -r $BRX 0 0 ;
select -r TopLeft ;
select -tgl TopRight ;
scale -r $XSCALE 1 $ZSCALE ;
select -r BottomLeft ;
select -tgl BottomRight ;

scale -r $BXSCALE 1 $BZSCALE ;

Next the script duplicates the original frame and moves it next to the original

select -r loftedSurface1 ;
select -tgl loftedSurface2 ;
select -tgl loftedSurface3 ;
select -tgl loftedSurface4 ;
duplicate -rr;
move -r 15 0 0 ;

Now the script sets the "Master Frame" back to its original self.
select -r TopLeft ;
setAttr "TopLeft.translateZ" 0;

select -r TopRight ;
setAttr "TopRight.translateX" 0;
setAttr "TopRight.translateZ" 0;

select -r BottomRight ;
setAttr "BottomRight.translateX" 0;




Now I have to create a UI for users to be able to control the frame's creation.
There's a contoler that controls the top left Z value and another that controls the top right's Z value.
If these two number are equal the frame will stay symetrical and parallel to the bottom of the frame. Otherwise the frame will look more like the one in the picture above.


The next two controllers manipulate the top and bottom right's X value.
Once agian if these numbers are equal the frame keeps parallel.
This time the frame will get wider rather than taller. If you want you can make the frame have unique shapes like the one to the left.
This is achived by offseting the numbers.

Okay two more controlers... First the top and bottom Z scalers. these add more width to the "Frame Pieces".
I added width to the top and bottom of the frame.

Finally the Pinches... These pinch the tops and bottoms...
If these are done equally the left and right pieces get wider.

So what else is in store for this script... Possibly a way to place a random texture on it.
Maybe a way to move the duplicate frame.

 

contact@joshwood.net