attilako opened this issue on Dec 11, 2011 · 10 posts
attilako posted Sun, 11 December 2011 at 3:25 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
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
http://sites.google.com/site/bagginsbill/free-stuff/parmatic
Forgot the link.
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
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
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