Tyring to access object componets with an excression.

Tyring to access object componets with an excression.

jimw77R4U
Observer Observer
188 Views
0 Replies
Message 1 of 1

Tyring to access object componets with an excression.

jimw77R4U
Observer
Observer

I'm trying to access components (in this case verts) with an expresion and its not behaving as expeted. For example.

Adding the folowing code to a cube's atributes.

 

int $i;

for($i = 0; $i < 8; $i++)

{

float $tmp[] = `xform -q -ws -t ("pCube1.vtx[" +$i +"]")`;

print("test - " +$i +" - " +$tmp[0] +", "+$tmp[1] +", "+$tmp[2] +"\n");

}

 

Outputs what I would expect when I hit the creat/edit button in the expresion editor:-

test - 0 - -0.5, -0.5, 0.5
test - 1 - 0.5, -0.5, 0.5
test - 2 - -0.5, 0.5, 0.5
test - 3 - 0.5, 0.5, 0.5
test - 4 - -0.5, 0.5, -0.5
test - 5 - 0.5, 0.5, -0.5
test - 6 - -0.5, -0.5, -0.5
test - 7 - 0.5, -0.5, -0.5

 

so I know the code is valid, however upon chaging time on the timeline all I get is this:

// Error: An execution error occured in the expression expression1. //
// Error: line 5: No object matches name: pCube1.vtx[0] //

 

I've tryed writing mel procs to return the position of the verts but whilst they work running from within the script editor I get the same result running them from within the expresion.

 

If I replace ("pCube1.vtx[" +$i +"]" with pCube1 it works just fine! Are component level atributes not accesable when an expression is run with a time change?

 

Thanks

0 Likes
189 Views
0 Replies
Replies (0)