Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware 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

    BitmapButton image change works in R13 but not R14

    SDK Help
    0
    20
    1.8k
    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

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

      On 15/12/2012 at 17:19, xxxxxxxx wrote:

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

      ---------
      One of my plugins (using an ObjectData and TagData) has Bitmapbuttons which are 'toggleable' to show their state as enabled or disabled.  The plugin is built for R13 (with the latest project changes to avoid crashes on MacOS X as outline in September).  This toggling (as outlined here in PluginCafe) works in all of the versions for which it is built (R10.1 to R13) but the functionality no longer works in R14 (and that includes registering the state change that allows the plugin to update thusly).

      Do I just need to rebuild for R14 or has the convoluted method of changing images in Bitmapbutton descriptions changed between R13 and R14 (and could you provide the changed code)?

      Thanks,

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

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

        On 17/12/2012 at 02:58, xxxxxxxx wrote:

        Hi Robert,

        We have to set both BITMAPBUTTON_BUTTON and BITMAPBUTTON_TOGGLE in the settings container for the button to toggle:

        BaseContainer bc;
        bc.SetBool(BITMAPBUTTON_BUTTON, TRUE);
        bc.SetBool(BITMAPBUTTON_TOGGLE, TRUE);
        bc.SetLong(BITMAPBUTTON_ICONID1, Osphere);
        bc.SetLong(BITMAPBUTTON_ICONID2, Ocube);
        
        1 Reply Last reply Reply Quote 0
        • H
          Helper
          last edited by

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

          On 17/12/2012 at 06:09, xxxxxxxx wrote:

          Can you post some code for both .res BITMAPBUTTON declarations and dynamic declarations?  Neither are working in R14.  I'm using code which sets the state using something like the included code (showing just examples).  Note that this is terse process is what was relayed to me here in order to control the toggle state of two-image bitmap buttons.  If there is now an easier way with those BITMAPBUTTON_ICONID1/2 options, I'd love to see code (there are no examples in the sdk docs or cinema4dsdk)

          BITMAPBUTTON    GREEBLER_BITMAP_ARRAY            { ANIM OFF; BUTTON; }  
            
            // BaseContainers for Dynamic Descriptions of Custom Greeble Shapes, Nurnies  
            bmbBC =                                GetCustomDataTypeDefault(DTYPE_BUTTON);  
            bmbBC.SetLong(DESC_ANIMATE,            DESC_ANIMATE_OFF);  
            bmbBC.SetLong(DESC_CUSTOMGUI,        CUSTOMGUI_BITMAPBUTTON);  
            bmbBC.SetLong(BITMAPBUTTON_BORDER,    BORDER_NONE);  
            bmbBC.SetBool(BITMAPBUTTON_BUTTON,    TRUE);  
            bmbBC.SetBool(BITMAPBUTTON_TOGGLE,    TRUE);  
            
          // NodeData.GetDParameter  
          //*---------------------------------------------------------------------------*  
          Bool GreeblerObj::GetDParameter(GeListNode* node, const DescID& id, GeData& t_data, DESCFLAGS_GET& flags)  
          //*---------------------------------------------------------------------------*  
          {  
            if (!node)        return FALSE;  
            LONG    did =    id[0].id;  
            // Custom Greebles  
            if ((did >= GREEBLER_GREEC_BITMAP) && (did <= GREEBLER_GREEC_BITMAP_END))  
            {  
                BitmapButtonStruct bbs(static_cast<PluginObject*>(node), id, cg_bm_dirty);  
                t_data =        GeData(CUSTOMDATATYPE_BITMAPBUTTON, bbs);  
                flags |=        DESCFLAGS_GET_PARAM_GET;  
                --cg_bm_dirty;  
            }  
            // Nurnies  
            else if ((did >= GREEBLER_NURN_BITMAP) && (did <= GREEBLER_NURN_BITMAP_END))  
            {  
                BitmapButtonStruct bbs(static_cast<PluginObject*>(node), id, nu_bm_dirty);  
                t_data =        GeData(CUSTOMDATATYPE_BITMAPBUTTON, bbs);  
                flags |=        DESCFLAGS_GET_PARAM_GET;  
                --nu_bm_dirty;  
            }  
            else  
            {  
                switch (did)  
                {  
                    // BitmapButtons  
                    case GREEBLER_BITMAP_ARRAY:  
                    {  
                        BitmapButtonStruct bbs(static_cast<PluginObject*>(node), id, sg_bm_dirty);  
                        t_data =        GeData(CUSTOMDATATYPE_BITMAPBUTTON, bbs);  
                        flags |=        DESCFLAGS_GET_PARAM_GET;  
                        --sg_bm_dirty;  
                        break;  
                    }  
                }  
            }  
            return SUPER::GetDParameter(node, id, t_data, flags);  
          }  
            
          // NodeData.SetDParameter  
          //*---------------------------------------------------------------------------*  
          Bool GreeblerObj::SetDParameter(GeListNode* node, const DescID& id, const GeData& t_data, DESCFLAGS_SET& flags)  
          //*---------------------------------------------------------------------------*  
          {  
            if (!node)        return FALSE;  
            LONG    did =    id[0].id;  
            // Array BitmapButton  
            else if (did == GREEBLER_BITMAP_ARRAY)  
            {  
                if (flags & DESCFLAGS_SET_USERINTERACTION)  
                {  
                    BaseContainer*    bc =    static_cast<PluginObject*>(node)->GetDataInstance();  
                    // user clicked on button - toggle state  
                    bc->SetBool(GREEBLER_SHAPE_ARRAY, !bc->GetBool(GREEBLER_SHAPE_ARRAY));  
                }  
                flags |=    DESCFLAGS_SET_PARAM_SET;  
            }  
            return SUPER::SetDParameter(node, id, t_data, flags);  
          }  
          // NodeData.Message  
          //*---------------------------------------------------------------------------*  
          Bool GreeblerObj::Message(GeListNode* node, LONG type, void* data)  
          //*---------------------------------------------------------------------------*  
          {  
            //GePrint(MsgToString(type));  
            if (!node)    return FALSE;  
            if        (type == MSG_DESCRIPTION_GETBITMAP)  
                return MsgGetBitmap(static_cast<DescriptionGetBitmap*>(data), static_cast<BaseObject*>(node));  
            else if (type == MSG_DESCRIPTION_COMMAND)  
                return MsgCommand(static_cast<DescriptionCommand*>(data), static_cast<BaseObject*>(node));  
            else if (type == MSG_DESCRIPTION_POSTSETPARAMETER)  
                return MsgPostSetParameter(static_cast<DescriptionPostSetValue*>(data), static_cast<BaseObject*>(node));  
            else if (type == MSG_DESCRIPTION_CHECKUPDATE)  
                return MsgCheckUpdate(static_cast<DescriptionCheckUpdate*>(data), static_cast<BaseObject*>(node));  
            /*  
            else if (type == MSG_DESCRIPTION_CHECKDRAGANDDROP)  
                return MsgCheckDragAndDrop(static_cast<BaseTag*>(node), static_cast<DescriptionCheckDragAndDrop*>(data));  
            */  
            return SUPER::Message(node,type,data);  
          }  
          // GreeblerObj.GetSSBitMap  
          //*---------------------------------------------------------------------------*  
          void GreeblerObj::GetSSBitMap(DescriptionGetBitmap* dgb, const Bool& enabled, const String& sfn)  
          //*---------------------------------------------------------------------------*  
          {  
            Filename    bg;  
            if (enabled)        bg =    stocksfn+Filename(sfn+"_T.tif");  
            else                bg =    stocksfn+Filename(sfn+"_F.tif");  
            if (!GeFExist(bg))    return;  
            AutoAlloc<BaseBitmap>    bm;  
            if (!bm)            return;  
            bm->Init(bg);  
            dgb->bmp =            bm.Release();  
          }  
          // GreeblerObj.MsgGetBitmap  
          //*---------------------------------------------------------------------------*  
          Bool GreeblerObj::MsgGetBitmap(DescriptionGetBitmap* dgb, BaseObject* op)  
          //*---------------------------------------------------------------------------*  
          {  
            if (!(dgb && op))        return TRUE;  
            BaseContainer*    bc =    op->GetDataInstance();  
            LONG            id =    dgb->id[0].id;  
            // Stock Greebles  
             else if (id == GREEBLER_BITMAP_ARRAY)            GetSSBitMap(dgb, bc->GetBool(GREEBLER_SHAPE_ARRAY),        "array");  
            else if ((id >= GREEBLER_GREEC_BITMAP) && (id <= GREEBLER_GREEC_BITMAP_END))  
            {  
                // Get associated GCBInfo bitmap  
                BaseBitmap*        ibm =            GetGCBInfoBitmap_Greebles(op, bc, id);  
                if (!ibm)                        return TRUE;  
                AutoAlloc<BaseBitmap>    bm;  
                if (!bm)                        return TRUE;  
                ibm->CopyTo(bm);  
                dgb->bmp =                        bm.Release();  
            }  
            // Nurnies  
            else if (id == GREEBLER_BITMAP_NBARS)            GetSSBitMap(dgb, bc->GetBool(GREEBLER_OBJECT_NBARS),    "bars");  
            else if (id == GREEBLER_BITMAP_NARRAY)            GetSSBitMap(dgb, bc->GetBool(GREEBLER_OBJECT_NARRAY),    "array");  
            else if (id == GREEBLER_BITMAP_NRARRAY)            GetSSBitMap(dgb, bc->GetBool(GREEBLER_OBJECT_NRARRAY),    "rarray");  
            else if ((id >= GREEBLER_NURN_BITMAP) && (id <= GREEBLER_NURN_BITMAP_END))  
            {  
                // Get associated GCBInfo bitmap  
                BaseBitmap*        ibm =            GetGCBInfoBitmap_Nurnies(op, bc, id);  
                if (!ibm)                        return TRUE;  
                AutoAlloc<BaseBitmap>    bm;  
                if (!bm)                        return TRUE;  
                ibm->CopyTo(bm);  
                dgb->bmp =                        bm.Release();  
            }  
            return TRUE;  
          }
          
          1 Reply Last reply Reply Quote 0
          • H
            Helper
            last edited by

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

            On 17/12/2012 at 07:43, xxxxxxxx wrote:

            Sorry, I didn't understood that you were talking about BitmapButtons in description for ObjectData and TagData plugins.

            Yes, I can confirm there's something buggy in R14 with BitmapButtons; MSG_DESCRIPTION_GETBITMAP isn't sent.
            As a workaround you can dynamically set BITMAPBUTTON_ICONID1 and BITMAPBUTTON_ICONID2 in GetDDescription()
            with bitmap/icon IDs previously registered with RegisterIcon() (e.g. before you register the plugins data).

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

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

              On 18/12/2012 at 01:14, xxxxxxxx wrote:

              Hi Yannick,
               
              is this bug only occuring when a res file is used? Or is the bug meant to be there when the layout is made with GetDDescription?
               
              WP.

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

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

                On 18/12/2012 at 01:42, xxxxxxxx wrote:

                Originally posted by xxxxxxxx

                is this bug only occuring when a res file is used? Or is the bug meant to be there when the layout is made with GetDDescription?

                The issue is only occurring with descriptions and if we want to respond to MSG_DESCRIPTION_GETBITMAP.

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

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

                  On 18/12/2012 at 05:13, xxxxxxxx wrote:

                  Thanks, Yannick! I will use the workaround to get the bitmap buttons working in Cinema 4D again.

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

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

                    On 18/12/2012 at 10:49, xxxxxxxx wrote:

                    One thing that I realize is that I have to register the images as icons.  There are ALOT of images involved here.  And due to the dynamic nature of the plugin, some of the images might be 'created' by the user during the use of the plugin which makes use of RegisterIcon() impossible - right?  Any alternative ideas on making these work again?

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

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

                      On 18/12/2012 at 16:53, xxxxxxxx wrote:

                      Hi Yannick and Rob,
                      by descriptions - do you mean the layout etc as shown in the AM?
                       
                      I've got an object plugin I'm working on, and I have made my own image boolean for it. It's in a dynamic group where the user can add as many groups (and thus buttons) as they need. The toggle state seems to work on that - but I'm drawing the image through the message function itself, so no reference to a file as such. It's under the MSG_DESCRIPTION_GETBITMAP so that seems to be working at my end...? Using Get & SetDParameter, but no .res file (I try program everything into the one file, just habbit).
                      R14.034 - latest build.
                       
                      WP.

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

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

                        On 18/12/2012 at 22:38, xxxxxxxx wrote:

                        WP,

                        Yes, these would be Descriptions associated with a plugin that displays its options in the Attributes Manager and not a GeDialog or derivative of one.

                        Could you show some code (an example would suffice)?  My plugins are built for R13 but run in R14.  It seems that all of them that use a BitmapButton (typically for a banner image clickable button in the AM for opening HTML help) are exhibiting this problem.  I may need to break down and built for R14 explicitly with code changes specifically for it to resolve this issue.

                        Thanks,

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

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

                          On 19/12/2012 at 02:08, xxxxxxxx wrote:

                          Hi Rob,
                           
                          sure. This is pretty much what I have, and it seems to work. Just remember the bitmap button is being added inside of a dynamic group, and the image is drawn manually.

                          ***** In my GetDDescription function *****  
                          *** note: this is just the bitmap element in a dynamic group  
                          virtual Bool GetDDescription(GeListNode *node, Description *description, DESCFLAGS_DESC & flags)  
                          {  
                            cid_Bitmap = DescLevel(Bool_Active+i, DTYPE_BUTTON, 0);  
                            if (!id_Bitmap || cid_Bitmap.IsPartOf(*id_Bitmap,NULL))  
                            {  
                            BaseContainer bc_leftgroupbool = GetCustomDataTypeDefault(CUSTOMGUI_BITMAPBUTTON);  
                            bc_leftgroupbool.GetCustomDataType( DTYPE_BUTTON, CUSTOMGUI_BITMAPBUTTON);  
                            bc_leftgroupbool.SetLong(DESC_CUSTOMGUI, CUSTOMGUI_BITMAPBUTTON);  
                            bc_leftgroupbool.SetLong(DESC_ANIMATE,DESC_ANIMATE_OFF);  
                            bc_leftgroupbool.SetLong(BITMAPBUTTON_BORDER, BORDER_NONE);  
                            bc_leftgroupbool.SetBool(BITMAPBUTTON_NOBORDERDRAW, TRUE);  
                            bc_leftgroupbool.SetBool(BITMAPBUTTON_TOGGLE, TRUE);  
                            bc_leftgroupbool.SetBool(BITMAPBUTTON_BUTTON, TRUE);  
                            bc_leftgroupbool.SetLong(BITMAPBUTTON_BACKCOLOR, COLOR_BGFOCUS);  
                            bc_leftgroupbool.SetString(DESC_NAME, "");  
                            bc_leftgroupbool.SetString(DESC_SHORT_NAME, "");  
                            if (!description->SetParameter(cid_Bitmap, bc_leftgroupbool, DescLevel(DYNAMIC_GROUP_LEFT+i)))  
                               {  
                               GePrint("Bitmap Boolean failed.");  
                               return TRUE;  
                               }  
                            }  
                          }
                            
                          ***** My GetDParameter function *****  
                          ***note: Count is a LONG for each group number added to description  
                          virtual Bool GetDParameter(GeListNode *node, const DescID &id, GeData &t_data, DESCFLAGS_GET &flags)  
                          {  
                            if(!node){return FALSE;}  
                            LONG Button_Bitmap_Bool = id[0].id;
                              if((Button_Bitmap_Bool >= BOOL_ACTIVE+1) && (Button_Bitmap_Bool <= BOOL_ACTIVE+Count))  
                            {  
                                LONG dirty = 0;  
                                BitmapButtonStruct bbs(static_cast<BaseObject*>(node), id, dirty);  
                                t_data = GeData(CUSTOMDATATYPE_BITMAPBUTTON, bbs);  
                                flags |= DESCFLAGS_GET_PARAM_GET;  
                            }
                              return SUPER::GetDParameter(node,id,t_data,flags);  
                          }
                            
                          ***** My SetDParameter function *****  
                          *** note: bitmap_bool   
                          virtual Bool SetDParameter(GeListNode *node, const DescID &id, const GeData &t_data, DESCFLAGS_SET &flags)  
                          {  
                            if(!node){return FALSE;}  
                            LONG Bitmap_Button = id[0].id;
                              if((Bitmap_Button >= BOOL_ACTIVE+1) && (Bitmap_Button <= BOOL_ACTIVE+Count))  
                            {  
                                  BaseContainer *Container = ((BaseList2D* )node)->GetDataInstance();  
                                  Bool Active_Temp = Container->GetBool(Bitmap_Button,NULL);  
                                  if(Active_Temp == TRUE)  
                                  {  
                                      Container->SetBool(Bitmap_Button,FALSE);  
                                  }  
                                  if(Active_Temp == FALSE)  
                                  {  
                                      Container->SetBool(Bitmap_Button,TRUE);  
                                  }  
                                  flags |= DESCFLAGS_SET_PARAM_SET;  
                            }  
                            
                            return SUPER::SetDParameter(node,id,t_data,flags);  
                          }
                            
                          ***** My Message function *****  
                          virtual Bool Message(GeListNode *node, LONG type, void *data)  
                          {  
                            if(type == MSG_DESCRIPTION_GETBITMAP)  
                            {  
                                DescriptionCommand *dc_Bool = (DescriptionCommand* )data;  
                                LONG Button_Bool = dc_Bool->id[0].id;
                                  if ((Button_Bool >= 320001) && (Button_Bool <= 320000 + Count))  
                                {  
                                    BaseContainer *Container = ((BaseList2D* )node)->GetDataInstance();  
                                    Bool Active_Temp = Container->GetBool(Button_Bool,NULL);  
                                    Bool Active = Active_Temp;  
                             
                                    if(Group_Bool_Active == TRUE)  
                                    {  
                                        DescriptionGetBitmap *DGB_Bool_Active = static_cast<DescriptionGetBitmap*>(data);  
                                        AutoAlloc<BaseBitmap> Active;  
                                        // Active bitmap bool drawn here...      
                                    }  
                              
                                    if(Group_Bool_Active == FALSE)  
                                    {  
                                        DescriptionGetBitmap *DGB_Bool_InActive = static_cast<DescriptionGetBitmap*>(data);  
                                        AutoAlloc<BaseBitmap> InActive;  
                                        // Inactive bitmap bool drawn here...      
                                    }   
                                }  
                            }    
                          }
                          

                          I hope I've copied all that across correctly! I removed some of the laborious code like the drawn image to keep it as short as possible. I can sure sympathise with you for having troubles getting it to work. This took me weeks to figure out 😃
                           
                          Hope it helps.
                           
                          WP.

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

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

                            On 19/12/2012 at 03:06, xxxxxxxx wrote:

                            Thanks for the code WP.
                            I got it working in a simple plugin. It wasn't working before because I had not implemented GetDParameter()/SetDParameter()...

                            Robert, I'm sure something is broken in your code. Also I think you should try to pass 0 to the dirty parameter of BitmapButtonStruct constructor.

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

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

                              On 19/12/2012 at 04:08, xxxxxxxx wrote:

                              Remember that my code works all the way back to at least 10.1 and is based on the code given by Matthias to handle BitmapButtons as descriptions (and handle user interaction and image toggling).

                              Interestingly, my dynamically added BitmapButton descriptions are working (loaded a test scene that uses them).  So that means that ones added statically via the .res file are no longer working.  Could be a difference in default Container settings or something so I will try to description->SetParameter() for the static ones and see what happens.

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

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

                                On 19/12/2012 at 04:41, xxxxxxxx wrote:

                                Confirmed.  If I set one of my static bitmapbuttons with description->SetParameter() using the BaseContainer settings used by dynamically added bitmapbuttons, it works.  But...

                                This means doing my entire description resource programmatically so as to keep them organized properly.  My resources for the Greebler Object and Tag are massive to be nice about it.  The one tab section just for stock greebles is three groups with three subgroups below two of them and hundreds of descriptions (about 1000 lines for the .res file).  Is there anyway to control the insertion of the bitmapbuttons with respect to the static elements?

                                Maybe I can use the Browse feature of Description to update the BaseContainer for BitmapButton types?

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

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

                                  On 19/12/2012 at 05:53, xxxxxxxx wrote:

                                  Alright.  Here is my solution that makes statically defined BITMAPBUTTON descriptions work in R14!  It is a bit non-standard but at least my static bitmapbuttons work again!  I call one of these methods in GetDDescription() for each static BitmapButton depending on whether it is a clickable button or a toggle button:

                                  // GreeblerObj.FixBitmapButton  
                                  // - Fix static BitmapButtons for Cinema 4D R14  
                                  //*---------------------------------------------------------------------------*  
                                  Bool GreeblerObj::FixBitmapButton(Description* description, const DescID& descID)  
                                  //*---------------------------------------------------------------------------*  
                                  {  
                                    BaseContainer    bmbcdt;  
                                    BaseContainer*    param =        description->GetParameterI(descID, NULL);  
                                    if (!param)                    return FALSE;  
                                    
                                    bmbcdt =                    GetCustomDataTypeDefault(DTYPE_BUTTON);  
                                    bmbcdt.CopyTo(param, COPYFLAGS_0, NULL);  
                                    param->GetCustomDataType(DTYPE_BUTTON, CUSTOMGUI_BITMAPBUTTON);  
                                    param->SetLong(DESC_CUSTOMGUI,        CUSTOMGUI_BITMAPBUTTON);  
                                    param->SetLong(BITMAPBUTTON_BORDER,    BORDER_NONE);  
                                    param->SetBool(BITMAPBUTTON_BUTTON,    TRUE);  
                                    param->SetBool(BITMAPBUTTON_TOGGLE,    FALSE);  
                                    return TRUE;  
                                  }  
                                  // GreeblerObj.FixBitmapButtonToggle  
                                  // - Fix static Toggle BitmapButtons for Cinema 4D R14  
                                  //*---------------------------------------------------------------------------*  
                                  Bool GreeblerObj::FixBitmapButtonToggle(Description* description, const DescID& descID)  
                                  //*---------------------------------------------------------------------------*  
                                  {  
                                    BaseContainer    bmbcdt;  
                                    BaseContainer*    param =        description->GetParameterI(descID, NULL);  
                                    if (!param)                    return FALSE;  
                                    
                                    bmbcdt =                    GetCustomDataTypeDefault(DTYPE_BUTTON);  
                                    bmbcdt.CopyTo(param, COPYFLAGS_0, NULL);  
                                    param->GetCustomDataType(DTYPE_BUTTON, CUSTOMGUI_BITMAPBUTTON);  
                                    param->SetLong(DESC_CUSTOMGUI,        CUSTOMGUI_BITMAPBUTTON);  
                                    param->SetLong(BITMAPBUTTON_BORDER,    BORDER_NONE);  
                                    param->SetBool(BITMAPBUTTON_BUTTON,    TRUE);  
                                    param->SetBool(BITMAPBUTTON_TOGGLE,    TRUE);  
                                    return TRUE;  
                                  }
                                  

                                  A final thought:

                                  As the revered Dr. McCoy said on Star Trek: "I know engineers , they love to change things!"

                                  Or, in more mundane terms: if it ain't broke, don't fix it! 😉

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

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

                                    On 19/12/2012 at 08:19, xxxxxxxx wrote:

                                    Originally posted by xxxxxxxx

                                    Confirmed. If I set one of my static bitmapbuttons with description->SetParameter() using the BaseContainer settings used by dynamically added bitmapbuttons, it works.  But...

                                    I can't confirm that. In my test I declare a BITMAPBUTTON in the resource description and it works in R14.
                                    Do you really set the BitmapButton container after you initialize it in GetDDescription()?

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

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

                                      On 19/12/2012 at 08:24, xxxxxxxx wrote:

                                      This is an R13 build working in R14.  There could be differences if I built explicitly R14 but I am not ready to make such builds yet.  All that I know is that updating the BaseContainer for the static BitmapButton elements allows them to work in both R13 and R14.

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

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

                                        On 19/12/2012 at 09:46, xxxxxxxx wrote:

                                        For what it's worth, I also found that bitmap button behavior changed in R14 (in an ObjectData with BITMAPBUTTONs defined in RES, in my case). I don't precisely recall debugging the issue, and it would take awhile to go back through the changes to remind myself, but according to my notes, it appears to come down to this: in R14, Message is called for button clicks, rather than SetDParameter. Here are those notes in context (please excuse my version-independence macros, you can easily infer what they do) :

                                        viIMPL_NODEDATA_MESSAGE(mxSceneObject)
                                            {
                                                viGET_NODEDATA_MESSAGE_OBJECTS;

                                        switch (type)
                                                {
                                                case MSG_DESCRIPTION_COMMAND :
                                                    {
                                                       LONG param = ((DescriptionCommand* )data)->id[0].id;

                                        if (param > MX_BITMAP_BUTTONS_FIRST && param < MX_BITMAP_BUTTONS_LAST)
                                                       {
                                                            // This is what gets called when you click a bitmap button in
                                                            // version R14. In R96 through R13, SetDParameter is called.

                                        OnButtonEvent(param, doc, bc);

                                        viIMPL_NODEDATA_SETDPARAMETER(mxSceneObject)
                                            {
                                                viGET_NODEDATA_SETDPARAMETER_OBJECTS;

                                        if (param > MX_BITMAP_BUTTONS_FIRST && param < MX_BITMAP_BUTTONS_LAST)
                                                {
                                                    // This is what gets called when you click a bitmap button
                                                    // in versions R96 through R13. in R14, Message is called.

                                        if (flags & viDESCFLAGS_SET_USERINTERACTION)
                                                    {
                                                       OnButtonEvent(param, doc, bc);

                                        I am not sure if this is exactly related to the current discussion but anyway, I thought it might be worth mentioning.

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

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

                                          On 19/12/2012 at 12:24, xxxxxxxx wrote:

                                          This is also what I found in X-Particles in R14, my BitmapButtons would no longer respond when using the SetDParameter method given by Matthias in this forum. In R14, Message() is used instead, which I think it should have been all along. My guess is that using SetDParameter() was a bit of a hack to get round a bug and that in R14 this has now been fixed. Annoying that the hack no longer works though since it was a critical function in my plugin and required a specific R14 build to get round it.

                                          Steve

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

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

                                            On 20/12/2012 at 01:09, xxxxxxxx wrote:

                                            I will remember that when R14 builds become necessary. 🙂

                                            Thanks!

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