Forum: Poser Python Scripting


Subject: Changing Alternate_Diffuse value

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


RobynsVeil posted Fri, 13 January 2012 at 9:39 PM

I'm looking at a script by a very clever person for setting Diffuse_Value on all nodes to .8.

When I try to run this script:

import poser
scn = poser.Scene()
figs = scn.Figures()
acts = scn.Actors()
for fig in figs:
  print fig.Name()    
  mats = fig.Materials()
  if mats:
    for mat in mats:
      tree = mat.ShaderTree()
      n = tree.NodeByInternalName("PoserSurface")
      i = n.InputByInternalName("Diffuse_Value")
      i.SetFloat(0.8)
      tree.UpdatePreview()

in a scene with multiple "characters" (figures) - i.e., a church and a V4 figure - in PP2012 from the Scripts -> Utility menu I get the following error:

Traceback (most recent call last):
  File "C:Program FilesSmith MicroPoser Pro 2012RuntimePythonposerScriptsScriptsMenuUtilitySetDiffuseValueZeroPointEight.py", line 15, in
    i = n.InputByInternalName("Diffuse_Value")
AttributeError: 'NoneType' object has no attribute 'InputByInternalName'

...which looks similar to the error already mentioned. I made certain that "PoserSurface" is indeed the internal name for... um... PoserSurface and that the input name (internal) is indeed "Diffuse_Value".

Any ideas why this happens?

ETA: I've only included code from the script to a bit past the "offending" line...

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