diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2017-04-21 15:53:19 +0300 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2017-04-21 16:27:32 +0300 |
commit | 19548040d91dedc2a63444f3277e4365837931e1 (patch) | |
tree | 75d34c60b4137f8b097276fad3d826f0509aa711 /source/blender/blenkernel | |
parent | 2f506b94588b9003d9f422ce3c5a0e9dc05f6610 (diff) |
Fix T51261: New objects aren't selected
The original code was failing because the base to object flushing was
only happening as part of the depsgraph. However we can use the
evaluated values to set the initial values of the base.
In this particular case, we couldn't set the new object visible because
its selectability flag was not set yet.
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/intern/layer.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/source/blender/blenkernel/intern/layer.c b/source/blender/blenkernel/intern/layer.c index 0fb945b64ea..4b9b77e7b82 100644 --- a/source/blender/blenkernel/intern/layer.c +++ b/source/blender/blenkernel/intern/layer.c @@ -267,7 +267,7 @@ static Base *object_base_add(SceneLayer *sl, Object *ob) if (base == NULL) { base = MEM_callocN(sizeof(Base), "Object Base"); - /* do not bump user count, leave it for SceneCollections */ + /* Do not bump user count, leave it for SceneCollections. */ base->object = ob; BLI_addtail(&sl->object_bases, base); @@ -775,13 +775,24 @@ static void layer_collection_object_add(SceneLayer *sl, LayerCollection *lc, Obj { Base *base = object_base_add(sl, ob); - /* only add an object once - prevent SceneCollection->objects and - * SceneCollection->filter_objects to add the same object */ + /* Only add an object once - prevent SceneCollection->objects and + * SceneCollection->filter_objects to add the same object. */ if (BLI_findptr(&lc->object_bases, base, offsetof(LinkData, data))) { return; } + bool is_visible = (lc->flag & COLLECTION_VISIBLE) != 0; + bool is_selectable = is_visible && ((lc->flag & COLLECTION_SELECTABLE) != 0); + + if (is_visible) { + base->flag |= BASE_VISIBLED; + } + + if (is_selectable) { + base->flag |= BASE_SELECTABLED; + } + BLI_addtail(&lc->object_bases, BLI_genericNodeN(base)); } |