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

    store data with the document

    Scheduled Pinned Locked Moved PYTHON Development
    3 Posts 0 Posters 443 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

      THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

      On 17/12/2012 at 16:01, xxxxxxxx wrote:

      info : R14, Vista64, Python

      hi,

      i have got a stupid question again. i have got a command plugin generating data for a 
      c4d file stored in a multilevel BaseContainer. currently i am saving these data with a 
      hyperfile which is a bad solution, because renaming or moving the c4d file breaks the 
      connection between the data and the c4d file. so i am looking for a better place now.

      i want :

      1. to store the data within the file
      2. the data not to be visible to the user (as a object, material or tag node)

      possible ways i have been looking into :

      1. use BaseDocument.SetData()
        1. is this way even possible ?
        2. i have tried the following simple example:
        *
            * console output:
            * SystemError: source\pymodules\c4d\PyBaseContainer\PyBaseContainer.cpp:1095: bad argument to internal function
            *   
            *       * import c4d
            *   
            * def main() :
            *     bc = c4d.BaseContainer()
            *     bc.SetBool(c4d.DOCUMENT_RENDERLOD, True)
            *     doc.SetData(c4d.DOCUMENT_RENDERLOD, bc)
            *   
            * if __name__=='__main__':
            *     main()
            * 
      
      3. so, how is the correct way to feed this method ?
      4. can i use own type ids and which id would i have to use without conflicting with other ids ? my plugin id ?
      
      1. use a NodeData plugin
        1. is it possible to create some NodeData subtype plugin type and add it in *hidden* mode into the document ?
        2. the sdk says it is even possible to inherit from c4d.plugins.nodeData itself, but when i do so, my plugin hasn't any access to the methods provided by NodeData.

      sorry for this bunch of questions, but i have really tried to solve this on my own without any real 
      success. i would be really thankful for a push into the right direction. i have also tried the search 
      function on this without any useable result.

      thanks for reading and any help.

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

        THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

        On 18/12/2012 at 00:28, xxxxxxxx wrote:

        Hi Ferdinand,

        To easily save data within a document or object, check this post.
        This is the simplest way in Python but remember that the ID to store the data has to be unique;
        generate it like a plugin ID.

        BaseDocument.SetData() is only useful with the defined document settings.

        Originally posted by xxxxxxxx

        console output:
        SystemError: source\pymodules\c4d\PyBaseContainer\PyBaseContainer.cpp:1095: bad argument to internal function
         
        import c4d
         
        def main() :
            bc = c4d.BaseContainer()
            bc.SetBool(c4d.DOCUMENT_RENDERLOD, True)
            doc.SetData(c4d.DOCUMENT_RENDERLOD, bc)
         
        if __name__=='__main__':
            main()
        

        In Python you can just do this:

        import c4d
          
        def main() :
            doc[c4d.DOCUMENT_LOD] = 0.5
            c4d.EventAdd()
          
          
        if __name__=='__main__':
            main()
        

        So, basically the operator [] is the way to go when dealing with parameters and the CINEMA API.

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

          THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

          On 18/12/2012 at 04:26, xxxxxxxx wrote:

          thanks

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