Forum: Poser Python Scripting


Subject: set preview window dimension

markschum opened this issue on Sep 11, 2009 · 6 posts


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