Maxwell Render

Maxwell Render Information Repository
It is currently Fri Jul 25, 2014 7:28 pm

All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: MEL For Maya
PostPosted: Wed Aug 03, 2011 1:59 am 

Joined: Wed Sep 20, 2006 11:33 am
Posts: 114
Location: Montreux
Hello guys,

I got a simple Mel Script that that i want to modify to link the Manual focus of the Maxwell camera to a included locator(included in the below script).
Please have a look...can someone update that for me? could be useful for those using animation with DOF directly in rendering.

I got a bunch of mel, expressions and GUI to write for production, is anyone interested for some jobs?

Thanks in advance

Roshan
VOXELPICTURES

--

global proc DOFcam ()
{
//curve -d 1 -p -1 -1 0
// -p -1 1 0
// -p 1 1 0
// -p 1 -1 0
// -p -1 -1 0
// -p 1 1 0

string $theCam[] = ` camera -dof 1` ;

float $fd = ` camera -query -fd $theCam[1] `;

string $theLoc[] = `spaceLocator` ;
move -a 0 0 (0-$fd);


select -tgl $theCam[0];

aimConstraint -aimVector 0 0 -1;

string $theGroup = ` group -em -name "DOFcam" `;

parent $theCam[0] $theGroup;
parent $theLoc[0] $theGroup;

string $exp = ( "float $diff[3] ;\n"+
"float $camPos[] = ` xform -q -t " + $theCam[0] + " ` ; \n"+
"float $locPos[] = ` xform -q -t " + $theLoc[0] + " `; \n " +
"\n"+
"for ($i=0; $i<3 ; $i++) \n"+
"{ \n"+
" $diff[$i] = $locPos[$i] - $camPos[$i] ; \n"+
"} \n\n"+
"float $dist = hypot($diff[0],$diff[1]); \n"+
"$dist = hypot($dist,$diff[2]); \n\n"+
$theCam[1]+".focusDistance = $dist ;") ;

expression -string $exp -name "DOFcamExp";


}

--

_________________
VOXELPICTURES
Innovate l Design l Experience
http://www.voxelpictures.com


Top
 Profile  
 
 Post subject: Re: MEL For Maya
PostPosted: Fri Mar 02, 2012 6:12 pm 
User avatar

Joined: Thu Oct 13, 2011 2:31 pm
Posts: 56
Location: Montpellier, France
I use a "distanceBetween" node to have the distance between the focus_locator and the camera.
Use the connection editor to link the wordMatrix of the cameraShape to the inMatrix1 and worldMatrix of the locator to the inMatrix2 param of the distanceBetween node.

In second time use this mel line to link the distanceBetween and the manual focus distance (Be sure that Maxwell manual focus is enable before) :
connectAttr -f distanceBetween1.distance cameraShape.mxFocusDistance;

In fact I have done this once and I save ma camera rig in separate file to import each time I want.

_________________
-------------------------------------------
IN EFECTO
http://www.inefecto.com


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC + 1 hour [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group