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:
authorCampbell Barton <ideasman42@gmail.com>2021-06-09 18:55:44 +0300
committerCampbell Barton <ideasman42@gmail.com>2021-06-09 19:22:45 +0300
commit4443c4082ed094baf11b5c6cff280582776466b6 (patch)
treee2878edc62e22635e9feb589a5f9590c4fdf5d87 /source/blender/editors/gpencil
parentbda8887e0cdfd2fc035b6f1d97f16120f719c6a3 (diff)
Cleanup: remove redundant checks which have already been tested
Note that these changes are limited simple cases as these kinds of changes could allow for errors when refactoring code when the known state is not so obvious.
Diffstat (limited to 'source/blender/editors/gpencil')
-rw-r--r--source/blender/editors/gpencil/gpencil_paint.c2
-rw-r--r--source/blender/editors/gpencil/gpencil_primitive.c30
2 files changed, 15 insertions, 17 deletions
diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c
index 993065a3a70..e40748e5f6e 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -3287,7 +3287,7 @@ static int gpencil_draw_invoke(bContext *C, wmOperator *op, const wmEvent *event
gpencil_guide_event_handling(C, op, event, p);
}
- if (ob && (ob->type == OB_GPENCIL) && ((p->gpd->flag & GP_DATA_STROKE_PAINTMODE) == 0)) {
+ if ((ob->type == OB_GPENCIL) && ((p->gpd->flag & GP_DATA_STROKE_PAINTMODE) == 0)) {
/* FIXME: use the mode switching operator, this misses notifiers, messages. */
/* Just set paintmode flag... */
p->gpd->flag |= GP_DATA_STROKE_PAINTMODE;
diff --git a/source/blender/editors/gpencil/gpencil_primitive.c b/source/blender/editors/gpencil/gpencil_primitive.c
index 1b0a40b1be1..5f02bbf0a77 100644
--- a/source/blender/editors/gpencil/gpencil_primitive.c
+++ b/source/blender/editors/gpencil/gpencil_primitive.c
@@ -1536,24 +1536,22 @@ static void gpencil_primitive_strength(tGPDprimitive *tgpi, bool reset)
Brush *brush = tgpi->brush;
BrushGpencilSettings *brush_settings = brush->gpencil_settings;
- if (brush) {
- if (reset) {
- brush_settings->draw_strength = tgpi->brush_strength;
- tgpi->brush_strength = 0.0f;
- }
- else {
- if (tgpi->brush_strength == 0.0f) {
- tgpi->brush_strength = brush_settings->draw_strength;
- }
- float move[2];
- sub_v2_v2v2(move, tgpi->mval, tgpi->mvalo);
- float adjust = (move[1] > 0.0f) ? 0.01f : -0.01f;
- brush_settings->draw_strength += adjust * fabsf(len_manhattan_v2(move));
+ if (reset) {
+ brush_settings->draw_strength = tgpi->brush_strength;
+ tgpi->brush_strength = 0.0f;
+ }
+ else {
+ if (tgpi->brush_strength == 0.0f) {
+ tgpi->brush_strength = brush_settings->draw_strength;
}
-
- /* limit low limit because below 0.2f the stroke is invisible */
- CLAMP(brush_settings->draw_strength, 0.2f, 1.0f);
+ float move[2];
+ sub_v2_v2v2(move, tgpi->mval, tgpi->mvalo);
+ float adjust = (move[1] > 0.0f) ? 0.01f : -0.01f;
+ brush_settings->draw_strength += adjust * fabsf(len_manhattan_v2(move));
}
+
+ /* limit low limit because below 0.2f the stroke is invisible */
+ CLAMP(brush_settings->draw_strength, 0.2f, 1.0f);
}
/* brush size */