Forum: Poser Python Scripting


Subject: I can't get this script to apply to all materials (Please help!)

destro75 opened this issue on Jun 01, 2006 · 3 posts


destro75 posted Thu, 01 June 2006 at 6:32 PM

Okay cool. I fixed it.

import poser

print "Starting Script"

scene  = poser.Scene()
OutlineVal = 0.00001

figs  = scene.Figures()

for fig in figs:
 mats  = fig.Materials()

 for mat in mats:
  tree  = mat.ShaderTree()
  
  iNodes  = tree.NumNodes()
  iCurrent = 0
  
  while (iCurrent < iNodes):
   WorkNode = tree.Node(iCurrent)
   
   print "%s" % (WorkNode.Name(),)
   
   if (WorkNode.Type() == poser.kNodeTypeCodeTOON):
    WorkNode.Input(4).SetFloat(OutlineVal)
    print "   Node Set: %f" % (OutlineVal,)
    
   iCurrent += 1
   
  tree.UpdatePreview()
 
scene.SetCurrentRenderEngine(poser.kRenderEngineCodeFIREFLY)
renderoptions = scene.CurrentFireFlyOptions()
renderoptions.SetDrawToonOutline(1)
renderoptions.SetToonOutlineStyle(poser.kOutlineCodeTHINPEN)

print "Done"

Now it scrolls through all materials on all figures. I had a nagging feeling this morning that this might be the case. I should have listened to my instincts. Anyway, thanks for the help!

Lou