From e922dd7d8a307c54d49bc01649a12610b022192b Mon Sep 17 00:00:00 2001 From: Jacques Lucke Date: Tue, 24 Nov 2020 17:32:40 +0100 Subject: Viewport: cannot select object by clicking on its instances Selecting an object by clicking on its instances only worked, when the object itself is visible. However, it is possible to hide the object and still keep the instances visible. The solution is to give every object the correct `select_id` in the depsgraph object iterator right before rendering. Reviewers: fclem, brecht Differential Revision: https://developer.blender.org/D9640 --- source/blender/depsgraph/intern/depsgraph_query_iter.cc | 2 ++ 1 file changed, 2 insertions(+) (limited to 'source/blender/depsgraph') diff --git a/source/blender/depsgraph/intern/depsgraph_query_iter.cc b/source/blender/depsgraph/intern/depsgraph_query_iter.cc index 7d47e1fb541..dd5c998466b 100644 --- a/source/blender/depsgraph/intern/depsgraph_query_iter.cc +++ b/source/blender/depsgraph/intern/depsgraph_query_iter.cc @@ -154,6 +154,7 @@ bool deg_objects_dupli_iterator_next(BLI_Iterator *iter) dupli_parent->runtime.local_collections_bits; temp_dupli_object->dt = MIN2(temp_dupli_object->dt, dupli_parent->dt); copy_v4_v4(temp_dupli_object->color, dupli_parent->color); + temp_dupli_object->runtime.select_id = dupli_parent->runtime.select_id; /* Duplicated elements shouldn't care whether their original collection is visible or not. */ temp_dupli_object->base_flag |= BASE_VISIBLE_DEPSGRAPH; @@ -224,6 +225,7 @@ void deg_iterator_objects_step(BLI_Iterator *iter, deg::IDNode *id_node) } } + object->runtime.select_id = DEG_get_original_object(object)->runtime.select_id; if (ob_visibility & OB_VISIBLE_INSTANCES) { if ((data->flag & DEG_ITER_OBJECT_FLAG_DUPLI) && (object->transflag & OB_DUPLI)) { data->dupli_parent = object; -- cgit v1.2.3