Fri, Apr 19, 7:20 AM CDT

Welcome to the Where can I find? Forum

Where can I find? F.A.Q (Last Updated: 2023 Sep 06 11:45 am)




Subject: Script to disable Alt Spec and Alt Difuse


Rembrandt42 ( ) posted Wed, 30 June 2021 at 6:42 AM ยท edited Fri, 19 April 2024 at 2:42 AM

It appears that many content creators now feel that including alt spec and alt diffuse nodes in materials is a plus because it imparts shine. I disagree. I think it makes everything look "oily". That aside. Does anyone know of a script that will remove all the alt spec and alt diffuse nodes from a figure? It's getting really old unplugging them all by hand. Is there an easier way to do away with them short of a script? Any help appreciated. Thanks in advance.


HartyBart ( ) posted Wed, 30 June 2021 at 3:58 PM

I think this little script should do it for you, though I don't have time to test right now. Make sure to keep the indents and let us know if it works.

disconnect.jpg



Learn the Secrets of Poser 11 and Line-art Filters.


Rembrandt42 ( ) posted Thu, 01 July 2021 at 8:16 AM

TYSM. I'll get it typed in and see what happens. Very kind of you!


HartyBart ( ) posted Thu, 01 July 2021 at 5:52 PM

My pleasure. I should add that, for Poser 12, Python 3 only accepts Tabs to place the required indents, not a string of multiple spaces.



Learn the Secrets of Poser 11 and Line-art Filters.


Rembrandt42 ( ) posted Fri, 02 July 2021 at 11:56 PM

I am about to admit to being the world's biggest dumb*ss... but... How does one type up a new script. I don't see a command to do it in Poser. :(


HartyBart ( ) posted Sat, 03 July 2021 at 5:40 AM

You type it into Notepad++, having switched the display to Language | Python and the Settings | Style Config to a nice style like Choco.

You then save it as a .py file. (or a .txt file that you then rename to .py).

Then copy-paste it to C:|Program Files|Smith Micro|Poser 11|Runtime|Python|poserScripts|ScriptsMenu and to any sub-folder you prefer (e.g. FaveScripts). Copy-paste, not cut-paste.

Launch Poser 11 and test to see if it disconnects the nodes. If it fails it will give you a useful console message. Most likely the indenting will be the problem, and you will be told the line-number of the problem.

Close down Poser. Go back to Notepad++, fix, copy, paste, overwrite. Launch Poser 11 and test again. Repeat until it works.



Learn the Secrets of Poser 11 and Line-art Filters.


Rembrandt42 ( ) posted Sun, 04 July 2021 at 11:40 AM

I am afraid I'm not knowlegable in python to trouble shoot it. I get errors and I don't see what the correct syntax is. Thanks anyway. I appreciate you trying to help.


HartyBart ( ) posted Sun, 04 July 2021 at 8:08 PM

Ok, at least you tried. This one is tested and working in the Poser 11.x version. May not work on Poser 12 due to the need for TAB indents rather than spaces.

import poser

scene = poser.Scene()
scn = poser.Scene()

figs = scene.Figures()
acts = scene.Actors()

for fig in figs:
        mats = fig.Materials()
    if mats:
            for mat in mats:
                tree=mat.ShaderTree()
                root = mat.ShaderTree().Node(0)
                nodeInput = root.InputByInternalName('AlternateDiffuse')
                nodeInput.Disconnect()
                nodeInput = root.InputByInternalName('AlternateSpecular')
                nodeInput.Disconnect()
                tree.UpdatePreview()

for act in acts:
    if act.IsProp() or act.IsHairProp():
        mats = act.Materials()
        if mats:
            for mat in mats:
                tree=mat.ShaderTree()
                root = mat.ShaderTree().Node(0)
                nodeInput = root.InputByInternalName('AlternateDiffuse')
                nodeInput.Disconnect()
                nodeInput = root.InputByInternalName('AlternateSpecular')
                nodeInput.Disconnect()
                tree.UpdatePreview()

scn.DrawAll()

And in case the forum software's code embedding has messed with the script (it usually does), here's a screenshot of how it should look and indent.

works.jpg



Learn the Secrets of Poser 11 and Line-art Filters.


Rembrandt42 ( ) posted Mon, 05 July 2021 at 7:53 AM

Thank you so much for your trouble and kindness! :)


purdon ( ) posted Wed, 04 August 2021 at 8:21 AM

Thank you for the python refresher.

One wonders if the authors of python yearn for the days of punch cards and languages that required lines to start on certain columns.


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.