fix [#32353] 'Focus'(center) applied on a rig should only take visible bones into...
authorCampbell Barton <ideasman42@gmail.com>
Sat, 18 Aug 2012 14:27:48 +0000 (14:27 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Sat, 18 Aug 2012 14:27:48 +0000 (14:27 +0000)
build_files/cmake/config/blender_lite.cmake
source/blender/blenkernel/BKE_object.h
source/blender/blenkernel/intern/constraint.c
source/blender/blenkernel/intern/object.c
source/blender/editors/object/object_transform.c
source/blender/editors/physics/particle_edit.c
source/blender/editors/space_view3d/view3d_edit.c
source/blender/editors/space_view3d/view3d_view.c

index 06a8226..b834cd3 100644 (file)
@@ -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)
index 3aa7148..31642da 100644 (file)
@@ -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],
index 16edbc3..00130dd 100644 (file)
@@ -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) {
index 4f4ee3f..914e19b 100644 (file)
@@ -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,14 +2284,23 @@ 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) {
-                                       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);
+
+                                       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;
+                                       }
                                }
-                               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;
                                }
                        }
                }
index f943c83..9129d65 100644 (file)
@@ -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);
index d6cf463..72d2d67 100644 (file)
@@ -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;
        }
   
index 8b8adb1..310630a 100644 (file)
@@ -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;
                        }
index 693c7c5..93d7000 100644 (file)
@@ -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;