bitmap button madness



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

    On 27/03/2008 at 19:12, xxxxxxxx wrote:

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

    ---------
    hi guys.

    i'm going crazy, thus i give up and go to bed. what i'm trying to do is making a bitmapbutton but the sdk help is giving me a hard time with chasing through the pages.
    i look into BitmapButtonCustomGui finding nothing that explains anything. i am just lead to CUSTOM_BitmapButton_IDs which is a dead end and to BitmapButtonStruct which triples the number of things i don't get and, of course, leads to iCustomDataType. on this trip through the docs i come across descriptions, listnodes and one billion other things, not to forget various posts referring to bitmap buttons in the forum that brought me to this point. my brain is pumping and my bitmapbutton is empty. i just want to fill that thing with an image. the button doesn't even need to be a button, just an image set by SetImage()
    PLEEEASE help me to get some things straight. what is the principle behind the 20 different classes and structures involved just to get an image in the attribute manager?? how can i use the SetImage() function before i go berzerk? i don' want to study computer sciences for several years to get an image on the screen. i am at the edge of my capabilities, i red the docs, i searched the web and the forum, i tried and tried and tried. HELP! ;D

    Yakuza



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

    On 27/03/2008 at 23:37, xxxxxxxx wrote:

    To use the BitmapButtonCustomGui in a dialog, you need to do something like this:

    > BaseContainer          tbc; \> \>           tbc.SetLong(DESC_CUSTOMGUI, CUSTOMGUI_BITMAPBUTTON); \> \>           tbc.SetLong(BITMAPBUTTON_BORDER, BORDER_NONE); \> \>           tbc.SetBool(BITMAPBUTTON_BUTTON, FALSE); \> \>           // BitMap Button \> \>           bmbutton =               (BitmapButtonCustomGui\* )AddCustomGui(IP_ABOUT, CUSTOMGUI_BITMAPBUTTON, String(), BFH_CENTER|BFV_CENTER, SizePix(256L), SizePix(40L), tbc); \> \>           if (!bmbutton)          return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_MEMORY_TEXT), "IPPDialog.CreateBannerGroup.bmbutton"); \> \>           Filename bg =          GeGetPluginPath()+Filename("res")+Filename("banner.tif"); \> \>           if (GeFExist(bg))     bmbutton->SetImage(bg, FALSE);



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

    On 28/03/2008 at 06:05, xxxxxxxx wrote:

    thank you for your reply. i want to use it as description element in the attribute manager of a plugin tag. i need to know where to place this stuff u posted, in Init()? what is the missing type of "bmbutton"? AddCustomGui is a layout function i can't use here, isn't it
    to be honest i stil don't get the concept. i have a bitmapbutton in the AM of the tag by using a res file.
    now how can i access all the bitmapbutton features in my code? how are all these clases structures and functions related, what's the principle behind all that?
    robert? bobtronic? samir? are you there? :)



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

    On 28/03/2008 at 07:28, xxxxxxxx wrote:

    Here is a working example for a BitmapButton in a tag's description.

    the ressource files:

    > \> CONTAINER Tlookatcameraexp \> { \>      NAME Tlookatcameraexp; \>      INCLUDE Texpression; \> \>      GROUP ID_TAGPROPERTIES \>      { \>           BITMAPBUTTON TEST_BUTTON { } \>      } \> } \>

    > \> #ifndef \_Tlookatcameraexp_H\_ \> #define \_Tlookatcameraexp_H\_ \> \> enum \> { \>      TEST_BUTTON = 1000 \> }; \> \> #endif \>

    > \> STRINGTABLE Tlookatcameraexp \> { \>      Tlookatcameraexp     "Look At Camera Expression"; \>       \>      TEST_BUTTON               "test button"; \> } \>

    and here the source code:

    > \> ///////////////////////////////////////////////////////////// \> // CINEMA 4D SDK                                           // \> ///////////////////////////////////////////////////////////// \> // (c) 1989-2004 MAXON Computer GmbH, all rights reserved // \> ///////////////////////////////////////////////////////////// \> \> // "look at editor camera" expression example \> \> #include "c4d.h" \> #include "c4d_symbols.h" \> #include "tlookatcameraexp.h" \> \> #include "customgui_bitmapbutton.h" \> \> \> class LookAtCamera : public TagData \> { \>      INSTANCEOF(LookAtCamera,TagData) \> \>      public: \>           virtual LONG Execute(PluginTag \*tag, BaseDocument \*doc, BaseObject \*op, BaseThread \*bt, LONG priority, LONG flags); \>           virtual Bool GetDParameter(GeListNode \*node, const DescID &id;, GeData &t;\_data, LONG &flags;); \>           virtual Bool SetDParameter(GeListNode \*node, const DescID &id;, const GeData &t;\_data, LONG &flags;); \>           virtual Bool Message(GeListNode \*node, LONG type, void \*data); \> \>           static NodeData \*Alloc(void) { return gNew LookAtCamera; } \> }; \> \> LONG LookAtCamera::Execute(PluginTag \*tag, BaseDocument \*doc, BaseObject \*op, BaseThread \*bt, LONG priority, LONG flags) \> { \>      return EXECUTION_RESULT_OK; \> } \> \> Bool LookAtCamera::GetDParameter(GeListNode \*node, const DescID &id;, GeData &t;\_data, LONG &flags;) \> { \>      switch(id[0].id) \>      { \>           case TEST_BUTTON: \>           { \>                LONG dirty = 0; \>                BitmapButtonStruct bbs(static_cast<PluginObject\*>(node), id, dirty); \>                t_data = GeData(CUSTOMDATATYPE_BITMAPBUTTON, bbs); \>                flags |= DESCFLAGS_PARAM_GET; \>                break; \>           } \>      } \> \>      return SUPER::GetDParameter(node, id, t_data, flags); \> } \> \> Bool LookAtCamera::SetDParameter(GeListNode \*node, const DescID &id;, const GeData &t;\_data, LONG &flags;) \> { \>      switch(id[0].id) \>      { \>           case TEST_BUTTON: \>                flags |= DESCFLAGS_PARAM_SET; \>                break; \>      } \> \>      return SUPER::SetDParameter(node, id, t_data, flags); \> } \> \> Bool LookAtCamera::Message(GeListNode \*node, LONG type, void \*data) \> { \>      if (type == MSG_DESCRIPTION_GETBITMAP) \>      { \>           DescriptionGetBitmap\* dgb = static_cast<DescriptionGetBitmap\*>(data); \>           if(dgb->id[0] == TEST_BUTTON) \>           { \>                AutoAlloc<BaseBitmap> bm; \>                Filename bg = GeGetPluginPath()+Filename("res")+Filename("lookatcamera.tif"); \>                bm->Init(bg); \>                dgb->bmp = bm.Release(); \>           } \>      } \> \>      return TRUE; \> } \> \> // be sure to use a unique ID obtained from www.plugincafe.com \> #define ID_LOOKATCAMERATAG     1001165 \> \> Bool RegisterLookAtCamera(void) \> { \>      // decide by name if the plugin shall be registered - just for user convenience \>      String name=GeLoadString(IDS_LOOKATCAMERA); if (!name.Content()) return TRUE; \>      return RegisterTagPlugin(ID_LOOKATCAMERATAG,name,TAG_EXPRESSION|TAG_VISIBLE,LookAtCamera::Alloc,"Tlookatcameraexp","lookatcamera.tif",0); \> } \>

    cheers,
    Matthias



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

    On 28/03/2008 at 07:35, xxxxxxxx wrote:

    wow, cool! :D

    i will check this later hoping i'll be able to do what i want now, before asking you agin gets embarassing ;)

    thank you very very much for your time, that code would take me months...

    Yakuza



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

    On 29/03/2008 at 09:40, xxxxxxxx wrote:

    hi, sorry to bother you again but this doesn't seem to be working for me. here is what i adapted according to my code:
    - TEST_BUTTON got the name of my button IMAGINARY_PREVIEW
    - SUPER changed to TagData (and NodeData) neither of it
    works
    - INSTANCEOF(LookAtCamera, TagData) changed to   
    INSTANCEOF(Imaginary, TagData) which is my main class
    - "lookatcamera.tif" changed to "imaginary.tif"

    are there mistakes in it? i checked it 5 times, the code
    should be correct, matthias called it a working example, any suggestions?
    thank you in advance

    Yakuza



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

    On 29/03/2008 at 12:04, xxxxxxxx wrote:

    If using the example:

    Did you change the file names? Did you change the plugin ID? Did you change 'Tlookatcameraexp'?

    SUPER can't be changed. It tells the method to call the base class's original method when you are deriving from it.

    So, you should have something like this (where 'Tmyplugintag', MyPluginTag, the plugin ID, etc. should be replaced with your own) :

    Tmyplugintag.res

    > CONTAINER Tmyplugintag \> { \>      NAME Tmyplugintag; \>      INCLUDE Texpression; \> \>      GROUP ID_TAGPROPERTIES \>      { \>           BITMAPBUTTON IMAGINARY_PREVIEW { } \>      } \> }

    Tmyplugintag.h

    > #ifndef \_Tmyplugintag_H\_ \> #define \_Tmyplugintag_H\_ \> \> enum \> { \>      IMAGINARY_PREVIEW = 1000 \> }; \> \> #endif

    Tmyplugintag.str

    > STRINGTABLE Tmyplugintag \> { \>      Tmyplugintag               "My Plugin Tag"; \>      IMAGINARY_PREVIEW          "test button"; \> }

    MyPluginTag.cpp

    > #include "c4d.h" \> #include "c4d_symbols.h" \> #include "tmyplugintag.h" \> #include "customgui_bitmapbutton.h" \> \> class MyPluginTag : public TagData \> { \>      INSTANCEOF(MyPluginTag,TagData) \> \>      public: \>           virtual LONG Execute(PluginTag \*tag, BaseDocument \*doc, BaseObject \*op, BaseThread \*bt, LONG priority, LONG flags); \>           virtual Bool GetDParameter(GeListNode \*node, const DescID &id;, GeData &t;\_data, LONG &flags;); \>           virtual Bool SetDParameter(GeListNode \*node, const DescID &id;, const GeData &t;\_data, LONG &flags;); \>           virtual Bool Message(GeListNode \*node, LONG type, void \*data); \> \>           static NodeData \*Alloc(void) { return gNew MyPluginTag; } \> }; \> \> LONG MyPluginTag::Execute(PluginTag \*tag, BaseDocument \*doc, BaseObject \*op, BaseThread \*bt, LONG priority, LONG flags) \> { \>      return EXECUTION_RESULT_OK; \> } \> \> Bool MyPluginTag::GetDParameter(GeListNode \*node, const DescID &id;, GeData &t;\_data, LONG &flags;) \> { \>      switch(id[0].id) \>      { \>           case IMAGINARY_PREVIEW: \>           { \>                LONG dirty = 0; \>                BitmapButtonStruct bbs(static_cast<PluginObject\*>(node), id, dirty); \>                t_data = GeData(CUSTOMDATATYPE_BITMAPBUTTON, bbs); \>                flags |= DESCFLAGS_PARAM_GET; \>                break; \>           } \>      } \>      return SUPER::GetDParameter(node, id, t_data, flags); \> } \> \> Bool MyPluginTag::SetDParameter(GeListNode \*node, const DescID &id;, const GeData &t;\_data, LONG &flags;) \> { \>      switch(id[0].id) \>      { \>           case IMAGINARY_PREVIEW: \>                flags |= DESCFLAGS_PARAM_SET; \>                break; \>      } \>      return SUPER::SetDParameter(node, id, t_data, flags); \> } \> \> Bool MyPluginTag::Message(GeListNode \*node, LONG type, void \*data) \> { \>      if (type == MSG_DESCRIPTION_GETBITMAP) \>      { \>           DescriptionGetBitmap\* dgb = static_cast<DescriptionGetBitmap\*>(data); \>           if(dgb->id[0] == IMAGINARY_PREVIEW) \>           { \>                AutoAlloc<BaseBitmap> bm; \>                Filename bg = GeGetPluginPath()+Filename("res")+Filename("imaginary.tif"); \>                bm->Init(bg); \>                dgb->bmp = bm.Release(); \>           } \>      } \>      return TRUE; \> } \> \> // be sure to use a unique ID obtained from www.plugincafe.com \> #define ID_MYPLUGINTAG     //PUT UNIQUE PLUGIN ID HERE! \> \> Bool RegisterMyPluginTag(void) \> { \>      return RegisterTagPlugin(ID_MYPLUGINTAG,"My Plugin Tag",TAG_EXPRESSION|TAG_VISIBLE,MyPluginTag::Alloc,"Tmyplugintag","myplugintag.tif",0L); \> }



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

    On 29/03/2008 at 12:39, xxxxxxxx wrote:

    hi robert.
    thank you for your reply. just to clearify what i did by now:
    i have a tag plugin built from the lookatcamera example.
    i changed all res and header files, the icon and the whole code. it is compiling, running and working quite fine(except for some of the usual bugs to be fixed). it has descriptions in the AM like a button, working fine, a filename description, also working, a bool/checkbox which is workin as well and a bitmapbutton without bitmap, only the name is shown. i implemented the above code and changed all names/references according to my plugin. it compiles without errors nor warnings - just that damn bitmap won't show up :(
    changing SUPER to TagData was just a wild guess, it also compiles without trouble but i changed it back to SUPER now. so in fact i think its all like shown above except for my additional functions and the code in the execute function and an additional case in the message function to catch the standard button. i am out of ideas...
    thanks again, Robert and Matthias for standing my noob questions :D

    Yakuza



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

    On 29/03/2008 at 13:33, xxxxxxxx wrote:

    Try this in the str file and see if it helps:

    STRINGTABLE Tmyplugintag
    {
         Tmyplugintag               "My Plugin Tag";
    }

    That is, remove the text associated with the bitmap button.

    See if SetDParameter() and GetDParameter() ever get called with IMAGINARY_PREVIEW id (doing a GePrint() is simple enough here). Also check that the code is executed in Message() and that the filename actually exists - you can do this:

    Filename bg = GeGetPluginPath()+Filename("res")+Filename("imaginary.tif");
    if (!GeFExist(bg)) GePrint("File Not Found!");

    I have to admit that I've never tried displaying a bitmap button in the AM before (except via a Tool plugin which uses a SubDialog to display AM elements) - mainly because there hasn't been a need for it.



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

    On 29/03/2008 at 13:58, xxxxxxxx wrote:

    ok, after debugging my brain it works now. even though i KNOW i changed the filename to "imaginary.tif" it somehow changed back to "lookatcamera.tif". i guess programming at 5am is not the best approach :D
    so here i stand a bit embarrassed and deeply thankful for your time. at least i am sure of this: it won't be my last question :D
    thanks again and now to something completely different:
    trying to get a dropdown/cycle description to work....
    cu later,

    Yakuza



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

    On 29/03/2008 at 15:05, xxxxxxxx wrote:

    dropdown/cycle is easy:

    1. Set the type as LONG.
    2. In the res file, add a CYCLE section inside the LONG description (for example) :

    // Rotation Order
    LONG          IPP_RORDER
    {
         ANIM OFF;
         CYCLE
         {
              IPP_RORDER_NONE;
              IPP_RORDER_XYZ;
              IPP_RORDER_XZY;
              IPP_RORDER_YXZ;
              IPP_RORDER_YZX;
              IPP_RORDER_ZXY;
              IPP_RORDER_ZYX;
         }
    }

    The cycle values should be enumerated in the Tmyplugintag.h file and numbered from 0 to N-1 (where N is the number of choices). The text in the Tmyplugintag.str file.

    If you need 'dynamic' dropdown elements (names and/or counts will change), you'll need to do this in GetDDescription() and omit the CYCLE section from the res file.



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

    On 29/03/2008 at 16:21, xxxxxxxx wrote:

    oh, thanks, that was not actually a question, but now that you answered it works fine ;D
    anyway, i'm still having some troubles updating the bitmapbutton. i am trying to load a movie frame from the movie given in the filename description. unfortunately its not showing up using:
    Bool bool_p= TRUE;                    
    if(bm->Init(bg, 1, &bool;_p) == IMAGE_OK)
    GePrint("IMAGE_OK " + LongToString(bool_p));

    it prints IMAGE_OK and confirms its a movie when it is one. also having issues resizing it.
    i will try some stuff and ask again tomorrow slightly more detailed if i can't get this right too.

    Yakuza



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

    On 29/03/2008 at 17:50, xxxxxxxx wrote:

    yeah, i got it, just don't get how i did it ;D



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

    On 30/03/2008 at 07:45, xxxxxxxx wrote:

    well, next question. my problem is to update the bitmapbutton. it should show the file in the filename description but only does that when the button is pressed. how to fake pushing the button when the filename is changed? with a message? i tried but no success.
    thank you for your ideas.

    Yakuza



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

    On 31/03/2008 at 06:42, xxxxxxxx wrote:

    The dirty parameter of the BitmapButtonStruct should be increased for every update.

    Btw. there are lots of old threads about BitmapButtons on the forum where you can find most of this stuff explained.

    cheers,
    Matthias



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

    On 01/04/2008 at 10:47, xxxxxxxx wrote:

    hi matthias,

    if these threads or the sdk documentation would have helped i certainly would not post my questions here :)

    the hint with the incrementation of the dirty parameter was indeed very helpful, my bitmapbutton finally works as intended. thank you very much again.

    Yakuza



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

    On 10/07/2009 at 12:45, xxxxxxxx wrote:

    Hey guys...
    I must be missing something... I got the above example type code to work and my buttons display fine now.  I also added the "BUTTON" attribute in the .res file so I can see it push in and pop back out as I click on it, but...
    The problem is that I'm not getting any MSG_DESCRIPTION_COMMAND message when I click on one of these (I do get notified for some regular text-based buttons in the same description).
    Any ideas?
    Thanks.



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

    On 10/07/2009 at 12:57, xxxxxxxx wrote:

    Ignore the above... the answer is in this thread.


Log in to reply