Call other plugins from plugin?



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 11/03/2003 at 10:22, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   8.012 
    Platform:   Windows  ;   
    Language(s) :     C++  ;

    ---------
    I know that this is probably a no-no, but is there a way to call someone else's plugin from my plugin?  Don't need to get any data from it, just a quick way to combine the process into one plugin call.
    Thanks,
    Robert



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 14/03/2003 at 13:50, xxxxxxxx wrote:

    If both plugins are yours you can arrange the communication using plugin message (GePluginMessage()). If the other plugin is a CommandData plugin it's possible to call it, but it's pretty complicated and uses some internal function pointers:

        
        
        BasePlugin* pl = FindPlugin(pluginid, C4DPL_COMMAND);  
        COMMANDPLUGIN* cp = pl->GetPluginStructure();  
        Bool res = (cp->Execute)(doc); // I think this is the syntax. Could be a * somewhere
    


  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 14/03/2003 at 15:11, xxxxxxxx wrote:

    Would the called plugin run asynchronously or would my plugin have to wait for it to finish before continuation, the latter being the desired operation?
    Excellent!  Had been looking for something like FindPlugin(), but hadn't chanced upon c4d_baseplugin.  Too busy parsing massive files to worry about it at the time.
    Very much help!
    Robert



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 14/03/2003 at 19:39, xxxxxxxx wrote:

    The last line of your code won't resolve to a function, even after trying a number of different approaches to resolving it.  After looking at the c4d_commandplugin.h and c4d_commanddata.h, I can't figure out a way to resolve it.
    The Execute in struct COMMANDPLUGIN appears to be a nameless pointer:
    Bool (CommandData::*Execute) (BaseDocument* doc);
    So, I can't resolve a way to get to the function itself in COMMANDPLUGIN.  I'm use to function pointers in C, but this is a new one for me. :)  The BaseData* adr in STATICPLUGIN (on which COMMANDPLUGIN in derived) is NULL, so the CommandData cannot be accessed using it.
    Could it be possible that the function pointer is only set once the plugin is registered?
    Hmmm, lost on this one.
    Robert



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 15/03/2003 at 00:18, xxxxxxxx wrote:

    The call would be synchronous, but I think I was wrong. It isn't possible to call these from another module since the Execute function is virtual in CommandData. I also always get a NULL structure; don't know why. However, the syntax would be like this:

        
        
          BasePlugin* pl = FindPlugin(pluginid, C4DPL_COMMAND);  
          COMMANDPLUGIN* cp = static_cast<COMMANDPLUGIN*>(pl->GetPluginStructure());  
          Bool res = ((static_cast<CommandData*>(cp->adr))->*(cp->Execute))(doc); // Scary...
    


  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 15/03/2003 at 08:57, xxxxxxxx wrote:

    Very scary. ;0)
    Any way to simulate a menu selection from within a plugin.  Maybe it could be accessed in a more "old-fashioned" manner this way. (?)
    If worse comes to worse, the user will just have to run the other plugin first and mine afterwards - mine will error out (nicely) if the expected data isn't present besides.
    Thanks for straining your mind on this one.  Incredible obsfucation. :)
    Robert



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 15/03/2003 at 09:26, xxxxxxxx wrote:

    Unfortunately there's no direct way to call another menu item. The closest you get is by inserting it into your own [popup] menu and letting the user choose it there. (See ShowPopupMenu() and MenuAddCommand().)


Log in to reply