Blender Git Loki

Git Commits -> Revision 78a1c27

Revision 78a1c27 by Brecht Van Lommel (master)
November 11, 2008, 18:31 (GMT)

Port of part of the Interface code to 2.50.

This is based on the current trunk version, so these files should not need
merges. There's two things (clipboard and intptr_t) that are missing in 2.50
and commented out with XXX 2.48, these can be enabled again once trunk is
merged into this branch.

Further this is not all interface code, there are many parts commented out:
* interface.c: nearly all button types, missing: links, chartab, keyevent.
* interface_draw.c: almost all code, with some small exceptions.
* interface_ops.c: this replaces ui_do_but and uiDoBlocks with two operators,
making it non-blocking.
* interface_regions: this is a part of interface.c, split off, contains code to
create regions for tooltips, menus, pupmenu (that one is crashing currently),
color chooser, basically regions with buttons which is fairly independent of
core interface code.
* interface_panel.c and interface_icons.c: not ported over, so no panels and
icons yet. Panels should probably become (free floating) regions?
* text.c: (formerly language.c) for drawing text and translation. this works
but is using bad globals still and could be cleaned up.

Header Files:
* ED_datafiles.h now has declarations for datatoc_ files, so those extern
declarations can be #included instead of repeated.
* The user interface code is in UI_interface.h and other UI_* files.

Core:
* The API for creating blocks, buttons, etc is nearly the same still. Blocks
are now created per region instead of per area.
* The code was made non-blocking, which means that any changes and redraws
should be possible while editing a button. That means though that we need
some sort of persistence even though the blender model is to recreate buttons
for each redraw. So when a new block is created, some matching happens to
find out which buttons correspond to buttons in the previously created block,
and for activated buttons some data is then copied over to the new button.
* Added UI_init/UI_init_userdef/UI_exit functions that should initialize code
in this module, instead of multiple function calls in the windowmanager.
* Removed most static/globals from interface.c.
* Removed UIafterfunc_ I don't think it's needed anymore, and not sure how it
would integrate here?
* Currently only full window redraws are used, this should become per region
and maybe per button later.

Operators:
* Events are currently handled through two operators: button activate and menu
handle. Operators may not be the best way to implement this, since there are
currently some issues with events being missed, but they can become a special
handler type instead, this should not be a big change.
* The button activate operator runs as long as a button is active, and will
handle all interaction with that button until the button is not activated
anymore. This means clicking, text editing, number dragging, opening menu
blocks, etc.
* Since this operator has to be non-blocking, the ui_do_but code needed to made
non-blocking. That means variables that were previously on the stack, now
need to be stored away in a struct such that they can be accessed again when
the operator receives more events.
* Additionally the place in the ui_do_but code indicated the state, now that
needs to be set explicit in order to handle the right events in the right
state. So an activated button can be in one of these states: init, highlight,
wait_flash, wait_release, wait_key_event, num_editing, text_editing,
text_selecting, block_open, exit.
* For each button type an ui_apply_but_* function has also been separated out
from ui_do_but. This makes it possible to continuously apply the button as
text is being typed for example, and there is an option in the code to enable
this. Since the code non-blocking and can deal with the button being deleted
even, it should be safe to do this.
* When editing text, dragging numbers, etc, the actual data (but->poin) is not
being edited, since that would mean data is being edited without correct
updates happening, while some other part of blender may be accessing that
data in the meantime. So data values, strings, vectors are written to a
temporary location and only flush in the apply function.

Regions:
* Menus, color chooser, tooltips etc all create screen level regions. Such menu
blocks give a handle to the button that creates it, which will contain the
results of the menu block once a MESSAGE event is received from that menu
block.
* For this type of menu block the coordinates used to be in window space. They
are still created that way and ui_positionblock still works with window
coordinates, but after that the block and buttons are brought back to region
coordinates since these are now contained in a region.
* The flush/overdraw frontbuffer drawing code was removed, the windowmanager
should have enough information with these screen level regions to have full
control over what gets drawn when and to then do correct compositing.

Testing:
* The header in the time space currently has some buttons to test the UI code.

Commit Details:

Full Hash: 78a1c27c4a6abe0ed31ca93ad21910f3df04da56
SVN Revision: 17411
Parent Commit: 44f94f7
Lines Changed: +12439, -876

11 Added Paths:

/source/blender/editors/include/ED_datafiles.h (+50, -0) (View)
/source/blender/editors/include/UI_interface.h (+350, -0) (View)
/source/blender/editors/include/UI_resources.h (+595, -0) (View)
/source/blender/editors/include/UI_text.h (+67, -0) (View)
/source/blender/editors/include/UI_view2d.h (+69, -0) (View)
/source/blender/editors/interface/interface.c (+2573, -0) (View)
/source/blender/editors/interface/interface.h (+292, -0) (View)
/source/blender/editors/interface/interface_draw.c (+2622, -0) (View)
/source/blender/editors/interface/interface_ops.c (+3425, -0) (View)
/source/blender/editors/interface/interface_regions.c (+1773, -0) (View)
/source/blender/editors/interface/text.c (+442, -0) (View)

17 Modified Paths:

/source/blender/editors/include/BIF_interface_icons.h (+0, -72) (Diff)
/source/blender/editors/include/BIF_resources.h (+0, -600) (Diff)
/source/blender/editors/include/BIF_view2d.h (+0, -68) (Diff)
/source/blender/editors/include/ED_interface.h (+0, -33) (Diff)
/source/blender/editors/interface/Makefile (+2, -0) (Diff)
/source/blender/editors/interface/resources.c (+41, -39) (Diff)
/source/blender/editors/interface/SConscript (+1, -1) (Diff)
/source/blender/editors/interface/view2d.c (+70, -14) (Diff)
/source/blender/editors/screen/area.c (+4, -3) (Diff)
/source/blender/editors/screen/spacetypes.c (+3, -0) (Diff)
/source/blender/editors/screen/stubs.c (+0, -1) (Diff)
/source/blender/editors/space_time/space_time.c (+44, -18) (Diff)
/source/blender/editors/space_time/time_ops.c (+3, -4) (Diff)
/source/blender/makesdna/DNA_windowmanager_types.h (+1, -0) (Diff)
/source/blender/windowmanager/intern/wm.c (+1, -0) (Diff)
/source/blender/windowmanager/intern/wm_files.c (+5, -6) (Diff)
/source/blender/windowmanager/intern/wm_init_exit.c (+6, -17) (Diff)
Tehnyt: Miika HämäläinenViimeksi päivitetty: 07.11.2014 14:18MiikaH:n Sivut a.k.a. MiikaHweb | 2003-2021