[Bf-blender-cvs] [e11601de22a] temp-gpencil-fill: GPencil: When multiframe is OFF, use CFRA for filling
Antonio Vazquez
noreply at git.blender.org
Tue Feb 2 16:38:31 CET 2021
Commit: e11601de22ad5a2eb1901bc3fc62bfa5fcc3a262
Author: Antonio Vazquez
Date: Tue Feb 2 16:38:22 2021 +0100
Branches: temp-gpencil-fill
https://developer.blender.org/rBe11601de22ad5a2eb1901bc3fc62bfa5fcc3a262
GPencil: When multiframe is OFF, use CFRA for filling
Create an empty frame in CFRA before filling.
===================================================================
M source/blender/editors/gpencil/gpencil_fill.c
===================================================================
diff --git a/source/blender/editors/gpencil/gpencil_fill.c b/source/blender/editors/gpencil/gpencil_fill.c
index a24e111b5b1..5743229ccee 100644
--- a/source/blender/editors/gpencil/gpencil_fill.c
+++ b/source/blender/editors/gpencil/gpencil_fill.c
@@ -1789,6 +1789,7 @@ static int gpencil_fill_modal(bContext *C, wmOperator *op, const wmEvent *event)
BrushGpencilSettings *brush_settings = brush->gpencil_settings;
const bool is_brush_inv = brush_settings->fill_direction == BRUSH_DIR_IN;
const bool is_inverted = (is_brush_inv && !event->ctrl) || (!is_brush_inv && event->ctrl);
+ const bool is_multiedit = (bool)GPENCIL_MULTIEDIT_SESSIONS_ON(tgpf->gpd);
int estate = OPERATOR_PASS_THROUGH; /* default exit state - pass through */
@@ -1827,6 +1828,14 @@ static int gpencil_fill_modal(bContext *C, wmOperator *op, const wmEvent *event)
gpencil_stroke_convertcoords_tpoint(
tgpf->scene, tgpf->region, tgpf->ob, &point2D, NULL, &pt->x);
+ /* If not multiframe and there is no frame in CFRA for the active layer, create
+ * a new frame before to make the hash function can find something. */
+ if (!is_multiedit) {
+ tgpf->gpf = BKE_gpencil_layer_frame_get(
+ tgpf->gpl, tgpf->active_cfra, GP_GETFRAME_ADD_NEW);
+ tgpf->gpf->flag |= GP_FRAME_SELECT;
+ }
+
/* Hash of selected frames.*/
GHash *frame_list = BLI_ghash_int_new_ex(__func__, 64);
BKE_gpencil_frame_selected_hash(tgpf->gpd, frame_list);
More information about the Bf-blender-cvs
mailing list