[Bf-blender-cvs] [f59bbc85249] greasepencil-object: WIP: More work on fill using new drawing method
Antonio Vazquez
noreply at git.blender.org
Sun Jan 7 20:27:40 CET 2018
Commit: f59bbc85249eaa21dcd47e842aaf27ee2864f159
Author: Antonio Vazquez
Date: Sun Jan 7 18:09:36 2018 +0100
Branches: greasepencil-object
https://developer.blender.org/rBf59bbc85249eaa21dcd47e842aaf27ee2864f159
WIP: More work on fill using new drawing method
===================================================================
M source/blender/editors/gpencil/drawgpencil.c
M source/blender/editors/gpencil/gpencil_fill.c
M source/blender/editors/include/ED_gpencil.h
===================================================================
diff --git a/source/blender/editors/gpencil/drawgpencil.c b/source/blender/editors/gpencil/drawgpencil.c
index a96c3edf2ac..b031e45b8a9 100644
--- a/source/blender/editors/gpencil/drawgpencil.c
+++ b/source/blender/editors/gpencil/drawgpencil.c
@@ -1533,12 +1533,10 @@ void ED_gp_draw_primitives(const bContext *C, tGPDprimitive *tgpi, const int typ
glDisable(GL_BLEND);
}
-/* draw fill mask (used only while operator is running) */
-void ED_gp_draw_fill(const struct bContext *UNUSED(C), struct tGPDfill *UNUSED(tgpf))
+/* wrapper to draw strokes for filling operator */
+void ED_gp_draw_fill(tGPDdraw *tgpw)
{
- /* TODO: Not implemented yet */
- float color[4];
- UI_GetThemeColor3fv(TH_GP_VERTEX_SELECT, color);
+ gp_draw_strokes(tgpw);
}
/* loop over gpencil data layers, drawing them */
diff --git a/source/blender/editors/gpencil/gpencil_fill.c b/source/blender/editors/gpencil/gpencil_fill.c
index a452038d77d..b03d1e9c50e 100644
--- a/source/blender/editors/gpencil/gpencil_fill.c
+++ b/source/blender/editors/gpencil/gpencil_fill.c
@@ -128,16 +128,31 @@ static void gp_draw_basic_stroke(bGPDstroke *gps, const float diff_mat[4][4],
/* loop all layers */
static void gp_draw_datablock(tGPDfill *tgpf, float ink[4])
{
+ /* duplicated */
+ typedef enum etempFlags {
+ GP_DRAWDATA_NOSTATUS = (1 << 0), /* don't draw status info */
+ GP_DRAWDATA_ONLY3D = (1 << 1), /* only draw 3d-strokes */
+ } etempFlags;
+
Scene *scene = tgpf->scene;
Object *ob = tgpf->ob;
bGPdata *gpd = tgpf->gpd;
+ tGPDdraw tgpw;
+ tgpw.rv3d = tgpf->rv3d;
+ tgpw.ob = ob;
+ tgpw.gpd = gpd;
+ tgpw.offsx = 0;
+ tgpw.offsy = 0;
+ tgpw.winx = tgpf->ar->winx;
+ tgpw.winy = tgpf->ar->winy;
+ tgpw.dflag |= (GP_DRAWDATA_ONLY3D | GP_DRAWDATA_NOSTATUS);
+
glEnable(GL_BLEND);
- float diff_mat[4][4];
for (bGPDlayer *gpl = gpd->layers.first; gpl; gpl = gpl->next) {
/* calculate parent position */
- ED_gpencil_parent_location(ob, gpd, gpl, diff_mat);
+ ED_gpencil_parent_location(ob, gpd, gpl, tgpw.diff_mat);
/* don't draw layer if hidden */
if (gpl->flag & GP_LAYER_HIDE)
@@ -160,8 +175,22 @@ static void gp_draw_datablock(tGPDfill *tgpf, float ink[4])
continue;
}
+ tgpw.gps = gps;
+ tgpw.gpl = gpl;
+ tgpw.gpf = gpf;
+ tgpw.t_gpf = gpf;
+
+ tgpw.lthick = gpl->thickness;
+ tgpw.opacity = 1.0;
+ copy_v4_v4(tgpw.tintcolor, ink);
+ tgpw.onion = true;
+ tgpw.custonion = true;
+
+ //No dibuja nada
+ ED_gp_draw_fill(&tgpw);
+
/* 3D Lines - OpenGL primitives-based */
- gp_draw_basic_stroke(gps, diff_mat, gps->flag & GP_STROKE_CYCLIC, ink,
+ gp_draw_basic_stroke(gps, tgpw.diff_mat, gps->flag & GP_STROKE_CYCLIC, ink,
tgpf->flag, tgpf->fill_threshold);
}
}
diff --git a/source/blender/editors/include/ED_gpencil.h b/source/blender/editors/include/ED_gpencil.h
index b48ce8429c2..eebe7e7ef85 100644
--- a/source/blender/editors/include/ED_gpencil.h
+++ b/source/blender/editors/include/ED_gpencil.h
@@ -43,6 +43,7 @@ struct bGPDstroke;
struct bGPDpalette;
struct bGPDpalettecolor;
struct bGPDspoint;
+struct tGPDdraw;
struct ID;
struct Image;
struct BLI_Stack;
@@ -269,6 +270,7 @@ void ED_gpencil_draw_ex(struct RegionView3D *rv3d, struct Scene *scene, struct b
const int cfra, const char spacetype);
void ED_gp_draw_interpolation(const struct bContext *C, struct tGPDinterpolate *tgpi, const int type);
void ED_gp_draw_primitives(const struct bContext *C, struct tGPDprimitive *tgpi, const int type);
+void ED_gp_draw_fill(struct tGPDdraw *tgpw);
/* ----------- Grease-Pencil AnimEdit API ------------------ */
bool ED_gplayer_frames_looper(struct bGPDlayer *gpl, struct Scene *scene,
More information about the Bf-blender-cvs
mailing list