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
    • Recent
    • Tags
    • Users
    • Login

    Storing data in the Doc's BaseContainer? [SOLVED]

    Scheduled Pinned Locked Moved PYTHON Development
    2 Posts 0 Posters 271 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 03/06/2015 at 16:23, xxxxxxxx wrote:

      Hi,

      I'm looking to save the state of a toggle button with the document. Doing some testing, it seems like I can do that with:

        
      doc[PLUGIN_ID] = True   
      

      Is it safe for me to store my data directly in the document's container so long as I'm using a unique plugin ID? If not, where would you recommend storing this sort of information for Python Command Plugins?
      Thanks,

      Donovan

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

        On 03/06/2015 at 16:33, xxxxxxxx wrote:

        Okay, seems like the issue is addressed in this thread. In short: it appears that storing this info in the doc's container is totally legit.

        That said, it's apparently best practice to use a sub container, and only for small amounts of data. Something more like:

          
        toggle_bc = c4d.BaseContainer()   
        toggle_bc[TOGGLE_ID] = True   
        doc[PLUGIN_ID] = toggle_bc   
        

        Where PLUGIN_ID is a unique ID from PluginCafe, and TOGGLE_ID is used to store the info in the sub-container, just in case the plugin will ever need to store additional data.

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