PDA

View Full Version : How to achieve this playblast mel


alibaba
04-07-2010, 12:48 AM
Scene with headsUpDisplay display relevant information. In the figure the central insert the company logo. Can choose their own path to the file storage playblast. After the automatic withdrawal headsUpDisplay playblast display. How to write.

bendingiscool
04-07-2010, 09:50 AM
This sort of thing is usually done by writing something for your editing/compositing program rather than for Maya.

For instance, you would run your playblast as normal in Maya.

Then would need to code something that adds such details to a macro in shake/nuke/etc. You could set up the scene manually in your compositing/editing program, then find the commands to bring in say, a selected playblast, and could give you options to change the name/etc of it.

cheers,
Chris

tonytouch
04-07-2010, 10:53 AM
sony released some source code ( c++ )
http://opensource.imageworks.com/?p=mayareticle

if you can compile plugins , you can try it - you can find the source code on google
http://code.google.com/p/imageworks-maya-reticle/

you can see a demo-video on youtube
http://www.youtube.com/watch?v=tpDLkF_59Cg

or you can grab a 2009 ( x64 and 32bit ) and 2010 ( only 32bit ) version of the plugin on creativecrash
http://www.creativecrash.com/maya/downloads/scripts-plugins/interface-display/c/spreticlen

----------------------
else you could "constraint" a customized_layout , in front of your camera - ( e.g. for "shot_name" , time_code (using some expressions) ... and whatever kind of information you might want to include

morphine596
04-08-2010, 10:29 AM
I think it could be a part of the Heads Up Display. You can edit/add elements to your HUD using the mel command headsUpDisplay.

alibaba
04-14-2010, 12:57 PM
Thank you for your reply. Guys
By compositing to complete this, I feel too much trouble,
I found a tool I thought was close,
http://www.creativecrash.com/maya/downloads/scripts-plugins/c/mayi_infotool--2
However, the version of the tool for me, too old, I use maya 2009

I tried to accomplish this by mel, but I encountered an error prompt, we have a good any good ideas, greatly appreciated:


global proc playblast()
{
// float $width = `getAttr "defaultResolution.width"`;
// float $hight = `getAttr "defaultResolution.height"`;

// if($width!=720 || $hight!=405)
// {
// confirmDialog -message "defaultResolution isn't 720x405" -button "ok";
// return;
// }

//get modelPanel and camera
string $modelPanel = `getModelPanel`;
if (`getPanel -typeOf $modelPanel` != "modelPanel")
return;

string $camera = `modelEditor -query -camera $modelPanel`;
if (`nodeType $camera` == "camera")
{
string $buf[] = `listRelatives -parent $camera`;
$camera = $buf[0];
}
string $camshape[] = `listRelatives -s $camera`;

string $meshA[] = `polyCube -w 10 -h 10 -d 10 -sx 1 -sy 1 -sz 1 -ax 0 1 0 -cuv 4 -ch 0`;
string $meshB[] = `polyCube -w 7.2 -h 4.05 -d 12 -sx 1 -sy 1 -sz 1 -ax 0 1 0 -cuv 4 -ch 0`;
string $meshC[] = `polyBoolOp -op 2 -ch 0 -useThresholds 1 $meshA[0] $meshB[0]`;
delete ($meshC[0]+".f[0:8]");
move -a 0 0 5 ($meshC[0]+".rotatePivot") ($meshC[0]+".scalePivot");
setAttr ($meshC[0]+".tz") -5;
string $mask = `rename $meshC[0] DCmask`;
makeIdentity -apply true -t 1 $mask;
float $aper = `getAttr ($camera+".horizontalFilmAperture")`;
string $dec = ($aper);
if(`gmatch $dec "1.417*"`)
setAttr ($mask+".tz") -0.2;
else
setAttr ($mask+".tz") -0.487;
setAttr ($mask+".sx") 0.0285;
setAttr ($mask+".sy") 0.0285;
makeIdentity -apply true -s 1;
string $maskgroup = `group -n ($mask+"Group") -em`;
parent $mask $maskgroup;

string $mat = `createNode lambert`;
setAttr ($mat+".color") -type double3 0.1 0.1 0.1;
select -r $mask;
hyperShade -assign $mat;
select -cl;
/*
if($camera=="front")
{
setAttr ($mask+".sx") 121.8;
setAttr ($mask+".sy") 121.8;
}
if($camera=="top")
{
setAttr ($mask+".sx") 46.5;
setAttr ($mask+".sy") 46.5;
}
if($camera=="side")
{
setAttr ($mask+".sx") 144.9;
setAttr ($mask+".sy") 144.9;
}
*/
parentConstraint $camera $maskgroup;

expression -s ($maskgroup+".scaleX = 35/"+$camshape[0]+".focalLength;\n"+$maskgroup+".scaleY = "+$maskgroup+".scaleX;\n")
-n ($camera+"DCmask_exp");

setAttr "defaultResolution.aspectLock" 0;
setAttr "defaultResolution.width" 720;
setAttr "defaultResolution.height" 485;



//color
int $origHudValCol = `displayColor -q -dormant "headsUpDisplayValues"`;
int $origHudLabCol = `displayColor -q -dormant "headsUpDisplayLabels"`;
float $camB[] = `displayRGBColor -q background`;
//setcolor
displayColor -dormant "headsUpDisplayLabels" 16;
displayColor -dormant "headsUpDisplayValues" 16;
displayRGBColor background .6 .6 .6;
//autokey
int $autoKey = `autoKeyframe -q -state`;
autoKeyframe -state false;
//Current Maya Hud
int $selH = (`optionVar -q selectDetailsVisibility`);
int $objH = (`optionVar -q objectDetailsVisibility`);
int $polyH = (`optionVar -q polyCountVisibility`);
int $subdH = (`optionVar -q subdDetailsVisibility`);
int $aniH = (`optionVar -q animationDetailsVisibility`);
int $fbikH = (`optionVar -q fbikDetailsVisibility`);
int $frameH = (`optionVar -q frameRateVisibility`);
int $curH = (`optionVar -q currentFrameVisibility`);
int $camH = (`optionVar -q cameraNamesVisibility`);
int $viewH = (`optionVar -q viqAxisVisibility`);
int $axisH = (`toggleAxis -q -o`);
//hide maya hud
setSelectDetailsVisibility 0;
setObjectDetailsVisibility 0;
setPolyCountVisibility 0;
setSubdDetailsVisibility 0;
setAnimationDetailsVisibility 0;
setFbikDetailsVisibility 0;
setFrameRateVisibility 0;
setCurrentFrameVisibility 0;
setCameraNamesVisibility 0;
setViqAxisVisibility 0;
toggleAxis -o 0;
//Make sure the Hud blocks are free
headsUpDisplay -rp 0 7;
headsUpDisplay -rp 0 8;
headsUpDisplay -rp 4 6;
headsUpDisplay -rp 5 2;
headsUpDisplay -rp 5 1;
headsUpDisplay -rp 7 2;
headsUpDisplay -rp 7 1;
headsUpDisplay -rp 9 10;
headsUpDisplay -rp 9 9;
//Create the Hud Elements and script
headsUpDisplay -s 0 -b 7 -p 20 -bs "small" -ba "left" -da "left" -lfs "large" -dfs "large" -c "qFileInfo" qfilehud;
headsUpDisplay -s 0 -b 8 -p 20 -bs "small" -ba "left" -da "left" -lfs "large" -dfs "large" -c "qTimeInfo" qtimehud;
headsUpDisplay -s 4 -b 6 -p 20 -bs "small" -ba "center" -da "left" -lfs "large" -dfs "large" -l "Author:" -c "qUserInfo" quserhud;
headsUpDisplay -s 5 -b 2 -p 20 -bs "small" -ba "left" -da "right" -lfs "large" -dfs "large" -l "Start/End:" -c "qStartEndInfo" qsehud;
headsUpDisplay -s 5 -b 1 -p 20 -bs "small" -ba "left" -da "right" -lfs "large" -dfs "large" -l "Time Unit:" -c "qfpsInfo" qfpshud;
headsUpDisplay -s 7 -b 2 -p 20 -bs "small" -ba "center" -da "left" -lfs "large" -dfs "large" -c "qCameraInfo" qcamhud;
headsUpDisplay -s 7 -b 1 -p 20 -bs "small" -ba "right" -da "left" -lfs "large" -dfs "large" -l "FocalLength:" -c "qFocalLengthInfo" qflhud;
headsUpDisplay -s 9 -b 10 -p 20 -bs "small" -ba "left" -da "left" -lfs "large" -dfs "large" -l " Frame:" -c "qFrameInfo" -atr qframehud;
headsUpDisplay -s 9 -b 9 -p 20 -bs "small" -ba "left" -da "left" -lfs "large" -dfs "large" -l "Sequence:" -c "qSequence" -atr qseqhud;
//script
string $cmd = "headsUpDisplay -r qframehud;\n";
$cmd+="headsUpDisplay -r qseqhud;";
expression -s $cmd -n "XXHUD";
//Camera Settings
int $sa = `camera -q -displaySafeAction $camera`;
float $os = `camera -q -overscan $camera`;
int $ff = `camera -q -filmFit $camera`;
int $dr = `camera -q -displayResolution $camera`;
//camera -e -dsa 1 -dr 0 -overscan 1.0 $camera;
//camera -e -dsa 1 -dr 0 $camera;
if(`gmatch $dec "1.417*"`)
camera -e -dsa 0 -dr 0 -overscan 1.05 -ff 0 $camera;
else
camera -e -dsa 0 -dr 0 -overscan 1.25 -ff 0 $camera;
//Project Resoultion

//Check for sound in timeline
global string $gPlayBackSlider;
string $soundFlags;
int $isSound = `timeControl -q -ds $gPlayBackSlider`;
string $sound = `timeControl -q -s $gPlayBackSlider`;

switch ($isSound){
case 1:
$soundFlags = (" -s " + $sound);
break;
case 0:
$soundFlags = "";
break;
}
//play blast

string $PB = ("playblast -format movie " + $soundFlags + " -cc 1 -fo -viqer 1 -showOrnaments 1 -fp 4 -compression dialog -widthHeight " + "720 485" + " -p 100");
catchQuiet (`eval $PB`);

//resume
headsUpDisplay -rp 0 7;
headsUpDisplay -rp 0 8;
headsUpDisplay -rp 4 6;
headsUpDisplay -rp 5 2;
headsUpDisplay -rp 5 1;
headsUpDisplay -rp 7 2;
headsUpDisplay -rp 7 1;
headsUpDisplay -rp 9 10;
headsUpDisplay -rp 9 9;
delete "XXHUD*";

delete ($camera+"DCmask_exp") $mat $maskgroup;

autoKeyframe -state $autoKey;

displayColor -dormant "headsUpDisplayLabels" $origHudValCol;
displayColor -dormant "headsUpDisplayValues" $origHudLabCol;
displayRGBColor background $camB[0] $camB[1] $camB[2];

setSelectDetailsVisibility $selH;
setObjectDetailsVisibility $objH;
setPolyCountVisibility $polyH;
setSubdDetailsVisibility $subdH;
setAnimationDetailsVisibility $aniH;
setFbikDetailsVisibility $fbikH;
setFrameRateVisibility $frameH;
setCurrentFrameVisibility $curH;
setCameraNamesVisibility $camH;
setViqAxisVisibility $viqH;
toggleAxis -o $axisH;

camera -e -dsa $sa -dr $dr -overscan $os -ff $ff $camera;

setAttr "defaultResolution.width" 720;
setAttr "defaultResolution.height" 405;
}

global proc string qUserInfo()
{
string $user = `getenv "USERNAME"`;
$user = `tolower $user`;
return $user;
}

global proc string qFileInfo()
{
string $scene = `file -q -sn`;
if($scene=="") return "untitled";
else
{
string $file = basenameEx($scene);
return $file;
}
}

global proc string qTimeInfo()
{
string $cmd = "\"C:/Documents and Settings/Administrator/My Documents/maya/sysTime.exe\"";
string $time = `system $cmd`;
$time = `substring $time 1 16`;
return $time;
}

global proc string qCameraInfo()
{
string $modelPanel = `getPanel -withFocus`;
if (`getPanel -typeOf $modelPanel` != "modelPanel")
return "";
string $camera = `modelEditor -query -camera $modelPanel`;
if (`nodeType $camera` == "camera")
{
string $buf[] = `listRelatives -parent $camera`;
$camera = $buf[0];
}
return $camera;
}

global proc float qStartInfo()
{
float $start;
if (`optionVar -query playblastUseStartEnd`)
$start = `optionVar -q playblastStartTime`;
else
$start = `playbackOptions -q -minTime`;
return $start;
}
global proc float qEndInfo()
{
float $end;
if (`optionVar -query playblastUseStartEnd`)
$end = `optionVar -q playblastEndTime`;
else
$end = `playbackOptions -q -maxTime`;
return $end;
}
global proc string qStartEndInfo()
{
float $start = `qStartInfo`;
float $end = `qEndInfo`;
string $se = $start+"/"+$end;
int $size = size("" + $end) - size("" + $start);
for ($i=0; $i<$size; $i++)
$se = "0" + $se;
return $se;
}

global proc string qFocalLengthInfo()
{
string $camera = `qCameraInfo`;
if($camera=="") return "";
float $FL = `getAttr ($camera + ".focalLength")`;
return $FL;
}

global proc float qFrameInfo()
{
float $frame =`currentTime -q`;
return $frame;
}

global proc string qSequence()
{
float $start = `qStartInfo`;
float $end = `qEndInfo`;
float $tol = $end-$start+1;
int $seq = `qFrameInfo` - $start + 1;
string $str = $seq + "/" + $tol;
int $size = size("" + $tol) - size("" + $seq);
for ($i=0; $i<$size; $i++)
$str = "0" + $str;
return $str;
}

global proc string qfpsInfo()
{
string $fps = `currentUnit -q -f -time`;
if($fps=="game") $fps="15fps";
else if($fps=="film") $fps="24fps";
else if($fps=="pal") $fps="25fps";
else if($fps=="ntsc") $fps="30fps";
else if($fps=="show") $fps="48fps";
else if($fps=="palf") $fps="50fps";
else if($fps=="ntscf") $fps="60fps";
else $fps=$fps;

return $fps;
}

global proc string getModelPanel()
{
string $currentPanel = `getPanel -withFocus`;
string $panelType = `getPanel -to $currentPanel`;
if($panelType == "modelPanel")
{
setFocus $currentPanel;
return $currentPanel;
}
else{
string $firstModelPanel = `getFirstVisibleModelPanel`;
if ( size($firstModelPanel) ){
setFocus $firstModelPanel;
return $firstModelPanel;
}
else { return ""; }
}
}

global proc string getFirstVisibleModelPanel()
{
string $visPanels[] = `getPanel -vis`;
for($currentPanel in $visPanels)
{
string $panelType = `getPanel -to $currentPanel`;
if ($panelType == "modelPanel")
{
return $currentPanel;
}
}
return "";
}

CGTalk Moderation
04-14-2010, 12:57 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.