Commit: 33d3dcdb00c99217333d8919565830807199d23f
Author: mano-wii
Date:   Sun Aug 11 22:12:11 2019 -0300
Branches: temp-lanpr-staging
https://developer.blender.org/rB33d3dcdb00c99217333d8919565830807199d23f

View3D: Circle Select optimization

Don't recreate `select_bitmap` for each edited object.

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

M       source/blender/editors/space_view3d/view3d_select.c

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

diff --git a/source/blender/editors/space_view3d/view3d_select.c 
b/source/blender/editors/space_view3d/view3d_select.c
index d20a854c022..3e2d387bcec 100644
--- a/source/blender/editors/space_view3d/view3d_select.c
+++ b/source/blender/editors/space_view3d/view3d_select.c
@@ -3392,7 +3392,9 @@ static bool mesh_circle_select(ViewContext *vc,
   struct EditSelectBuf_Cache *esel = wm_userdata->data;
 
   if (use_zbuf) {
-    esel->select_bitmap = DRW_select_buffer_bitmap_from_circle(mval, (int)(rad 
+ 1.0f), NULL);
+    if (esel->select_bitmap == NULL) {
+      esel->select_bitmap = DRW_select_buffer_bitmap_from_circle(mval, 
(int)(rad + 1.0f), NULL);
+    }
   }
 
   if (ts->selectmode & SCE_SELECT_VERTEX) {
@@ -3432,13 +3434,6 @@ static bool mesh_circle_select(ViewContext *vc,
     }
   }
 
-  if (use_zbuf) {
-    if (esel->select_bitmap != NULL) {
-      MEM_freeN(esel->select_bitmap);
-      esel->select_bitmap = NULL;
-    }
-  }
-
   changed |= data.is_changed;
 
   if (changed) {
@@ -4020,6 +4015,13 @@ static int view3d_circle_select_exec(bContext *C, 
wmOperator *op)
   if (wm_userdata == &wm_userdata_buf) {
     WM_generic_user_data_free(wm_userdata);
   }
+  else {
+    struct EditSelectBuf_Cache *esel = wm_userdata->data;
+    if (esel && esel->select_bitmap) {
+      MEM_freeN(esel->select_bitmap);
+      esel->select_bitmap = NULL;
+    }
+  }
 
   return OPERATOR_FINISHED;
 }

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to