GPencil: Include gpencil objects in BKE_object_minmax
authorCampbell Barton <ideasman42@gmail.com>
Tue, 19 Mar 2019 13:05:58 +0000 (00:05 +1100)
committerCampbell Barton <ideasman42@gmail.com>
Tue, 19 Mar 2019 13:12:16 +0000 (00:12 +1100)
Also remove redundant check for meshes.

source/blender/blenkernel/intern/object.c

index f7a7197..66b888c 100644 (file)
@@ -2762,6 +2762,20 @@ void BKE_object_minmax(Object *ob, float min_r[3], float max_r[3], const bool us
                        changed = true;
                        break;
                }
+               case OB_MESH:
+               {
+                       bb = *BKE_mesh_boundbox_get(ob);
+                       BKE_boundbox_minmax(&bb, ob->obmat, min_r, max_r);
+                       changed = true;
+                       break;
+               }
+               case OB_GPENCIL:
+               {
+                       bb = *BKE_gpencil_boundbox_get(ob);
+                       BKE_boundbox_minmax(&bb, ob->obmat, min_r, max_r);
+                       changed = true;
+                       break;
+               }
                case OB_LATTICE:
                {
                        Lattice *lt = ob->data;
@@ -2784,17 +2798,6 @@ void BKE_object_minmax(Object *ob, float min_r[3], float max_r[3], const bool us
                        changed = BKE_pose_minmax(ob, min_r, max_r, use_hidden, false);
                        break;
                }
-               case OB_MESH:
-               {
-                       Mesh *me = BKE_mesh_from_object(ob);
-
-                       if (me) {
-                               bb = *BKE_mesh_boundbox_get(ob);
-                               BKE_boundbox_minmax(&bb, ob->obmat, min_r, max_r);
-                               changed = true;
-                       }
-                       break;
-               }
                case OB_MBALL:
                {
                        float ob_min[3], ob_max[3];