diff options
author | Julian Eisel <julian@blender.org> | 2021-09-23 19:56:29 +0300 |
---|---|---|
committer | Julian Eisel <julian@blender.org> | 2021-09-23 20:33:54 +0300 |
commit | 323fd80aada46105e23985f5646f9252b5e6f193 (patch) | |
tree | e422378a2e2932b091653dcd0eb5d94d0ed9a51d /source/blender/editors/interface/interface_intern.h | |
parent | eb0eb54d9644c5139ef139fee1e14da35c4fab7e (diff) |
UI: Tree-View API for easy creation of tree UIs
This follows three main targets:
* Make creation of new tree UIs easy.
* Groundwork to generalize tree UIs (so e.g. Outliner, animation
channels, asset catalogs and spreadsheet data-sets don't have to
re-implement basic tree UI code) or even other data-view UIs.
* Better separate data and UI state. E.g. with this, tree-item selection
or the open/collapsed state can be stored on the UI level, rather than
in data. (Asset Catalogs need this, storing UI state info in them is
not an option.)
In addition, the design should be well testable and could even be
exposed to Python.
Note that things will likely change in master still. E.g. the actually
resulting UI isn't very nice visually yet.
The design is documented here:
https://wiki.blender.org/wiki/Source/Interface/Views
Differential Revision: https://developer.blender.org/D12573
Diffstat (limited to 'source/blender/editors/interface/interface_intern.h')
-rw-r--r-- | source/blender/editors/interface/interface_intern.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h index d61104f094e..95e6791b359 100644 --- a/source/blender/editors/interface/interface_intern.h +++ b/source/blender/editors/interface/interface_intern.h @@ -360,6 +360,14 @@ typedef struct uiButDatasetRow { int indentation; } uiButDatasetRow; +/** Derived struct for #UI_BTYPE_TREEROW. */ +typedef struct uiButTreeRow { + uiBut but; + + uiTreeViewItemHandle *tree_item; + int indentation; +} uiButTreeRow; + /** Derived struct for #UI_BTYPE_HSVCUBE. */ typedef struct uiButHSVCube { uiBut but; @@ -488,6 +496,11 @@ struct uiBlock { ListBase contexts; + /** A block can store "views" on data-sets. Currently tree-views (#AbstractTreeView) only. + * Others are imaginable, e.g. table-views, grid-views, etc. These are stored here to support + * state that is persistent over redraws (e.g. collapsed tree-view items). */ + ListBase views; + char name[UI_MAX_NAME_STR]; float winmat[4][4]; @@ -1274,6 +1287,11 @@ bool ui_jump_to_target_button_poll(struct bContext *C); /* interface_queries.c */ void ui_interface_tag_script_reload_queries(void); +/* interface_view.cc */ +void ui_block_free_views(struct uiBlock *block); +uiTreeViewHandle *ui_block_view_find_matching_in_old_block(const uiBlock *new_block, + const uiTreeViewHandle *new_view); + #ifdef __cplusplus } #endif |