GetDataInstance
-
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.
-
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(). -
On 12/04/2018 at 00:45, xxxxxxxx wrote:
Hello Andreas !
Your suggestion works correctly !
Thank you !