diff options
author | Philipp Oeser <info@graphics-engineer.com> | 2019-09-10 13:48:25 +0300 |
---|---|---|
committer | Philipp Oeser <info@graphics-engineer.com> | 2019-09-10 14:15:29 +0300 |
commit | b2b52c6c91902c75a994c54ff37f767b93c85478 (patch) | |
tree | 4e997c7a0bba55de17059eaec359edc5b0d0ee17 /source/blender/draw/intern/draw_cache_impl_particles.c | |
parent | df8341a4866e16f19d5fcf0760e51bc04e55ce09 (diff) |
Fix T69432: Hair particle editmode: hiding not working
PTCacheEditPoint flag PEP_HIDE was not respected at all...
Reviewers: brecht
Maniphest Tasks: T69432
Differential Revision: https://developer.blender.org/D5739
Diffstat (limited to 'source/blender/draw/intern/draw_cache_impl_particles.c')
-rw-r--r-- | source/blender/draw/intern/draw_cache_impl_particles.c | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/source/blender/draw/intern/draw_cache_impl_particles.c b/source/blender/draw/intern/draw_cache_impl_particles.c index 3afdd77b6a7..ed78f7d07f9 100644 --- a/source/blender/draw/intern/draw_cache_impl_particles.c +++ b/source/blender/draw/intern/draw_cache_impl_particles.c @@ -1551,6 +1551,9 @@ static void ensure_edit_inner_points_count(const PTCacheEdit *edit, ParticleBatc cache->edit_inner_point_len = 0; for (int point_index = 0; point_index < edit->totpoint; point_index++) { const PTCacheEditPoint *point = &edit->points[point_index]; + if (point->flag & PEP_HIDE) { + continue; + } BLI_assert(point->totkey >= 1); cache->edit_inner_point_len += (point->totkey - 1); } @@ -1572,6 +1575,9 @@ static void particle_batch_cache_ensure_edit_inner_pos(PTCacheEdit *edit, int global_key_index = 0; for (int point_index = 0; point_index < edit->totpoint; point_index++) { const PTCacheEditPoint *point = &edit->points[point_index]; + if (point->flag & PEP_HIDE) { + continue; + } for (int key_index = 0; key_index < point->totkey - 1; key_index++) { PTCacheEditKey *key = &point->keys[key_index]; float color = (key->flag & PEK_SELECT) ? 1.0f : 0.0f; @@ -1602,7 +1608,14 @@ static void ensure_edit_tip_points_count(const PTCacheEdit *edit, ParticleBatchC if (cache->edit_tip_pos != NULL) { return; } - cache->edit_tip_point_len = edit->totpoint; + cache->edit_tip_point_len = 0; + for (int point_index = 0; point_index < edit->totpoint; point_index++) { + const PTCacheEditPoint *point = &edit->points[point_index]; + if (point->flag & PEP_HIDE) { + continue; + } + cache->edit_tip_point_len += 1; + } } static void particle_batch_cache_ensure_edit_tip_pos(PTCacheEdit *edit, ParticleBatchCache *cache) @@ -1617,13 +1630,18 @@ static void particle_batch_cache_ensure_edit_tip_pos(PTCacheEdit *edit, Particle cache->edit_tip_pos = GPU_vertbuf_create_with_format(edit_point_format); GPU_vertbuf_data_alloc(cache->edit_tip_pos, cache->edit_tip_point_len); + int global_point_index = 0; for (int point_index = 0; point_index < edit->totpoint; point_index++) { const PTCacheEditPoint *point = &edit->points[point_index]; + if (point->flag & PEP_HIDE) { + continue; + } PTCacheEditKey *key = &point->keys[point->totkey - 1]; float color = (key->flag & PEK_SELECT) ? 1.0f : 0.0f; - GPU_vertbuf_attr_set(cache->edit_tip_pos, pos_id, point_index, key->world_co); - GPU_vertbuf_attr_set(cache->edit_tip_pos, color_id, point_index, &color); + GPU_vertbuf_attr_set(cache->edit_tip_pos, pos_id, global_point_index, key->world_co); + GPU_vertbuf_attr_set(cache->edit_tip_pos, color_id, global_point_index, &color); + global_point_index++; } } |