Hi,
I'm hoping to add some Bitmap Buttons to a project I'm working on, but I'm having difficulty styling them (and initially: creating them).
def AddIconButton(self, button_id, title, icon_id, tooltip, border=c4d.BORDER_ROUND):
"""
Reference: https://developers.maxon.net/forum/topic/11462/understanding-setcommanddragid/2
"""
bc = c4d.BaseContainer()
bc.SetBool(c4d.BITMAPBUTTON_BUTTON, True)
bc.SetInt32(c4d.BITMAPBUTTON_ICONID1, icon_id)
bc.SetInt32(c4d.BITMAPBUTTON_OUTBORDER, border)
bc.SetString(c4d.BITMAPBUTTON_TOOLTIP, tooltip)
bc.SetString(c4d.BITMAPBUTTON_STRING, title)
icon_width_height = 24
bc.SetInt32(c4d.BITMAPBUTTON_FORCE_SIZE, icon_width_height)
button = self.AddCustomGui(button_id, c4d.CUSTOMGUI_BITMAPBUTTON, title, c4d.BFH_LEFT, 0, 0, bc)
return button
A lot of the styling flags seem to have no impact. Specifically:
BITMAPBUTTON_BORDER
BITMAPBUTTON_STRING
I created some simple test code to show each of the styles and the buttons looked identical:
bitmapbutton_border_styles = [("BORDER_NONE", c4d.BORDER_NONE),
("BORDER_THIN_IN", c4d.BORDER_THIN_IN),
("BORDER_THIN_OUT", c4d.BORDER_THIN_OUT),
("BORDER_IN", c4d.BORDER_IN),
("BORDER_OUT", c4d.BORDER_OUT),
("BORDER_GROUP_IN", c4d.BORDER_GROUP_IN),
("BORDER_GROUP_OUT", c4d.BORDER_GROUP_OUT),
("BORDER_OUT2", c4d.BORDER_OUT2),
("BORDER_OUT3", c4d.BORDER_OUT3),
("BORDER_BLACK", c4d.BORDER_BLACK),
("BORDER_ACTIVE_1", c4d.BORDER_ACTIVE_1),
("BORDER_ACTIVE_2", c4d.BORDER_ACTIVE_2),
("BORDER_ACTIVE_3", c4d.BORDER_ACTIVE_3),
("BORDER_ACTIVE_4", c4d.BORDER_ACTIVE_4),
("BORDER_GROUP_TOP", c4d.BORDER_GROUP_TOP),
("BORDER_ROUND", c4d.BORDER_ROUND),
("BORDER_SCHEME_EDIT", c4d.BORDER_SCHEME_EDIT),
("BORDER_SCHEME_EDIT_NUMERIC", c4d.BORDER_SCHEME_EDIT_NUMERIC),
("BORDER_OUT3l", c4d.BORDER_OUT3l),
("BORDER_OUT3r", c4d.BORDER_OUT3r),
("BORDER_THIN_INb", c4d.BORDER_THIN_INb),
("BORDER_MASK", c4d.BORDER_MASK),
("BORDER_TEXT_DOTTED", c4d.BORDER_TEXT_DOTTED),
("BORDER_WITH_TITLE_MONO", c4d.BORDER_WITH_TITLE_MONO),
("BORDER_WITH_TITLE_BOLD", c4d.BORDER_WITH_TITLE_BOLD),
("BORDER_WITH_TITLE", c4d.BORDER_WITH_TITLE)]
for border_id_name, border_id in bitmapbutton_border_styles:
self.AddIconButton(0, border_id_name, ICON_NEW_PROJECT, border_id_name, border=border_id)
Ideally, I'd love a button that matches the look/feel of docked icons w/ text:
Any suggestions?
Also, FWIW, some sample code for how to add BitmapButtons inside of the BitmapButton class would be really helpful. I struggled for quite a while trying to create a button using c4d.gui.BitmapButtonCustomGui()
but was stumped when I couldn't figure out how to add it to a dialog.
Thank you,
Donovan