diff options
author | Campbell Barton <campbell@blender.org> | 2022-02-02 10:10:27 +0300 |
---|---|---|
committer | Campbell Barton <campbell@blender.org> | 2022-02-02 10:12:53 +0300 |
commit | e8b3bd15e8d91c3cb8fa3bf33b3328e1dd109b75 (patch) | |
tree | 8679121fe038c44fa2574e6370a5753da4416e78 /source/blender/editors/space_view3d/view3d_view.c | |
parent | da5e72eb01027d6992244983fc86b1d919c9c8bb (diff) |
Cleanup: skip redundant steps when the selection buffer is cached
The viewport theme loaded and virtual modifiers allocated unnecessary.
Diffstat (limited to 'source/blender/editors/space_view3d/view3d_view.c')
-rw-r--r-- | source/blender/editors/space_view3d/view3d_view.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c index 9a2cc76c44e..d6b928c6fa7 100644 --- a/source/blender/editors/space_view3d/view3d_view.c +++ b/source/blender/editors/space_view3d/view3d_view.c @@ -981,6 +981,15 @@ int view3d_opengl_select_ex(ViewContext *vc, } } + /* Re-use cache (rect must be smaller than the cached) + * other context is assumed to be unchanged */ + if (GPU_select_is_cached()) { + GPU_select_begin(buffer, buffer_len, &rect, gpu_select_mode, 0); + GPU_select_cache_load_id(); + hits = GPU_select_end(); + goto finally; + } + /* Important to use 'vc->obact', not 'OBACT(vc->view_layer)' below, * so it will be NULL when hidden. */ struct { @@ -1040,15 +1049,6 @@ int view3d_opengl_select_ex(ViewContext *vc, UI_Theme_Store(&theme_state); UI_SetTheme(SPACE_VIEW3D, RGN_TYPE_WINDOW); - /* Re-use cache (rect must be smaller than the cached) - * other context is assumed to be unchanged */ - if (GPU_select_is_cached()) { - GPU_select_begin(buffer, buffer_len, &rect, gpu_select_mode, 0); - GPU_select_cache_load_id(); - hits = GPU_select_end(); - goto finally; - } - /* All of the queries need to be perform on the drawing context. */ DRW_opengl_context_enable(); @@ -1132,14 +1132,14 @@ int view3d_opengl_select_ex(ViewContext *vc, DRW_opengl_context_disable(); + UI_Theme_Restore(&theme_state); + finally: if (hits < 0) { printf("Too many objects in select buffer\n"); /* XXX make error message */ } - UI_Theme_Restore(&theme_state); - return hits; } |