bugfix [#22941] set object center/origin on a linked duplicate causes linked copied to become unselectable in viewport
This commit is contained in:
@@ -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);
|
eulO_to_axis_angle( ob->rotAxis, &ob->rotAngle,eul, EULER_ORDER_DEFAULT);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
VECCOPY(ob->rot, eul);
|
copy_v3_v3(ob->rot, eul);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} // Duplicated in source/blender/editors/armature/editarmature.c
|
} // 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];
|
v3= ob->parentinv[3];
|
||||||
|
|
||||||
copy_m3_m4(mat, ob->parentinv);
|
copy_m3_m4(mat, ob->parentinv);
|
||||||
VECCOPY(v3, v1);
|
negate_v3_v3(v3, v1);
|
||||||
v3[0]= -v3[0];
|
|
||||||
v3[1]= -v3[1];
|
|
||||||
v3[2]= -v3[2];
|
|
||||||
mul_m3_v3(mat, v3);
|
mul_m3_v3(mat, v3);
|
||||||
}
|
}
|
||||||
ob->recalc |= OB_RECALC_OB;
|
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);
|
ScrArea *sa= CTX_wm_area(C);
|
||||||
View3D *v3d= sa->spacedata.first;
|
View3D *v3d= sa->spacedata.first;
|
||||||
Object *obedit= CTX_data_edit_object(C);
|
Object *obedit= CTX_data_edit_object(C);
|
||||||
|
Object *tob;
|
||||||
Mesh *me, *tme;
|
Mesh *me, *tme;
|
||||||
Curve *cu;
|
Curve *cu;
|
||||||
/* BezTriple *bezt;
|
/* BezTriple *bezt;
|
||||||
@@ -779,9 +777,10 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
|
|||||||
ob->flag &= ~OB_DONE;
|
ob->flag &= ~OB_DONE;
|
||||||
}
|
}
|
||||||
CTX_DATA_END;
|
CTX_DATA_END;
|
||||||
|
|
||||||
for (me= G.main->mesh.first; me; me= me->id.next) {
|
for (tob= G.main->object.first; tob; tob= tob->id.next) {
|
||||||
me->flag &= ~ME_ISDONE;
|
if(tob->data)
|
||||||
|
((ID *)tob->data)->flag &= ~LIB_DOIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) {
|
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) {
|
if(centermode) {
|
||||||
copy_m3_m4(omat, ob->obmat);
|
copy_m3_m4(omat, ob->obmat);
|
||||||
|
|
||||||
VECCOPY(centn, cent);
|
copy_v3_v3(centn, cent);
|
||||||
mul_m3_v3(omat, centn);
|
mul_m3_v3(omat, centn);
|
||||||
ob->loc[0]+= centn[0];
|
ob->loc[0]+= centn[0];
|
||||||
ob->loc[1]+= centn[1];
|
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;
|
ob_other->recalc= OB_RECALC_OB|OB_RECALC_DATA;
|
||||||
|
|
||||||
copy_m3_m4(omat, ob_other->obmat);
|
copy_m3_m4(omat, ob_other->obmat);
|
||||||
VECCOPY(centn, cent);
|
copy_v3_v3(centn, cent);
|
||||||
mul_m3_v3(omat, centn);
|
mul_m3_v3(omat, centn);
|
||||||
ob_other->loc[0]+= centn[0];
|
ob_other->loc[0]+= centn[0];
|
||||||
ob_other->loc[1]+= centn[1];
|
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);
|
where_is_object(scene, ob_other);
|
||||||
ignore_parent_tx(bmain, 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;
|
mvert= tme->mvert;
|
||||||
for(a=0; a<tme->totvert; a++, mvert++) {
|
for(a=0; a<tme->totvert; a++, mvert++) {
|
||||||
sub_v3_v3(mvert->co, cent);
|
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;
|
CTX_DATA_END;
|
||||||
}
|
}
|
||||||
tot_change++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (ELEM(ob->type, OB_CURVE, OB_SURF)) {
|
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++;
|
tot_lib_error++;
|
||||||
} else {
|
} else {
|
||||||
if(centermode==2) {
|
if(centermode==2) {
|
||||||
VECCOPY(cent, give_cursor(scene, v3d));
|
copy_v3_v3(cent, give_cursor(scene, v3d));
|
||||||
invert_m4_m4(ob->imat, ob->obmat);
|
invert_m4_m4(ob->imat, ob->obmat);
|
||||||
mul_m4_v3(ob->imat, cent);
|
mul_m4_v3(ob->imat, cent);
|
||||||
|
|
||||||
@@ -956,6 +956,8 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
|
|||||||
}
|
}
|
||||||
|
|
||||||
tot_change++;
|
tot_change++;
|
||||||
|
cu->id.flag |= LIB_DOIT;
|
||||||
|
|
||||||
if(obedit) {
|
if(obedit) {
|
||||||
if (centermode==0) {
|
if (centermode==0) {
|
||||||
DAG_id_flush_update(&obedit->id, OB_RECALC_DATA);
|
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;
|
cu->yof /= cu->fsize;
|
||||||
|
|
||||||
tot_change++;
|
tot_change++;
|
||||||
|
cu->id.flag |= LIB_DOIT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(ob->type==OB_ARMATURE) {
|
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.
|
* Bone + object locations are handled there.
|
||||||
*/
|
*/
|
||||||
docenter_armature(scene, v3d, ob, centermode);
|
docenter_armature(scene, v3d, ob, centermode);
|
||||||
|
|
||||||
tot_change++;
|
tot_change++;
|
||||||
|
cu->id.flag |= LIB_DOIT;
|
||||||
|
|
||||||
where_is_object(scene, ob);
|
where_is_object(scene, ob);
|
||||||
ignore_parent_tx(bmain, scene, ob);
|
ignore_parent_tx(bmain, scene, ob);
|
||||||
@@ -1007,10 +1012,15 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ob->recalc= OB_RECALC_OB|OB_RECALC_DATA;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
CTX_DATA_END;
|
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) {
|
if (tot_change) {
|
||||||
DAG_ids_flush_update(0);
|
DAG_ids_flush_update(0);
|
||||||
|
Reference in New Issue
Block a user