Commit: 2758e560a05f27da92becbc4ce1f3703067f5f01 Author: Falk David Date: Fri Aug 21 11:03:40 2020 +0200 Branches: soc-2020-greasepencil-curve https://developer.blender.org/rB2758e560a05f27da92becbc4ce1f3703067f5f01
GPencil: Recalc transform only in curve edit mode When changing the opacity or thickness, only reaclculate stroke if in curve edit mode. =================================================================== M source/blender/editors/transform/transform_mode_gpopacity.c M source/blender/editors/transform/transform_mode_gpshrinkfatten.c =================================================================== diff --git a/source/blender/editors/transform/transform_mode_gpopacity.c b/source/blender/editors/transform/transform_mode_gpopacity.c index fdc0bdd3900..0d698f2d039 100644 --- a/source/blender/editors/transform/transform_mode_gpopacity.c +++ b/source/blender/editors/transform/transform_mode_gpopacity.c @@ -29,6 +29,8 @@ #include "BKE_context.h" #include "BKE_unit.h" +#include "DNA_gpencil_types.h" + #include "ED_screen.h" #include "UI_interface.h" @@ -70,8 +72,16 @@ static void applyGPOpacity(TransInfo *t, const int UNUSED(mval[2])) BLI_snprintf(str, sizeof(str), TIP_("Opacity: %3f"), ratio); } + bool recalc = false; FOREACH_TRANS_DATA_CONTAINER (t, tc) { TransData *td = tc->data; + bGPdata *gpd = td->ob->data; + const bool is_curve_edit = (bool)GPENCIL_CURVE_EDIT_SESSIONS_ON(gpd); + /* Only recalculate data when in curve edit mode. */ + if (is_curve_edit) { + recalc = true; + } + for (i = 0; i < tc->data_len; i++, td++) { if (td->flag & TD_SKIP) { continue; @@ -86,8 +96,9 @@ static void applyGPOpacity(TransInfo *t, const int UNUSED(mval[2])) } } - /* GXX: This is only really needed in curve edit mode */ - recalcData(t); + if (recalc) { + recalcData(t); + } ED_area_status_text(t->area, str); } diff --git a/source/blender/editors/transform/transform_mode_gpshrinkfatten.c b/source/blender/editors/transform/transform_mode_gpshrinkfatten.c index 636461bf26d..41e6bebc838 100644 --- a/source/blender/editors/transform/transform_mode_gpshrinkfatten.c +++ b/source/blender/editors/transform/transform_mode_gpshrinkfatten.c @@ -29,6 +29,8 @@ #include "BKE_context.h" #include "BKE_unit.h" +#include "DNA_gpencil_types.h" + #include "ED_screen.h" #include "UI_interface.h" @@ -70,8 +72,16 @@ static void applyGPShrinkFatten(TransInfo *t, const int UNUSED(mval[2])) BLI_snprintf(str, sizeof(str), TIP_("Shrink/Fatten: %3f"), ratio); } + bool recalc = false; FOREACH_TRANS_DATA_CONTAINER (t, tc) { TransData *td = tc->data; + bGPdata *gpd = td->ob->data; + const bool is_curve_edit = (bool)GPENCIL_CURVE_EDIT_SESSIONS_ON(gpd); + /* Only recalculate data when in curve edit mode. */ + if (is_curve_edit) { + recalc = true; + } + for (i = 0; i < tc->data_len; i++, td++) { if (td->flag & TD_SKIP) { continue; @@ -88,8 +98,9 @@ static void applyGPShrinkFatten(TransInfo *t, const int UNUSED(mval[2])) } } - /* GXX: This is only really needed in curve edit mode */ - recalcData(t); + if (recalc) { + recalcData(t); + } ED_area_status_text(t->area, str); } _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs