Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    Using Core Messages

    Scheduled Pinned Locked Moved SDK Help
    7 Posts 0 Posters 558 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H Offline
      Helper
      last edited by

      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?

      1 Reply Last reply Reply Quote 0
      • H Offline
        Helper
        last edited by

        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

        1 Reply Last reply Reply Quote 0
        • H Offline
          Helper
          last edited by

          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

          1 Reply Last reply Reply Quote 0
          • H Offline
            Helper
            last edited by

            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...

            1 Reply Last reply Reply Quote 0
            • H Offline
              Helper
              last edited by

              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...

              1 Reply Last reply Reply Quote 0
              • H Offline
                Helper
                last edited by

                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

                1 Reply Last reply Reply Quote 0
                • H Offline
                  Helper
                  last edited by

                  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

                  1 Reply Last reply Reply Quote 0
                  • First post
                    Last post