Jump to content

For Each FORVALUE inside string


Recommended Posts

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.

Link to comment
Share on other sites

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.

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

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...