Get name of object properties



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 13/07/2010 at 02:28, xxxxxxxx wrote:

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

    ---------
    Hello,

    i implemented an objectData plugin with some properties.
    Now i like to read this properties with an further plugin. I get the values and the type of every property, but not the name of it.

    A cutout of the res file:

    CONTAINER OWidget
    {
      INCLUDE Obase;

    GROUP ID_OBJECTPROPERTIES
      {
           DEFAULT 1;

    GROUP {
               LONG POSX { }
               LONG POSY { }
               LONG WIDTH { MIN 0;}
               LONG HEIGHT { MIN 0;}
               BOOL VISIBLE { }
               BOOL PARENTVISIBLE { }
               BOOL FOCUSED { }

    and the corresponding string table

    STRINGTABLE OWidget
    {
       OWidget              "Widget";

    POSX                 "PosX";
       POSY                 "PosY";
       WIDTH                "Width";
       HEIGHT               "Height";
       VISIBLE              "Visible";
       PARENTVISIBLE        "ParentVisible";
       FOCUSED              "Focused";
    ...

    How can i read this strings to the according values?
    I don't like to add this strings fixed, because they will changed in the future.

    regards
    Markus



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 13/07/2010 at 03:49, xxxxxxxx wrote:

    You have to use the Description class and access it's container.

    Here is an example which prints the names and ID names of all description elements of an selected object.

      
    Bool MenuTest::Execute(BaseDocument *doc)  
    {  
      BaseObject *op = doc->GetActiveObject();  
      if (!op) return FALSE;  
      
      AutoAlloc<Description> desc;  
      if (!desc) return FALSE;  
      
      if (!op->GetDescription(desc,0)) return FALSE;  
      
      const BaseContainer *bc = NULL;  
      DescID id, groupid;  
      
      void *handle = desc->BrowseInit();  
      if (!handle) return FALSE;  
      
      while (desc->GetNext(handle, &bc, id, groupid))  
      {  
          if (bc)  
          {  
              GePrint(bc->GetString(DESC_NAME));    //the description element's name  
              GePrint(bc->GetString(DESC_IDENT));    //the description element's ID name  
          }  
      }  
      
      desc->BrowseFree(handle);  
      
      return TRUE;  
    }  
    

    cheers,
    Matthias



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 13/07/2010 at 06:43, xxxxxxxx wrote:

    thanks, it works.

    I check also the type of every paramter with DESC_CUSTOMGUI, but i didn't get every type.
    For LONG and BOOL values i got only DA_LONG as type. How can i get the right type?

    best regards
    Markus



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 13/07/2010 at 06:55, xxxxxxxx wrote:

    Originally posted by xxxxxxxx

    For LONG and BOOL values i got only DA_LONG as type. How can i get the right type?

    It's currently not possible.

    cheers,
    Matthias



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 13/07/2010 at 23:00, xxxxxxxx wrote:

    Hi,

    i have a further question about a DESC_CUSTOMGUI. I create an CYCLE { } element in the .res file:
    e.g.
                 LONG XALIGNMENT
                 {
                      CYCLE {
                              nXAlign_Left;
                              nXAlign_Center;
                              nXAlign_Right;
                            }
                 }

    If i read the DESC_CUSTOMGUI back, i get only the DTYPE_LONG value. But i need also the information if this parameter a CYCLE gui, because in this case i must convert the long value to a string value.

    Do you have an idea where i get this information?
    regards
    markus



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 14/07/2010 at 03:41, xxxxxxxx wrote:

    Just checked some stuff again and you can in fact determine if an element is Bool or LONG. To read the type you should directly access the DescID and check for its DTYPE.

    here is an example:

      
    while (desc->GetNext(handle, &bc, id, groupid))  
    {  
      if (bc)  
      {  
          LONG type = id[0].dtype;  
            
          switch (type)  
          {  
              case DTYPE_LONG:  
                  //do something  
                  break;  
              case DTYPE_BOOL:  
                  //do something  
                  break;  
          }  
      }  
    }  
    

    Check its DESC_CUSTOMGUI only for its interface.

    As for failing to check the CYCLE GUI, it seems like a bug to me. I reported it to the developers.

    cheers,
    Matthias


Log in to reply