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

    Object attributes descIDs

    SDK Help
    0
    2
    195
    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 20/11/2013 at 05:06, xxxxxxxx wrote:

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

      ---------
      I'm trying to read all descIDs from the base container of an object, but I can't get those from obase.res file.
      This is the code I'm using:

      BaseContainer* pbc = pObj->GetDataInstance();
      if (!pbc)
         return nrProperties;

      BaseContainer bc;
      LONG nrProperties = 0;

      for (LONG id, idx = 0; (id = pbc->GetIndexId(idx)) != NOTOK; idx++)
      {
        AutoAlloc<Description> desc;
        if ((desc) && (pObj->GetDescription(desc, DESCFLAGS_DESC_0)))
        {
                BaseContainer* pdbc = desc->GetParameterI(id, NULL);
                if (pdbc)
             {
                  if (!pdbc->GetBool(DESC_HIDE))
                    {               
                        bc.SetLong(T_OBJ_PROPERTY_ID + nrProperties, id);
                      bc.SetString(T_OBJ_PROPERTY_NAME + nrProperties, pdbc->GetString(DESC_NAME));
                     
                      nrProperties++;
                   }
              }
         }
       }

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

        On 20/11/2013 at 07:45, xxxxxxxx wrote:

        This is the one I tend to use a lot. Using the SDK Browse() function.

            BaseObject *obj = doc->GetActiveObject();  
          const BaseContainer *objBc = obj->GetDataInstance();  
          
          AutoAlloc<Description> desc;  
          if (!desc) return FALSE;  
          if (!obj->GetDescription(desc, DESCFLAGS_DESC_0)) return FALSE;  
          
          DescID dcid, groupid;  
          void *handle = desc->BrowseInit();  
          if (!handle) return FALSE;  
          
          //We will store the description values in this variable  
          GeData d;  
          
          while (desc->GetNext(handle, &objBc, dcid, groupid))  
          {  
              if (objBc)  
              {  
                  String name = objBc->GetString(DESC_NAME);          //The text in the GUI for each Gizmo (like the .str file works in plugins)  
                  GePrint(name);  
                  String ID = objBc->GetString(DESC_IDENT);             //The description's ID# expressed in text form  
                  GePrint(ID);  
          
                  obj->GetParameter(DescID(dcid), d, DESCFLAGS_GET_0);  //Get all the description values and store them in variable "d"  
                    
                  //Now we need to check the "d" variable for the specific type of data each description can store  
                  Real rValue = d.GetReal();  
                  LONG lValue = d.GetLong();  
                  String sValue = d.GetString();  
                  GePrint("RealValue: " +RealToString(rValue) + " , " + "LongValue: " +LongToString(rValue) + " , " + "StringValue: " +sValue);  
              }  
          }  
          
          desc->BrowseFree(handle);   //Free the memory used by the Browse function
        

        -ScottA

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