Tue, Nov 19, 8:42 AM CST

Renderosity Forums / Poser Python Scripting



Welcome to the Poser Python Scripting Forum

Forum Moderators: Staff

Poser Python Scripting F.A.Q (Last Updated: 2024 Sep 18 2:50 am)

We now have a ProPack Section in the Poser FreeStuff.
Check out the new Poser Python Wish List thread. If you have an idea for a script, jot it down and maybe someone can write it. If you're looking to write a script, check out this thread for useful suggestions.

Also, check out the official Python site for interpreters, sample code, applications, cool links and debuggers. This is THE central site for Python.

You can now attach text files to your posts to pass around scripts. Just attach the script as a txt file like you would a jpg or gif. Since the forum will use a random name for the file in the link, you should give instructions on what the file name should be and where to install it. Its a good idea to usually put that info right in the script file as well.

Checkout the Renderosity MarketPlace - Your source for digital art content!



Subject: How to update a Clouds node Gain value?


VedaDalsette ( ) posted Wed, 11 January 2023 at 11:27 AM · edited Tue, 19 November 2024 at 8:33 AM

I don't know how much to impose on folks here, but I'll give it a try. I'm using Poser 12.


I have a bunch of props/actors whose names begin with Building (ex: Building12_2)

Some of these actors have material names that begin with Concrete (either Concrete1, Concrete2, or Concrete3).

Some of these materials contain a Clouds node.

I want to change the Gain on these nodes from 1.0 to .75


I know this is simple for Python coders, but I ain't one of them. I got as far as this:

# initial references
scene = poser.Scene()
actor = scene.Actor('ActorName')

# loop actors in scene, with specific names...
for actor in scene.Actors():
    if actor.Name().startswith('Building'):
        # ...do something

And I found this off the pydoc.browse (1521) python shell.
kNodeTypeCodeCLOUDS = 'clouds'

Can I get an Amen? I mean Script. Thanks.



W11,Intel i9-14900KF @ 3.20GHz, 64.0 GB RAM, 64-bit, GeForce GTX 4070 Ti SUPER, 16GB. 

Old lady hobbyist.

All visual art or fiction is "playing with dolls."


adp001 ( ) posted Wed, 11 January 2023 at 1:34 PM
scene = poser.Scene()
for actor in [a for a in scene.Actors() if a.Name().startswith("Building")]: # type: poser.ActorType
for tree in [m.ShaderTree() for m in actor.Materials() if m.Name().startswith("Concret")]: # type: poser.ShaderTreeType
for node in [n for n in tree.Nodes() if n.Type() == poser.kNodeTypeCodeCLOUDS]: # type: poser.ShaderNodeType
node.InputByInternalName("Gain").SetFloat(0.75)
print("Done.")




VedaDalsette ( ) posted Wed, 11 January 2023 at 2:37 PM · edited Wed, 11 January 2023 at 2:42 PM

adp001 posted at 1:34 PM Wed, 11 January 2023 - #4453662

scene = poser.Scene()
for actor in [a for a in scene.Actors() if a.Name().startswith("Building")]: # type: poser.ActorType
for tree in [m.ShaderTree() for m in actor.Materials() if m.Name().startswith("Concret")]: # type: poser.ShaderTreeType
for node in [n for n in tree.Nodes() if n.Type() == poser.kNodeTypeCodeCLOUDS]: # type: poser.ShaderNodeType
node.InputByInternalName("Gain").SetFloat(0.75)
print("Done.")

adp001, thanks so much! I NEVER would have gotten this. Much appreciated. I'm so excited. Now, I can other values in this scene!

on Edit: BTW, it worked like a charm and in the blink of an eye!



W11,Intel i9-14900KF @ 3.20GHz, 64.0 GB RAM, 64-bit, GeForce GTX 4070 Ti SUPER, 16GB. 

Old lady hobbyist.

All visual art or fiction is "playing with dolls."


adp001 ( ) posted Wed, 11 January 2023 at 3:09 PM

Glad that it helped.




Privacy Notice

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.