Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDalai Felinto <dfelinto@gmail.com>2018-11-09 14:57:37 +0300
committerDalai Felinto <dfelinto@gmail.com>2018-11-09 14:57:37 +0300
commit494ba42254b4588f2c528a528741fd8f2e52bcb2 (patch)
tree979c6f4a318c085933165dec803774555f5a47fc /source/blender/editors/gpencil/gpencil_utils.c
parentab77f5b5fe59a8f0ff60b637883a53554b1de40c (diff)
GreasePencil: division by zero when stroke has one point
Error "runtime error: division by zero" when opening: "Sketch 1 demo by Brain Graft.blend"
Diffstat (limited to 'source/blender/editors/gpencil/gpencil_utils.c')
-rw-r--r--source/blender/editors/gpencil/gpencil_utils.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/source/blender/editors/gpencil/gpencil_utils.c b/source/blender/editors/gpencil/gpencil_utils.c
index 41ea3a2138d..0098d99e581 100644
--- a/source/blender/editors/gpencil/gpencil_utils.c
+++ b/source/blender/editors/gpencil/gpencil_utils.c
@@ -1835,15 +1835,21 @@ void ED_gpencil_calc_stroke_uv(Object *ob, bGPDstroke *gps)
totlen += len_v3v3(&pt->x, &ptb->x) / pixsize;
pt->uv_fac = totlen;
}
+
/* normalize the distance using a factor */
float factor;
+
/* if image, use texture width */
if ((gp_style) && (gp_style->sima)) {
factor = gp_style->sima->gen_x;
}
+ else if (totlen == 0) {
+ return;
+ }
else {
factor = totlen;
}
+
for (i = 0; i < gps->totpoints; i++) {
pt = &gps->points[i];
pt->uv_fac /= factor;