[Bf-blender-cvs] [782b7e0eb0b] temp-gpencil-fill: GPencil: More changes to Fill tool to improve precision

Antonio Vazquez noreply at git.blender.org
Mon Feb 1 20:22:42 CET 2021


Commit: 782b7e0eb0bdaa07890f778d6d9bb72c440f8b25
Author: Antonio Vazquez
Date:   Mon Feb 1 20:22:38 2021 +0100
Branches: temp-gpencil-fill
https://developer.blender.org/rB782b7e0eb0bdaa07890f778d6d9bb72c440f8b25

GPencil: More changes to Fill tool to improve precision

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

M	source/blender/blenkernel/BKE_gpencil.h
M	source/blender/blenkernel/intern/gpencil.c
M	source/blender/editors/gpencil/gpencil_fill.c

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

diff --git a/source/blender/blenkernel/BKE_gpencil.h b/source/blender/blenkernel/BKE_gpencil.h
index b915d9eba88..a8caf317467 100644
--- a/source/blender/blenkernel/BKE_gpencil.h
+++ b/source/blender/blenkernel/BKE_gpencil.h
@@ -115,7 +115,7 @@ struct bGPDlayer *BKE_gpencil_layer_duplicate(const struct bGPDlayer *gpl_src,
                                               const bool dup_frames,
                                               const bool dup_strokes);
 void BKE_gpencil_frame_copy_strokes(struct bGPDframe *gpf_src, struct bGPDframe *gpf_dst);
-void BKE_gpencil_frame_selected_hash(const struct bGPdata *gpd, struct GHash *r_list);
+void BKE_gpencil_frame_selected_hash(struct bGPdata *gpd, struct GHash *r_list);
 
 struct bGPDcurve *BKE_gpencil_stroke_curve_duplicate(struct bGPDcurve *gpc_src);
 struct bGPDstroke *BKE_gpencil_stroke_duplicate(struct bGPDstroke *gps_src,
diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c
index 92c0c8504c4..adf0d2d6551 100644
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@ -2949,12 +2949,17 @@ int BKE_gpencil_material_find_index_by_name_prefix(Object *ob, const char *name_
 }
 
 /* Create a hash with the list of selected frame number. */
-void BKE_gpencil_frame_selected_hash(const struct bGPdata *gpd, struct GHash *r_list)
+void BKE_gpencil_frame_selected_hash(bGPdata *gpd, struct GHash *r_list)
 {
   const bool is_multiedit = (bool)GPENCIL_MULTIEDIT_SESSIONS_ON(gpd);
+  bGPDlayer *gpl = BKE_gpencil_layer_active_get(gpd);
 
-  LISTBASE_FOREACH (bGPDlayer *, gpl, &gpd->layers) {
-    LISTBASE_FOREACH (bGPDframe *, gpf, &gpl->frames) {
+  LISTBASE_FOREACH (bGPDlayer *, gpl_iter, &gpd->layers) {
+    if ((gpl != NULL) && (!is_multiedit) && (gpl != gpl_iter)) {
+      continue;
+    }
+
+    LISTBASE_FOREACH (bGPDframe *, gpf, &gpl_iter->frames) {
       if (((gpf == gpl->actframe) && (!is_multiedit)) ||
           ((gpf->flag & GP_FRAME_SELECT) && (is_multiedit))) {
         if (!BLI_ghash_lookup(r_list, POINTER_FROM_INT(gpf->framenum))) {
diff --git a/source/blender/editors/gpencil/gpencil_fill.c b/source/blender/editors/gpencil/gpencil_fill.c
index 5a57326598c..9e1bd639af5 100644
--- a/source/blender/editors/gpencil/gpencil_fill.c
+++ b/source/blender/editors/gpencil/gpencil_fill.c
@@ -252,14 +252,14 @@ static void draw_mouse_position(tGPDfill *tgpf)
   uchar mouse_color[4] = {0, 0, 255, 255};
 
   bGPDspoint *pt = &tgpf->gps_mouse->points[0];
-
+  float point_size = (tgpf->zoom == 1.0f) ? 5.0f : 0.7f * tgpf->zoom;
   GPUVertFormat *format = immVertexFormat();
   uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 3, GPU_FETCH_FLOAT);
   uint col = GPU_vertformat_attr_add(format, "color", GPU_COMP_U8, 4, GPU_FETCH_INT_TO_FLOAT_UNIT);
 
   /* Draw mouse click position in Blue. */
   immBindBuiltinProgram(GPU_SHADER_3D_POINT_FIXED_SIZE_VARYING_COLOR);
-  GPU_point_size(5.0f * tgpf->zoom);
+  GPU_point_size(point_size);
   immBegin(GPU_PRIM_POINTS, 1);
   immAttr4ubv(col, mouse_color);
   immVertex3fv(pos, &pt->x);
@@ -1714,7 +1714,7 @@ static void gpencil_zoom_level_set(tGPDfill *tgpf, const bool is_inverted)
   float zoomx = (width > tgpf->region->winx) ? width / (float)tgpf->region->winx : 1.0f;
   float zoomy = (height > tgpf->region->winy) ? height / (float)tgpf->region->winy : 1.0f;
   if ((zoomx != 1.0f) || (zoomy != 1.0f)) {
-    tgpf->zoom = min_ff(ceil(max_ff(zoomx, zoomy) + 1.5f), 6.0f);
+    tgpf->zoom = min_ff(ceil(max_ff(zoomx, zoomy) + 0.5f), 6.0f);
   }
 }



More information about the Bf-blender-cvs mailing list