Forum: Poser Python Scripting


Subject: Changing Alternate_Diffuse value

papillon68 opened this issue on Nov 19, 2010 · 24 posts


RobynsVeil posted Sun, 15 January 2012 at 1:11 AM

Good point, SG... is there some way of figuring out what a node number (like Node(0) for PoserSurface) is? Documentation is a bit sketchy...

 

So, for those who want it, here's how it looks so far:

#====================================================================
#      Set Diffuse_Value of PoserSurface to .8
#      Poser script by MarkSchum
#      sets diffuse_value in all materials for figures or props
#      to 0.8
#====================================================================

import poser
psrScene = poser.Scene()
figs = psrScene.Figures()
acts = psrScene.Actors()
for fig in figs:
  print fig.Name()    
  mats = fig.Materials()
  if mats:
    for mat in mats:
      tree = mat.ShaderTree()
      node = tree.Node(0)
      if node:
        print node
        i = node.InputByInternalName("Diffuse_Value")
        i.SetFloat(0.8)
      tree.UpdatePreview()
for act in acts:
  print act.Name()
  if act.IsProp() or act.IsHairProp():
    mats = act.Materials()
    if mats:
      for mat in mats:
        tree = mat.ShaderTree()
        node = tree.Node(0)
        if node:
          i = node.InputByInternalName("Diffuse_Value")
          i.SetFloat(0.8)
        tree.UpdatePreview()

psrScene.DrawAll()

Monterey/Mint21.x/Win10 - Blender3.x - PP11.3(cm) - Musescore3.6.2

Wir sind gewohnt, daß die Menschen verhöhnen was sie nicht verstehen
[it is clear that humans have contempt for that which they do not understand] 

Metaphor of Chooks