Community
Maya Programming
Welcome to Autodesk’s Maya Forums. Share your knowledge, ask questions, and explore popular Maya SDK topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Tyring to access object componets with an excression.

0 REPLIES 0
Reply
Message 1 of 1
jimw77R4U
119 Views, 0 Replies

Tyring to access object componets with an excression.

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 REPLIES 0

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report