Fix T58913 Won't focus on Grease Pencil
authorAntonioya <blendergit@gmail.com>
Fri, 7 Dec 2018 09:42:14 +0000 (10:42 +0100)
committerAntonioya <blendergit@gmail.com>
Fri, 7 Dec 2018 09:42:14 +0000 (10:42 +0100)
When the datablock was empty, the center was not calculated. Now it uses the object location.

source/blender/editors/space_view3d/view3d_edit.c

index 6df4b3f82b9944133aa83d9962715bb5b7537aee..11927d6d53049fccefabc370eb0208107fbec3d1 100644 (file)
@@ -2848,6 +2848,12 @@ static int viewselected_exec(bContext *C, wmOperator *op)
        }
        else if (ob_eval && (ob_eval->type == OB_GPENCIL)) {
                ok |= BKE_gpencil_data_minmax(ob_eval, gpd, min, max);
+               /* if no strokes, use object location */
+               if ((ob_eval) && (!ok)) {
+                       copy_v3_v3(min, ob_eval->obmat[3]);
+                       copy_v3_v3(max, ob_eval->obmat[3]);
+                       ok = true;
+               }
        }
        else if (is_face_map) {
                ok = WM_gizmomap_minmax(ar->gizmo_map, true, true, min, max);