検索 - User list
Full Version: Procedurally creating variants in loop - Updates incorrectly
Root » Solaris and Karma » Procedurally creating variants in loop - Updates incorrectly
gnisbet
So I'm trying to loop through a few assets, and procedurally name them based on the input. I can't figure out how to set the variant name in python, so I'm doing a it a little bit badly and renaming my input python node with what I need, and using the name of the input node as the name of the variant. This works fine outside the loop.

However when I do it inside the loop, it doesn't update the naming correctly, if I rename my python node then only the next 3 iterations are correctly named, and not the first one. Sometimes it only loads in 3 of my 4 assets. I know for loops can update a little incorrectly sometimes. Does anyone know how to get around this, or how to set a variant name through python/vex?

mtucker
On the Add Variant LOP, the "Variant Name Default" parameter controls the variant name. So just change it to an expression based on the value of `@ITERATION` rather than using the input node's name. I'm a bit surprised you don't end up in some sort of infinite cooking loop by changing the node name during the cook process...
gnisbet
I was having a bit of an issue shoe-horning my code in there, but seem to have got it to work now and it's doing what it should. Thanks!

I was a bit surprised as well, but it seems like Houdini could deal with the changing name of the asset in the loop. Well, nearly.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Powered by DjangoBB