MSG_DESCRIPTION_COMMAND does nothing [SOLVED]



  • On 08/05/2015 at 02:59, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   R16 
    Platform:      Mac OSX  ; 
    Language(s) :     C++  ;

    ---------
    Hi,

    In my ObjectData plugin I have a button. To react when it is pressed you should implement something in Message -> MSG_DESCRIPTION_COMMAND, right?

    Well, I've done that and this is my code:

      
    else if (type == MSG_DESCRIPTION_COMMAND)  
    {  
      GePrint("A button has been pressed");  
    }  
    

    As you can see, I'm merely checking whether MSG_DESCRIPTION_COMMAND gets called, which it doesn't..
    It's also useless to post the rest of my code, since it doesn't get to that point.

    Has anybody had the same problem?
    And how can I fix this?

    Thanks in advance for your help and time!
    Greetings,
    Casimir Smets



  • On 08/05/2015 at 03:52, xxxxxxxx wrote:

    well, that's correct. Debugging should help to see if it jumps into the message function at all. Otherwise previously executed code is required (probably it'll jump out earlier). Cannot think of anything else spontaneously.



  • On 08/05/2015 at 05:00, xxxxxxxx wrote:

    Hi,

    I've also thought about that, the problem is, the previous message is MSG_DESCRIPTION_VALIDATE, and that works perfect... so I'm sure it gets to MSG_DESCRIPTION_COMMAND but then it just stops...

    Thanks for your time and help!
    Greetings,
    Casimir Smets



  • On 08/05/2015 at 05:46, xxxxxxxx wrote:

    Post some more code, it's impossible from that one line what the problem might be.

    Steve



  • On 08/05/2015 at 05:53, xxxxxxxx wrote:

    Hi,

    To be extra sure that it isn't some other message error, I've put MSG_DESCRIPTION_COMMAND first. "else if" is now simply "if".
    But even like this it doesn't get called.
    So, how should I post more code, if I simply don't have more code?? (I mean code relevant to this problem)
    It also makes no sense to show my .h, .res and .str file because it loads my description perfectly fine.

    Thanks for your help and time!
    Greetings,
    Casimir Smets



  • On 08/05/2015 at 07:08, xxxxxxxx wrote:

    Well, obviously something is wrong with your code (or resources) because I cannot remember I ever had this problem in the past 12 years (and never heard it either).. :)

    It should be called. What ID does the button have?



  • On 08/05/2015 at 08:08, xxxxxxxx wrote:

    Hi,

    The button ID is 10004, but the code doesn't even go to that point.
    And do I really have to make screenshots of my GUI to show my button is actually there?
    If you have 1 button, or 100000, and if ANY one of them is pressed, MSG_DESCRIPTION_COMMAND gets called, right?
    So, assuming I have a button, when I click on it MSG_DESCRIPTION_COMMAND gets called, which has on the first line GePrint("The button has been pressed");. It should print that line, no matter which other code I have (MSG_DESCRIPTION_COMMAND is my first type check!).

    Thanks for your help and time!
    Greetings,
    Casimir Smets



  • On 08/05/2015 at 08:31, xxxxxxxx wrote:

    Yes, it should be called independant of which button you click on. And no you don't need to post images of your GUI but you could have happen to have a colliding ID that's why I asked.

    Well, I guess without something to see I cannot think of anthing else right now I'm afraid.
    Have you tried it with an empty object plugin (so not doing anything but having a button) to see if the core functionality works generally for you?



  • On 08/05/2015 at 08:46, xxxxxxxx wrote:

    Hi,

    Well, I use an enumeration in my .res file, so colliding IDs should not be possible.
    And I will definately try it in an empty plugin!

    Thanks for your help and time! :)
    Greetings,
    Casimir Smets



  • On 08/05/2015 at 09:07, xxxxxxxx wrote:

    Well,

    I've tested it out in an empty ObjectData plugin.
    There it also doesn't work :(
    I've really no idea what the problem could be :s

    Thanks in advance for your help and time!
    Greetings,
    Casimir Smets



  • On 08/05/2015 at 09:29, xxxxxxxx wrote:

    check SDK example, MorphMixer.



  • On 08/05/2015 at 13:16, xxxxxxxx wrote:

    For the test ObjectData you created, please post the entire .res file and the complete Message() function - presumably both are very short :-)

    Then we should be able to find the problem.

    Steve



  • On 09/05/2015 at 06:57, xxxxxxxx wrote:

    Hi,

    Mohamed, I did follow the SKD example :p
    Steve, here is my code:
    My .res file:

      
    CONTAINER Omyplugin  
    {  
      NAME Omyplugin  
      INCLUDE Obase;  
      
      GROUP ID_OBJECTPROPERTIES  
      {  
          BUTTON MY_BUTTON { }  
      }  
    }  
    

    My Message method:

      
    Bool MyPluginData::Message(GeListNode* node, Int32 type, void*data)  
    {  
      if (type == MSG_DESCRIPTION_COMMAND)  
      {  
          GePrint("A button has been pressed");  
      }  
      return true;  
    }  
    

    I hope this gives enough information.
    And guys, I really really appreciate your help!! :)

    Greetings,
    Casimir Smets



  • On 10/05/2015 at 09:41, xxxxxxxx wrote:

    When you run it in the debugger, what happens? If you click the button, is Message() called at all?

    Steve



  • On 11/05/2015 at 06:52, xxxxxxxx wrote:

    Hi,

    It's kinda weird when I run it in the debugger. I go to my breakpoints inside Message() but it seems to ignore my GePrint.
    I really don't know what is wrong :s

    Greetings,
    Casimir Smets



  • On 11/05/2015 at 07:28, xxxxxxxx wrote:

    Okay,

    To make it extra weird: I get my output (A button has been pressed) when I type a value in one of my REALs and press enter.
    So, instead of calling MSG_DESCRIPTION_COMMAND when a button is actually pressed, it calls it when I change my REAL by pressing enter. (Even when I do not change it, when I just press enter to refresh).
    If I, however, press my button, the whole debug goes nuts and I get this:
    SocketIOWait cancelled because of timeout.
    Also no output in the console when I press my button (which it should do).

    I hope this gives some useful information to solve this problem..

    Thanks in advance for your help and time!
    Greetings,
    Casimir Smets



  • On 11/05/2015 at 09:21, xxxxxxxx wrote:

    Hi Casimir,

    I'm sorry you are having such a hard time with this.
    MSG_DESCRIPTION_COMMAND is such basic functionality and used in so many occasions inside C4D, that I can hardly believe there's a bug in C4D causing your problems. So I basically agree with Steve and Katachi, without looking at your code it will be hard to help.
    Furthermore, while we are always willing to help, debugging user's code actually does not belong to the things we are supposed to do. So you may need to rely on help from the community in this case.
    Maybe the article about debugging on our blog can also be of help and provide you with ideas, how to look for the cause of your problem: Debugging Cinema 4D Plugins Written in C++



  • On 11/05/2015 at 10:23, xxxxxxxx wrote:

    Hi Andreas,

    A few posts above is all the code related to my problem that I can give.
    I also can't believe that it would be a bug, but I can't find what's the problem either.
    I've tried it in my plugin, also in an empty plugin, and they both give me the same problem.
    I looked inside my _BugReport.txt file to see what caused the crash, but that's just chinese to me, or kind of.

    Thanks for your help and time!
    Greetings,
    Casimir Smets



  • On 11/05/2015 at 10:41, xxxxxxxx wrote:

    Hi,

    After some searching, I maybe found part of the problem.
    After another bug splat error, I've looked inside my Problem Report for CINEMA 4D, and I found something like this:
    Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
    0   c4dplugin.xlib                    0x000000010be4319f 0x10bd8a000 + 758175
    1   csb.dylib                         0x000000011fb12b07 BaseDocument::SearchObject(String const&) + 55 (c4d_basedocument.cpp:261)
    2   csb.dylib                         0x000000011fb0d03f MyPluginData::Message(GeListNode*, int, void* ) + 287 (character.cpp:43)

    It seems like there is a problem with SearchObject, but I don't know what yet.
    Does this say anything to someone?

    Thanks for your help and time!!
    Greetings,
    Casimir Smets



  • On 12/05/2015 at 05:11, xxxxxxxx wrote:

    Hi,

    I've found my problem, but I really didn't expect this.
    Later on in my code inside MSG_DESCRIPTION_COMMAND I call doc->SearchObject("MyPluginObject");
    Apparentally, this gives a huge error, which even causes previous lines to not get executed, or something like that?
    Of course I didn't think of that, because my method starts with a GePrint, and after that a check of which button has been pressed. Only after that check, it searches for an object.
    In my logic, the GePrint should still be printed, regardless if it finds the object or not. Aparentally, that doesn't happen.
    So changing SearchObject() to GetFirstObject() fixed my problem here.

    Thanks for all your help and time!
    This post may be marked as solved.
    Greetings,
    Casimir Smets


Log in to reply