On 30/10/2014 at 18:02, xxxxxxxx wrote:
Why should one use InitAttr() and subscripting to access object data over GetDataInstance() and then the Get/Set() type specific methods (ie, GetBool()
)?
I keep seeing plugins that do either or, sometimes both. There will be one plugin that calls InitAttr() in the Init() method to setup subscripting access (I'm assuming that's what InitAttr() does, since if you don't do that then any attempts to access that data via subscripting just return "None" instead), then access all the object data like obj[c4d.SomeObjectParameter] = 40.0
.
Then there's plugins that just forego this and call bc = op.GetDataInstance()
and access the data via the various type specific getters and setters, like bc.SetBool(c4d.SomeObjectParamter, False)
.
What's the difference? Why should I use one or the other? It seems like MAXON's examples tend to access things via GetDataInstance() rather then subscripting. Various third party plugins tend to use the alternative though, presumably because it's less typing.
-CMPX