[Bf-blender-cvs] [8e9b1e3e80e] greasepencil-object: Cleanup: Whitespace + Code Redundancy
Joshua Leung
noreply at git.blender.org
Tue Apr 17 18:39:50 CEST 2018
Commit: 8e9b1e3e80e30f43bef86956ba1fd09fc0c989fd
Author: Joshua Leung
Date: Tue Apr 17 18:37:56 2018 +0200
Branches: greasepencil-object
https://developer.blender.org/rB8e9b1e3e80e30f43bef86956ba1fd09fc0c989fd
Cleanup: Whitespace + Code Redundancy
===================================================================
M source/blender/editors/gpencil/gpencil_paint.c
M source/blender/modifiers/intern/MOD_gpencilopacity.c
===================================================================
diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c
index 6f640e692e6..a90b80f123f 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -2822,7 +2822,7 @@ static void gpencil_add_missing_events(bContext *C, wmOperator *op, const wmEven
sub_v2_v2v2(pt, b, pt);
/* create fake event */
gpencil_draw_apply_event(C, op, event, CTX_data_depsgraph(C),
- (int)pt[0], (int)pt[1]);
+ (int)pt[0], (int)pt[1]);
}
else if (dist >= factor) {
int slices = 2 + (int)((dist - 1.0) / factor);
@@ -2832,7 +2832,7 @@ static void gpencil_add_missing_events(bContext *C, wmOperator *op, const wmEven
sub_v2_v2v2(pt, b, pt);
/* create fake event */
gpencil_draw_apply_event(C, op, event, CTX_data_depsgraph(C),
- (int)pt[0], (int)pt[1]);
+ (int)pt[0], (int)pt[1]);
}
}
}
diff --git a/source/blender/modifiers/intern/MOD_gpencilopacity.c b/source/blender/modifiers/intern/MOD_gpencilopacity.c
index bace937a1f6..dd7b12c85d3 100644
--- a/source/blender/modifiers/intern/MOD_gpencilopacity.c
+++ b/source/blender/modifiers/intern/MOD_gpencilopacity.c
@@ -67,9 +67,8 @@ static void deformStroke(ModifierData *md, Depsgraph *UNUSED(depsgraph),
Object *ob, bGPDlayer *gpl, bGPDstroke *gps)
{
GpencilOpacityModifierData *mmd = (GpencilOpacityModifierData *)md;
+ PaletteColor *palcolor = gps->palcolor;
int vindex = defgroup_name_index(ob, mmd->vgname);
- bGPDspoint *pt;
- float weight;
if (!is_stroke_affected_by_modifier(
mmd->layername, mmd->pass_index, 3, gpl, gps,
@@ -78,26 +77,26 @@ static void deformStroke(ModifierData *md, Depsgraph *UNUSED(depsgraph),
return;
}
- gps->palcolor->fill[3] = gps->palcolor->fill[3] * mmd->factor;
+ palcolor->fill[3]*= mmd->factor;
/* if factor is > 1, then force opacity */
if (mmd->factor > 1.0f) {
- gps->palcolor->rgb[3] += mmd->factor - 1.0f;
- if (gps->palcolor->fill[3] > 1e-5) {
- gps->palcolor->fill[3] += mmd->factor - 1.0f;
+ palcolor->rgb[3] += mmd->factor - 1.0f;
+ if (palcolor->fill[3] > 1e-5) {
+ palcolor->fill[3] += mmd->factor - 1.0f;
}
}
- CLAMP(gps->palcolor->rgb[3], 0.0f, 1.0f);
- CLAMP(gps->palcolor->fill[3], 0.0f, 1.0f);
+ CLAMP(palcolor->rgb[3], 0.0f, 1.0f);
+ CLAMP(palcolor->fill[3], 0.0f, 1.0f);
/* if opacity > 1.0, affect the strength of the stroke */
if (mmd->factor > 1.0f) {
for (int i = 0; i < gps->totpoints; i++) {
- pt = &gps->points[i];
+ bGPDspoint *pt = &gps->points[i];
/* verify vertex group */
- weight = is_point_affected_by_modifier(pt, (int)(!(mmd->flag & GP_OPACITY_INVERSE_VGROUP) == 0), vindex);
+ float weight = is_point_affected_by_modifier(pt, (int)(!(mmd->flag & GP_OPACITY_INVERSE_VGROUP) == 0), vindex);
if (weight < 0) {
pt->strength += mmd->factor - 1.0f;
}
@@ -109,14 +108,14 @@ static void deformStroke(ModifierData *md, Depsgraph *UNUSED(depsgraph),
}
else {
for (int i = 0; i < gps->totpoints; i++) {
- pt = &gps->points[i];
+ bGPDspoint *pt = &gps->points[i];
/* verify vertex group */
if (mmd->vgname == NULL) {
pt->strength *= mmd->factor;
}
else {
- weight = is_point_affected_by_modifier(pt, (int)(!(mmd->flag & GP_OPACITY_INVERSE_VGROUP) == 0), vindex);
+ float weight = is_point_affected_by_modifier(pt, (int)(!(mmd->flag & GP_OPACITY_INVERSE_VGROUP) == 0), vindex);
if (weight >= 0) {
pt->strength *= mmd->factor * weight;
}
More information about the Bf-blender-cvs
mailing list