Solved No save prompt after userchange

Hi!

I am implementing a big external toolkit and after setting it up Cinema doesn't give a save prompt when exiting any more, even though BaseDocument.GetChanged() returns True.

It's kind of a weird question, because obviously the tookit code is causing this issue. I am trying to go though the mess of code for the toolkit trying to figure out what could be the culprit, but I don't even really know what I am looking for.

Does anyone have a hint as to what could be causing Cinema to not ask if you want to save changes when exiting?

Hi!

Thanks for your input!

I just found the cause.
There is an os.kill call on the C4DPL_ENDPROGRAM message. If you leave it out some python stuff seems to keep running and preventing Cinema from being opened again. I am assuming that's why the original author did that.

I will just catch the dirty flag myself and deal with unsaved scenes before terminating the process. Unless you know a more elegant way.

I will mark this as solved.
Thanks again.

P.S.: This is off topic, but trying to reply I would always get an error and I had to log out and in again to post this.

EDIT: I found the elegant solution - Adding c4d.documents.CloseAllDocuments() before the process termination handles the save dialogs perfectly!

Hello @Boony2000,

thank you for reaching out to us. It is a bit unclear to us what is meant by "a big external toolkit". Are you talking about something that lives to a certain extent outside of the bounds of the Cinema 4D SDK, e.g., something that provides its own UI framework or something that communicates with Cinema via a server-client interface?

We are currently not aware of any bugs that would prevent Cinema 4D from asking to save a modified document when the user is trying to close it. You could try to raise a Cinema 4D dialog box (e.g., c4d.gui.MessageDialog) of your own from within your "external toolkit". To make sure anything special you might do there, does not interfere with Cinema 4D's UI and therefore its ability to raise a dialog box when closing itself. But that is only a very faint option.

To answer your question properly, we will need more information:

  • What type of plugin do you implement?
  • What is the purpose/functionality of the plugin/toolkit?
  • Where do you do the scene modifications within your code that are not respected?
  • What are the scene modifications that are not being respected?
  • And most importantly code examples?

Cheers,
Ferdinand

MAXON SDK Specialist
developers.maxon.net

Hi!

Thanks for your input!

I just found the cause.
There is an os.kill call on the C4DPL_ENDPROGRAM message. If you leave it out some python stuff seems to keep running and preventing Cinema from being opened again. I am assuming that's why the original author did that.

I will just catch the dirty flag myself and deal with unsaved scenes before terminating the process. Unless you know a more elegant way.

I will mark this as solved.
Thanks again.

P.S.: This is off topic, but trying to reply I would always get an error and I had to log out and in again to post this.

EDIT: I found the elegant solution - Adding c4d.documents.CloseAllDocuments() before the process termination handles the save dialogs perfectly!