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
    • Unread
    • Recent
    • Tags
    • Users
    • Login
    1. Maxon Developers Forum
    2. mocoloco
    3. Best
    • Profile
    • Following 0
    • Followers 0
    • Topics 14
    • Posts 62
    • Best 3
    • Controversial 0
    • Groups 0

    Best posts made by mocoloco

    • RE: Some basic questions on BaseContainer

      Hi @orestiskon,

      From what I learnt recently, if you have more than one data to store, you can create a sub container of the base container identified by the pluginID.

      I can't remember where I read that... just be careful I'm not an advanced C4D developer 😉

      In a class for a BaseTag I use this like that,

              self.bcDATAS = c4d.BaseContainer()
              self.bcDATAS[ myData ] = "A string for example"
              # Be sure to use a unique ID obtained at https://developers.maxon.net/forum/pid
              myPLUGIN_ID = 0123456789 
      
              # Get the Document Settings BaseContainer
              self.bcDoc = doc.GetDocumentData( c4d.DOCUMENTSETTINGS_DOCUMENT )
              self.bcDoc[ myPLUGIN_ID ] = self.bcDATAS # Store plugin container inside the document container
      
              # Save the updated Document BC
              op.SetData( self.bcDoc )
              
              # To retrieve a data
              print ( op.GetData()[ myPLUGIN_ID ][ myData ] )
      
      

      Cheers,

      Christophe

      posted in Cinema 4D SDK
      mocolocoM
      mocoloco
    • RE: Some basic questions on BaseContainer

      @orestiskon, self is used because the example is an extract of a class. In my case, those variables are defined in the def __init__ (self):, and belongs to the class object. They are not globals. Have a look there, https://docs.python.org/3/tutorial/classes.html you will understand it with a much better explanation than mine.

      If you plan to do not use that inside a class, you can get rid of self of course. Just be careful of doc and op used here below as they are arguments of def Execute(self, tag, doc, op, bt, priority, flags): used in my BaseTag plugin.

      Knowing this, I assume you can easily transpose this to your purpose as the following example won't work as it is 😉

      bcDATAS = c4d.BaseContainer()
      bcDATAS[ myData ] = "A string for example"
      # Be sure to use a unique ID obtained at https://developers.maxon.net/forum/pid
      myPLUGIN_ID = 0123456789 
      
      # Get the Document Settings BaseContainer
      bcDoc = doc.GetDocumentData( c4d.DOCUMENTSETTINGS_DOCUMENT )
      bcDoc[ myPLUGIN_ID ] = bcDATAS # Store plugin container inside the document container
      
      # Save the updated Document BC
      op.SetData( bcDoc )
              
      # To retrieve a data
      print ( op.GetData()[ myPLUGIN_ID ][ myData ] )
      
      posted in Cinema 4D SDK
      mocolocoM
      mocoloco
    • RE: Getting the proper formatting/display on .RES

      I noticed by having a look on other .res files that there is a STATICTEXT { JOINEND; } that exists and can be applied on LAYERGROUP as well as STATICTEXT { NEWLINE; } but I didn't got the use of the last one as that does not create the "\r" or "\r\n" it should.

      Didn't found any informations in the SDK (C++ nor Python) about JOINEND and JOINENDSCALE... those tags looks like to be undocumented.

      posted in Cinema 4D SDK
      mocolocoM
      mocoloco