Cleanup: Outliner: Return early, reduce variable scope
This commit is contained in:
parent
9132679f1b
commit
90c53d265b
|
@ -460,33 +460,32 @@ static void outliner_id_remap(ScrArea *area,
|
|||
static void outliner_foreach_id(SpaceLink *space_link, LibraryForeachIDData *data)
|
||||
{
|
||||
SpaceOutliner *space_outliner = reinterpret_cast<SpaceOutliner *>(space_link);
|
||||
if (!space_outliner->treestore) {
|
||||
return;
|
||||
}
|
||||
const int data_flags = BKE_lib_query_foreachid_process_flags_get(data);
|
||||
const bool is_readonly = (data_flags & IDWALK_READONLY) != 0;
|
||||
const bool allow_pointer_access = (data_flags & IDWALK_NO_ORIG_POINTERS_ACCESS) == 0;
|
||||
|
||||
if (space_outliner->treestore != nullptr) {
|
||||
TreeStoreElem *tselem;
|
||||
BLI_mempool_iter iter;
|
||||
|
||||
BLI_mempool_iternew(space_outliner->treestore, &iter);
|
||||
while ((tselem = static_cast<TreeStoreElem *>(BLI_mempool_iterstep(&iter)))) {
|
||||
/* Do not try to restore non-ID pointers (drivers/sequence/etc.). */
|
||||
if (TSE_IS_REAL_ID(tselem)) {
|
||||
const int cb_flag = (tselem->id != nullptr && allow_pointer_access &&
|
||||
(tselem->id->flag & LIB_EMBEDDED_DATA) != 0) ?
|
||||
IDWALK_CB_EMBEDDED_NOT_OWNING :
|
||||
IDWALK_CB_NOP;
|
||||
BKE_LIB_FOREACHID_PROCESS_ID(data, tselem->id, cb_flag);
|
||||
}
|
||||
else if (!is_readonly) {
|
||||
tselem->id = nullptr;
|
||||
}
|
||||
BLI_mempool_iter iter;
|
||||
BLI_mempool_iternew(space_outliner->treestore, &iter);
|
||||
while (TreeStoreElem *tselem = static_cast<TreeStoreElem *>(BLI_mempool_iterstep(&iter))) {
|
||||
/* Do not try to restore non-ID pointers (drivers/sequence/etc.). */
|
||||
if (TSE_IS_REAL_ID(tselem)) {
|
||||
const int cb_flag = (tselem->id != nullptr && allow_pointer_access &&
|
||||
(tselem->id->flag & LIB_EMBEDDED_DATA) != 0) ?
|
||||
IDWALK_CB_EMBEDDED_NOT_OWNING :
|
||||
IDWALK_CB_NOP;
|
||||
BKE_LIB_FOREACHID_PROCESS_ID(data, tselem->id, cb_flag);
|
||||
}
|
||||
if (!is_readonly) {
|
||||
/* rebuild hash table, because it depends on ids too */
|
||||
space_outliner->storeflag |= SO_TREESTORE_REBUILD;
|
||||
else if (!is_readonly) {
|
||||
tselem->id = nullptr;
|
||||
}
|
||||
}
|
||||
if (!is_readonly) {
|
||||
/* rebuild hash table, because it depends on ids too */
|
||||
space_outliner->storeflag |= SO_TREESTORE_REBUILD;
|
||||
}
|
||||
}
|
||||
|
||||
static void outliner_deactivate(ScrArea *area)
|
||||
|
|
Loading…
Reference in New Issue