Forum Coordinators: RedPhantom
Poser - OFFICIAL F.A.Q (Last Updated: 2025 Jan 24 6:22 pm)
As far as I can see the 'compressed files' option can neither be read nor set from Python. poser.kExOptCodeSAVECOMPRESSED by its name seems to be a constant intended to make programs easier to read.
It is inconvenient you cannot read or set that option, but I do not understand why you need it. There is nothing wrong with either of the options. Poser reads both, and if you need to read it you can check for the compressed version if the non-compressed version does not exist.
I fully agree with you about the gibberish saved in Pose files. For that reason I did a little experimenting with saving poses as quaternions. The good thing there is that it takes just the real bone angles from the selected figure, including the effect of the pose dials and nothing else that later can cause havock elsewhere.
.
FVerbaas posted at 2:06AM Mon, 20 January 2020 - #4377172
(...) it takes just the real bone angles from the selected figure, including the effect of the pose dials and nothing else that later can cause havock elsewhere. (...)
Thank you Frans, that's exactly what I want to accomplish with the script.
Of course I know that Poser does read both formats, and that I eventually can convert the pose files either way later anyway.
I just thought it might be a nice extra if the script could detect automatically how a user has set his compression option.
I have a list of "poser.ProcessCommand()" codes which are a great help when accessing the UI, but it was a WIP at the time I got it, so I hoped that someone had discovered a code number since then, or any other neat trick to get that info without much ado...
Peter
You are not the first nor last to wish that Poser had better Python API access to all of its features. I've had a long-term project writing a package for Poser Python containing various modules which fill in some of those gaps. One such is a PoserPrefs module, which parses Poser's own preferences file (Poser.ini on windows or PoserPrefs on macOS) to extract the information stored there, including the very setting you're looking for.
Like all things Poser and Python, this is a somewhat complicated process, in order to give the user full flexibility to create and use their own, task-specific preference files, while still making use of Poser's own configuration, such as what unit scale the user has selected, or what library folder was last written to.
I must actually express my thanks to @pikesPit for this question, as it has finally prompted me to pull my finger out and write sufficient documentation to release a compiled version of the consummation of my efforts since 2014. PoserLib contains a PoserPrefs module which can parse Poser's own preferences and load and save user preference files in the same format.
Verbosity: Profusely promulgating Graham's number epics of complete and utter verbiage by the metric monkey barrel.
Hello @anomalaus:
thank you for posting your libraries. I downloaded them and will have a closer look at them to see what they can do for ME.
I said "ME", and that's the problem as I see it:
As long as a user doesn't have your library, of course he won't be able to bind them, thus making any script which uses them (a-hem)... a bit useless?
I saw you already have the Rendo "copywrong" :D notice in the documentation, so hopefully they may become a part of Poser future distributions?
In the meantime, I think I will use a workaround:
Of course I could also parse the .ini file to find out the recently set compression setting. But for a script of less than 400 lines, this would be overkill.
One more problem is, the .ini file is only updated on Poser program termination, afaik. So IF the user has changed his compression option while still being in a session, the .ini file won't know, and neither will I.
...........................................
I decided to make a "feature" of this instead:
Let the user decide for each pose whether he wants to write a compressed file or not, regardless of the General Preferences settings... :)
Thank you again for your help!
Peter
Actually, the LICENCE file is a mistake, since that came from another addon product I'd been working on. I am in some internal debate about how to least restrict the use of that code, since there are onerous versions at either end of the scale, such as the one you see, or the GPL, versions of which imply code must remain in the public domain and cannot be onsold as part of something else. However, the real purpose of the package is to, as I see it, fill a gap in what Poser provides. I would love to see all of that incorporated directly into Poser itself, so the addon would be totally redundant. As it stands, recent changes in version information have "broken" some old scripts which expect version numbers in a certain format. Thanks to SnarlyGribbly's workaround, which I incorporated in PoserLib with his attribution and permission, (I must check that that remains in the documentation, as it's in the source code which I haven't released just yet), that's not a problem any more.
Part of PoserLib's long term development has included internal tests for the availability of specific methods in Poser, so it tries to remain version independent. Wherever possible, if Poser has a method to do something, the code will make use of that directly. If not, it attempts to work around the missing feature (sometimes with more success than others). There will, of course, be limits to this, so future features may be restricted to the latest versions of Poser. At the moment, we have quite a large gap in the progression of Poser version operability, with everything from Poser Pro 2014 Game Dev to the last SM release of Poser Pro 11.1 rendered inoperative unless it has a permanent licence key, due to the switchoff of the required SM license servers. But non-Game Dev 2014 and earlier versions can still make use of PoserLib with various functions worked around. Too much earlier, though, and the Python library becomes incompatible unless you have the source python files.
Anyway, as I genuinely hope all of these features eventually find their way into Poser, it doesn't hurt to put it out there, if for no better reason than to polish the code where others find problems I wasn't able to discover on macOS alone. It SHOULD work on windows, but please let me know if you run into any problems.
On the status of the Poser preference file, I believe that it does get saved the moment the user clicks OK in the preferences dialog. There are other things like the library configuration which get written out when Poser exits (the preferences may do as well), but I know from experience that at least one of the preference entries, the LAST_OPEN_SAVE_PATH is updated whenever Poser reads from or writes to the library/filesystem, so that pretty much proves that parsing the file when you run your script will give you a LIVE state of the USE_COMPRESSION setting.
Another project of mine is to parse, load and save poser files without the current restrictions of Poser's parameter filters. There aren't enough required methods in the Python API to actually load a character or scene completely (without using just the direct calls that do so), but poses are fine. Part of the process involves checking whether a file is a compressed format before opening and reading it, or opening it in compressed mode to create/overwrite a pose file. I'm happy to share the code which deals with such, if you'd like to see it.
Verbosity: Profusely promulgating Graham's number epics of complete and utter verbiage by the metric monkey barrel.
Thank you for your reply!
I've spent some time today playing with yout lib, and it surely looks very useful. I hope it gets incorporated in PoserPython with the next version!
B.t.w., I would really LOVE to see the library made PoserVersion-independent because I still use PP2014 for many tasks where P11 is (to say it in a friendly way) somewhat "quirky". But of course I understand that you can't support all older versions, esp. since they changed the Python version in (iirc) P8.
But have a look at the forums: The P8 forum sections are as dead as a Dodo... So I believe catering for those few zombies simply won't be worth the while :D
On the status of the Poser preference file, I believe that it does get saved the moment the user clicks OK in the preferences dialog.
**Damnit, I just checked, and you're right! **Lesson learned: Never take anything for granted what you previously only believed...
Another project of mine is to parse, load and save poser files without the current restrictions of Poser's parameter filters.
That sounds interesting, never heard of such filters. Could you please explain what they do?
Part of the process involves checking whether a file is a compressed format before opening and reading it, or opening it in compressed mode to create/overwrite a pose file.
Well, at least this time I'm not the complete wxPython.Idiot(self, MyName) because I already learned how to do that...
I'm happy to share the code which deals with such, if you'd like to see it.
Sure I'd like to! One never stops learning, and it might be enlightening to see other coding styles!
Cheers!
Peter
[In reverse order, because reasons] Alternative coding styles are of great interest to me, since I like to pick useful pieces of other styles and incorporate them, even if they appear tedious, or anachronistic, there was usually a very good reason to do them at the time, like knowing what character set to expect, or some Python 3 future-proofing, or a guaranteed way to instantly detect file truncation.
I thought I'd made some significant progress in persuading Herb Gilliland at SM of the usefulness of AnimSets for parameter filtering in Animation Sets : can anyone get these to work correctly?, and their need for support and augmentation. I guess I'll have to go through the same lobbying process again, now that the baton has been passed. [To my delight, the linked thread contains my favourite @bagginsbill quote "Eat your own dog food" ;-)]
If I can establish an appropriate moment to engage in conversation with the devs, rather than just endlessly report and re-report bugs without significant feedback [I believe such things are currently being addressed, so I'm patiently hopeful, twitch, twitch ], I will definitely propose such an incorporation/augmentation of Poser Python's API and UI, but everyone's still finding their feet and working on improving systems, so it hasn't really happened yet. If I can ever identify the best channel to make such approaches I will do my best to nail elbows to armrests and lips to lugholes to get my points across. [All in the politest possible way, of course ]
I'll spend a bit of time to put together some code snippets and commentary as to what I've found useful for painless compressed poser file handling, to post here.
Verbosity: Profusely promulgating Graham's number epics of complete and utter verbiage by the metric monkey barrel.
Looking forward to that!
Most of my programs are only patchwork comprising code snippets I found else where, because that's how I learn best. Sites such as wxpython.org are almost useless for me because they presumably address professional coders (which I'm not the least) and they rarely have working examples.
So any collection of working code snippets is always welcome :)
Peter
b.t.w. :
Reading the USE_COMPRESSION from the Poser.ini file works great. PROBLEM SOLVED on my end. Thank you again!
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.
Hello all!
I'm currently trying to write a small python script which must either query (and if possible, SET!) the "Use file compression" option in Poser's "General Preferences/Misc."
The only thing I found in the reference manual is an ominous "poser.kExOptCodeSAVECOMPRESSED" which reads as "30" no matter if the box is ticked or not...
What I want this for:
Save a pose with a single click, scripted. But because I want to save a customized pose, I need to know whether I must save the data gzip-compressed or not.
I do NOT want to use the standard "scene.SaveLibraryPose()" because of all the overhead gibberish that Poser usually adds to a pose file... I want to avoid this!
SO I DO want to write my own pose file from scratch
BUT I need to know how the user has set his file compression (and also possibly change that, temporarily)
Any help would be greatly appreciated because I'm at my wit's end. Google search delivers nothing useful either.
Thank you!
Peter