Object attributes descIDs

  • 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));

  • 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)  
              String ID = objBc->GetString(DESC_IDENT);             //The description's ID# expressed in text form  
              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


Log in to reply