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).
This commit is contained in:
2020-01-28 18:28:10 +01:00
parent ca572e9970
commit b2034c6ba2
2 changed files with 10 additions and 25 deletions

View File

@@ -3246,22 +3246,24 @@ static void psys_cache_edit_paths_iter(void *__restrict iter_data_v,
}
}
else {
/* HACK(fclem): Instead of setting the color we pass the select state in the red channel.
* This is then picked up in DRW and the gpu shader will do the color interpolation. */
if ((ekey + (pind.ekey[0] - point->keys))->flag & PEK_SELECT) {
if ((ekey + (pind.ekey[1] - point->keys))->flag & PEK_SELECT) {
copy_v3_v3(ca->col, iter_data->sel_col);
ca->col[0] = 1.0f;
}
else {
keytime = (t - (*pind.ekey[0]->time)) / ((*pind.ekey[1]->time) - (*pind.ekey[0]->time));
interp_v3_v3v3(ca->col, iter_data->sel_col, iter_data->nosel_col, keytime);
ca->col[0] = 1.0f - keytime;
}
}
else {
if ((ekey + (pind.ekey[1] - point->keys))->flag & PEK_SELECT) {
keytime = (t - (*pind.ekey[0]->time)) / ((*pind.ekey[1]->time) - (*pind.ekey[0]->time));
interp_v3_v3v3(ca->col, iter_data->nosel_col, iter_data->sel_col, keytime);
ca->col[0] = keytime;
}
else {
copy_v3_v3(ca->col, iter_data->nosel_col);
ca->col[0] = 0.0f;
}
}
}