3dcheapskate opened this issue on May 13, 2016 ยท 3 posts
3dcheapskate posted Fri, 13 May 2016 at 12:31 AM
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
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).