Quit Cinema after SAVE_AFTER message

  • Hi there!

    I'm trying to close Cinema as fast as possible in reaction to a c4d.MSG_DOCUMENTINFO_TYPE_SAVE_AFTER message.
    It seems though, that Cinema is not a big fan of that. Both CallCommand(12104) and KillDocument() give the "do you want to save" popup and then freeze/crash Cinema if you click "no".
    If I wait for the code to finish and then call either of those commands from the console, Cinema closes fine (and without the popup).
    What's the correct way to quit Cinema in this case? Is there a way to call them after whatever is blocking it at the moment is done? Someone suggested trying to call it in the idle loop. Is there a way to do that in Cinema?
    And while we're talking about quitting: Is there a way to force quit or suppress the "do you want to save" popup?

    Thank you in advance!

  • HI @boony2000, first of all, welcome in the plugincafe community!

    No worry since it's your first post, but please use Q&A functionality I've done for you.

    Regarding your issue, You probably catch this Message in a threaded context. So the first idea could be to call StopAllThread() before any operation.
    Then make sure to call KillDocument before the CallCommand (since this CallComand exit, C4D, it makes no sense to kill the document after c4d is down).

    Another solution could be to react to a CORE_MESSAGE.

    Finally, if this is not working, may I ask you in which context are you in order to reproduce your issue.

  • Hi @m_adam!

    Thank you for your response.
    I looked for a way to mark the post as a question while submitting, I didn't think to look at the submitted post again for that option. I'll remember next time.

    KillDocument and Exiting were never ment to run consecutively, they were just two things I wanted to try for different scenarios. I should have clarified that.

    StopAllThreads() unfortunately wasn't enough, but adding in a small message plugin to trigger the exit from the CoreMessage() did the trick. I'm now changing a global boolean for the CoreMessage() to look for. Is that what you had in mind?

    Thank you for your help, everything works now. I'll make sure and try and find the "mark as solved" button on my way out :)

    Edit: I can't actually mark your comment as the solution, only this one...

Log in to reply