diff options
author | Campbell Barton <ideasman42@gmail.com> | 2021-10-21 08:44:06 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2021-10-21 08:57:53 +0300 |
commit | 3a2b7f35f4693dd40cd9457a0e6cd43b760ec558 (patch) | |
tree | 7e04276ee09d81a1d1fec269360e5a286f9a0e37 /source/blender/blenloader | |
parent | 063c4e467da3d926fc6447418e3f04fded9c051f (diff) |
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.
Diffstat (limited to 'source/blender/blenloader')
-rw-r--r-- | source/blender/blenloader/intern/readfile.c | 9 |
1 files changed, 9 insertions, 0 deletions
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); |