diff options
author | Pablo Dobarro <pablodp606@gmail.com> | 2020-02-07 00:14:18 +0300 |
---|---|---|
committer | Pablo Dobarro <pablodp606@gmail.com> | 2020-02-25 21:07:44 +0300 |
commit | f4411b58ade1d4d0921243756ecd3499e8d11cd2 (patch) | |
tree | fa73e1a786493f9cf17c7b59d24c76d9e5e50fb7 /source/blender/blenkernel/intern/subdiv_ccg.c | |
parent | 9cc5af64c65e146df95f33033a20992451967aa5 (diff) |
Fix T72721: Add visibility flags updates to the PBVH
Currently, there its a function that sets manually the fully_hidden flag
of the nodes from the visibility operators in paint_hide.c. The undo
code was not updating the flag, so the visibility state of the nodes was
incorrect after preforming undo operations. This sometimes was drawing
fully hidden nodes with empty buffers, causing artifacts in the
geometry.
I added a function to mark nodes which visibility state changed (similar
as we are updating the mask flags and the nodes bounding boxes). This
way, the tools, operators and undo code don't have to update the
visibility flags, making everything much simpler to understand and
maintain.
I did not remove the flag update code from the current visibility
operators in this patch, but after reimplementing them (and all the new
ones) in the new visibility system, all visibility updates should be
done using this method and the BKE_pbvh_node_fully_hidden_set function
should be removed.
Reviewed By: jbakker
Maniphest Tasks: T72721
Differential Revision: https://developer.blender.org/D6767
Diffstat (limited to 'source/blender/blenkernel/intern/subdiv_ccg.c')
-rw-r--r-- | source/blender/blenkernel/intern/subdiv_ccg.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/source/blender/blenkernel/intern/subdiv_ccg.c b/source/blender/blenkernel/intern/subdiv_ccg.c index 8654c50a783..3c1a9c4d3d6 100644 --- a/source/blender/blenkernel/intern/subdiv_ccg.c +++ b/source/blender/blenkernel/intern/subdiv_ccg.c @@ -623,9 +623,9 @@ void BKE_subdiv_ccg_destroy(SubdivCCG *subdiv_ccg) MEM_SAFE_FREE(subdiv_ccg->grid_flag_mats); if (subdiv_ccg->grid_hidden != NULL) { for (int grid_index = 0; grid_index < num_grids; grid_index++) { - MEM_freeN(subdiv_ccg->grid_hidden[grid_index]); + MEM_SAFE_FREE(subdiv_ccg->grid_hidden[grid_index]); } - MEM_freeN(subdiv_ccg->grid_hidden); + MEM_SAFE_FREE(subdiv_ccg->grid_hidden); } if (subdiv_ccg->subdiv != NULL) { BKE_subdiv_free(subdiv_ccg->subdiv); |