# Diffuse/ambient combiner import poser while 1: d=poser.DialogSimple.AskFloat("Enter the fraction of diffuse light for your scene") if d is not None: if (d>=0) and (d<=1.0): DiffuseFraction=d break else: poser.DialogSimple.MessageBox("The fraction should be between 0.0 and 1.0") continue scene=poser.Scene() def SetAmbient(mat,fraction): tree=mat.ShaderTree() root=tree.Node(0) textureMapNode=root.Input(0).InNode() if (textureMapNode): root.Input(1).SetFloat(DiffuseFraction) root.InputByInternalName("Ambient_Value").SetFloat(1.0-DiffuseFraction) root.InputByInternalName("Ambient_Color").SetColor(1,1,1) textureMapNode.ConnectToInput(root.InputByInternalName("Ambient_Color")) for fig in scene.Figures(): try: for mat in fig.Materials(): SetAmbient(mat,DiffuseFraction) except: pass for act in scene.Actors(): if act.IsProp() and not (act.ItsFigure()): try: for mat in act.Materials(): SetAmbient(mat,DiffuseFraction) except: pass