[Bf-blender-cvs] [16ef4da] GPencil_Editing_Stage3: GP Sculpt: Clone Brush - "Use Falloff" = "Smudge"

Joshua Leung noreply at git.blender.org
Fri Oct 16 16:06:45 CEST 2015


Commit: 16ef4da5e6847d3fa0e6f911973ab8931c1072eb
Author: Joshua Leung
Date:   Sat Oct 17 03:06:13 2015 +1300
Branches: GPencil_Editing_Stage3
https://developer.blender.org/rB16ef4da5e6847d3fa0e6f911973ab8931c1072eb

GP Sculpt: Clone Brush - "Use Falloff" = "Smudge"

When the "Use Falloff" option for the Clone brush is enabled, moving the mouse
after pasting some cloned strokes will now allow you to distort the points of
the pasted strokes with non-uniform weights. This can be used for creating
"distortion" effects (similar to using the push brush on these strokes afterwards).
This could be useful as a quick way to get lots of variation to a field of items.

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

M	source/blender/blenloader/intern/versioning_270.c
M	source/blender/editors/gpencil/gpencil_brush.c

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

diff --git a/source/blender/blenloader/intern/versioning_270.c b/source/blender/blenloader/intern/versioning_270.c
index e4a7490..1b3106a 100644
--- a/source/blender/blenloader/intern/versioning_270.c
+++ b/source/blender/blenloader/intern/versioning_270.c
@@ -913,6 +913,10 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main)
 				brush->size = 25;
 				brush->strength = 0.5f;
 				brush->flag = GP_EDITBRUSH_FLAG_USE_FALLOFF;
+				
+				brush = &gset->brush[GP_EDITBRUSH_TYPE_CLONE];
+				brush->size = 50;
+				brush->strength = 1.0f;
 			}
 		}
 	}
diff --git a/source/blender/editors/gpencil/gpencil_brush.c b/source/blender/editors/gpencil/gpencil_brush.c
index f61a53b..31a10c1 100644
--- a/source/blender/editors/gpencil/gpencil_brush.c
+++ b/source/blender/editors/gpencil/gpencil_brush.c
@@ -851,8 +851,26 @@ static void gp_brush_clone_adjust(bContext *C, tGP_BrushEditData *gso)
 		int i;
 		
 		for (i = 0, pt = gps->points; i < gps->totpoints; i++, pt++) {
-			// TODO: Use falloff info for controlling how this gets applied?
-			add_v3_v3(&pt->x, gso->dvec);
+			if (gso->brush->flag & GP_EDITBRUSH_FLAG_USE_FALLOFF) {
+				/* "Smudge" Effect when falloff is enabled */
+				float delta[3] = {0.0f};
+				int sco[2] = {0};
+				float influence;
+				
+				/* compute influence on point */
+				gp_point_to_xy(&gso->gsc, gps, pt, &sco[0], &sco[1]);
+				influence = gp_brush_influence_calc(gso, gso->brush->size, sco);
+				
+				/* adjust the amount of displacement to apply */
+				mul_v3_v3fl(delta, gso->dvec, influence);
+				
+				/* apply */
+				add_v3_v3(&pt->x, delta);
+			}
+			else {
+				/* Just apply the offset - All points move perfectly in sync with the cursor */
+				add_v3_v3(&pt->x, gso->dvec);
+			}
 		}
 	}
 }




More information about the Bf-blender-cvs mailing list