Different behavior of float and matrix data type

Different behavior of float and matrix data type

Anonymous
Not applicable
552 Views
2 Replies
Message 1 of 3

Different behavior of float and matrix data type

Anonymous
Not applicable

hello!

 

I've got a load of nodes with some custom attributes of type Boolean.

 

If i do

 

float $temop = `getAttr "object.boolattribute"`;

It comes out as 1, but if I'm using a matrix and I do

 

$myMatrix[0][0] = `getAttr "object.boolattribute"`;

It returns 0.

 

I don't understand but hopefully one of you does!

 

Thanks

0 Likes
Accepted solutions (1)
553 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable
Accepted solution

Actually it doesn't return 0, but it seems the cast will make bad stuff. Here is a solution, you explicitly have to cast it to a float or you write it before in another variable.

 

int $v = `getAttr pSphere1.visibility`;

matrix $m[3][3];
$m[0][0] = `getAttr pSphere1.visibility`;         // Wrong value
$m[0][1] = (float)`getAttr pSphere1.visibility`;  // Correct value
$m[0][2] = $v;                                    // Correct value 

print $v;
print "\n";
print $m;
print "\n";

 

0 Likes
Message 3 of 3

Anonymous
Not applicable

thanks!

0 Likes