Some C++ questions :



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

    On 28/10/2010 at 16:01, xxxxxxxx wrote:

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

    ---------
    Hi all,

    So i'm now working on C++, but despite the really complete SDK, I still have some unanswered questions ...

    1 - I'm creating a plugin object, this can have childs (and should have). Which update function do I have to create to get this updated only when it is selected or when it's childs or custom data values are changed ?

    Now my public is :

    virtual Bool Init(GeListNode *node); <--- this one is ok and understood

    virtual Bool Message(GeListNode *node, LONG type, void *t_data); <--- this one updates too much and makes the object too heavy to manipulate.
         
    static NodeData *Alloc(void) { return gNew Multicam; }

    2 - I also have some problem with the understanding of "Dirty"... does it means that the concerned ''object'' has been changed and needs an update ?

    3 - The last thing (for now) on what I had some troubles is the meaning of "virtual" (in virtual bool a.e) and "static".

    Well it may look like stupid questions ...

    Thanks in advance !

    Mike.



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

    On 28/10/2010 at 17:00, xxxxxxxx wrote:

    1. If your plugin object outputs new/changed geometry then you need to implement GetVirtualObjects().  If it outputs splines then you need GetContour().  These are updated when data changes or the cache is requested (for rendering, for instance).

    2. Yes.  This typically means that the resulting object cache needs to be rebuilt.

    3. 'virtual' before a method means that the method is expected to be overridden by a derived class when needed.  'virtual method() = 0;' means that you MUST override the method in your derived class - you must define a method in this case or the compiler will spew an error.  'static' means that there is only one copy of the method shared by all instances of the class and you do not need to instantiate to call the method:

    BaseObject* myNullobj = BaseObject::Alloc(Onull);

    This is an example of a static method in use.  Note that you do not need to do this (and should not do it this way) :

    BaseObject* myNullobj;
    BaseObject* myAllocObj = new BaseObject;
    if (myAllocObj) myNullobj = myAllocObj->Alloc(Onull);



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

    On 29/10/2010 at 00:20, xxxxxxxx wrote:

    Great... I'll dig on these explainations.

    Thanks a lot kuroyume !

    Mike.



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

    On 29/10/2010 at 00:33, xxxxxxxx wrote:

    For Message(), catch the ones you need and 'return TRUE;' to notify that you've caught them.  Otherwise return FALSE to let the super method handle it.  This should reduce the burden of Message() a bit.  Realize that Cinema 4D uses a message-based system and they will be flying around continuously. :)



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

    On 29/10/2010 at 05:45, xxxxxxxx wrote:

    hm ... still looks dark to me ...
    `
    So if I use as example MSG_CHANGE for Message(), it'll refresh only when any data object is changed ? Then I have to put my plugin code in the message function ? I mean : I first wrote this plugin in C.O.F.F.E.E. and I had to place my main code (what the pluginobject does) in the pluginobject::Execute(doc,op) function. Now, in C++ I have to build methods to tell C4D upon which conditions it must playmy main code ?

    Thanks Robert ...
    `



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

    On 03/11/2010 at 03:22, xxxxxxxx wrote:

    You should only override Message if you need to catch certain messages. For a ObjectData plugin most of the code is inside GetVirtualObjects or GetContour.

    cheers,
    Matthias



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

    On 04/11/2010 at 03:21, xxxxxxxx wrote:

    Thanks Matthias

    I got it working now.

    Mike


Log in to reply