Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    Quit Cinema after SAVE_AFTER message

    Cinema 4D SDK
    r20 python
    2
    3
    688
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • B
      Boony2000
      last edited by

      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!

      1 Reply Last reply Reply Quote 0
      • M
        m_adam
        last edited by m_adam

        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.
        Cheers,
        Maxime.

        MAXON SDK Specialist

        Development Blog, MAXON Registered Developer

        1 Reply Last reply Reply Quote 1
        • B
          Boony2000
          last edited by Boony2000

          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...

          1 Reply Last reply Reply Quote 0
          • First post
            Last post