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

    Problem with Effector plugin overloading Message()

    Scheduled Pinned Locked Moved SDK Help
    4 Posts 0 Posters 359 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 23/01/2012 at 06:51, xxxxxxxx wrote:

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

      ---------
      Hi,
      I'm currently trying to write an effector plugin and started with the dropeffector example. Now, I have problem with adding a button to the effector's description.
      The button is declared in the resource files and appears correctly within the GUI. But as soon as I overload Message(), the plugin stops working. It still registers successfully, but InitPoint() and ModifyPoints() aren't called anymore. Also the effector isn't automatically added to a selected MoGraph object on creation anymore (but it's still possible to add it manually, but still InitPoints() and ModifyPoints() aren't called anymore ). ModifyDDescription() keeps working though. Quite obviously, I'm doing something wrong, but I don't find the point...
      As soon as I add this Message() function to my plugin, it stops working:

      Bool MyTestPlugin::Message(GeListNode *node, LONG type, void *t_data)  
      {  
          BaseObject * const obj = static_cast<BaseObject*>(node);  
          BaseContainer * const bcData = obj->GetDataInstance();  
          // Button commands  
          if (type == MSG_DESCRIPTION_COMMAND) {  
            DescriptionCommand *dc = (DescriptionCommand* )t_data;  
        
            if (dc->id == MYTESTPLUGIN_BUTTON_RESET) {
              // do something  
            }  
          }  
          return TRUE;  
      }
      

      Even a completely empty Message() function has the same effect.

      Bool MyTestPlugin::Message(GeListNode *node, LONG type, void *t_data)  
      {  
          return TRUE;  
      }
      

      Anybody an idea?
      Thanks for your help in advance,
      Andreas

      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 23/01/2012 at 10:17, xxxxxxxx wrote:

        Hi,

        You need to call parent's class Message() implementation as your last return, like this:

        Bool DropEffector::Message(GeListNode* node, LONG type, void* t_data)
        {
            return EffectorData::Message(node, type, t_data);
        }
        

        If you just return TRUE, InitPoints() and ModifyPoints() aren't called.

        Regards,

        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 23/01/2012 at 10:29, xxxxxxxx wrote:

          Hello,
          thanks for the quick response.
          It works as expected, thanks. I was already looking in this direction but messed it up by calling ObjectData::Message()...
          Best regards,
          Andreas

          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 23/01/2012 at 11:26, xxxxxxxx wrote:

            Originally posted by xxxxxxxx

            It works as expected, thanks. I was already looking in this direction but messed it up by calling ObjectData::Message()...

            In fact when we subclass a C4D class, we should always declare the class with the macro INSTANCEOF:

            class DropEffector : public EffectorData
            {
                INSTANCEOF(DropEffector, EffectorData)
            public:
            	DropEffectorData ed;
                    etc..
            };
            

            INSTANCEOF() declares SUPER as the parent's class to make it easier to call parent's class methods:

            Bool DropEffector::Message(GeListNode* node, LONG type, void* t_data)
            {
                return SUPER::Message(node, type, t_data);
            }
            
            1 Reply Last reply Reply Quote 0
            • First post
              Last post