On 16/12/2016 at 03:13, xxxxxxxx wrote:
In the meantime I have implemented the whole via code, but am struggling with another issue.
In the attribute manager there always seems to be a quicktab bar title by default, not defined via the CreateLayout.
If I look at the Live Selection tool (for example), I notice that the different quicktab items are right below the icon and toolname. When I create a tool plugin there always is this extra tool name right below the icon and above the first gadget created (via resource or code).
This happens both in Python and C++.
Below a dummy Python tool plugin, which shows the issue.
Is there a way to get rid of this "extra" line, in order to mimic the native tools?
import c4d
import os
from c4d import gui, plugins, bitmaps, utils
PLUGIN_ID = 1031001 # dummy ID
ID_MAINGROUP = 1000
ID_QUICKTAB_BAR = 1100
ID_QUICKTAB_ITEM = 1110
ID_QUICKTAB_GROUP = 1120
quicktabTitle = ['Quicktab #1', 'Quicktab #2', 'Quicktab #3']
class SettingsDialog(gui.SubDialog) :
_quickTab = None;
def CreateLayout(self) :
self.GroupBegin(ID_MAINGROUP, c4d.BFH_SCALEFIT, 1, 1, '', 0)
bc = c4d.BaseContainer()
bc.SetBool(c4d.QUICKTAB_BAR, False)
self._quickTab = self.AddCustomGui(ID_QUICKTAB_BAR, c4d.CUSTOMGUI_QUICKTAB, '', c4d.BFH_SCALEFIT, 0, 0, bc)
for tabIdx in xrange(len(quicktabTitle)) :
self._quickTab.AppendString(ID_QUICKTAB_ITEM + tabIdx, quicktabTitle[tabIdx], False)
bc.FlushAll()
bc.SetBool(c4d.QUICKTAB_BAR, True)
bc.SetString(c4d.QUICKTAB_BARTITLE, quicktabTitle[tabIdx])
self.GroupBegin(ID_QUICKTAB_GROUP + tabIdx, c4d.BFH_SCALEFIT, 1, 1, '', 0)
self.AddCustomGui(0, c4d.CUSTOMGUI_QUICKTAB, '', c4d.BFH_SCALEFIT, 0, 0, bc)
# ...
self.GroupEnd()
self.GroupEnd()
return True
def InitValues(self) :
if self._quickTab:
for tabIdx in xrange(len(quicktabTitle)) :
self._quickTab.Select(ID_QUICKTAB_ITEM + tabIdx, tabIdx == 0)
self.HideElement(ID_QUICKTAB_GROUP + tabIdx, not self._quickTab.IsSelected(ID_QUICKTAB_ITEM + tabIdx))
return True
def Command(self, id, msg) :
if id == ID_QUICKTAB_BAR and self._quickTab:
for tabIdx in xrange(len(quicktabTitle)) :
self.HideElement(ID_QUICKTAB_GROUP + tabIdx, not self._quickTab.IsSelected(ID_QUICKTAB_ITEM + tabIdx))
self.LayoutChanged(ID_MAINGROUP)
return True
class DummyTool(plugins.ToolData) :
def GetState(self, doc) :
return c4d.CMD_ENABLED
def GetCursorInfo(self, doc, data, bd, x, y, bc) :
return True
def AllocSubDialog(self, bc) :
return SettingsDialog()
def PluginMain() :
bmp = bitmaps.BaseBitmap()
dir, file = os.path.split(__file__)
fn = os.path.join(dir, "res", "icon.tif")
bmp.InitWith(fn)
plugins.RegisterToolPlugin(id=PLUGIN_ID, str="DummyTool",
info=0,
icon=bmp,
help="DummyTool",
dat=DummyTool())
if __name__ == "__main__":
PluginMain()