diff options
author | Jeroen Bakker <j.bakker@atmind.nl> | 2019-05-08 10:45:20 +0300 |
---|---|---|
committer | Jeroen Bakker <j.bakker@atmind.nl> | 2019-05-09 14:27:23 +0300 |
commit | 8342a124c462104c12a98cca0b16e69920316346 (patch) | |
tree | cfcef9e21038d332476ec38abe5cad83eb27face /source/blender/blenkernel | |
parent | f877022956df3b55e30c312b20f364fd2657805c (diff) |
DepsGraph: Multi ViewLayer Selection
When using multiple viewlayers and switching between them the selection
gets buggy. The reason for this is that the select_id is updated based
on the index in the viewlayer. This makes the select_id not unique as
objects might be shared or not shared at all.
This fix will update the select_id on all objects in main. This will be triggered in all the selection operators.
Reviewed By: sergey, brecht
Maniphest Tasks: T55617
Differential Revision: https://developer.blender.org/D4824
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/BKE_object.h | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/object.c | 11 |
2 files changed, 13 insertions, 0 deletions
diff --git a/source/blender/blenkernel/BKE_object.h b/source/blender/blenkernel/BKE_object.h index 49b35bfccc1..c373fbfe478 100644 --- a/source/blender/blenkernel/BKE_object.h +++ b/source/blender/blenkernel/BKE_object.h @@ -100,6 +100,8 @@ bool BKE_object_is_mode_compat(const struct Object *ob, eObjectMode object_mode) bool BKE_object_data_is_in_editmode(const struct ID *id); +void BKE_object_update_select_id(struct Main *bmain); + typedef enum eObjectVisibilityResult { OB_VISIBLE_SELF = 1, OB_VISIBLE_PARTICLES = 2, diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index 38a8ad2769a..6c2bd5e6127 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -4487,3 +4487,14 @@ void BKE_object_type_set_empty_for_versioning(Object *ob) } ob->mode = OB_MODE_OBJECT; } + +/* Updates select_id of all objects in the given bmain. */ +void BKE_object_update_select_id(struct Main *bmain) +{ + Object *ob = bmain->objects.first; + int select_id = 1; + while (ob) { + ob->runtime.select_id = select_id++; + ob = ob->id.next; + } +}
\ No newline at end of file |