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/draw | |
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/draw')
-rw-r--r-- | source/blender/draw/intern/draw_armature.c | 9 | ||||
-rw-r--r-- | source/blender/draw/intern/draw_manager.c | 2 | ||||
-rw-r--r-- | source/blender/draw/modes/edit_metaball_mode.c | 5 | ||||
-rw-r--r-- | source/blender/draw/modes/object_mode.c | 7 |
4 files changed, 16 insertions, 7 deletions
diff --git a/source/blender/draw/intern/draw_armature.c b/source/blender/draw/intern/draw_armature.c index a94d47496e0..6361ff63fd4 100644 --- a/source/blender/draw/intern/draw_armature.c +++ b/source/blender/draw/intern/draw_armature.c @@ -37,6 +37,8 @@ #include "BKE_armature.h" +#include "DEG_depsgraph_query.h" + #include "ED_armature.h" #include "UI_resources.h" @@ -1848,7 +1850,9 @@ static void draw_armature_edit(Object *ob) const bool show_text = DRW_state_show_text(); const bool show_relations = ((draw_ctx->v3d->flag & V3D_HIDE_HELPLINES) == 0); - for (eBone = arm->edbo->first, index = ob->select_id; eBone; + const Object *orig_object = DEG_get_original_object(ob); + + for (eBone = arm->edbo->first, index = orig_object->runtime.select_id; eBone; eBone = eBone->next, index += 0x10000) { if (eBone->layer & arm->layer) { if ((eBone->flag & BONE_HIDDEN_A) == 0) { @@ -1943,7 +1947,8 @@ static void draw_armature_pose(Object *ob, const float const_color[4]) } if (arm->flag & ARM_POSEMODE) { - index = ob->select_id; + const Object *orig_object = DEG_get_original_object(ob); + index = orig_object->runtime.select_id; } } diff --git a/source/blender/draw/intern/draw_manager.c b/source/blender/draw/intern/draw_manager.c index 6499957b123..3bf3eaae4a2 100644 --- a/source/blender/draw/intern/draw_manager.c +++ b/source/blender/draw/intern/draw_manager.c @@ -2386,7 +2386,7 @@ void DRW_draw_select_loop(struct Depsgraph *depsgraph, /* This relies on dupli instances being after their instancing object. */ if ((ob->base_flag & BASE_FROM_DUPLI) == 0) { Object *ob_orig = DEG_get_original_object(ob); - DRW_select_load_id(ob_orig->select_id); + DRW_select_load_id(ob_orig->runtime.select_id); } DST.dupli_parent = data_.dupli_parent; DST.dupli_source = data_.dupli_object_current; diff --git a/source/blender/draw/modes/edit_metaball_mode.c b/source/blender/draw/modes/edit_metaball_mode.c index aa7c6863423..e94d394b98f 100644 --- a/source/blender/draw/modes/edit_metaball_mode.c +++ b/source/blender/draw/modes/edit_metaball_mode.c @@ -26,6 +26,8 @@ #include "BKE_object.h" +#include "DEG_depsgraph_query.h" + #include "ED_mball.h" /* If builtin shaders are needed */ @@ -160,7 +162,8 @@ static void EDIT_METABALL_cache_populate(void *vedata, Object *ob) copy_v3_v3(draw_scale_xform[2], scamat[2]); } - int select_id = ob->select_id; + const Object *orig_object = DEG_get_original_object(ob); + int select_id = orig_object->runtime.select_id; for (MetaElem *ml = mb->editelems->first; ml != NULL; ml = ml->next, select_id += 0x10000) { float world_pos[3]; mul_v3_m4v3(world_pos, ob->obmat, &ml->x); diff --git a/source/blender/draw/modes/object_mode.c b/source/blender/draw/modes/object_mode.c index 5f4888812f9..c494e222b3d 100644 --- a/source/blender/draw/modes/object_mode.c +++ b/source/blender/draw/modes/object_mode.c @@ -1925,13 +1925,14 @@ static void camera_view3d_stereoscopy_display_extra(OBJECT_ShadingGroupList *sgl static void camera_view3d_reconstruction(OBJECT_ShadingGroupList *sgl, Scene *scene, View3D *v3d, - const Object *camera_object, + Object *camera_object, Object *ob, const float color[4], const bool is_select) { const DRWContextState *draw_ctx = DRW_context_state_get(); Camera *cam = ob->data; + const Object *orig_camera_object = DEG_get_original_object(camera_object); if ((v3d->flag2 & V3D_SHOW_RECONSTRUCTION) == 0) { return; @@ -2012,7 +2013,7 @@ static void camera_view3d_reconstruction(OBJECT_ShadingGroupList *sgl, } if (is_select) { - DRW_select_load_id(camera_object->select_id | (track_index << 16)); + DRW_select_load_id(orig_camera_object->runtime.select_id | (track_index << 16)); track_index++; } @@ -2078,7 +2079,7 @@ static void DRW_shgroup_camera(OBJECT_ShadingGroupList *sgl, Object *ob, ViewLay RegionView3D *rv3d = draw_ctx->rv3d; Camera *cam = ob->data; - const Object *camera_object = DEG_get_evaluated_object(draw_ctx->depsgraph, v3d->camera); + Object *camera_object = DEG_get_evaluated_object(draw_ctx->depsgraph, v3d->camera); const bool is_select = DRW_state_is_select(); const bool is_active = (ob == camera_object); const bool look_through = (is_active && (rv3d->persp == RV3D_CAMOB)); |