Jump to content


For Each FORVALUE inside string


  • Please log in to reply
2 replies to this topic

#1 sueshijuu

sueshijuu

    Peon

  • Members
  • Pip
  • 6 posts
  • Joined: 10-June 11
  • Location:The Netherlands
  • Name:a z

Posted 18 August 2012 - 09:24 AM

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.

#2 wick3dParticle

wick3dParticle

    Peon

  • Members
  • Pip
  • 37 posts
  • Joined: 16-November 07
  • Location:NYC
  • Name:Ilan Gabai

Posted 18 August 2012 - 04:57 PM

View Postsueshijuu, 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.


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

Attached File  IG_forEach_MTL.hipnc   1.96MB   20 downloads

#3 sueshijuu

sueshijuu

    Peon

  • Members
  • Pip
  • 6 posts
  • Joined: 10-June 11
  • Location:The Netherlands
  • Name:a z

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.

Edited by sueshijuu, 20 August 2012 - 05:48 AM.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users