Efficiency in GetDDescription [SOLVED]

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

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

    Greetings !

    I have 2 questions for the plugin GetDDescription.
    I have created a tag plugin, which can be assigned to objects and configure their internal data.
    I use a resource file to create 5 groups of parameters.
    One of them is responsible to show which one of the other 4 groups will be active at any given time.

    So, 1 group has 4 checkboxes. The other 4 groups (pages) have the exact same parameters, but with different values. I would like to ask which one of the following scenarios is more efficient.

    1. Write 5 groups in the resource file. Whenever a user toggles any checkbox on/off, the corresponding page will appear.

    2. Write 2 groups in resource file. One for the checkboxes and the other for the values. Whenever the user switches the state of checkboxes, change the values of the corresponding parameters. Use Show / Hide in case the corresponding checkbox is on/off.

    What i notice is that the more groups i have activated , the slower it becomes when i enable a new checkbox.

    Another thing i would like to ask is that which is the best way to add new groups. Instead of having 5 groups of parameters, i would like to start with 1 and let the user add new groups using a button.
    Is it wise to have a structure with the new Parameter IDs instead of the const values defined (enum) in my_plugin.h and my_plugin.res.

    Thank you very much for your time and allow me to apologize for the long post.

  • On 12/08/2015 at 09:16, xxxxxxxx wrote:


    the route to choose depends heavily on your needs.
    Option 2) is probably a bit more problematic. Especially if the parameters are supposed to be animated. Then this will most likely fail.
    In my ManualKerning plugin (its source is actually on Google Code, but I won't link to it here 😉. It's outdated and old and not a real masterpiece) I dynamically create and toggle quite a bunch of groups and never experienced any significant slowdown.
    It is important to note the code recommended in all examples, that implement GetDDescription(), and in most cases it's marked with a comment "important to check for speedup".
    Basically like so:

    const DescID* singleid = description->GetSingleDescID();
    const DescID cid = DescLevel(YOUR_DESCRIPTION_ID, DTYPE_LONG, 0);
    if (!singleid || cid.IsPartOf(*singleid, nullptr))  // important to check for speedup c4d!
      // do something here

    It may also be a good idea to have a look at the SDK examples, there are some new ones on GitHub. Especially the gui/objectdata_descriptions.cpp may be worth a look.

  • On 14/08/2015 at 03:23, xxxxxxxx wrote:


    Thank you very much for your answer.

    As far as the efficinecy is concerned, whenever i modify a description parameter (lets say a checkbox), the method getDDescription is called 6 times (!!!)
    Even if I use the condition you mentioned (!single_id || cid.IsPartOf(*single_id, NULL)), the body is executed multiple times !
    Can i avoid that somehow ?

    Thnx again and i wish you the best !

  • On 14/08/2015 at 04:44, xxxxxxxx wrote:

    @peterakos, this is a normal behavior, it happens here too.

  • On 17/08/2015 at 08:12, xxxxxxxx wrote:

    as Mohamed already said, that's normal. And that's the reason, why implementation of the singleid check is so important.

Log in to reply