Drawing and viewing code for view3d back (no not objects :).
Quick test: converted 2250 ugly lines of code in 2.5 hours.
With about 300k lines todo, this will be 333 hours = 30 days? Whoa!
- WM subwindows now get freed on every ED_region_exit(). Was not
a leak, but it's cleaner this way (and saves some kilobytes!).
- fixed debug print for operators (on blender -d) to print correct
subwindow id.
* Added flags to View2D to specify whether the view should have pixel offsets applied (this is able to be specified per axis, just in case the need arises). Currently, this is only used for headers, where the UI elements were not as smooth + round as they could be
* Fixed IPO/Action/NLA so that new instance will show channel lists by default and with scrollers
* Fixed Outliner zoom-in/out on changing windowsize. I didn't notice this on my previous custom .B.blend file, but the problem was apparent in the default setup.
bpydoc.structs.keys() - ['Actuator', 'ActuatorSensor', 'AlwaysSensor', 'AndController'.... etc
now reads...
bpydoc.structs.keys() - ['Actuator', 'Actuator Sensor', 'Always Sensor', 'And Controller'...
This is more correct since an identifier is supposted to be unique when a name might not be.
Context API
This adds the context API as described here. The main practical change
now is that C is not longer directly accessible but has to be accessed
through accessor functions. This basically adds the implementation of
the API and adaption of existing code with some minor changes. The next
task of course is to actually use this design to cleanup of bad level
calls and global access, in blenkernel, blenloader.
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/Context
Error, Warning and Debug Info Reporting
This adds the error reporting API as described here. It should help
clean up error() calls in non-ui code, but eventually can become used
for gathering messages for a console window, and throwing exceptions
in python scripts when an error happens executing something.
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/Reports
Added screen-set notifier. Works for arrow keys now. For those who
know the messy old code, admire the simple 2-function call method
now :) Only context setting is messy a bit, that'll be solved.
Also: removed redundant code, and move freeing window handlers up
one level; windows can keep their handlers while screen switches.
Small commit, too much fun to not do separately:
- removed notifier restriction to go only to own window, so multiwindow
setups redraw correctly. (when other windows show other scenes we have
to handle still).
- fixed cursor type outside of window (got stuck to area-move cursor).
- Made a nice generic 'OK confirm' implementation for operators.
Just use in operator type definition this line:
ot->invoke= WM_operator_confirm;
It will autmatically use operator name for asking OK. It will
also use properties (if set before).
Note for Brecht: the test okee_operator() you coded could better not
be used in operators themselves.
In future we can also add menus that get automatically generated
based on operator properties. Like 'add constraint' showing the
constraint types.
- Added this confirm call for most of the keys you'd expect it for.
(user settings, delete marker, rip area, split region, etc).
- Cleanup: moved ed_markers.c to the util/ directory, it doesnt belong
in space_time. Also made separate function for the marker keymap
definition.
- removed ancient redraw notifier from ghost event level (every key
press gave full screen draw)
Now, preset view configurations are only to be used if they define all (scrollers not included) relevant settings for the view they are set for. This should be less confusing than in the previous situation with V2D_COMMONVIEW_TIMELINE stuff.
One implication of this though, is that all Animation Editors (for example), will have to define their own version of the relatively commonly shared info. However, given the great diversity in the range of settings each have, this should not be too much of an issue.
Also, added a 'standard' view config for main 'window' regions. At this stage, it is recommended that this view config should be used only as a placeholder template on which a set of custom settings could be based. I've put it into use for the buttons window/scripts window/info window so far.
* Added support for defining properties for operator buttons, with
uiButGetOperatorPtrRNA. Needed to cleanup a hack that was there
for operator properties in RNA, now a separate OperatorProperties
type is used for storing operator properties, instead of being part
of the Operator type itself.
* Allow selecting menu items with mouse release instead of press again.
* Fix some cases with hanging tooltips in the UI.
More notifier and redraw cleanup
- notifiers are not filtered anymore, apart from window/screen notifiers,
they get to all regions.
- fixed drawing of 'action zones' in areas.
- added support for basic multilayer draw, like for action zones now,
and future other area decorations (tabs, region handlers)
check: ED_area_overdraw_flush()
ED_area_overdraw()
- bugfix in UI redraw tags, it was calling region pointer in free'd
data
- added notifier for marker-changed
- added keymap for markers to ipo window
* Only open tooltip when the mouse is still over the button.
* Remove an unnecessary redraw call, though the two mentioned
in the previous commit seem to be working OK (it's for action
buttons when you move the mouse away from the button, holding
the mouse button down).
* Fix missing alt key in key event strings.
Test for Brecht: this line makes drawing buttons fine.
However note:
- redraws on lines 3107 and 3024 don't do anything
- tooltip timer is messing with redraws too, if you
have tooltips on, it continuously sends redraws.
- I would code tooltip to reset on any mouse move,
and only start timer when mouse is still completely.
That would make them appear much more quietly.
More notifier cleanup;
- removed view2d sync notifier, its data operations are too complex
for UI hints/notes, direct calls work too :)
- updated missing gpl header in region file
Noticed weird delay on menu refreshing now... will check.
Work on getting notifiers in shape.
- Most important: local (to own region or area) redraw notifiers
have been depricated. This is not a good or correct notifier anyway.
Notifiers should be signals to other areas.
- Instead use these 2 functions:
ED_area_tag_redraw(area);
ED_region_tag_redraw(region);
It seems to me good convention to keep the area/region redraw tag
itself protected everywhere, for future improvements.
- Also added a basic WM function that checks overlapping regions,
and flushes redraws to underlying regions. This makes menus and
buttons allow to only send local region redraws.
(Brought back two "swapbuffer indicators" to test this.
- Todo: area 'action zone' redraws, and fixing other notifiers...
sending data pointers in a notifier seems to be bad idea.
Improved the View2D API so that initialising View2D data in init() callbacks (called on new regions and also on resizing regions) for regions is easier.
Added a few preset view configurations for use when initialising new views. Views with the V2D_IS_INITIALISED flag set will not be reinitialised in the init() callbacks. Currently, some of these configurations will set/override all settings (like V2D_COMMONVIEW_LIST and V2D_COMMONVIEW_HEADER), while other ones serve a more supplimentary role (i.e. V2D_COMMONVIEW_TIMELINE only sets the x-axis settings, relying on the region to have already set the relevant y-axis settings).
The future of such supplimentary configurations is yet to be seen, as I'm currently not sure whether they will cause the code to become too confusing, as you'd have to keep track of which settings belong/are set where. So far, only a few areas have been ported to use this. Tomorrow I'll check on a few more.
As this commit touches a lot of files, hopefully there aren't any critical bugs I've missed here.
operators. RNA property buttons will automatically fill in the label, min/max,
etc if they are not specified. Operator menu buttons will look up the key
combination in the handlers and add it automatically.
uiDefButR, uiDefIconButR, uiDefIconTextButR
uiDefButO, uiDefIconButO, uiDefIconTextButO
uiDefButO takes a context pointer to do the key lookup, don't really like this..
which context to run the operator: WM_OP_DEFAULT, WM_OP_REGION_WIN,
WM_OP_AREA or WM_OP_SCREEN. This also replaces WM_operator_call_rwin
since it is more general.
This is useful for buttons and popup menus to run operators, and also
used by a new function to lookup the keymap item for that operator in
the right context.
and event handling code still, how it integrates with operators and
handlers is not worked out yet. For testing, Ctrl+Q quit now shows
a confirmation popup using the following call:
okee_operator(C, "WM_OT_exit_blender", "Quit Blender");
Small improvements;
- switch spacedata now doesn't cause full screen refresh and draw
- cursor switching is not part of SCREEN_CHANGED notifier, this
makes area dragging ugly.
Added notifiers for timeline syncing. Works for Timeline window
only now.
Note that I've removed the malloc-free in a Notifier... notifier
system is still under probabtion :)
Mouse cursors now work again
- centralized screen-level cursor changes, no more operator
running for it.
- spacetypes have callback to check/set individual cursor
types. Use notifier SCREEN_CHANGED to make sure it works
on mode changes etc.
- new calls WM_cursor_modal() and WM_cursor_restore() to
make temporarily cursor types during modes.
- used above for view2d cursors.
Added some functionality to make inspecting all RNA structs possible. Not used
yet, but can be tested by replacing this line in space_outliner.c:
RNA_main_pointer_create(G.main, &cell.ptr);
with:
RNA_blender_rna_pointer_create(&cell.ptr);
- depricated area "headbutofs" and "headbutlen", which is now fully
replaced with view2d handling.
- needed to add header default V2D_ALIGN_NO_NEG_Y, V2D_LOCKOFS_Y seems
to not do anything atm :)
- new: running blender in debug (blender -d) will print the current
handler and operator in use (not mousemove)
which will then be set when the operator is called, example:
kmi= WM_keymap_add_item(keymap, "ED_SCR_OT_region_split", SKEY, KM_PRESS, 0, 0);
RNA_enum_set(kmi->ptr, "dir", 'h');
kmi= WM_keymap_add_item(keymap, "ED_SCR_OT_region_split", SKEY, KM_PRESS, KM_SHIFT, 0);
RNA_enum_set(kmi->ptr, "dir", 'v');
There is a hack I had to do here, since properties are defined
as member of wmOperator, will try to fix later, committing now
so it can be used already.
I've gone through and simplified some of the redundant options while documenting the various settings (in the code and also in the Wiki Doc), to make it clearer how to use each option.
'Preset' view-types have yet to be fully implemented, but started groundwork for this. Only some commonly used view configurations will be defined using this method. For all others, they still need to define all relavent view settings themselves (as there's too much variation in terms of the various editor's use of View2D).
IPO Editor now draws with channels on the left, like all other anim editors. Now, how to make this wider...
funtion WM_keymap_add_item() now returns keymap-item, so you can use it
to set default properties for operators with WM_keymap_property_set().
Brecht will fill in this function, requires rna magic!
Example: an operator ED_OB_OT_add_primitive can be configured with
keymap like this:
WM_keymap_property_set(keymapitem, "Primitivetype", "Sphere");
Similar conventions we can use later for button/menu calls.
This will make creating operators easier, allowing a developer to group
tools functionality nicely.
* DNA_sequence_types.h done, patch by Roelf de Kock, with various changes,
mainly the use of inheritance for different sequence types and hiding the
separate Strip struct.
that is not supposed to be in the editor but at blenkernel level
to avoid bad level calls. Added sequencer free and strip iterator
functions there and used them to make sequencer data load/save
work again.
Small fix: in the ghost part of WM event handling, a function was
setting 'active subwindow' and registering headers to be drawn active
for this or not. It should be nicely inside the handler queue, so
it doesnt get executed on modal window-handlers.
(This solves flashing area headers while dragging area edges)
Still needed to resolve how screen handling goes... via handlers
with operators? On my list to keep track of. :)
OSX crashed on double-click the Finder Blender icon
Removed 7 years old hack to get the correct arguments for this case, it
was a terrible hack anyway. Needs proper code.