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

    Call Function on Save

    Scheduled Pinned Locked Moved PYTHON Development
    2 Posts 0 Posters 193 Views
    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.
    • H Offline
      Helper
      last edited by

      On 27/09/2016 at 08:57, xxxxxxxx wrote:

      I was wondering if there was a way to tie a function in a plugin to a c4d command like save, or save as new version. The overall purpose would be to update a database when a file is saved or versioned up.

      Currently users have to press a button on the plugin to save the document and pass the information to the database, but I would like to avoid the need for the user to change their saving behavior.

      Thanks!

      1 Reply Last reply Reply Quote 0
      • H Offline
        Helper
        last edited by

        On 28/09/2016 at 02:53, xxxxxxxx wrote:

        Hi,

        welcome to the Plugin Café forums 🙂

        Unfortunately in Python there's no good way to achieve completely what you want. You could create your own CommandData plugin, encapsulating the save operation and your database access. In this way, users would be able to have a button in the interface or remap their save keyboard shortcut to your command.

        In C++ you could implement a SceneHook with a Message() function reacting on MSG_DOCUMENTINFO of type MSG_DOCUMENTINFO_TYPE_SAVE_AFTER (see also DocumentInfoData). In this case I'd recommend to also add an option to the preferences, so the user has an option to disable this behavior.

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