[Bf-blender-cvs] [b038e849a7c] greasepencil-object: Move bGPDframe runtime data to bGPDframe_runtime struct

Antonio Vazquez noreply at git.blender.org
Sat May 12 18:51:55 CEST 2018


Commit: b038e849a7ccb48d5722a8c79a53f32606aa9098
Author: Antonio Vazquez
Date:   Sat May 12 18:47:38 2018 +0200
Branches: greasepencil-object
https://developer.blender.org/rBb038e849a7ccb48d5722a8c79a53f32606aa9098

Move bGPDframe runtime data to bGPDframe_runtime struct

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

M	source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
M	source/blender/draw/engines/gpencil/gpencil_draw_utils.c
M	source/blender/makesdna/DNA_gpencil_types.h

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

diff --git a/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c b/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
index 35de2cde774..7db7708fd6f 100644
--- a/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
+++ b/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
@@ -157,35 +157,35 @@ Gwn_Batch *DRW_gpencil_get_stroke_geom(bGPDframe *gpf, bGPDstroke *gps, short th
 		/* first point for adjacency (not drawn) */
 		if (i == 0) {
 			if (gps->flag & GP_STROKE_CYCLIC && totpoints > 2) {
-				gpencil_set_stroke_point(vbo, gpf->viewmatrix, &points[totpoints - 1], idx, 
+				gpencil_set_stroke_point(vbo, gpf->runtime.viewmatrix, &points[totpoints - 1], idx, 
 										 pos_id, color_id, thickness_id, uvdata_id, thickness, ink);
 				idx++;
 			}
 			else {
-				gpencil_set_stroke_point(vbo, gpf->viewmatrix, &points[1], idx, 
+				gpencil_set_stroke_point(vbo, gpf->runtime.viewmatrix, &points[1], idx, 
 										 pos_id, color_id, thickness_id, uvdata_id, thickness, ink);
 				idx++;
 			}
 		}
 		/* set point */
-		gpencil_set_stroke_point(vbo, gpf->viewmatrix, pt, idx, 
+		gpencil_set_stroke_point(vbo, gpf->runtime.viewmatrix, pt, idx, 
 								 pos_id, color_id, thickness_id, uvdata_id, thickness, ink);
 		idx++;
 	}
 
 	if (gps->flag & GP_STROKE_CYCLIC && totpoints > 2) {
 		/* draw line to first point to complete the cycle */
-		gpencil_set_stroke_point(vbo, gpf->viewmatrix, &points[0], idx, 
+		gpencil_set_stroke_point(vbo, gpf->runtime.viewmatrix, &points[0], idx, 
 								 pos_id, color_id, thickness_id, uvdata_id, thickness, ink);
 		idx++;
 		/* now add adjacency point (not drawn) */
-		gpencil_set_stroke_point(vbo, gpf->viewmatrix, &points[1], idx, 
+		gpencil_set_stroke_point(vbo, gpf->runtime.viewmatrix, &points[1], idx, 
 								 pos_id, color_id, thickness_id, uvdata_id, thickness, ink);
 		idx++;
 	}
 	/* last adjacency point (not drawn) */
 	else {
-		gpencil_set_stroke_point(vbo, gpf->viewmatrix, &points[totpoints - 2], idx, 
+		gpencil_set_stroke_point(vbo, gpf->runtime.viewmatrix, &points[totpoints - 2], idx, 
 								 pos_id, color_id, thickness_id, uvdata_id, thickness, ink);
 	}
 
diff --git a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
index a7bd28a79e2..d4f93b9b7af 100644
--- a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
+++ b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
@@ -530,7 +530,7 @@ static void gpencil_add_fill_shgroup(GpencilBatchCache *cache, DRWShadingGroup *
 				gpencil_batch_cache_check_free_slots(ob);
 				cache->batch_fill[cache->cache_idx] = DRW_gpencil_get_fill_geom(ob, gps, color);
 			}
-			DRW_shgroup_call_add(fillgrp, cache->batch_fill[cache->cache_idx], gpf->viewmatrix);
+			DRW_shgroup_call_add(fillgrp, cache->batch_fill[cache->cache_idx], gpf->runtime.viewmatrix);
 		}
 	}
 }
@@ -579,7 +579,7 @@ static void gpencil_add_stroke_shgroup(GpencilBatchCache *cache, DRWShadingGroup
 			cache->batch_stroke[cache->cache_idx] = DRW_gpencil_get_point_geom(gps, sthickness, ink);
 		}
 	}
-	DRW_shgroup_call_add(strokegrp, cache->batch_stroke[cache->cache_idx], gpf->viewmatrix);
+	DRW_shgroup_call_add(strokegrp, cache->batch_stroke[cache->cache_idx], gpf->runtime.viewmatrix);
 }
 
 /* add edit points shading group to pass */
@@ -604,7 +604,7 @@ static void gpencil_add_editpoints_shgroup(
 		}
 		if (cache->batch_edlin[cache->cache_idx]) {
 			if ((obact) && (obact == ob) && (gpd->flag & GP_DATA_STROKE_SHOW_EDIT_LINES)) {
-				DRW_shgroup_call_add(stl->g_data->shgrps_edit_line, cache->batch_edlin[cache->cache_idx], gpf->viewmatrix);
+				DRW_shgroup_call_add(stl->g_data->shgrps_edit_line, cache->batch_edlin[cache->cache_idx], gpf->runtime.viewmatrix);
 			}
 		}
 		/* edit points */
@@ -617,7 +617,7 @@ static void gpencil_add_editpoints_shgroup(
 				if (cache->batch_edit[cache->cache_idx]) {
 					if ((obact) && (obact == ob)) {
 						/* edit pass */
-						DRW_shgroup_call_add(stl->g_data->shgrps_edit_point, cache->batch_edit[cache->cache_idx], gpf->viewmatrix);
+						DRW_shgroup_call_add(stl->g_data->shgrps_edit_point, cache->batch_edit[cache->cache_idx], gpf->runtime.viewmatrix);
 					}
 				}
 			}
@@ -635,7 +635,7 @@ static void gpencil_draw_onion_strokes(GpencilBatchCache *cache, GPENCIL_e_data
 
 	/* get parent matrix and save as static data */
 	ED_gpencil_parent_location(ob, gpd, gpl, viewmatrix);
-	copy_m4_m4(gpf->viewmatrix, viewmatrix);
+	copy_m4_m4(gpf->runtime.viewmatrix, viewmatrix);
 
 	for (bGPDstroke *gps = gpf->strokes.first; gps; gps = gps->next) {
 		
@@ -694,7 +694,7 @@ static void gpencil_draw_strokes(GpencilBatchCache *cache, GPENCIL_e_data *e_dat
 
 	/* get parent matrix and save as static data */
 	ED_gpencil_parent_location(ob, gpd, gpl, viewmatrix);
-	copy_m4_m4(derived_gpf->viewmatrix, viewmatrix);
+	copy_m4_m4(derived_gpf->runtime.viewmatrix, viewmatrix);
 
 	/* apply geometry modifiers */
 	if ((cache->is_dirty) && (ob->modifiers.first) && (!is_multiedit)) {
diff --git a/source/blender/makesdna/DNA_gpencil_types.h b/source/blender/makesdna/DNA_gpencil_types.h
index 00478c8d85c..bd53fb6ce1c 100644
--- a/source/blender/makesdna/DNA_gpencil_types.h
+++ b/source/blender/makesdna/DNA_gpencil_types.h
@@ -213,6 +213,10 @@ typedef enum eGPDstroke_Flag {
 /* Grease-Pencil Annotations - 'Frame'
  *	-> Acts as storage for the 'image' formed by strokes
  */
+typedef struct bGPDframe_runtime {
+	float viewmatrix[4][4];     /* parent matrix for drawing */
+} bGPDframe_runtime;
+
 typedef struct bGPDframe {
 	struct bGPDframe *next, *prev;
 	
@@ -222,7 +226,8 @@ typedef struct bGPDframe {
 	
 	short flag;			/* temp settings */
 	short key_type;		/* keyframe type (eBezTriple_KeyframeType) */
-	float viewmatrix[4][4];     /* parent matrix for drawing */
+
+	bGPDframe_runtime runtime;
 } bGPDframe;
 
 /* bGPDframe->flag */



More information about the Bf-blender-cvs mailing list