diff options
author | Julian Eisel <eiseljulian@gmail.com> | 2017-02-22 18:02:43 +0300 |
---|---|---|
committer | Julian Eisel <eiseljulian@gmail.com> | 2017-02-22 19:25:00 +0300 |
commit | 910b7dec8dca25473d98c23f7c4fd8e44fafd47d (patch) | |
tree | c4dba049c8670704a7d789cf6f16f0e711dd0ec3 /source/blender/editors/space_outliner/outliner_intern.h | |
parent | e003499f6ffed72f3a166cca4d59e855774767d2 (diff) |
UI: Support drag & drop reordering of collections
This adds initial support for reordering collections from the Outliner
using drag & drop.
Although drag & drop support is limited to collections for now, this
lays most foundations for general drag & drop reordering support in the
Outliner. There are some design questions to be answered though:
* Would reordering of other data types (like objects) be a purely visual change or would it affect the order in which they are stored? (Would that make a difference for the user?)
* Should/can we allow mixing of different data types? (e.g. mixing render layers with objects)
* How could we realize this technically?
Notes:
* "Sort Alphabetically" has to be disabled to use this ("View" menu).
* Reordering only works with collections on the same hierarchy level.
* Added some visual feedback that should work quite well, it's by far not a final design though: {F493806}
* Modified collection orders are stored in .blends.
* Reordering can be undone.
* Did minor cleanups here and there.
Diffstat (limited to 'source/blender/editors/space_outliner/outliner_intern.h')
-rw-r--r-- | source/blender/editors/space_outliner/outliner_intern.h | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/source/blender/editors/space_outliner/outliner_intern.h b/source/blender/editors/space_outliner/outliner_intern.h index 4685744c570..6a4d53449e9 100644 --- a/source/blender/editors/space_outliner/outliner_intern.h +++ b/source/blender/editors/space_outliner/outliner_intern.h @@ -37,6 +37,7 @@ /* internal exports only */ struct wmOperatorType; +struct TreeElement; struct TreeStoreElem; struct bContext; struct Scene; @@ -46,6 +47,13 @@ struct Object; struct bPoseChannel; struct EditBone; +/** + * Callback type for reinserting elements at a different position, used to allow user customizable element order. + * Passing scene right now, may be better to allow some custom data. + */ +typedef void (*TreeElementReinsertFunc)(const struct Scene *scene, struct TreeElement *insert_element, + struct TreeElement *insert_after); + typedef struct TreeElement { struct TreeElement *next, *prev, *parent; ListBase subtree; @@ -58,7 +66,15 @@ typedef struct TreeElement { const char *name; void *directdata; // Armature Bones, Base, Sequence, Strip... PointerRNA rnaptr; // RNA Pointer -} TreeElement; + + /* callbacks */ + TreeElementReinsertFunc reinsert; + + struct { + /* the element after which we may insert the dragged one (NULL to insert at top) */ + struct TreeElement *insert_te; + } *drag_data; +} TreeElement; #define TREESTORE_ID_TYPE(_id) \ (ELEM(GS((_id)->name), ID_SCE, ID_LI, ID_OB, ID_ME, ID_CU, ID_MB, ID_NT, ID_MA, ID_TE, ID_IM, ID_LT, ID_LA, ID_CA) || \ |