Thu, Jan 2, 8:34 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 Dec 02 3:16 pm)

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: Poser and Events


Y-Phil ( ) posted Wed, 29 December 2021 at 12:52 PM · edited Fri, 13 December 2024 at 12:41 PM

Is there a way to trap the moment when a user change the current room (example: Pose to Material)
Is there a way to trap the moment when the current Poser document is being closed.

It would be great if I was able to bind a function to such events.
Thanks in advance.

𝒫𝒽𝓎𝓁


(っ◔◡◔)っ

👿 Win11 on i9-13900K@5GHz, 64GB, RoG Strix B760F Gamng, Asus Tuf Gaming RTX 4070 OC Edition, 1 TB SSD, 6+4+8TB HD
👿 Mac Mini M2, Sequoia 15.2, 16GB, 500GB SSD
👿 Nas 10TB
👿 Poser 13 and soon 14 ❤️


adp001 ( ) posted Wed, 29 December 2021 at 4:17 PM
Y-Phil ( ) posted Fri, 31 December 2021 at 3:50 AM
adp001 posted at 4:17 PM Wed, 29 December 2021 - #4432580

Posers UI is wxPython. So: https://docs.wxpython.org/wx.aui.AuiManagerEvent.html

Thank you 😊

𝒫𝒽𝓎𝓁


(っ◔◡◔)っ

👿 Win11 on i9-13900K@5GHz, 64GB, RoG Strix B760F Gamng, Asus Tuf Gaming RTX 4070 OC Edition, 1 TB SSD, 6+4+8TB HD
👿 Mac Mini M2, Sequoia 15.2, 16GB, 500GB SSD
👿 Nas 10TB
👿 Poser 13 and soon 14 ❤️


adp001 ( ) posted Fri, 31 December 2021 at 11:32 AM

Were you finally able to figure out how to successfully intercept the events?




Y-Phil ( ) posted Sat, 01 January 2022 at 2:30 AM

No.

Not sure if I understood correctly the online explanations but I suppose that the File->Close menu option is already intercepted and handled, as events aren't "going" further than the right destination window/panel.

When I see that the hierarchy window closes when a choose to close the current document, I was supposing that a kind of "Please close" event was being fired.

Then, I tried to add my panel to wx.aui.AuiManager. Upon closing the document, my dialog box is closed as well. But when I create a new document, my dialog is automatically re-opened, at the wrong place, either docked and undocked. 😂
I'm clearly missing something, lol

𝒫𝒽𝓎𝓁


(っ◔◡◔)っ

👿 Win11 on i9-13900K@5GHz, 64GB, RoG Strix B760F Gamng, Asus Tuf Gaming RTX 4070 OC Edition, 1 TB SSD, 6+4+8TB HD
👿 Mac Mini M2, Sequoia 15.2, 16GB, 500GB SSD
👿 Nas 10TB
👿 Poser 13 and soon 14 ❤️


Y-Phil ( ) posted Sat, 01 January 2022 at 4:20 PM · edited Sat, 01 January 2022 at 4:21 PM

Solution found 😊  not using events but rather a simple poseraddon, with something like this in the __init__.,py

class MyClass(poseraddon.Addon, poseraddon.SceneObserver, poseraddon.SceneDataSaver, poseraddon.PrefsSaver):
    def __init__(self):
        self.addonInfo = {
            'id': 'com..my.addon',
            'author': 'me',
            'copyright': '(c) 2022 me',
            'name': "My addon",
            'version': '1.0',
            'observer': 1,
            'scenedata': 1,
        }

    def load(self):
        # load your stuff

    def unload(self):
        # unload your stuff

    def sceneDeleting(self, scene):
        # unload your stuff

    def sceneCreated(self, scene):
        # load your stuff


𝒫𝒽𝓎𝓁


(っ◔◡◔)っ

👿 Win11 on i9-13900K@5GHz, 64GB, RoG Strix B760F Gamng, Asus Tuf Gaming RTX 4070 OC Edition, 1 TB SSD, 6+4+8TB HD
👿 Mac Mini M2, Sequoia 15.2, 16GB, 500GB SSD
👿 Nas 10TB
👿 Poser 13 and soon 14 ❤️


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.