Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    Invoke GetDDescription() in a tag

    SDK Help
    0
    5
    444
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H
      Helper
      last edited by

      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

      1 Reply Last reply Reply Quote 0
      • H
        Helper
        last edited by

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

        Have you tried setting the DIRTYFLAGS_DESCRIPTION on the tag?

        Best,
        -Niklas

        1 Reply Last reply Reply Quote 0
        • H
          Helper
          last edited by

          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?

          1 Reply Last reply Reply Quote 0
          • H
            Helper
            last edited by

            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

            1 Reply Last reply Reply Quote 0
            • H
              Helper
              last edited by

              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.

              1 Reply Last reply Reply Quote 0
              • First post
                Last post