Flakked Posted January 5, 2024 Share Posted January 5, 2024 Hello, For context, I'm processing some FBX files for a specific attribute name. The issue I'm running into is this attribute's name is not consistent across all the source geometry, but they do all have in common a certain string within the attribute's name. (e.g. "Base_Color") What I'm hoping to do in VEX is find a way to parse all attributes for a specific string, and then return what the value of that attribute is. I was looking into the "hasprimattrib" function, but that returns an integer only as far as I can tell. Quote Link to comment Share on other sites More sharing options...
tamagochy Posted January 5, 2024 Share Posted January 5, 2024 Use 'match' function match('*Base_Color*', attribute) it returns 0 or 1 Quote Link to comment Share on other sites More sharing options...
Flakked Posted January 5, 2024 Author Share Posted January 5, 2024 (edited) Thank you for the response! Hmm, I might not have explained my issue very well haha. I'll upload an example HIP file to hopefully convey the question better! In regards to your answer, I don't believe that function can work in this context, as the exact name of the attribute will vary from asset to asset, and I believe the match func requires and exact name in order to work? attribute_partial_name_example.hip Edited January 5, 2024 by Flakked Quote Link to comment Share on other sites More sharing options...
konstantin magnus Posted January 5, 2024 Share Posted January 5, 2024 (edited) Hi JD, append a primitive wrangle right after your merge1-node, that puts all primitive attributes into an array and checks if they match the name Color if their string is longer than 0, assign it to a variable named path and break out of the loop. string attribs[] = detailintrinsic(0,"primitiveattributes"); string path; foreach(string a; attribs){ if(match('*Color*', a)){ string path_n = prim(0, a, i@primnum); if(len(path_n)>0){ path = path_n; removeattrib(0, 'prim', a); break; } } } s@path = path; attribute_partial_name_example_KM.hipnc Edited January 5, 2024 by konstantin magnus 2 Quote Link to comment Share on other sites More sharing options...
Flakked Posted January 8, 2024 Author Share Posted January 8, 2024 On 1/5/2024 at 6:12 PM, konstantin magnus said: Hi JD, append a primitive wrangle right after your merge1-node, that puts all primitive attributes into an array and checks if they match the name Color if their string is longer than 0, assign it to a variable named path and break out of the loop. string attribs[] = detailintrinsic(0,"primitiveattributes"); string path; foreach(string a; attribs){ if(match('*Color*', a)){ string path_n = prim(0, a, i@primnum); if(len(path_n)>0){ path = path_n; removeattrib(0, 'prim', a); break; } } } s@path = path; attribute_partial_name_example_KM.hipnc 70.08 kB · 4 downloads Ahh, thank you! I ended up coming up with a solution that also involved using the detailintrinsic, but I think your code is much cleaner haha. This is what I cobbled together if interested heh: string attrib_name_array[] = detailintrinsic(0,"primitiveattributes"); // printf("%s", attrib_name_array); foreach(int i; string attrib_current_name; attrib_name_array){ if (match("*Base_Color*", attrib_current_name) == 1 && prim(0, attrib_current_name, @ptnum) != ""){ s@texture_name = prim(0, attrib_current_name, @ptnum); } } Quote Link to comment Share on other sites More sharing options...
vinyvince Posted February 24, 2024 Share Posted February 24, 2024 Notice the Intrisinc Detail Memory usage... Usefull! Notice also that if you take a Box primitive, increase the subd in one axe and revert back just one second after to the minimum, the SOP node occupies a footprint RAM 5 times what it should ! Like if the RAM never totally get properlly refreshed... That's is not as nice 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.