From 1e675132d4a5c6ac8c560513956a984f22fb56f7 Mon Sep 17 00:00:00 2001 From: Swann Date: Tue, 13 Jul 2021 16:33:46 +0200 Subject: [PATCH] fix: collection instances index offset --- multi_user/presence.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/multi_user/presence.py b/multi_user/presence.py index 8112de1..2da5096 100644 --- a/multi_user/presence.py +++ b/multi_user/presence.py @@ -337,9 +337,9 @@ class UserSelectionWidget(Widget): @property def selected_objects(self): user_selection = self.data.get('selected_objects') - if user_selection != self.current_selection_ids: - self.current_selection_ids = user_selection + if self.current_selection_ids != user_selection: self.current_selected_objects = [find_from_attr("uuid", uid, bpy.data.objects) for uid in user_selection] + self.current_selection_ids = user_selection return self.current_selected_objects @@ -361,11 +361,12 @@ class UserSelectionWidget(Widget): vertex_ind = [] collection_offset = 0 for obj_index, obj in enumerate(self.selected_objects): + if obj is None: + continue obj_index+=collection_offset - logging.info(collection_offset) if hasattr(obj, 'instance_collection') and obj.instance_collection: bbox_pos, bbox_ind = bbox_from_instance_collection(obj, index=obj_index) - collection_offset+=len(obj.instance_collection.objects) + collection_offset+=len(obj.instance_collection.objects)-1 else : bbox_pos, bbox_ind = bbox_from_obj(obj, index=obj_index) vertex_pos += bbox_pos