Maya 脚本命令

向左旋转:
rotate -r -os 0 46.689353 0 ;
向右旋转:
rotate -r -os 0 -36.555682 0 ;


//绘制曲线
EP Curve Settings:
Curve degree: 1 Linear /2 /3 Cubic /5 /7
Knot spacing Uniform / Chord length

curve -d 1 -p -2.54318 0 0.174007 -p -2.067642 0 -0.0847929 -p -1.725209 0 -0.427226 -p -1.531017 0 -0.755567 -p -1.600081 0 -1.363827 -p -1.483146 0 -1.879149 -p -1.233569 0 -1.992121 -p -1.14318 0 -2.219115 -p -1.765829 0 -3.411564 -p -1.445756 0 -3.982648 -p -0.925965 0 -3.691174 -p -0.592428 0 -3.807282 -p -1.354756 0 -5.516159 -k 0 -k 1 -k 2 -k 3 -k 4 -k 5 -k 6 -k 7 -k 8 -k 9 -k 10 -k 11 -k 12 ;


curve -d 3 -p -0.720445 0 0.820308 -p -0.501167 0 0.86447 -p -0.0626121 0 0.952794 -p 0.354617 0 0.889848 -p 0.30877 0 0.694192 -p 0.261551 0 0.401259 -p 0.387522 0 0.263266 -p 0.224793 0 -0.677265 -p 0.884217 0 0.100044 -p 1.040004 0 0.314897 -p 1.289225 0 0.235125 -p 1.161475 0 -0.407932 -p 1.0976 0 -0.729461 -k 0 -k 0 -k 0 -k 1 -k 2 -k 3 -k 4 -k 5 -k 6 -k 7 -k 8 -k 9 -k 10 -k 10 -k 10 ;
select -d curve2 ;

//查询中心点坐标、包围盒坐标

objectCenter -gl pCube1;
// 0.909328 0 0 // 
xform -worldSpace -query -translation pCube1;
// 0 0 0 // 
xform -query -boundingBox pCube1;
// -65.756111 -12.45939 -12.45939 -39.018669 12.45939 12.45939 // 


//帧数相关

int $m=(((`currentTime -q`)-(`playbackOptions -q -min`))/(`playbackOptions -q -max`)*100);
$b= "rendering: ";
for($i=0;$i<=25;$i++){
$b += ($m/4<$i)?".":"#";
}
trace($b+" "+$m+"% ("+`file -q -sn`+")");

// a test
float $frames_total = `playbackOptions -q -max`;
// Result: 300 // 
float $area_z = $z_max - $z_min;
// Result: 427.200134 // 
float $act_z = $area_z - $agent_l_z;
// Result: 402.281355 // 
float $act_unit = $act_z / ($frames_total /2 /10);
// Result: 26.818757 // 
int $move_num = int($frames_total/2/10);
// Result: 15 // 
int $i=0;
// Result: 0 // 

for($i=1;$i<=15; $i++){
	currentTime ($i*10);
	move -r 0 0 $act_unit;
	setKeyframe;
};


//

string $transformInScene[] = `ls -typ transform`;

float $coor[] = `objectCenter -gl pCube1`; //世界坐标

size($coor) //数组的大小

float $Min[] = `getAttr ("pCube1" + ".boundingBoxMin")`;


vector $v = `getAttr "pCube1.boundingBoxMin"`;
vector $v1 = `getAttr "pCube1.boundingBoxMax"`;

print($v1 - $v);


ls -sn -type transform -v;
// Result: pCube1 pCylinder1 pPyramid1 pSphere1 // 


move -r 10 1 1 "pSphere1";


currentTime 10;
move -r 10 10 10;
setKeyframe;

//



