* Big code cleanup and re-organisation, cleaner drawing
* Button alignment now enabled for default theme
* Sliders tweaked and improved
* Tooltip shadow cleaned up
Todo: Alignment looks pretty, but at this stage, what it *means* is not clear or consistent. Need to work out some UI guidelines for when to and when not to use the alignment code.
input. Somewhere in end NaN period this was changed... weird.
Now you can set layers with numeric buttons, including using ALT for
numbers larger than 10, and using SHIFT for extend-select buttons.
for the UI diehards who like to know; when you create a menu block, you
can provide two flags to control behaviour on keyboard input:
UI_BLOCK_RET_1 == return on any keypress (not mouse)
UI_BLOCK_ENTER_OK == return on Enter key
this was not correct in the doc/interface_API.txt , which will be fixed.
colors. This because of the pretty weird (ab)use of load & make editmesh...
For each added undo step, the load_editmesh was fed with an empty mesh
to assign data to, without knowledge of what was in the original mesh.
That way UV and color data got lost.
Solved it in 2 steps:
1. removing the ->tface pointer from EditVlak, and make TFace a builtin
struct inside EditVlak. This didnt cost much extra mem, since it already
stored UV and color. This enabled some pretty cleanup in editmesh.c as
well, storing tface pointers was cumbersome.
2. for each undo step, it then generates always a tface and mcol block to
link to the undo Mesh.
Even when it wasn't in the actual Mesh, at exit editmode the original
Mesh is used as reference anyway, and undo-meshes are freed correctly.
The enormous commit is because I had to change the BLI_editVert.h file, and
found it was included in about every file unnecessary. I removed it there.
ALso found out that subsurf has code ready (unfinished) to make UV coords for
the displaylist in EditMode as well, nice to know for later...
(unless you manually install font)
- Bug fix: string for AA font was only 64 chars... made 256.
- Changed API for buttons aligning... it now detects automatic what rows
are, or collums, and aligns buttons. This makes call easier:
uiBlockBeginAlign(block);
... defBut....
uiBlockEndAlign(block);
Only works when you provide buttons in row order!
- made sure only 'rounded' theme uses this align stuff
- still work in progress.. I commit now because I leave to denmark for 2 days!
http://www.blender.org/bf/rt.jpg <- now also groups with rows+collums
uiBlockBeginAlign(block, 'v'); 'v'= vertical. 'h'=horizontal
..... (button def calls)
uiBlockEndAlign(block);
this will allow new themes to have buttons nicely drawn together.
- added new rounded draw theme, to test & illustrate the above.
- only did parts of button code with align... rest for later
- fixed 'minimal' theme to make it usable (with some decoration)
- put back 'oldskool' theme... but it just looks plain ugly! remove?
Lazy people: http://www.blender.org/bf/rt.jpg
check the top header, or Nkey menu, to see the meaning of 'align'.
- nkey menu for buttonswindow (hex values) couldnt be restored yet, is
for next release
- replaced Nkey in IpoWindow with Panel, this now displays the buttons
that were formerly in 'anim buttons' as well; to view the boundbox
values of all visible curves, and adjust it.
- the new panel also has the 'set speed' option, fixed stuff in it and
added better errorwarning... still not a very well coded tool!
correctly for deciding whether its pressed or not
- added 'add new' buttons to material & texture menus
is done by std_lib buttons in headerbuttons.c, now only for this.
doing it for ipowindow, sound, etc. has some weird consequences, save
that for later
- verified usage of 'setting2' color for databuttons only
(the one you make with uIDefBut(..., MENU, ...)
add a %i<nr> to the string, and the item gets <nr> as icon.
- added this to the 'mode' selectors in 3dwin and ipowin
- cleaned up code for modeselector pup... that was a bad ass one! :)
- fixed constraint popup menu (used icons)
- moved 'full' and 'View3d props' and 'background' items in menu to bottom
Hope Matt wont kill me for it, but these were about the only useful
ones there... :)
- little fix in interface.c for menus...
Aim was to find a simple & easy system, script alike, to add and configure
a toolbox system, so that others can experiment, but also of course Python.
Summary:
- spacebar calls it up. SHIFT+A still does old toolbox
- hold left or rightmouse for 0.4 second, and it pops up as well
this is experimental! Can be tweaked with Userdef var "ThresA"
- it is a little bit complete for Object mode only. Needs still work
at information desing/structure level
- the code works like an engine, interpreting structs like this:
static TBitem addmenu_curve[]= {
{ 0, "Bezier Curve", 0, NULL},
{ 0, "Bezier Circle", 1, NULL},
{ 0, "NURBS Curve", 2, NULL},
{ 0, "NURBS Circle", 3, NULL},
{ 0, "Path", 4, NULL},
{ -1, "", 0, do_info_add_curvemenu}};
- first value is ICON code,
- then name
- return value
- pointer to optional child
last row has -1 to indicate its the last...
plus a callback to event function.
I also built an old toolbox style callback for this:
static TBitem tb_object_select[]= {
{ 0, "Border Select|B", 'b', NULL},
{ 0, "(De)select All|A", 'a', NULL},
{ 0, "Linked...|Shift L", 'L', NULL},
{ 0, "Grouped...|Shift G", 'G', NULL},
{ -1, "", 0, tb_do_hotkey}};
here the return values are put back as hotkeys in mainqueue.
A mainloop can do all context switching, and build menus on the fly.
Meaning, it also allows other designs such as radials...
- transparent faces in editmode don't write in zbuffer anymore (prevents
drawing errors) but still read (so behind the subsurf faces for example)
- improved drawing 'handles' for subsurf editing
- going in editmode to Solid view, will draw extra wire always, including
transparent faces when set
- works in all combos... http://www.blender.org/docs/ton/subsurf.html
- fixed error; padplus/padminus didnt work in buttonswindow anymore
- improved buttonswin: when dragging window edge, the buttons dont
rescale, but stay same size
- changed the BIF_DrawString() function. it used to work different for
AA fonts as for default fonts. Now it's identical. Setting color for fonts
can just be done with OpenGL, for both font types.
Removed: BIF_DrawStringRGB()
- added theme color options for Buttons
- recoded DefButton, so it automatically chooses the right color.
- had to remove a 1000 uiBlockSetCol() calls for that reason...
- uiBlockSetCol() still works, to override automatic color
- removed entirely the silly old color system (BIFColorID). All color
calls can now be done with a BIF_ThemeColor() call, including fonts and
buttons and opengl stuff
- all buttons in button header have headercolor by default
- recoded drawing icons, it was a really bad & old loop doing manually
colorshading and blending... which was per pixel a load of code!
Now it uses a single OpenGL call to blend or colorize. Quite faster!
- (as test, for review) icons don't colorize anymore with button color,
but have a different alpha to blend in (when not active)
- recoded the entire interface_draw.c file...:
- drawing buttons is separated in three parts:
1. main drawing function for text and icons
2. free definable callback for button itself
3. free definable callback for slider
- removed a load of redundant code for this!
- coded a minimal theme, and adjusted Matt's buttons to match new
callback system
- adding new drawing themes is piece of cake now
- for coders, default 'themes' to be aware of:
UI_EMBOSS : the themable drawing style
UI_EMBOSSP: the pulldown menu system (apart from color not themable)
UI_EMBOSSN: draw nothing, only text and/or icon
UI_EMBOSSM: minimal theme, still in use for Logic and Constraintsa
this can be set with uiBlockSetEmboss(block) or in the uiNewBlock() call.
TODO: make UI API call for button alignment
(plus removed another series of warnings from code...)
Plus: fixed bug in Matts commit: he used a 'short' button for an 'int'
input
- was needed for usage of this windowtype (headerless) as 'timeline'
dragger, which was supposed to be...
- as extra I fixed 'home', it sets start/end frame for sound window
- at mouselocation the current frame or time is printed
- rightmouse menu switches seconds/frames (should be in header as option...)
- displaybutton 'frs/sec/' updates soundwindow too
So, its not perfect... but try opening a tiny high headerless audio
window on top of buttonswin or somewhere full width. not bad...
- currently only implemented for 3d window
- create as many themes you like, and name them
- default theme is not editable, and always will be defined at startup
(initTheme)
- saves in .B.blend
- themes for spaces can become local too, so you can set individual
3d windows at theme 'Maya' or so. (to be implemented)
- it uses alpha as well...!
API:
This doesnt use the old method with BFCOLORID blahblah. The API is copied
from OpenGL conventions (naming) as much as possible:
- void BIF_ThemeColor(ScrArea *sa, int colorid)
sets a color... id's are in BIF_resources.h (TH_GRID, TH_WIRE, etc)
- void BIF_ThemeColorShade(ScrArea *sa, int colorid, int offset)
sets a color with offset, no more weird COLORSHADE_LGREY stuff
- void BIF_GetThemeColor3fv(ScrArea *sa, int colorid, float *col)
like opengl, this gives you in *col the three rgb values
- void BIF_GetThemeColor4ubv(ScrArea *sa, int colorid, char *col)
or the one to get 4 bytes
ThemeColor calls for globals (UI etc) can also call NULL for *sa... this
is to be implemented still.
Next step: cleaning up interface.c for all weird colorcalls.
- you can close them (x icon) or press ESC
- option to open panel at mouse location (try Nkey)
- using 'collapse' (triangle icon) stows header in bottom
- opening again restores at old location
- dragging panels or zooming clips nicely with window
evaluate: an 'auto close' when mouse goes outside panel
Warning: vertex selecting still broken! :) It's 2 am now, bedtime...
include only (use BIF_interface.h instead)
- split up interface.c in two files: NEW: interface_panel.c
- removed the temporal text files
WARN: FIX AUTOMAKE AND MSVC!
- join 3d window could crash... unchecked pointer in interface.c
- setting align in buttonswin caused stripes to draw in view3d-panels
- fixed events for new 'background and view settings menu'
more consistent and logical. (ICONROWs haven't
scrolled left/right in years!
More detailed tweaking of headerbuttons positions can come when
more menus are finished
- added text labels to the drawtype menu in 3d view header
- with mouse in Panel, padplus/minus defines scaling of Panel... dunno if
this is the correct key. thats for later to worry!
Forgot to mention in previous commit:
- Panels now have a uiSetPanelStyle() API call. Is under construction...
now for test purposes mostly.
window (type)
- each SpaceData struct (not the window!) can get 'block handlers'
assigned, basically event codes that invoke drawing button panels.
- this is saved in files, and Panels behave in any window like it does now
in buttonswindow
- it also means that a 'space window' should leave with a matrix set for
buttons level
- try it in view3d header menu, 'view'->'backdrop'. this opens the old
viewbuttons
- it all works non blocking! instant updates of viewbuttons visible in
3d window now.
Not done yet:
- checking and fixing frontbuffer drawing (select a wireframe draws over)
- temporally vertices cannot be selected, is my next project
- closing or hiding Panels...
- styling stuff... i committed for others to review as well.
Have fun. this is certainly a huge improvement over the old viewbuttons!
- in 'Horizontal Align' mode, Panels now close as a vertical bar
- switching align modes, also switches how closed Panels are drawn
- opengl nor ftgl support vertical string drawing... so for now it only
draws the capitals of the Panel title in a horizontal collapsed header
i tried to find place for it in the other menus, like material, object,
camera, etc. But thats hard... now it's just one nice Panel, without
the idiot headerbuttons icons!
- changed drawing of 'tabbed' Panels. The old method takes too much space.
hint from xype! Dragging tabbed Panels can be done with the right hand
circle. designers are welcom to tweak this.
main reason: dragging is not meant to be happening a lot... pressing tabs
is more important.
- menu auto open now is user preset, including 2 thresholds you can set
- hilites of pulldown menus were not cleared, fixed
- changed F4 key to logic. F5 will show lamp buttons, when lamp active
- in 'shader context' buttons, clicking camera will show world
- Converted lamp buttons and world buttons, they're pretty!
- menu auto open now is user preset, including 2 thresholds you can set
- hilites of pulldown menus were not cleared, fixed
- changed F4 key to logic. F5 will show lamp buttons, when lamp active
- in 'shader context' buttons, clicking camera will show world
leftmost/top panel now always at same location, so switching button
'main contextes' works consistantly
- fixed some more events to make sure Panels update when editing
- preview render panel now is 320 wide, just for getting the space filled!
- error in preview render matrix, which caused unpredictable drawing errors
Bedtime!
-Ton-
EEEK! It doesn't look well yet! Hopefully it inspires others to come
with great solutions.
- the material buttons have 6 panels, three of them merged
- some drawing errors in preview render
- made settings for new Material that makes sense for Flares
- cutoff of text in menus and buttons now even better!
- size of pull-up menu buttons is corrected
- pressing at 'menu button' had a delay, fixed
General: the 'outo open' wont become default, it will be removed or
become a user option. I am experimenting with it to get it all OK.
The 'auto open' for secondary levels in pulldowns will remain there
Check the latest state of pull-up menu buttons. for example the mode
selector: you can use such buttons in three ways,
- click on it, it opens and you can select
- click-and-hold-mouse, move, release at item you want to select
- move mouse over button, wait, it opens
The 'auto open' and its time threshold both can be user settings.