[Bf-blender-cvs] [3dce857632c] temp-gpencil-fill: GPencil: New option to disable automatic zoom

Antonio Vazquez noreply at git.blender.org
Sat Jan 30 19:15:44 CET 2021


Commit: 3dce857632c98728a41dd96940e74315de06fcec
Author: Antonio Vazquez
Date:   Sat Jan 30 19:15:37 2021 +0100
Branches: temp-gpencil-fill
https://developer.blender.org/rB3dce857632c98728a41dd96940e74315de06fcec

GPencil: New option to disable automatic zoom

(WIP) The UI is still in progress

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

M	release/scripts/startup/bl_ui/space_view3d_toolbar.py
M	source/blender/editors/gpencil/gpencil_fill.c
M	source/blender/makesdna/DNA_brush_enums.h
M	source/blender/makesrna/intern/rna_brush.c

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

diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
index 7c718ee8155..0ba65ad0b08 100644
--- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
@@ -1457,6 +1457,7 @@ class VIEW3D_PT_tools_grease_pencil_brush_advanced(View3DPanel, Panel):
                     sub = sub.row(align=True)
                     sub.active = gp_settings.show_fill
                     sub.prop(gp_settings, "fill_threshold", text="")
+                    col.prop(gp_settings, "use_fill_autofit")
 
 
 class VIEW3D_PT_tools_grease_pencil_brush_stroke(Panel, View3DPanel):
diff --git a/source/blender/editors/gpencil/gpencil_fill.c b/source/blender/editors/gpencil/gpencil_fill.c
index 0ddd5d35634..41478364fb8 100644
--- a/source/blender/editors/gpencil/gpencil_fill.c
+++ b/source/blender/editors/gpencil/gpencil_fill.c
@@ -1616,6 +1616,12 @@ static int gpencil_fill_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSE
  */
 static void gpencil_zoom_level_set(tGPDfill *tgpf, const bool is_inverted)
 {
+  Brush *brush = tgpf->brush;
+  if (brush->gpencil_settings->flag & GP_BRUSH_FILL_FIT_DISABLE) {
+    tgpf->zoom = 1.0f;
+    return;
+  }
+
   Object *ob = tgpf->ob;
   bGPdata *gpd = tgpf->gpd;
   BrushGpencilSettings *brush_settings = tgpf->brush->gpencil_settings;
diff --git a/source/blender/makesdna/DNA_brush_enums.h b/source/blender/makesdna/DNA_brush_enums.h
index f12934c9104..236cd65e5f6 100644
--- a/source/blender/makesdna/DNA_brush_enums.h
+++ b/source/blender/makesdna/DNA_brush_enums.h
@@ -75,6 +75,8 @@ typedef enum eGPDbrush_Flag {
   GP_BRUSH_USE_STRENGTH_PRESSURE = (1 << 1),
   /* brush use pressure for alpha factor */
   GP_BRUSH_USE_JITTER_PRESSURE = (1 << 2),
+  /* Disable automatic zoom for filling. */
+  GP_BRUSH_FILL_FIT_DISABLE = (1 << 3),
   /* fill hide transparent */
   GP_BRUSH_FILL_HIDE = (1 << 6),
   /* show fill help lines */
diff --git a/source/blender/makesrna/intern/rna_brush.c b/source/blender/makesrna/intern/rna_brush.c
index 4f98c6e8e07..05737bfa514 100644
--- a/source/blender/makesrna/intern/rna_brush.c
+++ b/source/blender/makesrna/intern/rna_brush.c
@@ -1834,6 +1834,15 @@ static void rna_def_gpencil_options(BlenderRNA *brna)
       prop, "Show Fill", "Show transparent lines to use as boundary for filling");
   RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 
+  prop = RNA_def_property(srna, "use_fill_autofit", PROP_BOOLEAN, PROP_NONE);
+  RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", GP_BRUSH_FILL_FIT_DISABLE);
+  RNA_def_property_boolean_default(prop, true);
+  RNA_def_property_ui_text(
+      prop,
+      "Automatic Fit",
+      "Fit the shape of the stroke to try to fill areas outside visible viewport");
+  RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+
   prop = RNA_def_property(srna, "use_default_eraser", PROP_BOOLEAN, PROP_NONE);
   RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_BRUSH_DEFAULT_ERASER);
   RNA_def_property_boolean_default(prop, true);



More information about the Bf-blender-cvs mailing list