Calling custom plugin methods from another plugin
-
On 26/03/2018 at 04:56, xxxxxxxx wrote:
Hi Everyone!
Suppose you have a custom point object generator plugin, derived from c4d.plugins.ObjectData. Lets call it MyPlugin. It has some custom data and methods.
There is also a tool plugin which should operate on MyPlugin. In the tool plugin I would like to receive some internal data (like multiple spline objects) from my object plugin. So, I want to call a custom method like GetSomeCustomData() of MyPlugin. This is not possible from within the tool plugin because the tool operates on the selected object, which will be identified as a c4d.PointObject (which has no GetSomeCustomData() method).
I'm aware that I can use messages to communicate between objects, but is there a more direct way to access the data of my object plugin from within the tool plugin?I tried to cast the c4d.PointObject to MyPlugin with selectedObj.__class__ = MyPlugin, but without success.
Any ideas?
Best regards
Tim -
On 27/03/2018 at 02:24, xxxxxxxx wrote:
Hi Tim,
yes, there are few ideas.
First of all, you could simply store information in the BaseContainer of your point object generator. This can then be easily accessed from where ever you want.
In a similar direction, but without storing additional information, you can override GetDParameter() for your point object generator, allowing access to arbitrary information via GetParameter(). -
On 28/03/2018 at 07:26, xxxxxxxx wrote:
Thanks Andreas!
I will check out both of your helpful suggestions.
Best regards
Tim