THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 11/09/2012 at 14:54, xxxxxxxx wrote:
Is there a function that is only called when a plugin is loaded in a scene? For example I have a generator object plugin that when it loads I want it to insert to other objects into the scene. Is there a function to do that or should I be using a command plugin?
On 11/09/2012 at 15:01, xxxxxxxx wrote:
I take it you mean when a plugin is created in a scene, not loaded when a scene file loads? When an ObjectData plugin like a generator is created, the Init() function is called. You could do this there.
On 11/09/2012 at 15:06, xxxxxxxx wrote:
MSG_MENUPREPARE is a message sent when the object was initially created. Init() is called more often (for example for Undo steps).
On 12/09/2012 at 08:49, xxxxxxxx wrote:
Thanks Spedler and Niklas.
Yes, I meant when loaded into a scene, I should have classified that. That's the problem I ran into Niklas, the Init() was called frequently, thanks for answer.
Edit: I don't want to make a new thread, but i have another question. Are global variables declared within a plugin shared between all instances of that plugin in the same scene? It seems to be that way from what I see. I'm checking if two link fields are filled and if they are I want to grey out a button. If I have two instances of the plugin in the scene and one has an empty field they are both counted as missing one. If that's how global variables are handled is there a way to declare a valuable that all functions in that plugin can access it but each instance of the plugin has there own? I hope that makes sense.