Plugin Cafe Homepage
Forum Home Forum Home > Plugin Cafe > SDK Help
  New Posts New Posts
  FAQ FAQ  Forum Search   Register Register  Login Login

GetDataInstance

 Post Reply Post Reply
Author
Message
peterakos View Drop Down
Member
Member


Joined: 2015 Jul 13
Online Status: Offline
Posts: 344
Post Options Post Options   Quote peterakos Quote  Post ReplyReply Direct Link To This Post Topic: GetDataInstance
    Posted: 2018 Apr 02 at 2:42am

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.
Back to Top
Andreas Block View Drop Down
Forum Moderator
Forum Moderator
Avatar

Joined: 2014 Oct 01
Location: Hannover
Online Status: Offline
Posts: 1822
Post Options Post Options   Quote Andreas Block Quote  Post ReplyReply Direct Link To This Post Posted: 2018 Apr 03 at 8:58am
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().

Cheers,
Andreas
SDK Support Engineer
Back to Top
peterakos View Drop Down
Member
Member


Joined: 2015 Jul 13
Online Status: Offline
Posts: 344
Post Options Post Options   Quote peterakos Quote  Post ReplyReply Direct Link To This Post Posted: 2018 Apr 12 at 12:45am
Hello Andreas ! 

Your suggestion works correctly !

Thank you !
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Bulletin Board Software by Web Wiz Forums® version 9.61 [Free Express Edition]
Copyright ©2001-2009 Web Wiz

This page was generated in 0.094 seconds.