Referencing a integer parameter in a nested foreach loop

   2204   4   1
User Avatar
Member
3 posts
Joined: June 2019
Offline
Hi, I'm very new to Houdini, and I'm having issues with linking a parameter to a node inside of a nested foreach loop.

I'm trying to set a value in an Attribute Create node so that it offsets an amount (integer) that I set up in an HDA.
I've named this integer parameter test_int.
I thought this could work by referencing the iteration detail from the metadata node, and adding test_int to it.

The parameter expression goes something like this
ch("../test_int") + detail("../foreach_begin1_metadata1", "iteration" , 0)

The problem is, when I try this on a attribute create node that's inside a foreach loop that's also in another foreach loop, it seems to only return the iteration value.
I know that this seems to work with a regular, non-nested foreach loop, but in my case I require it to be inside of another foreach loop.

Does anyone know what I'm doing wrong?
I'm a complete noob, so sorry if I'm not giving enough information to work with, I'm more than happy to respond.
User Avatar
Member
9380 posts
Joined: July 2007
Offline
should work fine, do you have an example file of it not working?
Tomas Slancik
CG Supervisor
Framestore, NY
User Avatar
Member
3 posts
Joined: June 2019
Offline
Hi tamte,

Sorry for the late reply, I didn't notice that my first post was approved.

Anyways, I've been working on the HDA a little bit since my last post but there's been no progression, except that the integer parameter name is "offset_num" instead of "test_int".

Here's the HIP file and the HDA, hopefully it helps

Attachments:
cable.hiplc (316.5 KB)
cable_generator1.hdalc (33.3 KB)

User Avatar
Member
9380 posts
Joined: July 2007
Offline
I looked at your file and there is no offset_num parameter so it will always return 0

there is however offset_num# as a part of multiparm so offset_num0, offset_num1...
so your expression will most likely need to be:
ch("../offset_num" + detail("../foreach_begin1_metadata1", "iteration" , 0)) + detail("../foreach_begin6_metadata1", "iteration" , 0)
Tomas Slancik
CG Supervisor
Framestore, NY
User Avatar
Member
3 posts
Joined: June 2019
Offline
Hi tamte,

Thank you for your advice, that works perfectly!
  • Quick Links