This commit *should* bring UI_view2d_status_enforce() (formerly known in pre 2.5 as test_view2d) under control again.
I've attempted to reduce the amount of duplicated code here, so hopefully there won't be any nasty bugs that will show up in some of the other views when they are ported.
Summary of changes:
* Restored V2D_KEEPZOOM flag which I had previously removed, having misunderstood its function.
* Fixed bugs with resizing Outliner window
* Outliner width is now columns + 1 again. Documented reasons for this (otherwise, stuff gets covered by scrollbars, but we cannot see it)
* Cleaned up flags defined for View2D, and added some for defining the alignment of the view's data in the 'tot' rect (i.e. which quadrant(s) the view data is allowed to reside in).
* These flags are used in the new UI_view2d_totRect_set() function, which sets the new size of the 'tot' rect (i.e. the maximum viewable area). Currently, is only used for Outliner, but channel-lists also require this.
* Added API method to reset 'cur' (current viewing region) to 'default' viewing region - UI_view2d_curRect_reset(). Currently, 'keepzoom' is not respected. I'll check on whether this is needed when I recode UI_view2d_status_enforce(), which is badly in need of a cleanup.
- Context in WM wasn't set for regions yet, done now. So repeat works on
per-region ops too.
- Debug print was printing the wrong repeated op.
(repeat-op could show menu naming the op to repeat)
* Added back vertical scale markings for vertical scrollbars. Currently untested (until IPO Editor can be put back in). Also, there was a special exception for the Sequencer, which will need to be checked when the time comes too.
* Fixed the display of frame numbers in scrollbars. Was caused by error in using an int, where a float was required (this is one place MSVC gives better warnings than GCC).
* Outliner horizontal scrollbar now displays a more useful range. The previous range was based on screen width, not width of content.
* Outliner horizontal scrollbar now draws with bevel-highlight line again. Was missed out in a previous commit.
* Added simple toggle Frames/Seconds operator to TimeLine to test if the View2D code is working right for this. This uses the same hotkey (TKEY) as it's counterpart (with a menu for input) did in previous incarnations of Blender.
Added back units on scrollbars for anim editors (i.e. Timeline). Vertical scrollbars have yet to be done, but there's no way to test yet.
Using markers and current frame indicator (and value) as guides, it is clear that there is still some inaccuracy with the drawing of the grid or the frames/markers are drawn wrong! Will investigate further.
* Added a function to define booleans negative, to turn negative
properties into positive ones gettin rid of the no_ prefix, and
also got rid of the use_ prefix for two booleans.
* Also made the function for enum bitflags separate, this is quite
rare so don't need to bother with this in most cases.
* Removed svn:executable flags from some files.
Fun commit for test: the Repeat Last option.
Only the split-area Operator is now added on stack, so that's the only
one that works. Just split an area, and press F4 to repeat it anywhere.
BOP_Merge2.cpp
had same variable name at different scopes so I renamed a couple.
resources.c
added include that was missing. (This maybe was going to move? the old one
was commented out)
ed_markers.c
initalized a var that needed it.
Kent
Fix crashing in pop-up menus when click.
There's something wrong still in handling menu itself, need Brecht
too look at that... probably a wrong return value somewhere.
Fix: the main button handler was swallowing all events. Now every button
type returns 'handled' only if it did something, so other events get nicely
processed.
This will enable MMB pan in dataviewer.
- Made view2d manipulations redraw on area level
- simplified call to send Notifiers:
WM_event_add_notifier(bContext *C, int type, int value, void *data)
This brings back more control to WM, no context messing within
operators. :) Handlers that execute operators will be responsible
for delivering correct contextes.
In general: should lead to making context not exposed, but only
readable via some callbacks.
- View2d bug: it was taking sliders into account for setting the
window matrix, which it shouldn't (glViewport does). This caused
error offset in drawing, like for current-frame scrolling.
- Current frame scrolling in TimeWindow back on window level.
(used to crash, but that was fixed in WM)
- Made UI_view2d_region_to_view accept ints, no shorts
- removed debug function in interface_ops.c
many small changes, but the two bigger ones are:
* Sensors and controllers now use inheritance, rather than pointing
to the data in a separate struct. Had to add some new RNA define
functionality to support this better.
* DNA_meta_types.h was marked as done but still missing many things,
now completed.
- after closing button (having used it), it sends empty mousemove for
invoking new modal handler on same button. Don't know better solution
for now, at least this way WM handles everything. :)
- experiment: moved button handlers to area level, that way it respects
handlers on higher hierarchical level, like moving area edges.
Als interesting is that you can have a button active (texteditor) and
use a similar button in other area.
This can also be done on region level even.
On todo: proper notifier events for redraw! Don't want all areas to draw
on simple refreshes
* RNA_property_enum_value
* RNA_property_enum_identifier
To get an enum string from a value and a value from an enum.
BPy_StructRNA types (objects, meshes, images etc) can now be used as dictionary keys.
* Changes in interface/ module
This commit brings back the way how buttons/menus work under control
of WM event system. The previous implementation extended usage of
handlers and operators in an interesting but confusing way. Better to
try it first according the design specs. :)
Most obviously:
- modal-handler operators are not stored anymore in regions/areas/windows.
such modal handlers own their operator, and should remove it themselves.
- removed code to move handlers from one queue to another.
(needs review with brecht!)
- WM fix: the API call to remove a modal handler got removed. This was a
dangerous thing anyway, and you should leave that to the event system.
Now, if a handler modal() call gets a cancel/finish return, it frees
itself in event system. WM_event_remove_modal_handler was a confusing
call anyway!
Todo:
- allow button-activate to refresh after using button
- re-enable arrow keys for menus
(do both after commit)
- review return values of operator callbacks in interface_ops.c
* Fixes in WM system
- Freeing areas/regions/windows, also on quit, now correctly closes
running modal handlers
- On starting a modal handler, the handler now stores previous area
and region context, so they send proper notifiers etc.
* Other fixes
- Area-split operator had bug, wrong minimal size checking. This
solves error when trying to split a very narrow area.
- removed DNA_USHORT_FIX from screen_types.h, gave warning
- operators didn't get ID name copied when activated, needed for
later re-use or saving.
* Improved scrollbar drawing a bit more - only cosmetic lines
* Added new view2d view-matrix api method to only use 'cur' coordinates on one axis, for use when drawing markers, etc. that need to be glued to a certain time but stay fixed in space in another dimension. This should improve the sitation for drawing markers
* To aid testing, adding markers now sets the marker to have frame number as it's "name". This will need to be removed later...
source\blender\python\intern\bpy_rna.c:1018: error: initializer element is not constant
source\blender\python\intern\bpy_rna.c:1018: error: (near initialization for `pyrna_prop_Type.tp_get
Assign get generic get/sets before PyType_Ready runs
* DNA_packedFile_types: added rna definitions for packed files
* also experimentally filled in correct struct 'PackedFile' in image rna for testing.
* updated MSVC projectfiles (also for rna_curve.c and rna_vfont.c)
Note:
I removed PackedFile->flags, I did grep through source and a complete recompile of blender trunk svn without them too, so they obviously aren't needed anymore. A bit of cleaning up :)
Implemented RNA wrappers for curves and VFont. Only issue I could
not yet solve is related to struct CharInfo curinfo; . This particular
line proved to be hard to wrap and I therefore marked it as a TODO
should someone want to fix this issue.
I also cleaned up makesrna.c a bit by unifying brush/meta parts
under one call just the way it is done in the case of other
wrappers.
Implemented RNA wrapper for ModifierData.
Note that actual interface to access data of any specific modifier is
still missing. I also marked a couple of parts as TODO that should be
reviewed to decide whether or not to expose those specific parts
via RNA.
* Added basic (non-modal) zoom operators that use a uniform scale factor, with zoom centered using the view center as scaling point. Use Scrollwheel up/down and Pad +/- to use this.
* Added back the 'button'/bubble for the scrollbars. I've added dark lines on either end of it for some later work on zooming widgets.
This is not the final form they'll take. I still need to decide how to handle those scrollbars which act as grid-markers too (showing timescale, etc.), before trying to integrate that with some fancy scrollbar drawing (rounded, etc.)
Assorted changes:
* Moved vertical scrollbar for Outliner to right hand side
* Made Timeline use standard scrollbars, and turned on various clamping options
* Fixed ortho-matrix corrections for scrollbars, and added pixel offsets
* Made Timeline markers sit more snugly on the scrollbar. They were a bit far out...
* Fixed memory leak with view2d keymaps not being freed when Blender exited