fix [#32353] 'Focus'(center) applied on a rig should only take visible bones into account

This commit is contained in:
Campbell Barton 2012-08-18 14:27:48 +00:00
parent 47e313ec0c
commit e982e9b04f
8 changed files with 34 additions and 20 deletions

@ -18,6 +18,7 @@ set(WITH_LIBMV OFF CACHE FORCE BOOL)
set(WITH_GAMEENGINE OFF CACHE FORCE BOOL)
set(WITH_COMPOSITOR OFF CACHE FORCE BOOL)
set(WITH_GHOST_XDND OFF CACHE FORCE BOOL)
set(WITH_IK_SOLVER OFF CACHE FORCE BOOL)
set(WITH_IK_ITASC OFF CACHE FORCE BOOL)
set(WITH_IMAGE_CINEON OFF CACHE FORCE BOOL)
set(WITH_IMAGE_DDS OFF CACHE FORCE BOOL)

@ -109,8 +109,8 @@ struct BoundBox *BKE_object_boundbox_get(struct Object *ob);
void BKE_object_dimensions_get(struct Object *ob, float vec[3]);
void BKE_object_dimensions_set(struct Object *ob, const float *value);
void BKE_object_boundbox_flag(struct Object *ob, int flag, int set);
void BKE_object_minmax(struct Object *ob, float r_min[3], float r_max[3]);
int BKE_object_minmax_dupli(struct Scene *scene, struct Object *ob, float r_min[3], float r_max[3]);
void BKE_object_minmax(struct Object *ob, float r_min[3], float r_max[3], const short use_hidden);
int BKE_object_minmax_dupli(struct Scene *scene, struct Object *ob, float r_min[3], float r_max[3], const short use_hidden);
/* sometimes min-max isn't enough, we need to loop over each point */
void BKE_object_foreach_display_point(struct Object *ob, float obmat[4][4],

@ -3114,7 +3114,8 @@ static void clampto_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *tar
copy_v3_v3(ownLoc, obmat[3]);
INIT_MINMAX(curveMin, curveMax);
BKE_object_minmax(ct->tar, curveMin, curveMax);
/* XXX - don't think this is good calling this here - campbell */
BKE_object_minmax(ct->tar, curveMin, curveMax, TRUE);
/* get targetmatrix */
if (cu->path && cu->path->data) {

@ -2234,7 +2234,7 @@ void BKE_object_dimensions_set(Object *ob, const float *value)
}
}
void BKE_object_minmax(Object *ob, float min_r[3], float max_r[3])
void BKE_object_minmax(Object *ob, float min_r[3], float max_r[3], const short use_hidden)
{
BoundBox bb;
float vec[3];
@ -2284,15 +2284,24 @@ void BKE_object_minmax(Object *ob, float min_r[3], float max_r[3])
break;
case OB_ARMATURE:
if (ob->pose) {
bArmature *arm = ob->data;
bPoseChannel *pchan;
for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {
if ((use_hidden == FALSE) && (PBONE_VISIBLE(arm, pchan->bone) == FALSE)) {
/* pass */
}
else {
mul_v3_m4v3(vec, ob->obmat, pchan->pose_head);
minmax_v3v3_v3(min_r, max_r, vec);
mul_v3_m4v3(vec, ob->obmat, pchan->pose_tail);
minmax_v3v3_v3(min_r, max_r, vec);
}
change = TRUE;
}
}
}
break;
case OB_MESH:
{
@ -2331,9 +2340,9 @@ void BKE_object_minmax(Object *ob, float min_r[3], float max_r[3])
}
}
int BKE_object_minmax_dupli(Scene *scene, Object *ob, float r_min[3], float r_max[3])
int BKE_object_minmax_dupli(Scene *scene, Object *ob, float r_min[3], float r_max[3], const short use_hidden)
{
int ok = 0;
int ok = FALSE;
if ((ob->transflag & OB_DUPLI) == 0) {
return ok;
}
@ -2343,7 +2352,10 @@ int BKE_object_minmax_dupli(Scene *scene, Object *ob, float r_min[3], float r_ma
lb = object_duplilist(scene, ob);
for (dob = lb->first; dob; dob = dob->next) {
if (dob->no_draw == 0) {
if ((use_hidden == FALSE) && (dob->no_draw != 0)) {
/* pass */
}
else {
BoundBox *bb = BKE_object_boundbox_get(dob->ob);
if (bb) {
@ -2354,7 +2366,7 @@ int BKE_object_minmax_dupli(Scene *scene, Object *ob, float r_min[3], float r_ma
minmax_v3v3_v3(r_min, r_max, vec);
}
ok = 1;
ok = TRUE;
}
}
}

@ -759,7 +759,7 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
float min[3], max[3];
/* only bounds support */
INIT_MINMAX(min, max);
BKE_object_minmax_dupli(scene, ob, min, max);
BKE_object_minmax_dupli(scene, ob, min, max, TRUE);
mid_v3_v3v3(cent, min, max);
invert_m4_m4(ob->imat, ob->obmat);
mul_m4_v3(ob->imat, cent);

@ -4111,7 +4111,7 @@ int PE_minmax(Scene *scene, float min[3], float max[3])
}
if (!ok) {
BKE_object_minmax(ob, min, max);
BKE_object_minmax(ob, min, max, TRUE);
ok= 1;
}

@ -2072,7 +2072,7 @@ static int view3d_all_exec(bContext *C, wmOperator *op) /* was view3d_home() in
continue;
}
BKE_object_minmax(base->object, min, max);
BKE_object_minmax(base->object, min, max, FALSE);
}
}
if (!onedone) {
@ -2218,8 +2218,8 @@ static int viewselected_exec(bContext *C, wmOperator *UNUSED(op))
}
/* account for duplis */
if (BKE_object_minmax_dupli(scene, base->object, min, max) == 0)
BKE_object_minmax(base->object, min, max); /* use if duplis not found */
if (BKE_object_minmax_dupli(scene, base->object, min, max, FALSE) == 0)
BKE_object_minmax(base->object, min, max, FALSE); /* use if duplis not found */
ok = 1;
}

@ -1409,7 +1409,7 @@ static int view3d_localview_init(Main *bmain, Scene *scene, ScrArea *sa, ReportL
}
else {
if (scene->obedit) {
BKE_object_minmax(scene->obedit, min, max);
BKE_object_minmax(scene->obedit, min, max, FALSE);
ok = TRUE;
@ -1419,7 +1419,7 @@ static int view3d_localview_init(Main *bmain, Scene *scene, ScrArea *sa, ReportL
else {
for (base = FIRSTBASE; base; base = base->next) {
if (TESTBASE(v3d, base)) {
BKE_object_minmax(base->object, min, max);
BKE_object_minmax(base->object, min, max, FALSE);
base->lay |= locallay;
base->object->lay = base->lay;
ok = TRUE;