Passing array through type throws error while parsing arguments

Passing array through type throws error while parsing arguments

YetiTech
Advocate Advocate
1,915 Views
3 Replies
Message 1 of 4

Passing array through type throws error while parsing arguments

YetiTech
Advocate
Advocate

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;

 

 


 NIKHIL JEEWA -CEO/Founder & Technical Director @ YetiTech $tudios (◣_◢) | Retargeting Script [MEL]
0 Likes
Accepted solutions (1)
1,916 Views
3 Replies
Replies (3)
Message 2 of 4

tony.su
Autodesk Support
Autodesk Support
Accepted solution

Yes, xform -s don't support string in Maya or Maya LT. I'll report it to our developer team.

 

It don't work

xform -s $j[1] $j[1] $j[1]; 

It works

int $a = $j[1];

xform -s $a $a $a;

 

{
polySphere -n p1;
string $j[]={"p1",2};
int $a = $j[1];
select $j[0];
xform -t $j[1] $j[1] $j[1];
xform -ro $j[1] $j[1] $j[1];
//xform -s $j[1] $j[1] $j[1];
xform -s $a $a $a;
}



Tony Su
Product Support
0 Likes
Message 3 of 4

YetiTech
Advocate
Advocate

@tony.su wrote:

Yes, xform -s don't support string in Maya or Maya LT. I'll report it to our developer team.

 

It don't work

 


Thanks Tony, don't forget to report double3 too, i dont know about any other types if i come across ill post here.



 NIKHIL JEEWA -CEO/Founder & Technical Director @ YetiTech $tudios (◣_◢) | Retargeting Script [MEL]
0 Likes
Message 4 of 4

YetiTech
Advocate
Advocate

Can not pass array through joint -radius but can pass variable type non array. Please tell your dev team to check all argument types passing array and fix up maya its very buggy.


 NIKHIL JEEWA -CEO/Founder & Technical Director @ YetiTech $tudios (◣_◢) | Retargeting Script [MEL]
0 Likes