[Bf-blender-cvs] [4bbc2cc] GPencil_Editing_Stage3: Code Cleanup: Remove code for old GP eraser
Joshua Leung
noreply at git.blender.org
Sun Dec 13 01:08:03 CET 2015
Commit: 4bbc2cc1b1d702f20c905d336b53bb54b630313b
Author: Joshua Leung
Date: Sun Dec 13 12:01:31 2015 +1300
Branches: GPencil_Editing_Stage3
https://developer.blender.org/rB4bbc2cc1b1d702f20c905d336b53bb54b630313b
Code Cleanup: Remove code for old GP eraser
===================================================================
M source/blender/editors/gpencil/gpencil_paint.c
===================================================================
diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c
index 620eadf..16b6352 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -741,114 +741,6 @@ static void gp_stroke_newfrombuffer(tGPsdata *p)
/* --- 'Eraser' for 'Paint' Tool ------ */
-#if 0
-/* eraser tool - remove segment from stroke/split stroke (after lasso inside) */
-static bool gp_stroke_eraser_splitdel(bGPDframe *gpf, bGPDstroke *gps, int i)
-{
- bGPDspoint *pt_tmp = gps->points;
- bGPDstroke *gsn = NULL;
-
- /* if stroke only had two points, get rid of stroke */
- if (gps->totpoints == 2) {
- /* free stroke points, then stroke */
- MEM_freeN(pt_tmp);
- BLI_freelinkN(&gpf->strokes, gps);
-
- /* nothing left in stroke, so stop */
- return true;
- }
-
- /* if last segment, just remove segment from the stroke */
- else if (i == gps->totpoints - 2) {
- /* allocate new points array, and assign most of the old stroke there */
- gps->totpoints--;
- gps->points = MEM_mallocN(sizeof(bGPDspoint) * gps->totpoints, "gp_stroke_points");
- memcpy(gps->points, pt_tmp, sizeof(bGPDspoint) * gps->totpoints);
-
- /* free temp buffer */
- MEM_freeN(pt_tmp);
-
- /* nothing left in stroke, so stop */
- return true;
- }
-
- /* if first segment, just remove segment from the stroke */
- else if (i == 0) {
- /* allocate new points array, and assign most of the old stroke there */
- gps->totpoints--;
- gps->points = MEM_mallocN(sizeof(bGPDspoint) * gps->totpoints, "gp_stroke_points");
- memcpy(gps->points, pt_tmp + 1, sizeof(bGPDspoint) * gps->totpoints);
-
- /* We must adjust timings!
- * Each point's timing data is a delta from stroke's inittime, so as we erase the first
- * point of the stroke, we have to offset this inittime and all remaining points' delta values.
- * This way we get a new stroke with exactly the same timing as if user had started drawing from
- * the second point...
- */
- {
- bGPDspoint *pts;
- float delta = pt_tmp[1].time;
- int j;
-
- gps->inittime += (double)delta;
-
- pts = gps->points;
- for (j = 0; j < gps->totpoints; j++, pts++) {
- pts->time -= delta;
- }
- }
-
- /* free temp buffer */
- MEM_freeN(pt_tmp);
-
- /* no break here, as there might still be stuff to remove in this stroke */
- return false;
- }
-
- /* segment occurs in 'middle' of stroke, so split */
- else {
- /* duplicate stroke, and assign 'later' data to that stroke */
- gsn = MEM_dupallocN(gps);
- gsn->prev = gsn->next = NULL;
- BLI_insertlinkafter(&gpf->strokes, gps, gsn);
-
- gsn->totpoints = gps->totpoints - i;
- gsn->points = MEM_mallocN(sizeof(bGPDspoint) * gsn->totpoints, "gp_stroke_points");
- memcpy(gsn->points, pt_tmp + i, sizeof(bGPDspoint) * gsn->totpoints);
-
- /* We must adjust timings of this new stroke!
- * Each point's timing data is a delta from stroke's inittime, so as we erase the first
- * point of the stroke, we have to offset this inittime and all remaing points' delta values.
- * This way we get a new stroke with exactly the same timing as if user had started drawing from
- * the second point...
- */
- {
- bGPDspoint *pts;
- float delta = pt_tmp[i].time;
- int j;
-
- gsn->inittime += (double)delta;
-
- pts = gsn->points;
- for (j = 0; j < gsn->totpoints; j++, pts++) {
- pts->time -= delta;
- }
- }
-
- /* adjust existing stroke */
- gps->totpoints = i;
- gps->points = MEM_mallocN(sizeof(bGPDspoint) * gps->totpoints, "gp_stroke_points");
- memcpy(gps->points, pt_tmp, sizeof(bGPDspoint) * gps->totpoints);
-
- /* free temp buffer */
- MEM_freeN(pt_tmp);
-
- /* nothing left in stroke, so stop */
- return true;
- }
-}
-#endif
-
/* which which point is infront (result should only be used for comparison) */
static float view3d_point_depth(const RegionView3D *rv3d, const float co[3])
{
More information about the Bf-blender-cvs
mailing list