Tue, Nov 26, 12:06 PM 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 Sep 18 2:50 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: Can Poser 7 Python change state of Normals_Forward?


diana ( ) posted Mon, 14 May 2007 at 6:55 PM · edited Fri, 22 November 2024 at 5:49 PM

I don't see anywhere you can access this setting via Python in the PoserPython Methods manual.  I see counting normals, flipping normals and such, but not some way to just toggle the Normals_Forward setting in the material room in Poser 7.  I have found numerous flower models that I've purchased from Daz and others that need this switched on. I have to do it manually for each of the model's parts because they use different maps. Or is there a way to copy and paste one setting change to all without messing with the other nodes?


SAMS3D ( ) posted Tue, 15 May 2007 at 3:48 AM

Pretty sure you can only do this in the material room when you select the material.


semidieu ( ) posted Tue, 15 May 2007 at 4:27 AM

Yes you can.

if "mat" is your material.

mat.ShaderTree().Node(0).InputByInternalName("Normals_Forward").SetFloat(1)

to set the Normal Forwards to on (use 0 to set uncheck it)


diana ( ) posted Tue, 15 May 2007 at 7:18 AM

If you want to turn it on (or off) for all materials, can you use a generic term in a script to apply to all materials in a prop or figure?

For instance, I have some prop plants with materials for stem, leaves, center and petals.  Other plants have materials with variations on those material names.  I want to turn on Normals_Forward for all of these materials but without having a special script for each material name.  I've never written any Python scripts but from looking at some it looks like you should be able to gather all the material names in a prop or figure first and run the set Normals_Forward on against all the names of materials like setting all materials to white or such, but what do I know...  Is this a doable thing?

Thanks so much for responding, y'all.


Dizzi ( ) posted Tue, 15 May 2007 at 12:09 PM

How about making it a Wacro so that it works on one material regularly and on all if you shift click the Wacro? That should look like that:

import poser
mats = poser.Scene().WacroMaterials()
        if (mats == None):
                poser.DialogSimple.MessageBox( "Please select a material first.")
        else:
                for mat in mats:
                        mat.ShaderTree().Node(0).InputByInternalName("Normals_Forward").SetFloat(1)



diana ( ) posted Tue, 15 May 2007 at 7:35 PM

I guess I'm going to have to know more about Python to do this.  The script above has a syntax error right after the word "if" when I run it.  I tried removing the only space between the if and the opening parenthesis, as seen in a piece of code in the PoserPython Methods manual page 23, but it still has a syntax error after the "if" so I put the one space back.  I just copied and pasted the code in Dizzi's message into UltraEdit, saved as a py file in the wacros user defined folder and tried running it.  I just don't know what is up with the if statement.  I've been looking at code samples on the web for the if statement and don't see anything unusual about the code.

Here's the error:

File "D:appsposer7RuntimePythonposerScriptsWacrosUserDefinedTurnNormalsForwardOn.py", line 3
    if (mats == None):
    ^
SyntaxError: invalid syntax

Ok, I removed the indentation before the if and else statements and it turns normals forward on for the currently selected material and no more syntax error.  But shift click does not turn on normals forward for all materials in the prop.  Any suggestions?


nruddock ( ) posted Tue, 15 May 2007 at 8:03 PM

Quote - But shift click does not turn on normals forward for all materials in the prop.  Any suggestions?

Shift-clicking only works if you install the Wacro into one of the buttons.


diana ( ) posted Tue, 15 May 2007 at 9:20 PM

Install the Wacro into one of the buttons, hmm, didn't even think about that.  I tried shift clicking on the user installed button and thought that would work for any script in that list.  Now I've installed the script into the main Wacro buttons and it works like a charm.  Saves lots of steps!

Appreciate all the help!


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.