Outliner: Avoid unnecessary Outliner storage copy
Was always creating a copy of `SpaceOutliner`, even though it's only needed for one conditional branch. This is a shallow copy, so shouldn't be that expensive, still trivial to avoid.
This commit is contained in:
parent
31279d522b
commit
ecf4a7835d
|
@ -1128,8 +1128,6 @@ static void write_space_outliner(BlendWriter *writer, SpaceOutliner *space_outli
|
|||
BLI_mempool *ts = space_outliner->treestore;
|
||||
|
||||
if (ts) {
|
||||
SpaceOutliner space_outliner_flat = *space_outliner;
|
||||
|
||||
int elems = BLI_mempool_len(ts);
|
||||
/* linearize mempool to array */
|
||||
TreeStoreElem *data = elems ? BLI_mempool_as_arrayN(ts, "TreeStoreElem") : NULL;
|
||||
|
@ -1157,6 +1155,7 @@ static void write_space_outliner(BlendWriter *writer, SpaceOutliner *space_outli
|
|||
MEM_freeN(data);
|
||||
}
|
||||
else {
|
||||
SpaceOutliner space_outliner_flat = *space_outliner;
|
||||
space_outliner_flat.treestore = NULL;
|
||||
BLO_write_struct_at_address(writer, SpaceOutliner, space_outliner, &space_outliner_flat);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue