Wed, Nov 20, 9:20 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: 'Actor' object has no attribute 'FindMaterialByName' (P6/9 Manuals say it does..


3dcheapskate ( ) posted Thu, 21 February 2013 at 12:46 AM · edited Sun, 17 November 2024 at 2:21 AM

file_491789.jpg

1) Both the Poser 6 and Poser 9 manuals say that 'FindMaterialByName()' is an Actor method (see screenshots above)
  1. Script snippet:

            # Pre-check to verify that 'act' is a valid actor and 'Helmet' is a valid material
            matlist = act.Materials()
            for mat in matlist:
                print "mat.Name() = "+mat.Name()
            print "matlist[3].Name() = "+matlist[3].Name()
            # So what's wrong with the following line?
            mat = act.FindMaterialByName("Helmet")

  1. Poser 9 output from the above screen snippet:

mat.Name() = Preview
mat.Name() = ChinStrap
mat.Name() = Flaps
mat.Name() = Helmet
mat.Name() = Decoration
matlist[3].Name() = Helmet
Traceback (most recent call last):
  File "E:e frontierPoser 6RuntimePythonposerScripts3DCheapskate!TEST Helmet Smart+.py", line 240, in
    mat = act.FindMaterialByName("Helmet") # TEMPORARY - use head mat for A3
AttributeError: 'Actor' object has no attribute 'FindMaterialByName'

**                ???**

I remember somebody commenting a long time ago that the PoserPython Methods Manuals were unreliable. Is that the problem here?

(P.S. I've double and triple-checked that I typed FindMaterialByName correctly, even tried cut-and-pasting from the manuals. Both of them!)


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).



bagginsbill ( ) posted Thu, 21 February 2013 at 4:32 AM

There is no method by that identifier - manual is wrong.

The method is simply called Material.

 

mat = act.Material("Helmet")


Renderosity forum reply notifications are wonky. If I read a follow-up in a thread, but I don't myself reply, then notifications no longer happen AT ALL on that thread. So if I seem to be ignoring a question, that's why. (Updated September 23, 2019)


bagginsbill ( ) posted Thu, 21 February 2013 at 4:38 AM · edited Thu, 21 February 2013 at 4:38 AM

file_491793.png

I checked my PP2012 manual page 164. The method name in the section heading is correct. The method name in the example is not (same as you showed).

I never noticed this because I looked at the section heading, not the example.


Renderosity forum reply notifications are wonky. If I read a follow-up in a thread, but I don't myself reply, then notifications no longer happen AT ALL on that thread. So if I seem to be ignoring a question, that's why. (Updated September 23, 2019)


markschum ( ) posted Thu, 21 February 2013 at 7:22 PM

yup, theres a couple of clangers in the manual.


3dcheapskate ( ) posted Thu, 21 February 2013 at 8:01 PM · edited Thu, 21 February 2013 at 8:01 PM

Thanks both - even though I noticed that the manual heading was different from the function name I'd never thought to just try 'act.Material("Helmet")'


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.