Mon, Dec 2, 6:56 AM CST

Renderosity Forums / Poser Python Scripting



Welcome to the Poser Python Scripting Forum

Forum Moderators: Staff

Poser Python Scripting F.A.Q (Last Updated: 2024 Dec 02 3:09 am)

We now have a ProPack Section in the Poser FreeStuff.
Check out the new Poser Python Wish List thread. If you have an idea for a script, jot it down and maybe someone can write it. If you're looking to write a script, check out this thread for useful suggestions.

Also, check out the official Python site for interpreters, sample code, applications, cool links and debuggers. This is THE central site for Python.

You can now attach text files to your posts to pass around scripts. Just attach the script as a txt file like you would a jpg or gif. Since the forum will use a random name for the file in the link, you should give instructions on what the file name should be and where to install it. Its a good idea to usually put that info right in the script file as well.

Checkout the Renderosity MarketPlace - Your source for digital art content!



Subject: Trying to add Spots node to displacement - 3 questions


parrotdolphin ( ) posted Thu, 17 January 2013 at 9:30 PM · edited Tue, 01 October 2024 at 11:23 PM

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)


parrotdolphin ( ) posted Thu, 17 January 2013 at 10:18 PM

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)


markschum ( ) posted Thu, 17 January 2013 at 11:21 PM

:thumbupboth:


pitklad ( ) posted Wed, 23 January 2013 at 2:01 AM

Cool! I should give this a chance, thanks!


My FreeStuff


Privacy Notice

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.