IPO Editor Fixes:
* Grid now draws correct. Fixed typo in gridline calculations preventing drawing from occurring. Also, set the right arguments to the appropriate View2D calls.
* Limited Ton's cur<->mask mapping 'hack' to Outliner only, as it was causing problems with the drawing of the grid. Perhaps there's still some faulty code in curRect_validate that should be changed instead...
* Horizontal scroller draws frames now by default. However, the values are still offset a bit, so will need further investigation.
Outliner Fixes:
* Fixed overlapping text problem with RNA-path and menus. Now RNA path draws as a label beside the menus, so there shouldn't be any more problems there.
* do_versions code now sets all appropriate flags, as old OOPS views could cause errors with scroller drawing + view manipulation operators which depend on flags being set.
- found fix for time-space view2d when increasing height of area, it has min/max Y zoom stored based on size of area... needs
smarter way.
- outliner: header file added, area switch menu + dummy pulldown.
this will become template for other space types...
Fixes in view2d:
- mask/slider rects were calculated wrong 1 pixel (was overlapping)
- found bug with outliner stretching on area-edge-dragging. It required
an extra mapping of the 'cur view' via mask to actual region.
- added v2d sanity check for uninitialized v2d's
- removed cruft in do_versions for headers (gets catched with above)
- added header-view2d-initialize function, for new-space calls
Fixes in areamanager:
- fixes in 'new space' for time/outliner/view2d
(unfinished)
For Joshua:
- Making time window higher shows it doesn't update 'cur'. Not sure
what kind of v2d flag should be checked or set?
Scrollers now draw in the 'rounded + shaded' style as much of the rest of Blender now. This is just a rough draft of what they could look like (vertical scrollbers in particular highlight the need for a complementary version of gl_round_box_shade).
Resolved cyclic calls for editors.
Now there's a space_api/ module, here you can use functions calling
other editor modules. The functions in the module are only used by
the WindowManager module to initialize space types.
Note for sconzers and MSVC and cmake: the proper linking order for
editors is:
- space_api
- space_xxx
- object / mesh / transform / etc
- interface
- util / datafiles
- screen
Today's progress; half working, but i better commit to prevent
conflicts tomorrow :)
- added storage for regions in spacedata
- added space switching (unfinished, gives mem-free errors)
- bugfix: icon of timewindow gave error on split-area
- cleaned interface_icons.c a bit, no warnings
- first work on space new() callbacks, they have to make regions too
NOTE: probably files saved with 2.5 crash now. Have to look at
patching this.
NOTE2: the Makefiles required libeditor screen twice... scons too?
TimeLine window pulldowns work sorta (for the options that were coded :)
Still trying to bring back code without recoding uiDefButs. In future these
will get directly operator stuff linked. For time being made a simple
operator call function, like:
WM_operator_call(C, "ED_MARKER_OT_add");
and for forcing operator to run in the main region-window:
WM_operator_call_rwin(C, "ED_MARKER_OT_add");
These calls also work for modal operators, like marker grab in this case.
Small fix: Screen state updating should be blocked while menus are open.
Caused draw errors for activated headers. Todo is: bring back separation
between window-handlers and screen-handlers, to solve this?
Notes:
- I'm not sure whether we want to move out the PoseMode hide flags from here, but PoseChannels directly get most of their flags from here.
- Some of the settings for Bones have not been exposed, as they are mostly internal flags or used only by transform
- I'm not sure whether we should be exposing EditMode settings like head/tail/roll directly here...
Added support for panning headers using View2D of the header regions (only done for TimeLine, as only that one has buttons on it).
Currently, this uses some do_versions magic to initialise the View2D rects required, however, I'm not sure if all the information was safely ported over yet (notably height and position of rects due to alignment issues).
In the process, I noticed a few bugs with the current View2D code:
* UI_view2d_curRect_validate() is now called after UI_view2d_size_update(), as the size of the 'mask' rect is closely related to the size of the 'cur' rect (especially when zooming is locked).
* Fixed a bug in UI_view2d_curRect_validate() which meant that if the 'cur' rect was slightly larger than the 'tot' rect, and keeptot was set, the view would flicker between the two closely related positions.
* Added context pointer to function callbacks for buttons and blocks.
* Added a uiBlockSetHandleFunc, which will be called with the button
return value. This seems kind of redundant with uiBlockSetButmFunc,
but the latter uses a2 to pass the value.
- Brought back (most of) buttons in TimeLine window.
They don't work yet though! Waiting for Brecht to commit callbacks
for menus and ui-blocks
- Area headers hilite again when mouse is inside.
Cleanup in area/region management
- more intelligence in area management for adding handlers and setting
data correct. Space/Region type callbacks only have to do own things.
- added option for adding default handlers to areas/regions. (flag in
type definition)
- ensured that region-types store the minsizes for regions.
- added boundbox check for handlers; note that it accepts pointer to
boundbox, because handlers don't get reset on area-resizing or
view changes. Example: view2d handlers use mask rect.
- handlers get now added on correct context levels (example frame change
also worked in header)
- removed ->refresh() callback. Context refreshing is Listener.
- the ->init() is being called on all WM level actions, also after a
file read, moving areas, re-opening areas etc.
- fixed bug: crash on exit was caused by cleaning up Screen too late.
- UI_view2d_size_update() removed from draw callback, is init()
- regions now store (winx, winy) subwindow size.
Fixed a few typos in View2D code, which included the zoom-locking flags not being checked for correctly by the zoom operators.
This commit does NOT fix the problems with the Outliner 'cur' rect expanding/contracting as the view changes size. I still haven't found the cause of this, but it might be related to the off-by-1 errors with UI-widgets that brecht noted in TimeLine header...
a special UI handler which makes the code clearer. This UI handler is attached
to the region along with other handlers, and also gets a callback when all
handlers for the region are removed to ensure things are properly cleaned up.
This should fix XXX's in the UI code related to events and context switching.
Most of the changes are in interface_handlers.c, which was renamed from
interface_ops.c, to convert operators to the UI handler. UI code notes:
* uiBeginBlock/uiEndBlock/uiFreeBlocks now takes a context argument, this is
required to properly cancel things like timers or tooltips when the region
gets removed.
* UI_add_region_handlers will add the region level UI handlers, to be used
when adding keymap handlers etc. This replaces the UI keymap.
* When the UI code starts a modal interaction (number sliding, text editing,
opening a menu, ..), it will add an UI handler at the window level which
will block events.
Windowmanager changes:
* Added an UI handler next to the existing keymap and operator modal handlers.
It has an event handling and remove callback, and like operator modal handlers
will remember the area and region if it is registered at the window level.
* Removed the MESSAGE event.
* Operator cancel and UI handler remove callbacks now get the
window/area/region restored in the context, like the operator modal and UI
handler event callbacks.
* Regions now receive MOUSEMOVE events for the mouse going outside of the
region. This was already happening for areas, but UI buttons are at the region
level so we need it there.
Issues:
* Tooltips and menus stay open when switching to another window, and button
highlight doesn't work without moving the mouse first when Blender starts up.
I tried using some events like Q_FIRSTTIME, WINTHAW, but those don't seem to
arrive..
* Timeline header buttons seem to be moving one pixel or so sometimes when
interacting with them.
* Seems not due to this commit, but UI and keymap handlers are leaking. It
seems that handlers are being added to regions in all screens, also in regions
of areas that are not visible, but these handlers are not removed. Probably
there should only be handlers in visible regions?
Area Manager: revised how an area subdivision gets managed. Originally
the 'spacedata' would store regiondata too, but this already became
impractical (like having view2d data in region is useful). So I left
that part how it is. See new diagram:
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/AreaManager
This means that regions in an Area define location/size or constraints
for how they get arranged. The "RegionType" which is linked to this
defines its functionality.
For fun, test, and code validation: two temporary hotkeys added.
SKEY: splits current region horizontally
SHIFT+S: splits vertically
Note - in outliner - that "context" sticks to the Area as whole, the region
here only defines view. That's the purpose. :) For two outliners with different
context you open 2 areas.
Also note that dragging screen-edges shows the region-alignment type (split
with percentage).
Part one of wrapping up area/region management.
Read design doc here:
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/AreaManager
This commit:
- brings keymap storage to WM, based on names/types. This structure
allows rna-ifying it too, so you can browse keymaps etc.
- creating areas and regions works slightly different now, wich
regiontypes stored in areatype.
Todo:
- better callbacks and structure for defining which handlers need to
be added.
- using region types to validate regions
- proper implementation of local region data
- code method for customizing keymaps. Current idea is that you have
to indicate an entire keymap to be custom, to prevent too complicated
merging problems of default and custom maps (like order, multiple keys
for same operator, disabling options, etc).
Added back the Ctrl-MMB-drag zoom.
* It uses RNA-props for delta amounts to be added to the cur rect, as opposed to storing a transform factor like the others.
* Made the operator another repeatable one
* The user-pref Continue/Dolly/Scale options are still respected. Currently, this is not stored as an RNA-prop for repeated behaviour, as it is not necessary for this operator to function correctly (and also, this data would fall under 'context' info more)
Removed clamping of scroller 'bubble' to bounds of scroller, as it produced a confusing display when using handles to zoom view.
Implemented operator to work with scrollers. This should work reasonably well, but as always, more testing is needed.
* LMB-drag can now be used to initiate manipulations of scrollbars (so they can be dragged as per normal)
* By clicking on the 'dark regions' on the ends of the scroll bubble, it is possible to zoom the view (in a way similar to Sony Vegas scrollbars)
Tidied up code of other operators
* Re-labelled the current zoom operators, as there is still a modal click-drag zoom tool to be ported still
* Marked all of the existing view manipulation operators as redoable. Scrollers manipulator is not allowed to be redoable.
Assorted changes:
* Added more flags for Outliner on reading old files, to prevent more weird things happening as code expects certain flags these days
When time grids are drawn in 'seconds' not 'frames' (use the TKEY to toggle this in Timeline for testing), times are now printed in a timecode format similar to SMPTE. It deviates from SMPTE in several respects, otherwise the timecodes will collide with the current grid spacings (Note: this will be subject to review in future).
* Hours will only be shown when they are needed. This shouldn't cause too many problems, since it is highly unlikely to get sequences, etc. that long.
* Frames are only shown when zoomed in close enough. When they are shown, display of minutes is generally ommitted unless significant.
* I've used the semicolon (;) character as the delimeter between frames and seconds. This seems to be the convention in Final Cut Pro, Vegas, and Quicktime...
---
Also in this commit:
* added UI_view2d_status_enforce() call to the end of UI_view2d_totRect_set(), so that the caller will not have to worry about doing so.
* swapped the order of V2D_GRID_(NO)CLAMP defines so to be more consistent with older versions of Blender. Default (0) is now no-clamping.