forbidden14 Posted December 5, 2021 Share Posted December 5, 2021 Hey all, Think I'm pretty close to what I'm trying to do, but missing how to read the iteration attribute into python to create the material names. Basically I'm trying to make a material for every US state. I'm making the 50 materials but they are all stuck on alabama then incrementing number added to alabama instead of the names other states. I'd like to also assign the basecolor texture based on the s@state attribute that would be something like C:/filefolder/`@state`.jpg into the python script creating the material. I'm pretty new to python in any sense, and slapped some code together from stack overflow, so would appreciate any hand holding! Also if there is any other way to do this without creating the 50 textures and access a file path in a single texture in PDG, would love to hear. Thanks in advance Quote Link to comment Share on other sites More sharing options...
JXS Posted December 8, 2021 Share Posted December 8, 2021 (edited) Hi. Not sure if this is what you're looking for. Without a HIP file, I don't have much to work with but given what it is you're looking for, this is how I would go about it. Hope it helps! I’m sure what your attempting to do is doable using the iterPrims() method, but in my case I simply tackled them all at once using the prims() method, extracted the “state” attribute on each loop and created a principled shader using the value of the attribute. I set up an additional file_path_dir string attribute which I also use to set the texture path parameter in the shader. material_name_attrib.hip Edited December 8, 2021 by JXS 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.