Using Core Messages



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

    On 24/03/2008 at 04:43, xxxxxxxx wrote:

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

    ---------
    Hi
    i want to optimize a tag plugin. The problem is it is executed all the time if the object, it belongs to, is selected. The tag plugin is very complex and is using a lot of CPU-power so it should only be executed if someting changes (for example the user moves the object). Now i thought i can use core messages for this but i don't really know how or is there another different way to solve my problem? I tried...

        
        
          
        MessageData *md;  
        BaseContainer *bc;  
        if(md->CoreMessage(EVMSG_ASYNCEDITORMOVE,bc))  
           GePrint("MOVING OBJECT");  
        
    

    ...but i don't know how to initialize the MessageData object md and the BaseContainer bc. Any ideas?



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

    On 25/03/2008 at 03:34, xxxxxxxx wrote:

    MessageData is a plugin type class. You have to register it just like any other plugin type with its Register function.

    this is how it should look like:

    > \> class MessageTest : public MessageData \> { \>      public: \>           virtual LONG GetTimer(void); \>           virtual Bool CoreMessage(LONG id, const BaseContainer &bc;); \> }; \> \> LONG MessageTest::GetTimer() \> { \>      return 0; \> } \> \> Bool MessageTest::CoreMessage(LONG id, const BaseContainer &bc;) \> { \>      return TURE; \> } \> \> Bool RegisterMessageTest(void) \> { \>      // decide by name if the plugin shall be registered - just for user convenience \>      String name=GeLoadString(IDS_MESSAGETEST); if (!name.Content()) return TRUE; \>      // be sure to use a unique ID obtained from www.plugincafe.com \>      return RegisterCommandPlugin(MYPLUGINID,name,PLUGINFLAG_HIDEPLUGINMENU,gNew MessageTest); \> } \>

    cheers,
    Matthias



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

    On 26/03/2008 at 08:47, xxxxxxxx wrote:

    Howdy,

    I don't think a MessageData plugin receives the EVMSG_ASYNCEDITORMOVE core message. I've tried this before by adding these lines:

    > \>           case EVMSG_ASYNCEDITORMOVE: \>                GePrint("something moved in the editor"); \>                break; \>

    ... and it never prints anything when I move an object in the viewport. :(

    I've polled for that message in a GeDialog::CoreMessage() function before and it seems to work there, but not in a MessageData plugin.

    Adios,
    Cactus Dan



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

    On 31/03/2008 at 14:52, xxxxxxxx wrote:

    Hi Matthias,
    thx for your reply. I tried the things you posted here and registered a MessagePlugin called EventMessage. Now i want to use it but i still don't know how. I think i have to use the CoreMessage function, but first i have to alloc an object of my class EventMessage right? But how can i initialize that?
    EventMessage *em; //returns the warning that em has not been initilized... little confused now, cause there seems no constructor for these message plugins...



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

    On 02/04/2008 at 13:27, xxxxxxxx wrote:

    Did anybody write a function like the one i described here and is able to post some example code? I really need to solve this problem, cause my tagplugin uses too much CPU-power...



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

    On 02/04/2008 at 14:55, xxxxxxxx wrote:

    Howdy,

    Well, have you tried simply storing the object's position, rotation and scale in BaseContainers in the tag, and then comparing the stored value to the object's current position, rotation and scale in the TagData::Execut() function. It could be something as simple as:

    > if(VectorEqual(data->GetVector(STORED_POSITION),op->GetPos(),0.001)) \> { \>      // execute expression code here ... \> \>      // store new position after execution \>      data->SetVector(STORED_POSITION,op->GetPos()); \> }

    Adios,
    Cactus Dan



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

    On 03/04/2008 at 01:47, xxxxxxxx wrote:

    Quote: Originally posted by Cactus Dan on 02 April 2008
    >
    > * * *
    >
    > Howdy,
    >
    > Well, have you tried simply storing the object's position, rotation and scale in BaseContainers in the tag, and then comparing the stored value to the object's current position, rotation and scale in the TagData::Execut() function.
    >
    >
    > * * *

    yeah, that was what I also wanted to suggest.

    cheers,
    Matthias


Log in to reply