Forum Moderators: Staff
Poser Python Scripting F.A.Q (Last Updated: 2024 Dec 02 3:16 pm)
It should roughly look like this:
import poser
scene = poser.Scene ()
actor = scene.CurrentActor ()
material = actor.Materials ()[0]
shader = material.ShaderTree ()
image_map = shader.CreateNode (poser.kNodeTypeCodeIMAGEMAP)
path_input = image_map.InputByInternalName ("Image_Source")
path_input.SetString ("d:my_image.png")
surface = shader.NodeByInternalName ("PoserSurface")
shader.AttachTreeNodes (surface, "Diffuse_Color", image_map)
Even easier with matmatic. It's a one-liner.
for name in os.listdir("some folder here"): if name.endswith(".jpg"): outputs += ["=Material[%s]" % name, Surface(ImageMap(name), .8)]
Of course I'm just showing off and that's not really a finished script as there would be some manipulation of the path name. But the part of making the material for each image file is correct:
Surface(ImageMap(imageFileName), .8)
Renderosity forum reply notifications are wonky. If I read a follow-up in a thread, but I don't myself reply, then notifications no longer happen AT ALL on that thread. So if I seem to be ignoring a question, that's why. (Updated September 23, 2019)
This site uses cookies to deliver the best experience. Our own cookies make user accounts and other features possible. Third-party cookies are used to display relevant ads and to analyze how Renderosity is used. By using our site, you acknowledge that you have read and understood our Terms of Service, including our Cookie Policy and our Privacy Policy.
Please excuse me if I am using the wrong terminology.
I want to apply a graphic which is not a Material in the Library. Manually, I would open the Material room, create an 'Image Map', choose the selected graphic; and then apply the image map to Diffuse Color.
Using script, I could use "LoadMaterialCollection" to apply a material from the Library. But that does not work with a graphic outside the Library, eg: d:tempa.jpg
Can anyone point me in the right direction, please.
Alternatively; is there a scripting way to take a bunch of graphic file and convert them into materials?
I appreciate all this may involve itinerating through materials etc. But, I am really getting lost in the Poser Python manual.
Thanks for any assistance.