bonassus Posted May 5, 2021 Share Posted May 5, 2021 (edited) How can I loop through texture map names in a foreachloop. I thought this should work with a spare parameter: H:/Assets/1x/Asset_`detail(-1,“iteration”,0)`.png Edited May 5, 2021 by bonassus added image Quote Link to comment Share on other sites More sharing options...
bonassus Posted May 5, 2021 Author Share Posted May 5, 2021 sorry for the double post. Quote Link to comment Share on other sites More sharing options...
underscoreus Posted May 6, 2021 Share Posted May 6, 2021 Hey! There are a few things with your expression that might be messing it up. The first is in your detail expression. I don't know what "-1" is meant to be pulling data from, but when using the "point", "prim" or "detail" expression in hscript we usually feed it the absolute or relative path to a node instead of feeding it inputs like we do in vex. For example "/obj/geo1/foreach_begin1_metadata1" or like in your spare parameter "../foreach_begin1_metadata1". That should be enough to fix it, at least it seems to work for me in my little test scene, but if not then the second thing you could also try is to splice the strings together with the "strcat" hscript function. Since you are splicing together things before and after an expression it might look a little messy but something like this: `strcat(strcat("H:/Assets/1x/Asset_",detail(-1,“iteration”,0)),".png")` Hope some of that can help you fix your issue! Quote Link to comment Share on other sites More sharing options...
bonassus Posted May 6, 2021 Author Share Posted May 6, 2021 Thank you for your reply. I didn't realize that spare parameters were not used with expressions like this. I have used -1 to reference the metadata node in the past with out a problem. Thank you for suggesting the strcat function. Unfortunitly I couldn't make my expression work. It's starting to become quite messy. I've decided to use another approach with material overrides. thanks again for you time in answering my question I do apricate it. Quote Link to comment Share on other sites More sharing options...
pookzzz Posted May 14, 2021 Share Posted May 14, 2021 Hi bonassus, I tried out the forloop with a file sop, and the expression is able to evaluate the iteration value with no problem, excuse the error because I didn't create any files. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.