Icons with external resouce files



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

    On 08/09/2011 at 12:44, xxxxxxxx wrote:

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

    ---------
    Hi,

    Can anyone tell me how to add icon images to gizmos when you are using an external .res file.
    The SDK has an example of how to do it with the Add method like this:

    Bool myDialog::CreateLayout(void)  
    {  
      Bool result = TRUE;  
      GeResource dlg_res;  
      dlg_res.Init(GeGetPluginPath());  
      result = LoadDialogResource(IDS_RESDIALOG, &dlg_res, 0);  //IDS_RESDIALOG is the items found in the .res file  
        
      
    //This combobutton we'll add here in the .cpp file... And not from the external .res file  
      GroupBegin(0,BFH_LEFT,2,0,"",0);  
      {                  
      AddComboBox(MY_COMBOBUTTON2, BFH_SCALEFIT);  
      IconData dat1,dat2,dat3,dat4;  //Create a few new IconData type variables to hold our icons  
      GetIcon(Ocube,&dat1);  
      GetIcon(Osphere,&dat2);  
      GetIcon(Ocylinder,&dat3);     //Assign some icons to the variables we created above  
      GetIcon(Ttexture,&dat4);      //IconID's can be found in the file CINEMA 4D R12/resource/libs/interface_icons.txt  
                        
      AddChild(MY_COMBOBUTTON2, 0, GeLoadString(IDS_CUBE)+"&i"+LongToString(Ocube)+"&");   //IDS_CUBE is declared in the c4d_symbols.h file.& the text is in c4d_strings.str   
      AddChild(MY_COMBOBUTTON2, 1, GeLoadString(IDS_PHONG)+"&i"+LongToString(Tphong)+"&");      
      AddChild(MY_COMBOBUTTON2, 2, GeLoadString(IDS_SPHERE)+"&"+PtrToString(&dat2)+"&");  //Uses a pointer to find the icon image instead of using the above method  
                
      }  
      GroupEnd();  
        
      return TRUE;  
    }
    

    But I can't find any information how to do the same thing using a .res file.

    -ScottA



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

    On 09/09/2011 at 15:48, xxxxxxxx wrote:

    Nobody knows how to do this?
    I'm working on a dialog. But what I'm looking for should be the same thing as using the GetIcon() function with a tag based plugin.

    I was thinking that possibly the code should be put in the GetDDescription() method. But I'm not sure.
    Nobody has ever used GetIcon() in any of their tag plugins?

    -ScottA



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

    On 10/09/2011 at 05:19, xxxxxxxx wrote:

    Dialogs don't use Descriptions.  They use GUI elements and, possibly, custom GUIs.  GeDialog doesn't even support GetIcon() (and it isn't derived from BaseList2D).  AddChild() takes a string as the third argument.  It is not an image.  I'm not sure what you want to achieve but you may need to look at SimpleListView or TreeViewCustomGui.



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

    On 10/09/2011 at 07:11, xxxxxxxx wrote:

    Suppose you have a tag plugin with a Multibutton on it. And you want the Multibuttons to not only have text on it. But also one of the registered icon images on it.
    AddChild() is no longer an option because there is no CreateLayout() method to use it in for tags.
    That's what I'm trying to do.

    I was thinking that if I learned how to do this on a tag button. I might be able to use the same sort of thing of my resource based dialogs too.

    -ScottA



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

    On 10/09/2011 at 07:20, xxxxxxxx wrote:

    BitmapButtonCustomGui for Descriptions on tags, etc.  You can use the same thing for images in dialogs but the way they work in each is totally different.  On a dialog, you use AddCustomGUI() whereas you need to do a bunch of complex stuff in a plugin for descriptions.

    The resources between dialogs and tags (etc.) are different beasts (even if they look similar).  The resources for a tag are the header with the IDs, the .res with the descriptions, and the string file.  The resource for a dialog is the dialog layout with dialog GUI elements and IDs are in the plugin's c4d_symbols.h not in a plugin-specific header.  While they look the same, the elements within are not interchangeable between description resources and dialog resources.



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

    On 10/09/2011 at 07:39, xxxxxxxx wrote:

    I looked in the docs and it says this:

    [BaseBitmap](../c4d_basebitmap/class_BaseBitmap51.html)* (*GetIcon )(void* userdata) 
    Gets the data type icon.  
      
     **Note:** This is currently not used.
    

    I could have sworn I saw people using icons on their tag plugins. One of those things you see and at the time don't pay much attention to it.
    But the docs seem to indicate it's not supported.
    -ScottA



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

    On 12/09/2011 at 06:47, xxxxxxxx wrote:

    Do you mean something like this?

    This can be done in the resource file. Please have a look at resource file of the light source object.

      
    LONG LIGHT_TYPE  
    {  
      CYCLE  
      {  
          LIGHT_TYPE_OMNI~5102;  
          LIGHT_TYPE_SPOT~300000146;  
          LIGHT_TYPE_DISTANT~300000148;  
          LIGHT_TYPE_AREA~300000150;  
          -1;  
          LIGHT_TYPE_SPOTRECT;  
          LIGHT_TYPE_PARALLEL;  
      }  
    }  
    

    The combo button is a LONG description element with a CYCLE list. Behind each entry with a icon you can see a tilde ~ symbol followed by the ID of the registered icon. A -1 produces a separator.

    So you first you need to register your icon. Look up RegisterIcon in the docs and the SDK examples. Then pass the icon IDs to the CYCLE list in your resource file.

    This is mentioned too in the docs for the CYCLE description element.

    cheers,
    Matthias



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

    On 12/09/2011 at 08:29, xxxxxxxx wrote:

    Yes. That's it.👍
    I tried to get this to work with a resource based dialog. Using a Combo Button & CHILD in place of the Tag's Multi Button & CYCLE. But it didn't work.
    So I've come to the conclusion that it's something that isn't supported.

    If we want to use registered icons in our dialogs. We don't have a choice.
    We MUST add them in the .cpp file with the ADDCHILD() method. Even if the other gizmos are using an external resource file.
    That's the conclusion I've come to.

    Thanks for the help guys,
    -ScottA


Log in to reply