Dev:Source/UI/Custom Toolbar

提供: wiki
移動先: 案内検索


What?

A set of buttons that can be added to and removed from to create a user-customisable bar of handy tools. This could be implemented in the form of a floating panel type thing in the 3D view or as custom items in the toolbox, or maybe even in the window header.

Why?

Because it would be very handy. There are plenty of advantages to having tools always available as buttons, but there are problems with doing it in the buttons window - interactive tools become rather confusing when there is more than 3D View around. Having toolbars per-view would also enable toolbars in the other window types, like the UV/Image editor, Ipo editor, and so on.

So what are we waiting for?

Partly due to historical "the way it's been done" and lack of foresight in the 2.30 menu system redesign, the code that executes commands (in especially the 3D View) is a total mess. There is code copied and pasted all over the place to execute events that come from the header menus, the toolbox, the buttons window, the header, and hotkeys. The event codes in the menus are hard-coded and are not unique, specific to each menu's own handling function. Not only is this a complete mess, it's a huge burden for developers to add copies of the same code to three different places, which usually means the toolbox or menus being neglected, and ditto for making fizes or improvements in one area of the code and forgetting about others. It's very inflexible and just nasty.

If we can have a centralised place where all commands are executed, life becomes much easier.

And what can we do about it?

To enable this, we need to do some surgery to the menus, toolbox, hotkeys (space.c, etc) to unify them and minimise duplication of code. By pointing all the events to the one function, we can then use the event codes as unique identifiers for each tool, which allows it to be passed around and into new structs.

... to be continued ...

-- MattEbb - 03 May 2005