[Bf-blender-cvs] [43416a61450] greasepencil-object: GPencil: Remove Spread effect

Antonio Vazquez noreply at git.blender.org
Wed Mar 24 17:09:42 CET 2021


Commit: 43416a61450d36e331ab559670e2f4d5d4bf87ab
Author: Antonio Vazquez
Date:   Wed Mar 24 17:06:47 2021 +0100
Branches: greasepencil-object
https://developer.blender.org/rB43416a61450d36e331ab559670e2f4d5d4bf87ab

GPencil: Remove Spread effect

This was a test for spay brush

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

M	source/blender/editors/gpencil/gpencil_utils.c

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

diff --git a/source/blender/editors/gpencil/gpencil_utils.c b/source/blender/editors/gpencil/gpencil_utils.c
index 25229e06bd6..574670de7ca 100644
--- a/source/blender/editors/gpencil/gpencil_utils.c
+++ b/source/blender/editors/gpencil/gpencil_utils.c
@@ -3352,117 +3352,3 @@ void ED_gpencil_stroke_close_by_distance(bGPDstroke *gps, const float threshold)
     BKE_gpencil_stroke_close(gps);
   }
 }
-
-/* Helper to move a point in buffer. */
-static void gpencil_spread_point(
-    Brush *brush, GP_SpaceConversion *gsc, const int pt_index, const float x, const float y)
-{
-  BrushGpencilSettings *brush_settings = brush->gpencil_settings;
-  RegionView3D *rv3d = gsc->region->regiondata;
-  float pixsize = rv3d->pixsize * 1000.0f;
-  const float factor = brush->size * pixsize;
-  float rand = 1.0f;
-
-  bGPdata *gpd = gsc->gpd;
-  tGPspoint *pt = ((tGPspoint *)(gpd->runtime.sbuffer) + pt_index);
-  rand = BLI_hash_int_01(BLI_hash_int_2d(pt->x + gpd->runtime.sbuffer_used, pt->y)) * 2.0f - 1.0f;
-  pt->x += x * factor * rand;
-
-  rand = BLI_hash_int_01(BLI_hash_int_2d(pt->y + gpd->runtime.sbuffer_used, pt->x)) * 2.0f - 1.0f;
-  pt->y += y * factor * rand;
-
-  /* Randomness to other factors. */
-  rand = BLI_hash_int_01(BLI_hash_int_2d(pt->x, pt->y)) * 2.0f - 1.0f;
-  pt->pressure += rand * 1.5f;
-  CLAMP_MIN(pt->pressure, 0.01f);
-
-  rand = BLI_hash_int_01(BLI_hash_int_2d(pt->x + pt->y, pt->x)) * 2.0f - 1.0f;
-  pt->strength += rand * 1.5f;
-  CLAMP(pt->strength, 0.01f, brush_settings->draw_strength);
-}
-
-/* Define how the spread points are created. */
-static void gpencil_spread_points(Brush *brush, GP_SpaceConversion *gsc, int spread, int pt_index)
-{
-  /* Spread the points. */
-  switch (spread) {
-    case 1: {
-      gpencil_spread_point(brush, gsc, pt_index, -1.0f, 0.0f);
-      gpencil_spread_point(brush, gsc, pt_index + 1, 1.0f, 0.0f);
-      break;
-    }
-    case 2: {
-      gpencil_spread_point(brush, gsc, pt_index, -0.7f, 1.0f);
-      gpencil_spread_point(brush, gsc, pt_index + 2, 0.7f, -1.0f);
-      break;
-    }
-    case 3: {
-      gpencil_spread_point(brush, gsc, pt_index, -1.0f, 1.0f);
-      gpencil_spread_point(brush, gsc, pt_index + 1, 1.0f, 1.0f);
-      gpencil_spread_point(brush, gsc, pt_index + 3, 0.0f, -1.0f);
-      break;
-    }
-    case 4: {
-      gpencil_spread_point(brush, gsc, pt_index, -1.0f, 1.0f);
-      gpencil_spread_point(brush, gsc, pt_index + 1, 1.0f, 1.0f);
-      gpencil_spread_point(brush, gsc, pt_index + 3, -1.0f, -1.0f);
-      gpencil_spread_point(brush, gsc, pt_index + 4, 1.0f, -1.0f);
-      break;
-    }
-    case 5: {
-      gpencil_spread_point(brush, gsc, pt_index, -1.0f, 1.0f);
-      gpencil_spread_point(brush, gsc, pt_index + 1, 0.0f, 1.0f);
-      gpencil_spread_point(brush, gsc, pt_index + 2, 1.0f, 1.0f);
-      gpencil_spread_point(brush, gsc, pt_index + 4, -1.0f, -1.0f);
-      gpencil_spread_point(brush, gsc, pt_index + 5, 1.0f, -1.0f);
-      break;
-    }
-    case 6: {
-      gpencil_spread_point(brush, gsc, pt_index, -1.0f, 1.0f);
-      gpencil_spread_point(brush, gsc, pt_index + 1, 0.0f, 1.0f);
-      gpencil_spread_point(brush, gsc, pt_index + 2, 1.0f, 1.0f);
-      gpencil_spread_point(brush, gsc, pt_index + 4, -1.0f, -1.0f);
-      gpencil_spread_point(brush, gsc, pt_index + 5, 0.0f, -1.0f);
-      gpencil_spread_point(brush, gsc, pt_index + 6, 1.0f, -1.0f);
-      break;
-    }
-    case 7: {
-      gpencil_spread_point(brush, gsc, pt_index, -1.0f, 1.0f);
-      gpencil_spread_point(brush, gsc, pt_index + 1, 0.0f, 1.0f);
-      gpencil_spread_point(brush, gsc, pt_index + 2, 1.0f, 1.0f);
-      gpencil_spread_point(brush, gsc, pt_index + 3, -0.7f, 0.0f);
-      gpencil_spread_point(brush, gsc, pt_index + 4, 0.7f, 0.0f);
-      gpencil_spread_point(brush, gsc, pt_index + 5, -1.0f, -1.0f);
-      gpencil_spread_point(brush, gsc, pt_index + 6, 0.0f, -1.0f);
-      gpencil_spread_point(brush, gsc, pt_index + 7, 1.0f, -1.0f);
-      break;
-    }
-    case 8: {
-      gpencil_spread_point(brush, gsc, pt_index, -1.0f, 1.0f);
-      gpencil_spread_point(brush, gsc, pt_index + 1, 0.0f, 1.0f);
-      gpencil_spread_point(brush, gsc, pt_index + 2, 1.0f, 1.0f);
-      gpencil_spread_point(brush, gsc, pt_index + 3, -1.0f, 0.0f);
-      gpencil_spread_point(brush, gsc, pt_index + 5, 1.0f, 0.0f);
-      gpencil_spread_point(brush, gsc, pt_index + 6, -1.0f, -1.0f);
-      gpencil_spread_point(brush, gsc, pt_index + 7, 0.0f, -1.0f);
-      gpencil_spread_point(brush, gsc, pt_index + 8, 1.0f, -1.0f);
-      break;
-    }
-    default:
-      break;
-  }
-}
-
-/* Helper to copy buffer points. */
-static void gpencil_copy_buffer_point(tGPspoint *pt_from, tGPspoint *pt_dst)
-{
-  copy_v2_v2(&pt_dst->x, &pt_from->x);
-  pt_dst->pressure = pt_from->pressure;
-  pt_dst->strength = pt_from->strength;
-  pt_dst->time = pt_from->time;
-  pt_dst->uv_fac = pt_from->uv_fac;
-  pt_dst->uv_rot = pt_from->uv_rot;
-  copy_v3_v3(pt_dst->rnd, pt_from->rnd);
-  pt_dst->rnd_dirty = pt_from->rnd_dirty;
-  copy_v4_v4(pt_dst->vert_color, pt_from->vert_color);
-}



More information about the Bf-blender-cvs mailing list