Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClément Foucault <foucault.clem@gmail.com>2020-01-28 20:28:10 +0300
committerClément Foucault <foucault.clem@gmail.com>2020-01-28 20:28:48 +0300
commitb2034c6ba245e131e6ecabe33ca9afa1e6394247 (patch)
treebd9fc02d009315d946f20bbf64d0df1f3e2eba1a /source/blender/draw/intern/draw_cache_impl_particles.c
parentca572e99708e1c59067fbeea09f2feca777caff9 (diff)
Fix T62730 Overlay: Selected edit hair points highlight is incorrect
This was due to the fact the drawing code was expecting the editpoints to be equaly spaced. Reuse the code in particle.c to output the select mask in red color channel of the particle (which is unused in new code).
Diffstat (limited to 'source/blender/draw/intern/draw_cache_impl_particles.c')
-rw-r--r--source/blender/draw/intern/draw_cache_impl_particles.c25
1 files changed, 4 insertions, 21 deletions
diff --git a/source/blender/draw/intern/draw_cache_impl_particles.c b/source/blender/draw/intern/draw_cache_impl_particles.c
index 7de6ee2b3b1..f699388c38c 100644
--- a/source/blender/draw/intern/draw_cache_impl_particles.c
+++ b/source/blender/draw/intern/draw_cache_impl_particles.c
@@ -637,23 +637,6 @@ static void particle_batch_cache_fill_segments_proc_pos(ParticleCacheKey **path_
}
}
-static float particle_key_select_ratio(const PTCacheEdit *edit, int strand, float t)
-{
- const PTCacheEditPoint *point = &edit->points[strand];
- float edit_key_seg_t = 1.0f / (point->totkey - 1);
- if (t == 1.0) {
- return (point->keys[point->totkey - 1].flag & PEK_SELECT) ? 1.0f : 0.0;
- }
- else {
- float interp = t / edit_key_seg_t;
- int index = (int)interp;
- interp -= floorf(interp); /* Time between 2 edit key */
- float s1 = (point->keys[index].flag & PEK_SELECT) ? 1.0f : 0.0;
- float s2 = (point->keys[index + 1].flag & PEK_SELECT) ? 1.0f : 0.0;
- return s1 + interp * (s2 - s1);
- }
-}
-
static float particle_key_weight(const ParticleData *particle, int strand, float t)
{
const ParticleData *part = particle + strand;
@@ -673,8 +656,8 @@ static float particle_key_weight(const ParticleData *particle, int strand, float
}
static int particle_batch_cache_fill_segments_edit(
- const PTCacheEdit *edit, /* NULL for weight data */
- const ParticleData *particle, /* NULL for select data */
+ const PTCacheEdit *UNUSED(edit), /* NULL for weight data */
+ const ParticleData *particle, /* NULL for select data */
ParticleCacheKey **path_cache,
const int start_index,
const int num_path_keys,
@@ -697,8 +680,8 @@ static int particle_batch_cache_fill_segments_edit(
seg_data->color = (weight < 1.0f) ? weight : 1.0f;
}
else {
- float selected = particle_key_select_ratio(edit, i, strand_t);
- seg_data->color = selected;
+ /* Computed in psys_cache_edit_paths_iter(). */
+ seg_data->color = path[j].col[0];
}
GPU_indexbuf_add_generic_vert(elb, curr_point);
curr_point++;