Forum: Poser Python Scripting


Subject: Changing Alternate_Diffuse value

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


MistyLaraCarrara posted Thu, 23 February 2012 at 9:49 AM

Quote - > Quote - Yay! getting somewhere. I did this:

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()
      node = tree.NodeByInternalName("PoserSurface")
      if node:
        print node
        i = node.InputByInternalName("Diffuse_Value")
        i.SetFloat(0.8)
      tree.UpdatePreview()

With apologies to the originator of this fine script, I've changed a variable name and put in a print statement, which was quite revelatory:

Charlotte
<ShaderNode object at 0x00000000384D06A8>
<ShaderNode object at 0x00000000384D0690>
<ShaderNode object at 0x00000000384D06D8>
CitySwan_Hair_V4
<ShaderNode object at 0x00000000384D06C0>
<ShaderNode object at 0x00000000384D0678>
<ShaderNode object at 0x00000000384D0690>
<ShaderNode object at 0x00000000384D06D8>
ChurchNull
<ShaderNode object at 0x00000000384D06C0>
GROUND
Traceback (most recent call last):
  File "C:Program FilesSmith MicroPoser Pro 2012RuntimePythonposerScriptsScriptsMenuUtilitySetDiffuseValueZeroPointEight.py", line 28, in
    i = n.InputByInternalName("Diffuse_Value")
AttributeError: 'NoneType' object has no attribute 'InputByInternalName'

Now I know on which object/figure/whatever things appear to be hiccuping on: the GROUND prop. I think. Or was it ChurchNull? I'm guessing ChurchNull is a sort-of null object that acts as a "figure container" for the rest of the church bits. Something to parent to. It only has a preview mat zone.

ETA: never mind: think I've sorted it... 😄

 

revaltory python  😄



♥ My Gallery Albums    ♥   My YT   ♥   Party in the CarrarArtists Forum  ♪♪ 10 years of Carrara forum ♥ My FreeStuff