Forum: Poser Python Scripting


Subject: all materials white ( poser 8 script)

ice-boy opened this issue on Aug 20, 2009 · 19 posts


PhilC posted Thu, 20 August 2009 at 8:16 AM

More scripts than you can shake a stick at. :)

This one may be more flexible, it will change all materials in the scene to match the material currently selected in the Material Room. If you want everything white just pick any actor, pick any of its materials, set that to white, then run the script.


# Script to change every material for every

# actor in the scene to match the material

# currently selected in the material room.

#

# by PhilC

# http://www.philc.net/index.php

import poser<br></br>
import os

scene = poser.Scene()

def main():<br></br>
    filename =
os.path.join(os.curdir,"temp.mt5")<br></br>
    mat = scene.CurrentMaterial()<br></br>
    mat.SaveMaterialSet(filename)

    for actor in scene.Actors():<br></br>
        try:<br></br>
           
print "Processing %s" % actor.Name()<br></br>
           
for mat in actor.Materials():<br></br>
               
try:<br></br>
                   
mat.SetSelected(1)   <br></br>
                   
mat.LoadMaterialSet(filename)<br></br>
                   
print "------ %s OK" % mat.Name()<br></br>
               
except:<br></br>
                   
print "------ %s FAILED" % mat.Name()<br></br>
        except:<br></br>
           
print "------ Bypassing %s" % actor.Name()<br></br>
main()

print "--------------------------"<br></br>
print "     TASK COMPLETED"<br></br>
print "--------------------------"<br></br>