Thu, Nov 28, 8:55 PM 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: set preview window dimension


markschum ( ) posted Fri, 11 September 2009 at 12:34 PM · edited Thu, 28 November 2024 at 5:57 PM

Is there a way to set the preview window size from python.

poser.Scene().SetOutputRes(x,y)  does not set the preview window.

also , set end frame for animations ? how ?

thanks


nruddock ( ) posted Fri, 11 September 2009 at 1:34 PM

Quote - Is there a way to set the preview window size from python.

poser.Scene().SetOutputRes(x,y)  does not set the preview window.

I think it's possible for P8, but not earlier versions.

Quote - set end frame for animations ? how ?

I'm pretty sure that you can't change the number of frames directly via Python, but there may be a trick involving writing a temp file and then reading it.


markschum ( ) posted Fri, 11 September 2009 at 2:06 PM

ok, thanks


semidieu ( ) posted Fri, 11 September 2009 at 2:10 PM

SetOutputRes sets the rendering size, not the preview window. The only way I found to do it is to create a 'pose' file containing the doc size.

For the animations... I really don't know as I don't do them...


ockham ( ) posted Fri, 11 September 2009 at 9:40 PM

The temp PZ2 is still the only way to change frame count.  I'm surprised they
haven't fixed that........

Here's the way to do it, in the form of a function that returns the same number
you asked for on success, or 0 on failure.

def FakeFrames(DesiredCount):
    # Write a short PZ2 file forcing the desired number of
    # frames; load it; delete it.
    BasePathUncut=poser.AppLocation()
    BasePath=BasePathUncut[:(-len('poser.exe'))]
    DirName=os.path.join(BasePath, 'runtime', 'libraries', 'pose', 'fakes')
    try:
        os.mkdir(DirName)
    except:
        pass # ignore 'already exists' error
    PZ2Name=os.path.join(DirName,'ztemp.pz2')
    fpFake=open(PZ2Name,'wt')
    if not fpFake: return 0
    fpFake.write('{nversionnt{ntnumber 4.2nt}nmovieInfont{nt')
    fpFake.write('numFrames %dnt}n}' % DesiredCount)
    fpFake.close()
    try:
        scene.LoadLibraryPose(PZ2Name)
    except:
        return 0
    os.remove(PZ2Name)
    return  DesiredCount

My python page
My ShareCG freebies


markschum ( ) posted Mon, 14 September 2009 at 11:45 PM

Thanks very much for that , it will be very useful.
I added some comment lines crediting you for it.


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.