[Bf-blender-cvs] [958f34dd030] master: GPencil: Add support for Bound Box

Antonioya noreply at git.blender.org
Mon Mar 11 17:13:55 CET 2019


Commit: 958f34dd030d9a0ba7fee9534a0791141f361799
Author: Antonioya
Date:   Mon Mar 11 17:13:30 2019 +0100
Branches: master
https://developer.blender.org/rB958f34dd030d9a0ba7fee9534a0791141f361799

GPencil: Add support for Bound Box

The bound box was not calculated for grease pencil objects.

===================================================================

M	source/blender/blenkernel/intern/gpencil.c
M	source/blender/draw/engines/gpencil/gpencil_engine.c
M	source/blender/draw/modes/object_mode.c

===================================================================

diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c
index c9cb38fcc4e..88c4e1249e3 100644
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@ -1127,14 +1127,11 @@ static void boundbox_gpencil(Object *ob)
 /* get bounding box */
 BoundBox *BKE_gpencil_boundbox_get(Object *ob)
 {
-	bGPdata *gpd;
-
 	if (ELEM(NULL, ob, ob->data))
 		return NULL;
 
-	gpd = ob->data;
-	if ((ob->runtime.bb) && ((ob->runtime.bb->flag & BOUNDBOX_DIRTY) == 0) &&
-	    ((gpd->flag & GP_DATA_CACHE_IS_DIRTY) == 0))
+	bGPdata *gpd = (bGPdata *)ob->data;
+	if ((ob->runtime.bb) && ((gpd->flag & GP_DATA_CACHE_IS_DIRTY) == 0))
 	{
 		return ob->runtime.bb;
 	}
diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.c b/source/blender/draw/engines/gpencil/gpencil_engine.c
index 97b81e3ba1f..957be9ef1cd 100644
--- a/source/blender/draw/engines/gpencil/gpencil_engine.c
+++ b/source/blender/draw/engines/gpencil/gpencil_engine.c
@@ -583,7 +583,12 @@ void GPENCIL_cache_populate(void *vedata, Object *ob)
 	ToolSettings *ts = scene->toolsettings;
 	View3D *v3d = draw_ctx->v3d;
 
+	/* bound box object are not visible, only external box*/
 	if (ob->type == OB_GPENCIL && ob->data) {
+		if (ob->dt == OB_BOUNDBOX) {
+			return;
+		}
+
 		bGPdata *gpd = (bGPdata *)ob->data;
 
 		/* enable multisample and basic framebuffer creation */
diff --git a/source/blender/draw/modes/object_mode.c b/source/blender/draw/modes/object_mode.c
index 63932cd986f..3c64fe14100 100644
--- a/source/blender/draw/modes/object_mode.c
+++ b/source/blender/draw/modes/object_mode.c
@@ -2732,7 +2732,7 @@ static void DRW_shgroup_bounds(OBJECT_ShadingGroupList *sgl, Object *ob, int the
 	BoundBox *bb = BKE_object_boundbox_get(ob);
 
 	if (!ELEM(ob->type, OB_MESH, OB_CURVE, OB_SURF, OB_FONT,
-	                    OB_MBALL, OB_ARMATURE, OB_LATTICE))
+	                    OB_MBALL, OB_ARMATURE, OB_LATTICE, OB_GPENCIL))
 	{
 		const float min[3] = {-1.0f, -1.0f, -1.0f}, max[3] = {1.0f, 1.0f, 1.0f};
 		bb = &bb_local;



More information about the Bf-blender-cvs mailing list