Sat, Jan 25, 5:43 PM 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 Dec 02 3:16 pm)

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: Master dial to control several dials in the material window.


attilako ( ) posted Sun, 11 December 2011 at 3:25 AM · edited Sun, 12 January 2025 at 8:43 AM

I need a python script which creates a master dial to control several poser surface nodes. 

I have a figure which contains 50 trees (flats). There is one material window for every tree. I'd like to control for example the ambient value (or the color) of 50 trees with one master dial 

Would that be possible? 


markschum ( ) posted Sun, 11 December 2011 at 10:19 AM

I do that sort of thing with a python script.  I dont think the materials can be controlled via ERC but I have never tried it.

 

Here is a script to set the diffuse value for all materials in one figure

 

sets diffuse value in all materials for current figure

dval = 0.5

import poser
scn = poser.Scene()
fig = scn.CurrentFigure()
mats = fig.Materials()
if mats:
    print fig.Name()    
    for mat in mats:
        tree=mat.ShaderTree()
        n = tree.NodeByInternalName("PoserSurface")
        if n:
            i = n.InputByInternalName("Diffuse_Value")
            if i:
                i.SetFloat(dval)
        tree.UpdatePreview()
scn.DrawAll()


attilako ( ) posted Sun, 11 December 2011 at 11:54 AM

I copied this script to a blank text document with .py extention and placed it to poser pythons scripts.

But when I opened it in Poser, the python window was blank.


markschum ( ) posted Sun, 11 December 2011 at 6:16 PM

OK, sorry , to clarify. This script does not prompt for anything. It will set the diffuse value of all materials in the current figure to the value in the variable dval.

I edit my scripts before running them to do a specific job.  A prompt could be added to ask for the value to use. 


bagginsbill ( ) posted Sun, 11 December 2011 at 6:21 PM

I take it nobody has heard of parmatic?


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)


bagginsbill ( ) posted Sun, 11 December 2011 at 6:27 PM


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)


bagginsbill ( ) posted Sun, 11 December 2011 at 6:28 PM

Note: This script could be (and may need to be) modified to run outside the main runtime. I haven't looked at it in a long time.


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)


attilako ( ) posted Mon, 12 December 2011 at 4:36 AM

I tried the script, but unfortunately it doesn't change the diffuse value.  The python window

has only one word in it and that's the figure name. 


bagginsbill ( ) posted Mon, 12 December 2011 at 7:05 AM · edited Mon, 12 December 2011 at 7:06 AM

It is not a script to do exactly what you asked - it is a script to do a thousand times more than you asked.

Your original statement was "I need a python script which creates a master dial to control several poser surface nodes. " Well that is a description of parmatic.

It does not change the diffuse value, or the ambient value or any other particular value. It changes nodes that have been named in a way to identify that you want them to be parameters.

To change diffuse value, you would have to attach a math node to the diffuse value, and rename it so it is recognized. For example, you might call it PM:Diffuse Value and then it will make itself into a parameter dial by using parmatic.


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)


attilako ( ) posted Tue, 13 December 2011 at 4:59 AM · edited Tue, 13 December 2011 at 5:00 AM

This little script "Markschum" gave to me works OK with figures with body parts in it.

But I have another kind of figure which looks like this

http://atko.dk/langw/forums/Picturetrees.png

Would that be possible to modify this script to work with non body part figures? Instead body parts there are just objects (trees).

 

Thanks


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.