Wednesday, December 16, 2009

Mel Script

Here's script for parenting any prop

/////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////
///////////////////////////Run script : "setparent" /////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////


global proc setparent()
{
string $sel[]=`ls -sl`;
string $child=$sel[0];
string $parent=$sel[1];
select -r $child;
string $rt[]=`pickWalk -d up`;
string $root=$rt[0];
if ($root==$child)
{
select -cl ;
$root=`group -em`;
xform -os -piv 0 0 0;
select -cl ;
select -r $child ;
select -add $root;
string $pc[]=`parentConstraint -weight 1`;
delete $pc[0] ;
select -r $child ;
select -add $root ;
parent;
}
select -cl ;
string $group;
if (!objExists("Parent_Group"))
{
$group =`group -em -n Parent_Group`;
}
else { $group="Parent_Group"; }
$pnull=`group -em`;
select -r $pnull;
select -add $group;
parent;
select -cl ;
select -r $parent;
select -add $pnull;
parentConstraint -weight 1;
select -r $pnull;
select -add $root;
$pc=`parentConstraint -mo -weight 1`;
string $list[]=`parentConstraint -q -wal $pc[0]`;
int $n=`size($list)`;
if ($n > 1)
{
setAttr ($pc[0] + "." + $list[$n-2]) 0;
setKeyframe ($pc[0] + "." + $list[$n-2]);
setKeyframe ($pc[0] + "." + $list[$n-1]);
int $ct=`currentTime -query`;
currentTime -edit ($ct-1);
setAttr ($pc[0] + "." + $list[$n-2]) 1;
setAttr ($pc[0] + "." + $list[$n-1]) 0;
setKeyframe ($pc[0] + "." + $list[$n-2]);
setKeyframe ($pc[0] + "." + $list[$n-1]);
currentTime -edit $ct;
}
else
{
setKeyframe ($pc[0] + "." + $list[$n-1]);

int $ct=`currentTime -q`;
currentTime -edit ($ct-1);
setAttr ($pc[0] + "." + $list[$n-1]) 0;
setKeyframe ($pc[0] + "." + $list[$n-1]);

currentTime -edit $ct;

}
select -cl ;
select -r $child;
}


https://www.lucasfilm.apply2jobs.com/ProfExt/index.cfm?fuseaction=mExternal.showJob&RID=2164&CurrentPage=1





Here's the script for quicktime framecounter:
{QTtext}
{timescale: 15}
{font: Arial}
{bold}
{justify: center}
{size: 22}
{backColor: 0, 0, 0}
{width: 60}
{height: 30}
{timeStamps: relative}
[00:00:00.00] 1
[00:00:00.01] 2
[00:00:00.01] 3
[00:00:00.01] 4
[00:00:00.01] 5
[00:00:00.01] 6
[00:00:00.01] 7
[00:00:00.01] 8
[00:00:00.01] 9
[00:00:00.01] 10
[00:00:00.01]

No comments: