2022-02-10 23:07:11 +01:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
2015-04-07 03:01:47 +02:00
|
|
|
#pragma once
|
2013-08-23 22:35:00 +02:00
|
|
|
|
2019-02-17 22:08:12 +01:00
|
|
|
/** \file
|
|
|
|
* \ingroup bke
|
2013-08-23 22:35:00 +02:00
|
|
|
*/
|
|
|
|
|
2020-03-02 15:07:49 +01:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2013-08-23 22:35:00 +02:00
|
|
|
struct BLI_mempool;
|
2019-01-28 11:08:24 +01:00
|
|
|
struct ID;
|
2013-08-23 22:35:00 +02:00
|
|
|
struct TreeStoreElem;
|
|
|
|
|
|
|
|
/* create and fill hashtable with treestore elements */
|
2015-04-07 03:01:47 +02:00
|
|
|
void *BKE_outliner_treehash_create_from_treestore(struct BLI_mempool *treestore);
|
2013-08-23 22:35:00 +02:00
|
|
|
|
|
|
|
/* full rebuild for already allocated hashtable */
|
2015-04-07 03:01:47 +02:00
|
|
|
void *BKE_outliner_treehash_rebuild_from_treestore(void *treehash, struct BLI_mempool *treestore);
|
2013-08-23 22:35:00 +02:00
|
|
|
|
2018-05-28 17:07:52 +02:00
|
|
|
/* clear element usage flags */
|
|
|
|
void BKE_outliner_treehash_clear_used(void *treehash);
|
|
|
|
|
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.
2017-02-28 20:37:14 +01:00
|
|
|
/* Add/remove hashtable elements */
|
2015-04-07 03:01:47 +02:00
|
|
|
void BKE_outliner_treehash_add_element(void *treehash, struct TreeStoreElem *elem);
|
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.
2017-02-28 20:37:14 +01:00
|
|
|
void BKE_outliner_treehash_remove_element(void *treehash, struct TreeStoreElem *elem);
|
2013-08-23 22:35:00 +02:00
|
|
|
|
|
|
|
/* find first unused element with specific type, nr and id */
|
2015-04-07 03:01:47 +02:00
|
|
|
struct TreeStoreElem *BKE_outliner_treehash_lookup_unused(void *treehash,
|
|
|
|
short type,
|
|
|
|
short nr,
|
|
|
|
struct ID *id);
|
2013-08-23 22:35:00 +02:00
|
|
|
|
|
|
|
/* find user or unused element with specific type, nr and id */
|
2015-04-07 03:01:47 +02:00
|
|
|
struct TreeStoreElem *BKE_outliner_treehash_lookup_any(void *treehash,
|
|
|
|
short type,
|
|
|
|
short nr,
|
|
|
|
struct ID *id);
|
2013-08-23 22:35:00 +02:00
|
|
|
|
|
|
|
/* free treehash structure */
|
2015-04-07 03:01:47 +02:00
|
|
|
void BKE_outliner_treehash_free(void *treehash);
|
2013-08-23 22:35:00 +02:00
|
|
|
|
2020-03-02 15:07:49 +01:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|