From bd90c33bbf7cb39e0b9f479d44a31d0dfa942ed3 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 23 Jul 2010 23:48:21 +0000 Subject: bugfix [#22941] set object center/origin on a linked duplicate causes linked copied to become unselectable in viewport --- source/blender/editors/object/object_transform.c | 46 ++++++++++++++---------- 1 file changed, 28 insertions(+), 18 deletions(-) (limited to 'source/blender/editors/object/object_transform.c') diff --git a/source/blender/editors/object/object_transform.c b/source/blender/editors/object/object_transform.c index 66a9dab572a..cd66b9ab2ba 100644 --- a/source/blender/editors/object/object_transform.c +++ b/source/blender/editors/object/object_transform.c @@ -205,7 +205,7 @@ static int object_rotation_clear_exec(bContext *C, wmOperator *op) eulO_to_axis_angle( ob->rotAxis, &ob->rotAngle,eul, EULER_ORDER_DEFAULT); } else { - VECCOPY(ob->rot, eul); + copy_v3_v3(ob->rot, eul); } } } // Duplicated in source/blender/editors/armature/editarmature.c @@ -340,10 +340,7 @@ static int object_origin_clear_exec(bContext *C, wmOperator *op) v3= ob->parentinv[3]; copy_m3_m4(mat, ob->parentinv); - VECCOPY(v3, v1); - v3[0]= -v3[0]; - v3[1]= -v3[1]; - v3[2]= -v3[2]; + negate_v3_v3(v3, v1); mul_m3_v3(mat, v3); } ob->recalc |= OB_RECALC_OB; @@ -712,6 +709,7 @@ static int object_origin_set_exec(bContext *C, wmOperator *op) ScrArea *sa= CTX_wm_area(C); View3D *v3d= sa->spacedata.first; Object *obedit= CTX_data_edit_object(C); + Object *tob; Mesh *me, *tme; Curve *cu; /* BezTriple *bezt; @@ -779,9 +777,10 @@ static int object_origin_set_exec(bContext *C, wmOperator *op) ob->flag &= ~OB_DONE; } CTX_DATA_END; - - for (me= G.main->mesh.first; me; me= me->id.next) { - me->flag &= ~ME_ISDONE; + + for (tob= G.main->object.first; tob; tob= tob->id.next) { + if(tob->data) + ((ID *)tob->data)->flag &= ~LIB_DOIT; } CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) { @@ -823,13 +822,14 @@ static int object_origin_set_exec(bContext *C, wmOperator *op) } } } - - me->flag |= ME_ISDONE; + + tot_change++; + me->id.flag |= LIB_DOIT; if(centermode) { copy_m3_m4(omat, ob->obmat); - VECCOPY(centn, cent); + copy_v3_v3(centn, cent); mul_m3_v3(omat, centn); ob->loc[0]+= centn[0]; ob->loc[1]+= centn[1]; @@ -849,7 +849,7 @@ static int object_origin_set_exec(bContext *C, wmOperator *op) ob_other->recalc= OB_RECALC_OB|OB_RECALC_DATA; copy_m3_m4(omat, ob_other->obmat); - VECCOPY(centn, cent); + copy_v3_v3(centn, cent); mul_m3_v3(omat, centn); ob_other->loc[0]+= centn[0]; ob_other->loc[1]+= centn[1]; @@ -858,7 +858,7 @@ static int object_origin_set_exec(bContext *C, wmOperator *op) where_is_object(scene, ob_other); ignore_parent_tx(bmain, scene, ob_other); - if(tme && (tme->flag & ME_ISDONE)==0) { + if(!(tme->id.flag & LIB_DOIT)) { mvert= tme->mvert; for(a=0; atotvert; a++, mvert++) { sub_v3_v3(mvert->co, cent); @@ -874,15 +874,15 @@ static int object_origin_set_exec(bContext *C, wmOperator *op) } } } - - tme->flag |= ME_ISDONE; + + tot_change++; + tme->id.flag |= LIB_DOIT; } } } } CTX_DATA_END; } - tot_change++; } } else if (ELEM(ob->type, OB_CURVE, OB_SURF)) { @@ -903,7 +903,7 @@ static int object_origin_set_exec(bContext *C, wmOperator *op) tot_lib_error++; } else { if(centermode==2) { - VECCOPY(cent, give_cursor(scene, v3d)); + copy_v3_v3(cent, give_cursor(scene, v3d)); invert_m4_m4(ob->imat, ob->obmat); mul_m4_v3(ob->imat, cent); @@ -956,6 +956,8 @@ static int object_origin_set_exec(bContext *C, wmOperator *op) } tot_change++; + cu->id.flag |= LIB_DOIT; + if(obedit) { if (centermode==0) { DAG_id_flush_update(&obedit->id, OB_RECALC_DATA); @@ -982,6 +984,7 @@ static int object_origin_set_exec(bContext *C, wmOperator *op) cu->yof /= cu->fsize; tot_change++; + cu->id.flag |= LIB_DOIT; } } else if(ob->type==OB_ARMATURE) { @@ -998,7 +1001,9 @@ static int object_origin_set_exec(bContext *C, wmOperator *op) * Bone + object locations are handled there. */ docenter_armature(scene, v3d, ob, centermode); + tot_change++; + cu->id.flag |= LIB_DOIT; where_is_object(scene, ob); ignore_parent_tx(bmain, scene, ob); @@ -1007,10 +1012,15 @@ static int object_origin_set_exec(bContext *C, wmOperator *op) break; } } - ob->recalc= OB_RECALC_OB|OB_RECALC_DATA; } } CTX_DATA_END; + + for (tob= G.main->object.first; tob; tob= tob->id.next) { + if(tob->data && (((ID *)tob->data)->flag & LIB_DOIT)) { + tob->recalc= OB_RECALC_OB|OB_RECALC_DATA; + } + } if (tot_change) { DAG_ids_flush_update(0); -- cgit v1.2.3