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

    GetDataInstance

    SDK Help
    0
    3
    866
    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
      Helper
      last edited by

      On 02/04/2018 at 02:42, xxxxxxxx wrote:

      User Information:
      Cinema 4D Version:   R18 
      Platform:   Windows  ;   
      Language(s) :     C++  ;

      ---------
      Hello.

      I have a light object and I set its parameters using its BaseContainer*, which I access via GetDataInstance.
      For example, I use SetInt32 to set its LIGHT_TYPE parameter.
      I have applied a TagData plugin on this Light object, which has the Execute method implemented.
      In Execute() method, I check the LIGHT_TYPE parameter and its BaseContainer has different value than light_object.GetParameter(...). The BaseContainer has the correct value.
      Why is this happening ? Shouldn't GetParameter return the same value as the one stored in object's data BaseContainer ?

      Thank you for your time.

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

        On 03/04/2018 at 08:58, xxxxxxxx wrote:

        Hi,

        maybe look at it the other way round.
        The point is no entity inside of Cinema 4D is forced to store its data inside of a BaseContainer. Or, if needed, every entity may do additional steps, whenever a certain parameter gets changed or is read. In order to do so, one can override SetDParameter() and/or GetDParameter(). And this is also the reason, it is recommended to access parameter always with SetParameter()/GetParameter() instead of accessing the data inside of the BaseContainer directly.
        In your case you may be of the opinion to read the correct value from the BaseContainer (as it seems to be the one, you wrote into it earlier), but I think, indeed GetParameter() delivers the "correct" value. And I expect everything to work fine, if you use SetParameter() and GetParameter().

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

          On 12/04/2018 at 00:45, xxxxxxxx wrote:

          Hello Andreas !

          Your suggestion works correctly !

          Thank you !

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