[Bf-blender-cvs] [ecf4a7835d5] master: Outliner: Avoid unnecessary Outliner storage copy

Julian Eisel noreply at git.blender.org
Wed Aug 17 20:40:13 CEST 2022


Commit: ecf4a7835d5b6b02194f97af6c6b343a1352d83d
Author: Julian Eisel
Date:   Wed Aug 17 16:25:36 2022 +0200
Branches: master
https://developer.blender.org/rBecf4a7835d5b6b02194f97af6c6b343a1352d83d

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.

===================================================================

M	source/blender/blenkernel/intern/screen.c

===================================================================

diff --git a/source/blender/blenkernel/intern/screen.c b/source/blender/blenkernel/intern/screen.c
index c16a0927365..66ec887b3d4 100644
--- a/source/blender/blenkernel/intern/screen.c
+++ b/source/blender/blenkernel/intern/screen.c
@@ -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);
     }



More information about the Bf-blender-cvs mailing list