GeDialog.AskClose Method Problem



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 15/11/2012 at 22:53, xxxxxxxx wrote:

    Hello!

    I'm implementing the AskClose() method in a CommandData plugin and everything is working as expected. If I close the dialog window for the plugin, the method gets called and it does its job.

    The problem I'm experiencing however, is that if you quit C4D from either the file->quit menu or just command + q (mac) while the plugin window is open, C4D crashes. Removing the AskClose() method solves the issue so it seems that this is where the problem stems from.  It makes sense because once the dialog is gone, there is no AskClose method to call. At least that is my thinking. Even just having the method as a stubb with pass in it crashes the app.

    Is there a way to detect when C4D is about to close and avoid calling the method? I tried using c4d.BFM_DESTROY in Message but could not get it to work. I'm at a loss on how to solve this.

    Thanks!



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 16/11/2012 at 02:29, xxxxxxxx wrote:

    Hi,

    This is a known issue with GeDialog.AskClose().



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 16/11/2012 at 18:43, xxxxxxxx wrote:

    Thanks for the info Yannick!

    Also, does GeDialog.Message() suffer from the same issue when used in a CommandData plugin?



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 19/11/2012 at 02:47, xxxxxxxx wrote:

    Originally posted by xxxxxxxx

    Also, does GeDialog.Message() suffer from the same issue when used in a CommandData plugin?

    No, here's how you can filter BFM_DESTROY in a dialog's Message() method:

    def Message(self, msg, result) :
        if msg.GetId()==c4d.BFM_DESTROY:
            print "Dialog to be destroyed"
        return GeDialog.Message(self, msg, result)
    

    As you can see, we have to get the message ID from the container's ID.
    Also, be sure to call GeDialog.Message() implementation as last return otherwise your dialog won't work as expected.



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 21/11/2012 at 16:38, xxxxxxxx wrote:

    Thanks again for your help Yannick!

    I've tried this code and various other methods but Cinema still crashes when using file->quit or using the quit shortcut while the plugin window is visible.

    I've stripped down the plugin to the bare minimum to determine the cause of the issue but it is only resolved when I don't implement GeDialog.Message()

    The method works as expected while the plugin is operating and if I close the plugin window first then close Cinema, everything is fine.



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 22/11/2012 at 00:00, xxxxxxxx wrote:

    Originally posted by xxxxxxxx

    I've tried this code and various other methods but Cinema still crashes when using file->quit or using the quit shortcut while the plugin window is visible.

    I've stripped down the plugin to the bare minimum to determine the cause of the issue but it is only resolved when I don't implement GeDialog.Message()

    Yes, you're right. There's a similar known issue with GeDialog.Message().



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 22/11/2012 at 00:25, xxxxxxxx wrote:

    Thanks Yannick! I appreciate you taking the time to look into this.

    I thought I was going crazy! ;)

    Not a deal breaker. Everything else works good. I just thought it was something I was doing wrong.

    Thanks again! :)


Log in to reply