Hello people,
I'm trying to apply a different shader to a bunch of different groups. The group selection takes place inside a ForEach node (.. because otherwise it would be a big network). At the end I apply a material with a Material node. Now what I'd like is to add the current number of the loop we are in (the FORVALUE I guess) to the end of the shader name. So that I'd get:
/shop/shader1
/shop/shader2
/shop/shader3
etc. in the Material name parameter.
How would I achieve that? Basically I just need to append the current FORVALUE to /shop/shader. Numbers and strings and whichever all added together to point to a material. But I don't know how to do that correctly. I can't even get the number there haha. I also made an attribute which has the correct number..( $SN ).
Thanks for any help! If you need pictures if it's unclear, let me know.
For Each FORVALUE inside string
Started by sueshijuu, Aug 18 2012 09:24 AM
2 replies to this topic
#1
Posted 18 August 2012 - 09:24 AM
#2
Posted 18 August 2012 - 04:57 PM
sueshijuu, on 18 August 2012 - 09:24 AM, said:
Hello people,
I'm trying to apply a different shader to a bunch of different groups. The group selection takes place inside a ForEach node (.. because otherwise it would be a big network). At the end I apply a material with a Material node. Now what I'd like is to add the current number of the loop we are in (the FORVALUE I guess) to the end of the shader name. So that I'd get:
/shop/shader1
/shop/shader2
/shop/shader3
etc. in the Material name parameter.
How would I achieve that? Basically I just need to append the current FORVALUE to /shop/shader. Numbers and strings and whichever all added together to point to a material. But I don't know how to do that correctly. I can't even get the number there haha. I also made an attribute which has the correct number..( $SN ).
Thanks for any help! If you need pictures if it's unclear, let me know.
I'm trying to apply a different shader to a bunch of different groups. The group selection takes place inside a ForEach node (.. because otherwise it would be a big network). At the end I apply a material with a Material node. Now what I'd like is to add the current number of the loop we are in (the FORVALUE I guess) to the end of the shader name. So that I'd get:
/shop/shader1
/shop/shader2
/shop/shader3
etc. in the Material name parameter.
How would I achieve that? Basically I just need to append the current FORVALUE to /shop/shader. Numbers and strings and whichever all added together to point to a material. But I don't know how to do that correctly. I can't even get the number there haha. I also made an attribute which has the correct number..( $SN ).
Thanks for any help! If you need pictures if it's unclear, let me know.
Hello sueshijuu,
One way would be to use the 'opdigits' expression.
You can assign
opdigits(stamps("..", "FORVALUE","")) to an attribute and string it in to your material path. I made an example file for you.Best,
~Ilan
IG_forEach_MTL.hipnc 1.96MB
20 downloads
#3
Posted 20 August 2012 - 05:32 AM
Thank you, Ilan. I got it working fine now.
I tried just adding my attribute ( $SN ) but somehow it didn't work for me then. But that was the way to go!
Cheers.
I tried just adding my attribute ( $SN ) but somehow it didn't work for me then. But that was the way to go!
Cheers.
Edited by sueshijuu, 20 August 2012 - 05:48 AM.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users










