diff options
-rw-r--r-- | source/blender/blenkernel/intern/mesh_wrapper.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/source/blender/blenkernel/intern/mesh_wrapper.c b/source/blender/blenkernel/intern/mesh_wrapper.c index 4cc43354a44..d1f15cf9007 100644 --- a/source/blender/blenkernel/intern/mesh_wrapper.c +++ b/source/blender/blenkernel/intern/mesh_wrapper.c @@ -331,6 +331,18 @@ Mesh *BKE_mesh_wrapper_ensure_subdivision(const Object *ob, Mesh *me) return me; } + /* Initialize the settings before ensuring the descriptor as this is checked to decide whether + * subdivision is needed at all, and checking the descriptor status might involve checking if the + * data is out-of-date, which is a very expensive operation. */ + SubdivToMeshSettings mesh_settings; + mesh_settings.resolution = me->runtime.subsurf_resolution; + mesh_settings.use_optimal_display = me->runtime.subsurf_use_optimal_display; + + if (mesh_settings.resolution < 3) { + BLI_mutex_unlock(mesh_eval_mutex); + return me; + } + const bool apply_render = me->runtime.subsurf_apply_render; SubdivSettings subdiv_settings; @@ -349,15 +361,6 @@ Mesh *BKE_mesh_wrapper_ensure_subdivision(const Object *ob, Mesh *me) return me; } - SubdivToMeshSettings mesh_settings; - mesh_settings.resolution = me->runtime.subsurf_resolution; - mesh_settings.use_optimal_display = me->runtime.subsurf_use_optimal_display; - - if (mesh_settings.resolution < 3) { - BLI_mutex_unlock(mesh_eval_mutex); - return me; - } - Mesh *subdiv_mesh = BKE_subdiv_to_mesh(subdiv, &mesh_settings, me); if (subdiv != runtime_data->subdiv) { |