Sun, Dec 1, 6:08 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 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: PoserPython Wacros and Scripts - WacroMaterials()


3dcheapskate ( ) posted Fri, 13 May 2016 at 12:31 AM · edited Thu, 28 November 2024 at 6:42 PM
Online Now!

I write a PoserPython script that starts like this:

mats = poser.Scene().WacroMaterials()
if mats:
    for mat in mats:
        doStuff(mat)

The script is on my desktop.

I assign my script to one of the ten wacro buttons(alt-click a wacro button to remove the existing assigned wacro, then click the button (now labelled '...') to select and assign my script)

If I now run my script by clicking the wacro button it runs for the current material only, as expected. If I run my script by shift-clicking the wacro button it runs for the all materials of the current object, as expected.

If I run my script via File > Run Python Script it sometimes runs for just the current material, but sometimes for all materials of the current object. It seems to depend on how I last ran a wacro from one of the ten buttons.

It appears as if running a wacro from one of the ten buttons sets/clears a global flag that indicates current/all materials, and it seems that WacroMaterials() builds a list of mats for the current object based on the current setting of this flag.

Does anybody have any insight into this ?


The 3Dcheapskate* occasionally posts sensible stuff. Usually by accident.
And it usually uses Poser 11, with units set to inches. Except when it's using Poser 6 or PP2014, or when its units are set to PNU.

*also available in ShareCG, DAZ, and HiveWire3D flavours (the DeviantArt and CGBytes flavour have been discontinued).



markschum ( ) posted Mon, 16 May 2016 at 2:36 PM

you might be able to add a statement like print Len(mats) to see how many materials are being selected.


3dcheapskate ( ) posted Mon, 16 May 2016 at 11:00 PM · edited Mon, 16 May 2016 at 11:07 PM
Online Now!

Thanks - that's similar to the approach I've ended up using. I've already had feedback on two other forums which helped clear up my understanding on this. I'm not going to duplicate what I said on them, so I'll just link* to them:

https://community.hivewire3d.com/threads/poserpython-wacros-and-scripts-wacromaterials.904</https:>

https://forum.smithmicro.com/topic/179/poserpython-wacros-and-scripts-wacromaterials/7

(*Links legitimately included on this basis. )


The 3Dcheapskate* occasionally posts sensible stuff. Usually by accident.
And it usually uses Poser 11, with units set to inches. Except when it's using Poser 6 or PP2014, or when its units are set to PNU.

*also available in ShareCG, DAZ, and HiveWire3D flavours (the DeviantArt and CGBytes flavour have been discontinued).



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.