On 23/03/2015 at 09:27, xxxxxxxx wrote:
Cinema 4D Version: R16
Platform: Mac OSX ;
Language(s) : C++ ;
I'm working on an object-plugin. I have implemented the method Command, but it seems it doesn't get called. Here is my method:
Bool MyPluginData::Command(Int32 id, const BaseContainer &msg)
if (id == HIPNULLPTR_POS_Y)
GePrint("The slider is pressed!");
Did I do something wrong here? Or did I simply forget something?
I've looked for hours on the internet, in the SDK, but still found no answer.
Thanks for your help and time!
On 23/03/2015 at 11:46, xxxxxxxx wrote:
Mainly only buttons really trigger Command(). For other controls, you need to use Message().
On 23/03/2015 at 17:44, xxxxxxxx wrote:
And actually Command() is not a method of the ObjectData class, but GeDialog. If you want to notice
when a value was changed, override Message() and catch the MSG_DESCRIPTION_* message that
matches your needs.
On 24/03/2015 at 06:31, xxxxxxxx wrote:
Well, that did it, especially the MSG_DESCRIPTION. With my slider I needed the MSG_DESCRIPTION_CHECKUPDATE inside Message.
You can mark this as closed!!
Thanks for your help guys!! :)
On 24/03/2015 at 06:52, xxxxxxxx wrote:
Well, it worked when I had a simple GePrint. Now with some additional methods it doesn't work anymore.
Here is my code in Message:
if (type == MSG_DESCRIPTION_CHECKUPDATE)
BaseObject* op = (BaseObject* )node;
BaseDocument* doc = (BaseDocument* )data;
GePrint("The slider is pressed! - CheckUpdate");
And the code from EditHipNullptr:
BaseObject* CharacterCreatorData::EditHipNullptr(BaseObject* op, BaseDocument* doc)
BaseObject* hipNullPtr = doc->SearchObject("Hip_Nullptr");
BaseContainer* bb = op->GetDataInstance();
hipNullPtr->SetRelPos(Vector(0, bb->GetInt32(HIPNULLPTR_POS_Y), 0));
When I change the slider in Cinema 4D, the application doesn't respond anymore.
Does somebody have an idea what could be the problem here?
On 24/03/2015 at 07:52, xxxxxxxx wrote:
the data of MSG_DESCRIPTION_CHECKUPDATE is not a BaseDocument but of the type DescriptionCheckUpdate. In that structure you will find a pointer to the document.
Also, you don't have any nullptr-checks in your code, so when SearchObject() fails it must crash.
On 24/03/2015 at 08:10, xxxxxxxx wrote:
That did it! Thank you very much!
I also changed my method for nullptr-checks.
You can surely mark this as closed now!