Merged changes in the trunk up to revision 49986.
[blender.git] / source / blender / blenkernel / intern / object.c
index 409e1e3921ad7dbc8050cb48738b3dc06c7cb701..bc6cdc949eb55ba4df8c4beab99a8f7d61958416 100644 (file)
@@ -2244,7 +2244,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];
@@ -2294,14 +2294,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:
@@ -2341,9 +2350,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;
        }
@@ -2353,7 +2362,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) {
@@ -2364,7 +2376,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;
                                }
                        }
                }