Forum Moderators: Staff
Poser Python Scripting F.A.Q (Last Updated: 2024 Sep 18 2:50 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.
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)
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?
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!
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 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?