[Bf-blender-cvs] [3a2b7f35f46] master: LibLink: ensure objects are selectable when "Select" is enabled

Campbell Barton noreply at git.blender.org
Thu Oct 21 07:58:55 CEST 2021


Commit: 3a2b7f35f4693dd40cd9457a0e6cd43b760ec558
Author: Campbell Barton
Date:   Thu Oct 21 16:44:06 2021 +1100
Branches: master
https://developer.blender.org/rB3a2b7f35f4693dd40cd9457a0e6cd43b760ec558

LibLink: ensure objects are selectable when "Select" is enabled

Appended objects could be hidden, making any further operations
potentially skip the newly added objects.

Now FILE_AUTOSELECT asserts when newly added options aren't selectable.

===================================================================

M	source/blender/blenloader/intern/readfile.c

===================================================================

diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index ba152bbf2c6..0b69395b4f8 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -4480,6 +4480,8 @@ static void object_base_instance_init(
   }
 
   if (flag & FILE_AUTOSELECT) {
+    /* All objects that use #FILE_AUTOSELECT must be selectable (unless linking data). */
+    BLI_assert((base->flag & BASE_SELECTABLE) || (flag & FILE_LINK));
     if (base->flag & BASE_SELECTABLE) {
       base->flag |= BASE_SELECTED;
     }
@@ -4503,6 +4505,13 @@ void BLO_object_instantiate_object_base_instance_init(Main *bmain,
                                                       const int flag,
                                                       bool set_active)
 {
+  /* Auto-select and appending. */
+  if ((flag & FILE_AUTOSELECT) && ((flag & FILE_LINK) == 0)) {
+    /* While in general the object should not be manipulated,
+     * when the user requests the object to be selected, ensure it's visible and selectable. */
+    ob->visibility_flag &= ~(OB_HIDE_VIEWPORT | OB_HIDE_SELECT);
+  }
+
   BKE_collection_object_add(bmain, collection, ob);
 
   object_base_instance_init(ob, view_layer, v3d, flag, set_active);



More information about the Bf-blender-cvs mailing list