Forum Moderators: Staff
Poser Python Scripting F.A.Q (Last Updated: 2024 Dec 02 3:09 am)
I think I got it figured out now. Here's the working script in case anyone is interested. It's to make a material furry.
import poser
def addDISP(mat):
scene = poser.Scene()
tree = mat.ShaderTree()
root = tree.Node(0)
if (root.Type() != poser.kNodeTypeCodePOSERSURFACE):
print "Select a material first"
return
displacein = root.InputByInternalName("Displacement")
displacein.SetFloat(0.7) #sets the amount of displacement
dispin = displacein.InNode()
furry = tree.CreateNode(poser.kNodeTypeCodeSPOTS)
furry.Input(0).SetColor(0,0,0) #sets the Base_Color on Spots node to black
furry.Input(2).SetFloat(0.01) #sets spot size
furry.Input(3).SetFloat(0.5)
furry.Input(4).SetFloat(0.5)
furry.Input(6).SetFloat(2) #sets Noise_Type to Improved
furry.ConnectToInput(displacein)
furry.SetLocation(400, 400)
tree.UpdatePreview()
mat = poser.Scene().CurrentMaterial()
addDISP(mat)
This site uses cookies to deliver the best experience. Our own cookies make user accounts and other features possible. Third-party cookies are used to display relevant ads and to analyze how Renderosity is used. By using our site, you acknowledge that you have read and understood our Terms of Service, including our Cookie Policy and our Privacy Policy.
I am trying to set a displacement amount and add a Spots node to the displacement. My script works to connect the Spots node to the displacement but I am not sure how to set the displacement amount or the Base_Color on the Spots node, or to tell it whether the Noise_Type is Improved or Original on the Spots node.
Does someone know? I would be grateful.
Thanks,
Janet
Here is the script:
import poser
def addDISP(mat):
scene = poser.Scene()
tree = mat.ShaderTree()
root = tree.Node(0)
if (root.Type() != poser.kNodeTypeCodePOSERSURFACE):
print "Select a material first"
return
displacein = root.InputByInternalName("Displacement")
dispin = displacein.InNode()
#SetDisplacment(0.06) #trying to set the amount of displacement
furry = tree.CreateNode(poser.kNodeTypeCodeSPOTS)
#furry.Input(0).Set???(0,0,0) #trying to set the Base_Color on Spots node to black
furry.Input(2).SetFloat(0.01)
furry.Input(3).SetFloat(0.5)
furry.Input(4).SetFloat(0.5)
#furry,Input(6).Set???(1) #trying to set Noise_Type to Improved
furry.ConnectToInput(displacein)
furry.SetLocation(400, 400)
tree.UpdatePreview()
mat = poser.Scene().CurrentMaterial()
addDISP(mat)