Using pluginmessage to call a function?



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

    On 16/01/2007 at 13:03, xxxxxxxx wrote:

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

    ---------
    Hello.
    I have made a commandplugin, and I would like to call a function (not neccesarily execute()) in my plugin from another plugin. I read in a thread in this forum that I could do this using pluginmessages, but I don't really understand how.
    I have made my other plugin send a GePluginMessage that is recieved by the first plugin, but I don't understand where to go from there since I don't have access to an instance of my commandplugin from pluginmessage().
    Any suggestions?
    regards
    /Filip



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

    On 20/01/2007 at 01:42, xxxxxxxx wrote:

    I have solved this using

        
        
        
        
        BasePlugin* pl = FindPlugin(ID_OF_MYCOMMANDPLUGIN);  
         MyCommandPlugin* m=static_cast<MyCommandPlugin*>(pl->GetPluginStructure());  
           m->MyFunction();
        
        
        
    

    Does anybody know a more elegant way?
    regards
    Filip



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

    On 25/01/2007 at 07:13, xxxxxxxx wrote:

    You could pass the this pointer of the plugin and cast it within the PluginMessage function.

    from somewhere in your plugin

    GePluginMessage(MY_MESSAGE, this);

    and within PluginMessage of your other plugin

    case MY_MESSAGE:
    ((MyPlugin* )data)->DoSomething();

    cheers,
    Matthias


Log in to reply