Passing Data between plugin instances
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 10/03/2005 at 14:46, xxxxxxxx wrote:
They are in the same file. This is what I was looking for. Some while back, you had mentioned using FindPlugin() and GetPluginStructure(), but this turned out to be a blind path since GetPluginStructure() always returns NULL (being private and internal, I guess).
Actually, I was working towards the second option (despite them being in the same file). One question about this for future reference: After sending the SpecialEventAdd() message, what is the 'id' and what are the 'msg' contents? Does msg.GetId() return the id used in SpecialEventAdd() and the two ULONGs are stored where (under what container IDs)?
Okay, that was two questions! ;0)
Thanks,
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 10/03/2005 at 14:50, xxxxxxxx wrote:
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 10/03/2005 at 14:53, xxxxxxxx wrote:
Well, whenever you are dealing with none document specific data that each document may need to reference a global clipboard is always helpful.? Global pointer in your main source that is referenced as an external variable from the other sources ( in the same project ). If you are going to write your nodes as separate plugins you could just use messaging to request the global clipboard pointer from the shader hub.
darf
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 10/03/2005 at 15:04, xxxxxxxx wrote:
Mikael - received and understood!
darf - I had considered using the Global CommandData pointer stored in main.cpp. Used an 'extern' in the PluginShader source. Instant crashola. Don't know why though since it is gNew'd before either the Command or Shader plugins are registered. In this case, the 'global clipboard' is the Command plugin.
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 10/03/2005 at 15:34, xxxxxxxx wrote:
No offense intended, but I would double check your code.
darf
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 10/03/2005 at 16:00, xxxxxxxx wrote:
None taken, but I mainly know what I'm doing. This is somewhat simple. I don't think that I could release a commercial plugin for both Windows and MacOS (with 50 reg. users and probably twice that using the demo) which received comments like "one of the most stable Cinema4D plugins I've ever used" and be a hack programmer.
Main.cpp
interShader *intershader = NULL; // Plugin Functions Bool PluginStart() { // create new instance of interShader class if (!(intershader = gNew interShader)) { GePrint(GeLoadString(IDS_PLUGIN_NAME)+": "+GeLoadString(IDS_PLUGIN_ERROR)); return FALSE; } // register hook and return return RegisterInterShader(intershader) && RegisterIShader(); }
Shader.cpp
extern interShader *intershader; // NodeData.Init Bool iShader::Init(GeListNode *node) { is = intershader; // BOOM - CRASH ;) return TRUE; }
* All nonrelevant code removed.
Now, of course, this could be the incorrect approach. I don't use globals anymore except as static or const data (like CHAR* arrays) since starting Java and C++.
If this is incorrect, correct it!
Thanks,
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 10/03/2005 at 16:56, xxxxxxxx wrote:
Nonetheless, I don't like using and depending upon global data. I've gone the SpecialEventAdd() direction and it's working like a charm. Heck, I'm an old Amiga programmer, so I know the idea of 'interprocess communications" and like the elegance of the method - as long as there is a way to do it!
Thanks all,
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 10/03/2005 at 17:48, xxxxxxxx wrote:
I'm having no luck with GeRegistryFind(). It always returns NULL. The Command and Shader plugins are in the same cdl/xdl and registered. GeRegistryFind() is being called in the ShaderData's Init().
Thanks again,
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 10/03/2005 at 19:03, xxxxxxxx wrote:
Some of the relevant code is missing. 9-)
darf
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 10/03/2005 at 19:31, xxxxxxxx wrote:
Any clues agout GeRegistryFind()? I tried the plugin for the CommandPlugin, for another of my plugins, and one of the Cinema4D SDK plugins. All NULL!
Don't tell me that all avenues to get the CommandData have been cut off by devious programmers?
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 10/03/2005 at 20:27, xxxxxxxx wrote:
All you smarty-pants, huh? Try this:
In PluginStart() after gNew of CommandData:
Bool success = GeRegistryAdd(PLUGIN_ID, C4DPL_COMMAND, intershader);
In ShaderPlugin.Init() :
if (!(registry = GeRegistryFind(PLUGIN_ID, C4DPL_COMMAND))) { MessageDialog(GeLoadString(IDS_PLUGIN_ERROR)); return FALSE; } if (!(intershader = (interShader* )(registry->GetData()))) { MessageDialog(GeLoadString(IDS_PLUGIN_ERROR)+"2"); return FALSE; }
Note that sub_id refers to Plugin ID and main_id refers to type, not vice versa!
Works!!
Thank you, Mikael. This at least gave me a direction to go. Make a note of this for future documention, please.