Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware 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

    Detecting unsaved changes

    Cinema 4D SDK
    3
    3
    577
    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.
    • N
      nicholas_yue
      last edited by

      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

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

        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.

        MAXON SDK Specialist

        Development Blog, MAXON Registered Developer

        1 Reply Last reply Reply Quote 0
        • P
          PluginStudent
          last edited by

          Is BaseDocument.GetChanged() what you want? See Changed Mode.

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