Invoke GetDDescription() in a tag



  • On 17/12/2013 at 01:55, xxxxxxxx wrote:

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

    ---------
    Hi folks,
    I have a simple tag with a dynamic combobox which gets filled in GetDdescription. Like this:

      
    Bool ModelMetaDataTag::GetDDescription(GeListNode* node, Description* description, DESCFLAGS_DESC& flags)   
    {   
         if (!description->LoadDescription(node->GetType())) return FALSE;   
      
         std::vector<String> items;   
      
         BaseContainer *descbase = description->GetParameterI(DescLevel(1001),NULL);   
         if (descbase) {   
              BaseContainer *listBc = descbase->GetContainerInstance(DESC_CYCLE);   
              if (listBc)   
              {   
                   listBc->FlushAll(); // clear combobox   
                   for (size_t i = 0; i < items.size(); ++i) {   
                        listBc->SetString((LONG)i, items[i]);   
                   }   
              }   
         }   
      
         flags |= DESCFLAGS_DESC_LOADED;   
         return SUPER::GetDDescription(node, description, flags);   
    }   
    

    When I have this tag selected and then perform a clone of the document and insert it then the combobox of the tag will be empty and I need to rebuild it by deselecting and activating it again.
    For the mentioned procedure I use these python commands:

      
    docClone = doc.GetClone(c4d.COPYFLAGS_DOCUMENT)   
    c4d.documents.InsertBaseDocument(docClone)   
    

    Now the question how can I restore the content of the combobox immediately when the cloned document gets inserted?
    Best regards,
    Satara



  • On 17/12/2013 at 04:37, xxxxxxxx wrote:

    Have you tried setting the DIRTYFLAGS_DESCRIPTION on the tag?

    Best,
    -Niklas



  • On 17/12/2013 at 05:37, xxxxxxxx wrote:

    Thanks, totally forgot about that flag. It seems to work, but it does appear empty for a short time. Is it possible to fill the container outside of this function? Shouldn't it be filled already, when the document is just cloned?



  • On 19/12/2013 at 13:31, xxxxxxxx wrote:

    Hi Satara,

    can you put a debug print in GetDDescription() and check if it is called once before the correct items are
    filled in the description?

    Thanks,
    -Niklas



  • On 22/12/2013 at 02:43, xxxxxxxx wrote:

    Yes it gets called. I have to change the way the list of items gets generated. Thanks for your help.


Log in to reply