diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2019-09-26 13:01:52 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2019-09-26 13:01:52 +0300 |
commit | 8a7085b9d45b5e364978672ac50cff4e7ee9e269 (patch) | |
tree | aa5171df774b117ae420ce9d3c5822577665031e /source/blender/blenkernel/intern/subdiv_eval.c | |
parent | ee4707544904aa76cfee7f7b5cc16b7e9f4a872c (diff) |
Fix T70163: Error painting with Subdivision at end of stack
Deformation of subdivision surface modifier was using wrong coordinates
for the coarse mesh: as the modifier flow goes the coordinates are to be
taken from the input array of coordinates.
Diffstat (limited to 'source/blender/blenkernel/intern/subdiv_eval.c')
-rw-r--r-- | source/blender/blenkernel/intern/subdiv_eval.c | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/source/blender/blenkernel/intern/subdiv_eval.c b/source/blender/blenkernel/intern/subdiv_eval.c index 419371c7a4b..bf5e886dd22 100644 --- a/source/blender/blenkernel/intern/subdiv_eval.c +++ b/source/blender/blenkernel/intern/subdiv_eval.c @@ -61,7 +61,9 @@ bool BKE_subdiv_eval_begin(Subdiv *subdiv) return true; } -static void set_coarse_positions(Subdiv *subdiv, const Mesh *mesh) +static void set_coarse_positions(Subdiv *subdiv, + const Mesh *mesh, + const float (*coarse_vertex_cos)[3]) { const MVert *mvert = mesh->mvert; const MLoop *mloop = mesh->mloop; @@ -83,8 +85,15 @@ static void set_coarse_positions(Subdiv *subdiv, const Mesh *mesh) if (!BLI_BITMAP_TEST_BOOL(vertex_used_map, vertex_index)) { continue; } - const MVert *vertex = &mvert[vertex_index]; - subdiv->evaluator->setCoarsePositions(subdiv->evaluator, vertex->co, manifold_veretx_index, 1); + const float *vertex_co; + if (coarse_vertex_cos != NULL) { + vertex_co = coarse_vertex_cos[vertex_index]; + } + else { + const MVert *vertex = &mvert[vertex_index]; + vertex_co = vertex->co; + } + subdiv->evaluator->setCoarsePositions(subdiv->evaluator, vertex_co, manifold_veretx_index, 1); manifold_veretx_index++; } MEM_freeN(vertex_used_map); @@ -112,7 +121,9 @@ static void set_face_varying_data_from_uv(Subdiv *subdiv, } } -bool BKE_subdiv_eval_update_from_mesh(Subdiv *subdiv, const Mesh *mesh) +bool BKE_subdiv_eval_update_from_mesh(Subdiv *subdiv, + const Mesh *mesh, + const float (*coarse_vertex_cos)[3]) { if (!BKE_subdiv_eval_begin(subdiv)) { return false; @@ -123,7 +134,7 @@ bool BKE_subdiv_eval_update_from_mesh(Subdiv *subdiv, const Mesh *mesh) return false; } /* Set coordinates of base mesh vertices. */ - set_coarse_positions(subdiv, mesh); + set_coarse_positions(subdiv, mesh, coarse_vertex_cos); /* Set face-varyign data to UV maps. */ const int num_uv_layers = CustomData_number_of_layers(&mesh->ldata, CD_MLOOPUV); for (int layer_index = 0; layer_index < num_uv_layers; layer_index++) { |