vector $v1_0 = `getAttr "pCylinder1.boundingBoxMin"`;
vector $v1_1 =  `getAttr "pCylinder1.boundingBoxMax"`;
vector $v1 = `objectCenter -gl pCylinder1`;
// Result: <<29.911315, 0.490727, 10.28121>>  // 
vector $v0_d = $v0_1 - $v0_0;
// Result: <<225.204939, 225.204939, 225.204939>>  // 
vector $v1_d = $v1_1 - $v1_0;
// Result: <<14.090104, 14.090103, 14.090107>>  // 
$float m = max($v1_d.x+$v0_d.x, max(v1_d.y+v0_d_y, v1_d.z+v0_d.z));
// Error: $float m = max($v1_d.x+$v0_d.x, max(v1_d.y+v0_d_y, v1_d.z+v0_d.z)); // 
// Error: Syntax error // 
$float $m = max($v1_d.x+$v0_d.x, max(v1_d.y+v0_d_y, v1_d.z+v0_d.z));
// Error: $float $m = max($v1_d.x+$v0_d.x, max(v1_d.y+v0_d_y, v1_d.z+v0_d.z)); // 
// Error: Syntax error // 
$float $m = max(v1_d.y+v0_d_y, v1_d.z+v0_d.z);
// Error: $float $m = max(v1_d.y+v0_d_y, v1_d.z+v0_d.z); // 
// Error: Syntax error // 
$float $m = max($v1_d.x+$v0_d.x, max($v1_d.y+$v0_d.y, $v1_d.z+$v0_d.z));
// Error: $float $m = max($v1_d.x+$v0_d.x, max($v1_d.y+$v0_d.y, $v1_d.z+$v0_d.z)); // 
// Error: Syntax error // 
$float $m = max($v1_d.y+$v0_d.y, $v1_d.z+$v0_d.z);
// Error: $float $m = max($v1_d.y+$v0_d.y, $v1_d.z+$v0_d.z); // 
// Error: Syntax error // 
$v1_d.x;
// Error: $v1_d.x; // 
// Error: Syntax error // 
print($v1_d.x);
14.090104print($v1_d.x+$v0_d.x);
239.295044print($v0_d);
225.204939 225.204939 225.204939select -r pCylinder1 ;
$v1_0;
// Error: $v1_0; // 
// Error: Syntax error // 
print($v1_0);
22.866263 -6.554324 3.236157print($v1_1);
36.956367 7.535778 17.326264print($v1_1+$v1_0);
59.822629 0.981454 20.562421print($v1_1-$v1_0);
14.090104 14.090103 14.090107$v1_d = $v1_1 - $v1_0;
// Result: <<14.090104, 14.090103, 14.090107>>  // 
print($v0_d);
225.204939 225.204939 225.204939print($v0_0);
-132.824804 -113.374293 -175.974011print($v0_1);
92.380135 111.830646 49.230928select -r pSphere1 ;
$v0_0 = `getAttr pShpere1.boundingBoxMin`;
// Error: No object matches name: pShpere1.boundingBoxMin // 
$v0_0 = `getAttr "pShpere1.boundingBoxMin"`;
// Error: No object matches name: pShpere1.boundingBoxMin // 
select -r pSphere1 ;
$v0_0 = `getAttr "pSphere1.boundingBoxMin"`;
// Result: <<12.012832, -2.874071, -3.14505>>  // 
$v0_1 = `getAttr "pSphere1.boundingBoxMax"`;
// Result: <<38.207366, 22.874071, 23.145047>>  // 
$v0_d = $v0_1 - $v0_0;
// Result: <<26.194534, 25.748141, 26.290097>>  // 
$v = ($v0_d + $v1_d)/2;
// Result: <<20.142319, 19.919122, 20.190102>>  // 
max($v);
// Error: Invalid call to "max".  Check number and types of arguments expected by the procedure. // 
float $d = max(max($v.x, $v.y), $v.z);
// Result: 20.190102 // 
print($v0);
-20.222334 -0.771823 -63.371541print($v1);
29.911315 0.490727 10.28121dot($v0,$v1);
// Result: -1256.791506 // 
$vv = dot($v0,$v1);
// Result: -1256.791506 // 
mag($vv);
// Error: Invalid call to "mag".  Check number and types of arguments expected by the procedure. // 
mag($v1-$v0);
// Result: 89.10502 // 
print($v);
20.142319 19.919122 20.190102print($v0_d);
26.194534 25.748141 26.290097print($v1_d);
14.090104 14.090103 14.090107select -cl  ;
select -r pSphere1 ;
print($v0);
-20.222334 -0.771823 -63.371541$v0 = `objectCenter -gl pSphere1`;
// Result: <<25.110099, 10, 9.999998>>  // 
mag($v1-$v0);
// Result: 10.656314 // 
$v = ($v1_d+$v0_d)/2;
// Result: <<20.142319, 19.919122, 20.190102>>  // 
float $d = max($v.x, max($v.y, $v.z));
// Result: 20.190102 // 
float $d1 = mag($v1-$v0);
// Result: 10.656314 // 
print($d1<$d);
1print($d1>=$d);

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值