Forum: Poser - OFFICIAL


Subject: Python script for specularity?

Ghostofmacbeth opened this issue on Mar 17, 2009 · 6 posts


Ghostofmacbeth posted Tue, 17 March 2009 at 12:36 PM

I am wondering if there is a python script to turn the specularity to 0. Thanks



PhilC posted Tue, 17 March 2009 at 1:17 PM

For all materials in a figure?

# script to set specularity to zero<br></br>
# for all materials in a figure

import poser<br></br>
scene = poser.Scene()<br></br>
fig = scene.CurrentFigure()<br></br>
materials = fig.Materials()

for mat in materials:<br></br>
    root = mat.ShaderTree().Node(0)<br></br>
    nodeInput = root.Inputs()[3] # specularity<br></br>
    nodeInput.SetFloat(0.000)<br></br>
    mat.ShaderTree().UpdatePreview()<br></br>
   <br></br>
scene.DrawAll()

Ghostofmacbeth posted Tue, 17 March 2009 at 1:24 PM

Thanks!!



Ghostofmacbeth posted Tue, 17 March 2009 at 1:51 PM

This works great for figures but I also have this issue with props. Any way to change that? Thanks



PhilC posted Tue, 17 March 2009 at 2:00 PM

Use:-

actor = scene.CurrentActor()
materials = actor.Materials()

You can add error checking lines to ensure that it is a prop that is selected, or in the first one to ensure it is a figure. Otherwise just be careful about what is currently selected before running the script.


Ghostofmacbeth posted Tue, 17 March 2009 at 4:31 PM

Thanks a ton!!