SOLVED Detecting unsaved changes

Hi,

Is there a call to c4d to ascertain if there are unsaved changes in the current session. The current session was started from opening a file from disk.

I am using R21 on Windows and using Python.

Cheers

Hi @nicholas_yue this is indeed something not documented but you can know it by accessing the c4d.DOCUMENT_USERCHANGE parameter of a document.

doc = c4d.documents.GetActiveDocument()
isChanged = bool(doc[c4d.DOCUMENT_USERCHANGE])

The parameter c4d.DOCUMENT_USERCHANGE is an integer that can have 3 values:

  • 0 means there is no change
  • 1 means there is a change in the scene.
  • 2 means there is a change from the undo stack.

Cheers,
Maxime.