diff options
author | Joshua Leung <aligorith@gmail.com> | 2016-02-08 16:44:02 +0300 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2016-02-08 16:45:36 +0300 |
commit | 52668c56b74f75c45a6b5176704dfd168fd3e6ac (patch) | |
tree | c818559d81985570dafa5ea746d25740af37b669 /source/blender/editors/gpencil | |
parent | 4bc070a5193f927551a7c2aebb8c6306308bee4e (diff) |
GPencil: Layers with alpha = 0 should not be editable
* Added a new API function to test if a GPencil layer is visible or not
* Replaced all editability checks with this new "super check"
* Replaced all magic number thresholds for opacity visiblity with a single define
Diffstat (limited to 'source/blender/editors/gpencil')
-rw-r--r-- | source/blender/editors/gpencil/drawgpencil.c | 2 | ||||
-rw-r--r-- | source/blender/editors/gpencil/gpencil_brush.c | 4 | ||||
-rw-r--r-- | source/blender/editors/gpencil/gpencil_edit.c | 2 | ||||
-rw-r--r-- | source/blender/editors/gpencil/gpencil_paint.c | 4 |
4 files changed, 5 insertions, 7 deletions
diff --git a/source/blender/editors/gpencil/drawgpencil.c b/source/blender/editors/gpencil/drawgpencil.c index 66d86285470..b5d9283f6c6 100644 --- a/source/blender/editors/gpencil/drawgpencil.c +++ b/source/blender/editors/gpencil/drawgpencil.c @@ -993,7 +993,7 @@ static void gp_draw_data_layers(bGPdata *gpd, int offsx, int offsy, int winx, in /* fill strokes... */ // XXX: this is not a very good limit - GP_DRAWFLAG_APPLY((gpl->fill[3] > 0.001f), GP_DRAWDATA_FILL); + GP_DRAWFLAG_APPLY((gpl->fill[3] > GPENCIL_ALPHA_OPACITY_THRESH), GP_DRAWDATA_FILL); #undef GP_DRAWFLAG_APPLY /* draw 'onionskins' (frame left + right) */ diff --git a/source/blender/editors/gpencil/gpencil_brush.c b/source/blender/editors/gpencil/gpencil_brush.c index 0d1698e9ec7..ef80f25bb9b 100644 --- a/source/blender/editors/gpencil/gpencil_brush.c +++ b/source/blender/editors/gpencil/gpencil_brush.c @@ -1118,9 +1118,7 @@ static void gpsculpt_brush_init_stroke(tGP_BrushEditData *gso) /* go through each layer, and ensure that we've got a valid frame to use */ for (gpl = gpd->layers.first; gpl; gpl = gpl->next) { /* only editable and visible layers are considered */ - if ((gpl->flag & (GP_LAYER_HIDE | GP_LAYER_LOCKED)) == 0 && - (gpl->actframe != NULL)) - { + if (gpencil_layer_is_editable(gpl) && (gpl->actframe != NULL)) { bGPDframe *gpf = gpl->actframe; /* Make a new frame to work on if the layer's frame and the current scene frame don't match up diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c index 4852723c747..03d5ed3e24f 100644 --- a/source/blender/editors/gpencil/gpencil_edit.c +++ b/source/blender/editors/gpencil/gpencil_edit.c @@ -391,7 +391,7 @@ static int gp_strokes_paste_exec(bContext *C, wmOperator *op) /* no active layer - let's just create one */ gpl = gpencil_layer_addnew(gpd, DATA_("GP_Layer"), true); } - else if (gpl->flag & (GP_LAYER_HIDE | GP_LAYER_LOCKED)) { + else if (gpencil_layer_is_editable(gpl) == false) { BKE_report(op->reports, RPT_ERROR, "Can not paste strokes when active layer is hidden or locked"); return OPERATOR_CANCELLED; } diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c index ab6253c5cdb..b76ed90a0f1 100644 --- a/source/blender/editors/gpencil/gpencil_paint.c +++ b/source/blender/editors/gpencil/gpencil_paint.c @@ -931,7 +931,7 @@ static void gp_stroke_doeraser(tGPsdata *p) bGPDframe *gpf = gpl->actframe; /* only affect layer if it's editable (and visible) */ - if (gpl->flag & (GP_LAYER_HIDE | GP_LAYER_LOCKED)) { + if (gpencil_layer_is_editable(gpl) == false) { continue; } else if (gpf == NULL) { @@ -1220,7 +1220,7 @@ static void gp_paint_initstroke(tGPsdata *p, eGPencil_PaintModes paintmode) bGPDlayer *gpl; for (gpl = p->gpd->layers.first; gpl; gpl = gpl->next) { /* Skip if layer not editable */ - if (gpl->flag & (GP_LAYER_HIDE | GP_LAYER_LOCKED)) + if (gpencil_layer_is_editable(gpl) == false) continue; /* Add a new frame if needed (and based off the active frame, |