Message 1 of 4
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Passing an array through type scale value throws an error while parsing arguments. [Maya 2018LT SP3-MEL]
polySphere -n p1;
polySphere -n p2;
string $j[]={
"p1", 2,2,2, 2,2,2, 2,2,2,
"p2", 2,2,2, 2,2,2, 2,2,2};
for ($i=0;$i<size($j);$i++){
if ($i%10==0){
select $j[$i];
xform -t $j[$i+1] $j[$i+2] $j[$i+3] -ro $j[$i+4] $j[$i+5] $j[$i+6] -s $j[$i+7] $j[$i+8] $j[$i+8];
$j[$i+6] -s $sx $sy $sz;
}
}This is a work around by passing a variable instead of an array.
polySphere -n p1;
polySphere -n p2;
string $j[]={
"p1", 2,2,2, 2,2,2, 2,2,2,
"p2", 2,2,2, 2,2,2, 2,2,2};
for ($i=0;$i<size($j);$i++){
if ($i%10==0){
select $j[$i];
float $sx=$j[$i+7];float $sy=$j[$i+8];float $sz=$j[$i+9];
xform -t $j[$i+1] $j[$i+2] $j[$i+3] -ro $j[$i+4] $j[$i+5] $j[$i+6] -s $sx $sy $sz;
}
}The same throws an error parsing arguments type doube3
string $a[]={
"mat",1,1,1};
shadingNode -asShader phong -n $a[0];
sets -renderable true -noSurfaceShader true -empty -name ($a[0]+"SG");
connectAttr -f ($a[0]+".outColor") ($a[0]+"SG.surfaceShader");
setAttr ($a[0]+".color") -type double3 $a[1] $a[2] $a[3];The same work around can be applied by passing a variable instead of an array.
string $a[]={
"mat",1,1,1};
shadingNode -asShader phong -n $a[0];
sets -renderable true -noSurfaceShader true -empty -name ($a[0]+"SG");
connectAttr -f ($a[0]+".outColor") ($a[0]+"SG.surfaceShader");
float $r=$a[1]; float $g=$a[2]; float $b=$a[3];
setAttr ($a[0]+".color") -type double3 $r $g $b;
Solved! Go to Solution.

