diff options
author | Julian Eisel <eiseljulian@gmail.com> | 2017-02-28 22:37:14 +0300 |
---|---|---|
committer | Julian Eisel <eiseljulian@gmail.com> | 2017-02-28 23:15:51 +0300 |
commit | c0e055fa7e4b171b9a188bc2328c6c11d2af22ab (patch) | |
tree | c00febbae447a1a533af520ef8480d19ce38f4be /source/blender/editors/space_outliner/outliner_intern.h | |
parent | 5e889ebf19ae1bd3daf6930473dc1d19029bf837 (diff) |
Outliner: Delete all selected collections, not just active one
There were some issues with how we store outliner tree elements:
Apparently the only removable elements have been data-blocks so far.
When recreating the TreeElements, their TreeStoreElem instances were
mainly identified by their ID pointer. However non-data-blocks mostly
depend on an index. For collections, such an index isn't a reliable
measure though if we want to allow removing items. Depending on it for
identifying the TreeStoreElem instance would cause some quite noticeable
glitches (wrong highlights, two elements sharing highlight, etc).
For now I've solved that by actually removing the TreeStoreElem that
represents the removed element. A little limitation of this is that
after undoing the removal, some information might get lost, like
flags to store selection, or opened/closed state.
A better solution that would also fix this issue would be having a real
unique identifier for each non-data-block element, like an idname or even
its data-pointer. Not sure if we can get those to work reliable with
file read/write though, would have to investigate...
Also added a general Outliner tree traversal utility.
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 6a4d53449e9..6787146fc46 100644 --- a/source/blender/editors/space_outliner/outliner_intern.h +++ b/source/blender/editors/space_outliner/outliner_intern.h @@ -47,12 +47,24 @@ struct Object; struct bPoseChannel; struct EditBone; + +typedef enum TreeTraversalReturn { + /* Continue traversal regularly, don't skip children. */ + TRAVERSE_CONTINUE = 0, + /* Stop traversal */ + TRAVERSE_BREAK, + /* Continue traversal, but skip childs of traversed element */ + TRAVERSE_SKIP_CHILDS, +} TreeTraversalReturn; + /** * 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 TreeTraversalReturn (*TreeTraversalFunc)(struct TreeElement *te, void *customdata); + typedef struct TreeElement { struct TreeElement *next, *prev, *parent; @@ -150,6 +162,7 @@ typedef enum { void outliner_free_tree(ListBase *lb); void outliner_cleanup_tree(struct SpaceOops *soops); +void outliner_remove_treestore_element(struct SpaceOops *soops, TreeStoreElem *tselem); TreeElement *outliner_find_tse(struct SpaceOops *soops, const TreeStoreElem *tse); TreeElement *outliner_find_tree_element(ListBase *lb, const TreeStoreElem *store_elem); @@ -233,6 +246,9 @@ TreeElement *outliner_dropzone_find(const struct SpaceOops *soops, const float f TreeElement *outliner_find_item_at_y(const SpaceOops *soops, const ListBase *tree, float view_co_y); TreeElement *outliner_find_item_at_x_in_row(const SpaceOops *soops, const TreeElement *parent_te, float view_co_x); +bool outliner_tree_traverse(const SpaceOops *soops, ListBase *tree, int filter_te_flag, int filter_tselem_flag, + TreeTraversalFunc func, void *customdata); + /* ...................................................... */ void OUTLINER_OT_highlight_update(struct wmOperatorType *ot); @@ -293,7 +309,7 @@ void outliner_keymap(struct wmKeyConfig *keyconf); /* outliner_collections.c */ -void OUTLINER_OT_collection_delete(struct wmOperatorType *ot); +void OUTLINER_OT_collections_delete(struct wmOperatorType *ot); void OUTLINER_OT_collection_select(struct wmOperatorType *ot); void OUTLINER_OT_collection_link(struct wmOperatorType *ot); void OUTLINER_OT_collection_unlink(struct wmOperatorType *ot); |