store data with the document

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.

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.

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