Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukas Tönne <lukas.toenne@gmail.com>2015-03-23 11:07:49 +0300
committerLukas Tönne <lukas.toenne@gmail.com>2015-03-23 11:07:49 +0300
commit9ad96b26896e5b6aaaa8998f2c85578edba30544 (patch)
treef41e02ba3c7caebbb7ced39d0876c2fc90b46ce1
parent0919a3d56d6e57e89fc10cc58b3f0837bc711764 (diff)
Use dupli overrides also for the selection drawing code.alembic_pointcache
Now clicking a cached dupli instance also selects the duplicator object as expected.
-rw-r--r--source/blender/editors/space_view3d/view3d_view.c23
1 files changed, 20 insertions, 3 deletions
diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c
index 4154f8e8845..914c1a818ed 100644
--- a/source/blender/editors/space_view3d/view3d_view.c
+++ b/source/blender/editors/space_view3d/view3d_view.c
@@ -1030,23 +1030,40 @@ static void view3d_select_loop(ViewContext *vc, Scene *scene, View3D *v3d, ARegi
lb = object_duplilist(G.main->eval_ctx, scene, base->object);
for (dob = lb->first; dob; dob = dob->next) {
- float omat[4][4];
+ /* for restoring after override */
+ struct DerivedMesh *store_final_dm;
+ float store_obmat[4][4];
tbase.object = dob->ob;
- copy_m4_m4(omat, dob->ob->obmat);
+ copy_m4_m4(store_obmat, dob->ob->obmat);
copy_m4_m4(dob->ob->obmat, dob->mat);
+ store_final_dm = dob->ob->derivedFinal;
/* extra service: draw the duplicator in drawtype of parent */
/* MIN2 for the drawtype to allow bounding box objects in groups for lods */
dt = tbase.object->dt; tbase.object->dt = MIN2(tbase.object->dt, base->object->dt);
dtx = tbase.object->dtx; tbase.object->dtx = base->object->dtx;
+ /* override final DM */
+ tbase.object->transflag &= ~OB_IS_DUPLI_CACHE;
+ if (base->object->dup_cache) {
+ DupliObjectData *dob_data = BKE_dupli_cache_find_data(base->object->dup_cache, tbase.object);
+ if (dob_data->cache_dm) {
+ tbase.object->transflag |= OB_IS_DUPLI_CACHE;
+
+ tbase.object->derivedFinal = dob_data->cache_dm;
+ }
+ }
+
draw_object(scene, ar, v3d, &tbase, DRAW_PICKING | DRAW_CONSTCOLOR);
tbase.object->dt = dt;
tbase.object->dtx = dtx;
- copy_m4_m4(dob->ob->obmat, omat);
+ /* restore obmat and final DM */
+ tbase.object->transflag &= ~OB_IS_DUPLI_CACHE;
+ copy_m4_m4(dob->ob->obmat, store_obmat);
+ tbase.object->derivedFinal = store_final_dm;
}
free_object_duplilist(lb);
}