Fix T42571,T42572 snapping ignores linked objects

Make sure to use edit object if objects share the same data.
This commit is contained in:
Antonis Ryakiotakis 2014-11-13 15:41:29 +01:00
parent 9ebe44bc9c
commit dc519f3eb7
Notes: blender-bot 2023-02-14 09:49:36 +01:00
Referenced by issue #42571, snap update bug
Referenced by issue #42572, Linked curve snap bug
1 changed files with 15 additions and 4 deletions

View File

@ -1948,21 +1948,32 @@ static bool snapObjectsRay(Scene *scene, short snap_mode, Base *base_act, View3D
(ELEM(mode, SNAP_ALL, SNAP_NOT_OBEDIT) && base != base_act)))
{
Object *ob = base->object;
Object *ob_snap = ob;
bool use_obedit = false;
/* for linked objects, use the same object but a different matrix */
if (obedit && ob->data == obedit->data) {
use_obedit = true;
ob_snap = obedit;
}
if (ob->transflag & OB_DUPLI) {
DupliObject *dupli_ob;
ListBase *lb = object_duplilist(G.main->eval_ctx, scene, ob);
for (dupli_ob = lb->first; dupli_ob; dupli_ob = dupli_ob->next) {
retval |= snapObject(scene, snap_mode, ar, dupli_ob->ob, dupli_ob->mat, false,
bool use_obedit_dupli = (obedit && dupli_ob->ob->data == obedit->data);
Object *dupli_snap = (use_obedit_dupli) ? obedit : dupli_ob->ob;
retval |= snapObject(scene, snap_mode, ar, dupli_snap, dupli_ob->mat, use_obedit_dupli,
r_ob, r_obmat,
ray_start, ray_normal, ray_origin, mval, r_loc, r_no, r_dist_px, r_ray_dist);
}
free_object_duplilist(lb);
}
retval |= snapObject(scene, snap_mode, ar, ob, ob->obmat, false,
retval |= snapObject(scene, snap_mode, ar, ob_snap, ob->obmat, use_obedit,
r_ob, r_obmat,
ray_start, ray_normal, ray_origin, mval, r_loc, r_no, r_dist_px, r_ray_dist);
}