Sun, Dec 1, 4:26 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: Parmatic script error


IsaoShi ( ) posted Sun, 17 May 2009 at 7:07 AM · edited Sat, 30 November 2024 at 5:54 AM

I've installed bagginsbill's Parmatic so that I can use the parameter dials for the VSS PR3 Template Skin.

First there was a problem where it couldn't find the Parmatic module, but I managed to fix that by changing the parmaticMenu.py script so that it added the Parmatic folder to the paths list.

Now I'm getting the following error when I click the Parmatic Updater button, and also every time I move the Main camera. Does anyone have any idea what's wrong, please?

Traceback (most recent call last):

  File "/Applications/Poser Pro/Runtime/Python/parmatic/parmaticUpdater.py", line 55, in ParmaticCallback

    ParmaticCameraUpdate()

  File "/Applications/Poser Pro/Runtime/Python/parmatic/parmaticUpdater.py", line 118, in ParmaticCameraUpdate

    for mat in materials:

TypeError: iteration over non-sequence

"If I were a shadow, I know I wouldn't like to be half of what I should be."
Mr Otsuka, the old black tomcat in Kafka on the Shore (Haruki Murakami)


markschum ( ) posted Sun, 17 May 2009 at 10:06 AM

the last line is the error to fix .  for mat in materials: there is nothing in materials so you get the "iteration over non-sequence' error.  Pretty sure of it.  No idea how to fix it.  I would pm BB with this problem. It sounds like something in the install isnt quite right. 


svdl ( ) posted Sun, 17 May 2009 at 10:17 AM

You could encapsulate the for loop in a try-except clause:

    try:
        for mat in materials:
        .... (rest of the code at the same indentation level as the first line after the for statement)
    except:
        pass

    

The pen is mightier than the sword. But if you literally want to have some impact, use a typewriter

My gallery   My freestuff


IsaoShi ( ) posted Sun, 17 May 2009 at 10:42 AM · edited Sun, 17 May 2009 at 10:42 AM

Thanks for the advice, markschum and svdl. I didn't really want to bother bb with this directly, as it's probably something weird in my scene.

I think bb's previous code is already testing for materials in the current prop. But it uses "continue" where you (svdl) have suggested using "pass". I'll try using "pass" instead. Strange that no-one else has this problem, though.

for actor in scene.Actors():

    if not actor.IsProp():

        continue

    try:

        materials = actor.Materials()

    except:

        continue

    for mat in materials:
        ..........

"If I were a shadow, I know I wouldn't like to be half of what I should be."
Mr Otsuka, the old black tomcat in Kafka on the Shore (Haruki Murakami)


svdl ( ) posted Sun, 17 May 2009 at 10:54 AM

Hmm, weird. If I read the script right, it'll test each actor for being a prop - if not, go to the next actor.
It should only reach the try: statement when the actor is a prop, and it should only reach the for statement if the Materials() function returns a value.

What might work is the following:

for actor in scene.Actors():
    if not actor.IsProp():
        continue
    try:
        materials=actor.Materials()
    except:
        continue
    if !materials:
        continue
    for mat in materials:
        ....

The red code should prevent the error from happening.

The pen is mightier than the sword. But if you literally want to have some impact, use a typewriter

My gallery   My freestuff


IsaoShi ( ) posted Sun, 17 May 2009 at 11:25 AM

Me and my trusty sledgehammer deleted all the code to do with the Parmatic parameter for the main camera position, and that worked fine.

But I also went back to the original code and tried the extra test on the presence of materials.
The exclamation mark gives me a syntax error, but it works if I use the syntax " if not materials: ".

Being multi-lingual has its downside, n'est ce pas!

Thank you for your help, I really appreciate it.

"If I were a shadow, I know I wouldn't like to be half of what I should be."
Mr Otsuka, the old black tomcat in Kafka on the Shore (Haruki Murakami)


RobynsVeil ( ) posted Fri, 30 October 2009 at 8:44 PM

The exclamation mark was a problem to me too, but "not" worked fine.

Thanks IsaoShi and everyone else... works a treat, now!

Monterey/Mint21.x/Win10 - Blender3.x - PP11.3(cm) - Musescore3.6.2

Wir sind gewohnt, daß die Menschen verhöhnen was sie nicht verstehen
[it is clear that humans have contempt for that which they do not understand] 

Metaphor of Chooks


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.