[Bf-blender-cvs] [23ffb562b63] greasepencil-object: Move GPD runtime fields to runtime struct
Antonio Vazquez
noreply at git.blender.org
Thu Jun 28 17:25:41 CEST 2018
Commit: 23ffb562b63ca116df7e291af391789a0aea9e00
Author: Antonio Vazquez
Date: Thu Jun 28 17:23:27 2018 +0200
Branches: greasepencil-object
https://developer.blender.org/rB23ffb562b63ca116df7e291af391789a0aea9e00
Move GPD runtime fields to 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/draw/engines/gpencil/gpencil_engine.c
M source/blender/editors/gpencil/annotate_draw.c
M source/blender/editors/gpencil/annotate_paint.c
M source/blender/editors/gpencil/drawgpencil.c
M source/blender/editors/gpencil/gpencil_paint.c
M source/blender/editors/gpencil/gpencil_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 c644630418a..9eee6139892 100644
--- a/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
+++ b/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
@@ -204,8 +204,8 @@ Gwn_Batch *DRW_gpencil_get_buffer_stroke_geom(bGPdata *gpd, float matrix[4][4],
ToolSettings *ts = scene->toolsettings;
Object *ob = draw_ctx->obact;
- tGPspoint *points = gpd->sbuffer;
- int totpoints = gpd->sbuffer_size;
+ tGPspoint *points = gpd->runtime.sbuffer;
+ int totpoints = gpd->runtime.sbuffer_size;
static Gwn_VertFormat format = { 0 };
static uint pos_id, color_id, thickness_id, uvdata_id;
@@ -238,17 +238,17 @@ Gwn_Batch *DRW_gpencil_get_buffer_stroke_geom(bGPdata *gpd, float matrix[4][4],
if (totpoints > 1) {
ED_gpencil_tpoint_to_point(ar, origin, &points[1], &pt2);
gpencil_set_stroke_point(vbo, matrix, &pt2, idx,
- pos_id, color_id, thickness_id, uvdata_id, thickness, gpd->scolor);
+ pos_id, color_id, thickness_id, uvdata_id, thickness, gpd->runtime.scolor);
}
else {
gpencil_set_stroke_point(vbo, matrix, &pt, idx,
- pos_id, color_id, thickness_id, uvdata_id, thickness, gpd->scolor);
+ pos_id, color_id, thickness_id, uvdata_id, thickness, gpd->runtime.scolor);
}
idx++;
}
/* set point */
gpencil_set_stroke_point(vbo, matrix, &pt, idx,
- pos_id, color_id, thickness_id, uvdata_id, thickness, gpd->scolor);
+ pos_id, color_id, thickness_id, uvdata_id, thickness, gpd->runtime.scolor);
idx++;
}
@@ -256,11 +256,11 @@ Gwn_Batch *DRW_gpencil_get_buffer_stroke_geom(bGPdata *gpd, float matrix[4][4],
if (totpoints > 2) {
ED_gpencil_tpoint_to_point(ar, origin, &points[totpoints - 2], &pt2);
gpencil_set_stroke_point(vbo, matrix, &pt2, idx,
- pos_id, color_id, thickness_id, uvdata_id, thickness, gpd->scolor);
+ pos_id, color_id, thickness_id, uvdata_id, thickness, gpd->runtime.scolor);
}
else {
gpencil_set_stroke_point(vbo, matrix, &pt, idx,
- pos_id, color_id, thickness_id, uvdata_id, thickness, gpd->scolor);
+ pos_id, color_id, thickness_id, uvdata_id, thickness, gpd->runtime.scolor);
}
return GWN_batch_create_ex(GWN_PRIM_LINE_STRIP_ADJ, vbo, NULL, GWN_BATCH_OWNS_VBO);
@@ -277,8 +277,8 @@ Gwn_Batch *DRW_gpencil_get_buffer_point_geom(bGPdata *gpd, float matrix[4][4], s
ToolSettings *ts = scene->toolsettings;
Object *ob = draw_ctx->obact;
- tGPspoint *points = gpd->sbuffer;
- int totpoints = gpd->sbuffer_size;
+ tGPspoint *points = gpd->runtime.sbuffer;
+ int totpoints = gpd->runtime.sbuffer_size;
static Gwn_VertFormat format = { 0 };
static uint pos_id, color_id, thickness_id, uvdata_id;
@@ -308,7 +308,8 @@ Gwn_Batch *DRW_gpencil_get_buffer_point_geom(bGPdata *gpd, float matrix[4][4], s
/* set point */
gpencil_set_stroke_point(vbo, matrix, &pt, idx,
- pos_id, color_id, thickness_id, uvdata_id, thickness, gpd->scolor);
+ pos_id, color_id, thickness_id, uvdata_id,
+ thickness, gpd->runtime.scolor);
idx++;
}
@@ -322,8 +323,8 @@ Gwn_Batch *DRW_gpencil_get_buffer_fill_geom(bGPdata *gpd)
return NULL;
}
- const tGPspoint *points = gpd->sbuffer;
- int totpoints = gpd->sbuffer_size;
+ const tGPspoint *points = gpd->runtime.sbuffer;
+ int totpoints = gpd->runtime.sbuffer_size;
if (totpoints < 3) {
return NULL;
}
@@ -378,7 +379,7 @@ Gwn_Batch *DRW_gpencil_get_buffer_fill_geom(bGPdata *gpd)
tpt = &points[tmp_triangles[i][j]];
ED_gpencil_tpoint_to_point(ar, origin, tpt, &pt);
GWN_vertbuf_attr_set(vbo, pos_id, idx, &pt.x);
- GWN_vertbuf_attr_set(vbo, color_id, idx, gpd->sfill);
+ GWN_vertbuf_attr_set(vbo, color_id, idx, gpd->runtime.sfill);
idx++;
}
}
diff --git a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
index 2cf9c1a95ab..8df19495f89 100644
--- a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
+++ b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
@@ -900,14 +900,14 @@ void DRW_gpencil_populate_buffer_strokes(GPENCIL_e_data *e_data, void *vedata, T
/* Check if may need to draw the active stroke cache, only if this layer is the active layer
* that is being edited. (Stroke buffer is currently stored in gp-data)
*/
- if (ED_gpencil_session_active() && (gpd->sbuffer_size > 0)) {
- if ((gpd->sbuffer_sflag & GP_STROKE_ERASER) == 0) {
+ if (ED_gpencil_session_active() && (gpd->runtime.sbuffer_size > 0)) {
+ if ((gpd->runtime.sbuffer_sflag & GP_STROKE_ERASER) == 0) {
/* It should also be noted that sbuffer contains temporary point types
* i.e. tGPspoints NOT bGPDspoints
*/
short lthick = brush->size * obscale;
/* if only one point, don't need to draw buffer because the user has no time to see it */
- if (gpd->sbuffer_size > 1) {
+ if (gpd->runtime.sbuffer_size > 1) {
if ((gp_style) && (gp_style->mode == GP_STYLE_MODE_LINE)) {
stl->g_data->shgrps_drawing_stroke = DRW_gpencil_shgroup_stroke_create(
e_data, vedata, psl->drawing_pass, e_data->gpencil_stroke_sh, NULL, gpd, gp_style, -1, false);
@@ -918,7 +918,7 @@ void DRW_gpencil_populate_buffer_strokes(GPENCIL_e_data *e_data, void *vedata, T
}
/* use unit matrix because the buffer is in screen space and does not need conversion */
- if (gpd->mode == GP_STYLE_MODE_LINE) {
+ if (gpd->runtime.mode == GP_STYLE_MODE_LINE) {
stl->g_data->batch_buffer_stroke = DRW_gpencil_get_buffer_stroke_geom(
gpd, stl->storage->unit_matrix, lthick);
}
@@ -932,12 +932,12 @@ void DRW_gpencil_populate_buffer_strokes(GPENCIL_e_data *e_data, void *vedata, T
stl->g_data->batch_buffer_stroke,
stl->storage->unit_matrix);
- if ((gpd->sbuffer_size >= 3) && (gpd->sfill[3] > GPENCIL_ALPHA_OPACITY_THRESH) &&
- ((gpd->sbuffer_sflag & GP_STROKE_NOFILL) == 0))
+ if ((gpd->runtime.sbuffer_size >= 3) && (gpd->runtime.sfill[3] > GPENCIL_ALPHA_OPACITY_THRESH) &&
+ ((gpd->runtime.sbuffer_sflag & GP_STROKE_NOFILL) == 0))
{
/* if not solid, fill is simulated with solid color */
- if (gpd->bfill_style > 0) {
- gpd->sfill[3] = 0.5f;
+ if (gpd->runtime.bfill_style > 0) {
+ gpd->runtime.sfill[3] = 0.5f;
}
stl->g_data->shgrps_drawing_fill = DRW_shgroup_create(
e_data->gpencil_drawing_fill_sh, psl->drawing_pass);
diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.c b/source/blender/draw/engines/gpencil/gpencil_engine.c
index 0cdbef47b59..9e794eb3104 100644
--- a/source/blender/draw/engines/gpencil/gpencil_engine.c
+++ b/source/blender/draw/engines/gpencil/gpencil_engine.c
@@ -332,7 +332,9 @@ void GPENCIL_cache_init(void *vedata)
(obact_gpd->flag & GP_DATA_STROKE_PAINTMODE) &&
(stl->storage->playing == 0))
{
- if (((obact_gpd->sbuffer_sflag & GP_STROKE_ERASER) == 0) && (obact_gpd->sbuffer_size > 1)) {
+ if (((obact_gpd->runtime.sbuffer_sflag & GP_STROKE_ERASER) == 0) &&
+ (obact_gpd->runtime.sbuffer_size > 1))
+ {
stl->g_data->session_flag = GP_DRW_PAINT_PAINTING;
}
else {
@@ -634,7 +636,7 @@ void GPENCIL_draw_scene(void *ved)
MULTISAMPLE_GP_SYNC_DISABLE(stl->storage->multisamples, fbl, fbl->temp_fb_a, txl);
}
/* Current buffer drawing */
- if ((!is_render) && (gpd->sbuffer_size > 0)) {
+ if ((!is_render) && (gpd->runtime.sbuffer_size > 0)) {
DRW_draw_pass(psl->drawing_pass);
}
diff --git a/source/blender/editors/gpencil/annotate_draw.c b/source/blender/editors/gpencil/annotate_draw.c
index 03e02a6a762..6a769c62c67 100644
--- a/source/blender/editors/gpencil/annotate_draw.c
+++ b/source/blender/editors/gpencil/annotate_draw.c
@@ -820,7 +820,9 @@ static void gp_draw_data_layers(
* It should also be noted that sbuffer contains temporary point types
* i.e. tGPspoints NOT bGPDspoints
*/
- gp_draw_stroke_buffer(gpd->sbuffer, gpd->sbuffer_size, lthick, dflag, gpd->sbuffer_sflag, gpl->color);
+ gp_draw_stroke_buffer(gpd->runtime.sbuffer,
+ gpd->runtime.sbuffer_size, lthick,
+ dflag, gpd->runtime.sbuffer_sflag, gpl->color);
}
}
}
diff --git a/source/blender/editors/gpencil/annotate_paint.c b/source/blender/editors/gpencil/annotate_paint.c
index 311e9ca5b50..efe2c7978df 100644
--- a/source/blender/editors/gpencil/annotate_paint.c
+++ b/source/blender/editors/gpencil/annotate_paint.c
@@ -221,7 +221,7 @@ static int gpencil_draw_poll(bContext *C)
static bool gpencil_project_check(tGPsdata *p)
{
bGPdata *gpd = p->gpd;
- return ((gpd->sbuffer_sflag & GP_STROKE_3DSPACE) && (*p->align_flag & (GP_PROJECT_DEPTH_VIEW | GP_PROJECT_DEPTH_STROKE)));
+ return ((gpd->runtime.sbuffer_sflag & GP_STROKE_3DSPACE) && (*p->align_flag & (GP_PROJECT_DEPTH_VIEW | GP_PROJECT_DEPTH_STROKE)));
}
/* ******************************************* */
@@ -248,7 +248,7 @@ static bool gp_stroke_filtermval(tGPsdata *p, const int mval[2], int pmval[2])
int dy = abs(mval[1] - pmval[1]);
/* if buffer is empty, just let this go through (i.e. so that dots will work) */
- if (p->gpd->sbuffer_size == 0)
+ if (p->gpd->runtime.sbuffer_size == 0)
return true;
/* check if mouse moved at least certain distance on both axes (best case)
@@ -309,7 +309,7 @@ static void gp_reproject_toplane(tGPsdata *p, bGPDstroke *gps)
RegionView3D *rv3d = p->ar->regiondata;
/* verify the stroke mode is CURSOR 3d space mode */
- if ((gpd->sbuffer_sflag & GP_STROKE_3DSPACE) == 0) {
+ if ((gpd->runtime.sbuffer_sflag & GP_STROKE_3DSPACE) == 0) {
return;
}
if ((*p->align_flag & GP_PROJECT_VIEWSPACE) == 0) {
@@ -334,7 +334,7 @@ static void gp_stroke_convertcoords(tGPsdata *p, const int mval[2], float out[3]
bGPdata *gpd = p->gpd;
/* in 3d-space - pt->x/y/z are 3 side-by-side floats */
- if (gpd->sbuffer_sflag & GP_STROKE_3DSPACE) {
+ if (gpd->runtime.sbuffer_sflag & GP_STROKE_3DSPACE) {
if (gpencil_project_check(p) && (ED_view3d_autodist_simple(p->ar, mval, out, 0, depth))) {
/* projecting onto 3D-Geometr
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list