Depsgraph and selection: Flush selcol on Depsgraph

Selection code needs to iterate over DEG_OBJECT_ITER otherwise we won't
get modifiers, dupli objects, ...

Also make selection respect selectability flag.

Review by: Sergey Sharybin
This commit is contained in:
Dalai Felinto
2017-04-26 10:40:41 +02:00
parent 3dc6528cd4
commit f88e6763d6
4 changed files with 19 additions and 15 deletions

View File

@@ -2109,23 +2109,21 @@ void DRW_draw_select_loop(
/* or render properties / materials change */
if (cache_is_dirty) {
int code = 1;
DRW_engines_cache_init();
if (use_obedit) {
DRW_engines_cache_populate(vc->obedit);
}
else {
/* TODO, use DEG_OBJECT_ITER or similar.
* Currently its not well suited for selection
* since it loops over Objects instead of bases and does so recursively. */
for (Base *base = sl->object_bases.first; base; base = base->next) {
base->selcol = code++;
DRW_select_load_id(base->selcol);
DRW_engines_cache_populate(base->object);
Depsgraph *graph = scene->depsgraph; // CTX_data_depsgraph(C);
DEG_OBJECT_ITER(graph, ob)
{
if ((ob->base_flag & BASE_SELECTABLED) != 0) {
DRW_select_load_id(ob->base_selection_color);
DRW_engines_cache_populate(ob);
}
}
DEG_OBJECT_ITER_END
}
DRW_engines_cache_finish();