[Bf-blender-cvs] [d07f2b12c32] greasepencil-object: Cleanup: style
Campbell Barton
noreply at git.blender.org
Fri Oct 13 19:35:07 CEST 2017
Commit: d07f2b12c32dcada80306e766c9b1611b7aef3de
Author: Campbell Barton
Date: Sat Oct 14 04:32:32 2017 +1100
Branches: greasepencil-object
https://developer.blender.org/rBd07f2b12c32dcada80306e766c9b1611b7aef3de
Cleanup: style
===================================================================
M source/blender/blenkernel/BKE_gpencil.h
M source/blender/blenkernel/intern/gpencil.c
M source/blender/blenkernel/intern/gpencil_modifier.c
M source/blender/blenkernel/intern/object.c
M source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
M source/blender/draw/engines/gpencil/gpencil_engine.c
M source/blender/draw/engines/gpencil/gpencil_geom.c
M source/blender/draw/engines/gpencil/gpencil_vfx.c
M source/blender/editors/animation/anim_channels_defines.c
M source/blender/editors/gpencil/drawgpencil.c
M source/blender/editors/gpencil/gpencil_brush.c
M source/blender/editors/gpencil/gpencil_data.c
M source/blender/editors/gpencil/gpencil_edit.c
M source/blender/editors/gpencil/gpencil_paint.c
M source/blender/editors/gpencil/gpencil_utils.c
M source/blender/editors/object/object_edit.c
M source/blender/editors/sculpt_paint/paint_ops.c
M source/blender/makesdna/DNA_object_types.h
M source/blender/makesrna/intern/rna_palette.c
M source/blender/modifiers/intern/MOD_gpencilarray.c
M source/blender/modifiers/intern/MOD_gpencilblur.c
M source/blender/modifiers/intern/MOD_gpencilcolor.c
M source/blender/modifiers/intern/MOD_gpencildupli.c
M source/blender/modifiers/intern/MOD_gpencillattice.c
M source/blender/modifiers/intern/MOD_gpencilnoise.c
M source/blender/modifiers/intern/MOD_gpencilopacity.c
M source/blender/modifiers/intern/MOD_gpencilpixel.c
M source/blender/modifiers/intern/MOD_gpencilsimplify.c
M source/blender/modifiers/intern/MOD_gpencilsubdiv.c
M source/blender/modifiers/intern/MOD_gpencilswirl.c
M source/blender/modifiers/intern/MOD_gpencilthick.c
M source/blender/modifiers/intern/MOD_gpenciltint.c
M source/blender/modifiers/intern/MOD_gpencilwave.c
===================================================================
diff --git a/source/blender/blenkernel/BKE_gpencil.h b/source/blender/blenkernel/BKE_gpencil.h
index f7719e1e6b0..c8096570fd0 100644
--- a/source/blender/blenkernel/BKE_gpencil.h
+++ b/source/blender/blenkernel/BKE_gpencil.h
@@ -159,7 +159,7 @@ void BKE_gpencil_paletteslot_set_active_palette(struct bGPdata *gpd, const struc
void BKE_gpencil_paletteslot_set_palette(struct bGPdata *gpd, struct bGPDpaletteref *palslot, struct Palette *palette);
struct bGPDpaletteref *BKE_gpencil_paletteslot_add(struct bGPdata *gpd, struct Palette *palette);
-struct bGPDpaletteref *BKE_gpencil_paletteslot_addnew(struct Main *bmain, struct bGPdata *gpd, char name[MAX_ID_NAME - 2]);
+struct bGPDpaletteref *BKE_gpencil_paletteslot_addnew(struct Main *bmain, struct bGPdata *gpd, const char name[]);
struct bGPDpaletteref *BKE_gpencil_paletteslot_validate(struct Main *bmain, struct bGPdata *gpd);
/* Palettes - Deprecated (2.78-2.79) */
diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c
index c85ee21746e..16bda235384 100644
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@ -281,8 +281,8 @@ static void BKE_gpencil_clear_derived(bGPDlayer *gpl)
return;
}
- GHASH_ITER(gh_iter, gpl->derived_data) {
- bGPDframe *gpf = (bGPDframe *)BLI_ghashIterator_getValue(&gh_iter);
+ GHASH_ITER(gh_iter, gpl->derived_data) {
+ bGPDframe *gpf = (bGPDframe *)BLI_ghashIterator_getValue(&gh_iter);
if (gpf) {
BKE_gpencil_free_layer_temp_data(gpl, gpf);
}
@@ -1555,7 +1555,7 @@ bGPDpaletteref *BKE_gpencil_paletteslot_add(bGPdata *gpd, Palette *palette)
/* Wrapper for BKE_gpencil_paletteslot_add() to add a new Palette + slot,
* and set all the usercounts correctly
*/
-bGPDpaletteref *BKE_gpencil_paletteslot_addnew(Main *bmain, bGPdata *gpd, char name[MAX_ID_NAME - 2])
+bGPDpaletteref *BKE_gpencil_paletteslot_addnew(Main *bmain, bGPdata *gpd, const char name[])
{
/* create the palette first */
Palette *palette = BKE_palette_add(bmain, name);
@@ -2092,7 +2092,7 @@ static void gpencil_minmax(bGPdata *gpd, float min[3], float max[3])
INIT_MINMAX(min, max);
for (bGPDlayer *gpl = gpd->layers.first; gpl; gpl = gpl->next) {
- gpf= gpl->actframe;
+ gpf = gpl->actframe;
if (!gpf) {
continue;
}
diff --git a/source/blender/blenkernel/intern/gpencil_modifier.c b/source/blender/blenkernel/intern/gpencil_modifier.c
index 49337174839..963956e9c6e 100644
--- a/source/blender/blenkernel/intern/gpencil_modifier.c
+++ b/source/blender/blenkernel/intern/gpencil_modifier.c
@@ -50,7 +50,8 @@
#include "BKE_modifier.h"
#include "BKE_colortools.h"
-#define GPENCIL_ANY_EDIT_MODE(gpd) ((gpd) && (gpd->flag & (GP_DATA_STROKE_EDITMODE | GP_DATA_STROKE_SCULPTMODE | GP_DATA_STROKE_WEIGHTMODE)))
+#define GPENCIL_ANY_EDIT_MODE(gpd) \
+ ((gpd) && ((gpd)->flag & (GP_DATA_STROKE_EDITMODE | GP_DATA_STROKE_SCULPTMODE | GP_DATA_STROKE_WEIGHTMODE)))
/* used to save temp strokes */
typedef struct tGPencilStrokeCache {
@@ -66,14 +67,15 @@ typedef struct tbGPDspoint {
/* fill an array with random numbers */
void BKE_gpencil_fill_random_array(float *ar, int count)
{
- for (int i = 0; i < count; ++i) {
+ for (int i = 0; i < count; i++) {
ar[i] = BLI_frand();
}
}
/* verify if valid layer and pass index */
-static bool is_stroke_affected_by_modifier(char *mlayername, int mpassindex, int minpoints,
- bGPDlayer *gpl, bGPDstroke *gps, bool inv1, bool inv2)
+static bool is_stroke_affected_by_modifier(
+ char *mlayername, int mpassindex, int minpoints,
+ bGPDlayer *gpl, bGPDstroke *gps, bool inv1, bool inv2)
{
/* omit if filter by layer */
if (mlayername[0] != '\0') {
@@ -181,7 +183,8 @@ void BKE_gpencil_stroke_normal(const bGPDstroke *gps, float r_normal[3])
}
/* calculate a noise base on stroke direction */
-void BKE_gpencil_noise_modifier(int UNUSED(id), GpencilNoiseModifierData *mmd, Object *ob, bGPDlayer *gpl, bGPDstroke *gps)
+void BKE_gpencil_noise_modifier(
+ int UNUSED(id), GpencilNoiseModifierData *mmd, Object *ob, bGPDlayer *gpl, bGPDstroke *gps)
{
bGPDspoint *pt0, *pt1;
float shift, vran, vdir;
@@ -193,8 +196,10 @@ void BKE_gpencil_noise_modifier(int UNUSED(id), GpencilNoiseModifierData *mmd, O
int vindex = get_vertex_group_index(ob, mmd->vgname);
float weight = 1.0f;
- if (!is_stroke_affected_by_modifier(mmd->layername, mmd->passindex, 3, gpl, gps,
- (bool) mmd->flag & GP_NOISE_INVERSE_LAYER, (bool)mmd->flag & GP_NOISE_INVERSE_PASS)) {
+ if (!is_stroke_affected_by_modifier(
+ mmd->layername, mmd->passindex, 3, gpl, gps,
+ (bool) mmd->flag & GP_NOISE_INVERSE_LAYER, (bool)mmd->flag & GP_NOISE_INVERSE_PASS))
+ {
return;
}
@@ -208,8 +213,7 @@ void BKE_gpencil_noise_modifier(int UNUSED(id), GpencilNoiseModifierData *mmd, O
/* move points */
for (int i = 0; i < gps->totpoints; i++) {
- if (((i == 0) || (i == gps->totpoints - 1)) && ((mmd->flag & GP_NOISE_MOVE_EXTREME) == 0))
- {
+ if (((i == 0) || (i == gps->totpoints - 1)) && ((mmd->flag & GP_NOISE_MOVE_EXTREME) == 0)) {
continue;
}
@@ -239,7 +243,7 @@ void BKE_gpencil_noise_modifier(int UNUSED(id), GpencilNoiseModifierData *mmd, O
sc_diff = abs(mmd->scene_frame - sc_frame);
/* only recalc if the gp frame change or the number of scene frames is bigger than step */
if ((!gpl->actframe) || (mmd->gp_frame != gpl->actframe->framenum) ||
- (sc_diff >= mmd->step))
+ (sc_diff >= mmd->step))
{
vran = mmd->vrand1 = BLI_frand();
vdir = mmd->vrand2 = BLI_frand();
@@ -306,14 +310,17 @@ void BKE_gpencil_noise_modifier(int UNUSED(id), GpencilNoiseModifierData *mmd, O
}
/* subdivide stroke to get more control points */
-void BKE_gpencil_subdiv_modifier(int UNUSED(id), GpencilSubdivModifierData *mmd, Object *UNUSED(ob), bGPDlayer *gpl, bGPDstroke *gps)
+void BKE_gpencil_subdiv_modifier(
+ int UNUSED(id), GpencilSubdivModifierData *mmd, Object *UNUSED(ob), bGPDlayer *gpl, bGPDstroke *gps)
{
bGPDspoint *temp_points;
int totnewpoints, oldtotpoints;
int i2;
- if (!is_stroke_affected_by_modifier(mmd->layername,mmd->passindex, 3, gpl, gps,
- (bool)mmd->flag & GP_SUBDIV_INVERSE_LAYER, (bool)mmd->flag & GP_SUBDIV_INVERSE_PASS)) {
+ if (!is_stroke_affected_by_modifier(
+ mmd->layername, mmd->passindex, 3, gpl, gps,
+ (bool)mmd->flag & GP_SUBDIV_INVERSE_LAYER, (bool)mmd->flag & GP_SUBDIV_INVERSE_PASS))
+ {
return;
}
@@ -385,19 +392,22 @@ void BKE_gpencil_subdiv_modifier(int UNUSED(id), GpencilSubdivModifierData *mmd,
}
/* change stroke thickness */
-void BKE_gpencil_thick_modifier(int UNUSED(id), GpencilThickModifierData *mmd, Object *ob, bGPDlayer *gpl, bGPDstroke *gps)
+void BKE_gpencil_thick_modifier(
+ int UNUSED(id), GpencilThickModifierData *mmd, Object *ob, bGPDlayer *gpl, bGPDstroke *gps)
{
bGPDspoint *pt;
int vindex = get_vertex_group_index(ob, mmd->vgname);
float weight = 1.0f;
float curvef = 1.0;
- if (!is_stroke_affected_by_modifier(mmd->layername, mmd->passindex, 3, gpl, gps,
- (bool)mmd->flag & GP_THICK_INVERSE_LAYER, (bool)mmd->flag & GP_THICK_INVERSE_PASS)) {
+ if (!is_stroke_affected_by_modifier(
+ mmd->layername, mmd->passindex, 3, gpl, gps,
+ (bool)mmd->flag & GP_THICK_INVERSE_LAYER, (bool)mmd->flag & GP_THICK_INVERSE_PASS))
+ {
return;
}
- for (int i = 0; i < gps->totpoints; ++i) {
+ for (int i = 0; i < gps->totpoints; i++) {
curvef = 1.0;
pt = &gps->points[i];
/* verify vertex group */
@@ -419,12 +429,15 @@ void BKE_gpencil_thick_modifier(int UNUSED(id), GpencilThickModifierData *mmd, O
}
/* tint strokes */
-void BKE_gpencil_tint_modifier(int UNUSED(id), GpencilTintModifierData *mmd, Object *UNUSED(ob), bGPDlayer *gpl, bGPDstroke *gps)
+void BKE_gpencil_tint_modifier(
+ int UNUSED(id), GpencilTintModifierData *mmd, Object *UNUSED(ob), bGPDlayer *gpl, bGPDstroke *gps)
{
bGPDspoint *pt;
- if (!is_stroke_affected_by_modifier(mmd->layername, mmd->passindex, 1, gpl, gps,
- (bool)mmd->flag & GP_TINT_INVERSE_LAYER, (bool)mmd->flag & GP_TINT_INVERSE_PASS)) {
+ if (!is_stroke_affected_by_modifier(
+ mmd->layername, mmd->passindex, 1, gpl, gps,
+ (bool)mmd->flag & GP_TINT_INVERSE_LAYER, (bool)mmd->flag & GP_TINT_INVERSE_PASS))
+ {
return;
}
@@ -444,7 +457,7 @@ void BKE_gpencil_tint_modifier(int UNUSED(id), GpencilTintModifierData *mmd, Obj
/* if factor > 1.0, affect the strength of the stroke */
if (mmd->factor > 1.0f) {
- for (int i = 0; i < gps->totpoints; ++i) {
+ for (int i = 0; i < gps->totpoints; i++) {
pt = &gps->points[i];
pt->strength += mmd->factor - 1.0f;
CLAMP(pt->strength, 0.0f, 1.0f);
@@ -454,12 +467,15 @@ void BKE_gpencil_tint_modifier(int UNUSED(id), GpencilTintModifierData *mmd, Obj
}
/* color correction strokes */
-void BKE_gpencil_color_modifier(int UNUSED(id), GpencilColorModifierData *mmd, Object *UNUSED(ob), bGPDlayer *gpl, bGPDstroke *gps)
+void BKE_gpencil_color_modifier(
+ int UNUSED(id), GpencilColorModifierData *mmd, Object *UNUSED(ob), bGPDlayer *gpl, bGPDstroke *gps)
{
PaletteColor *palcolor;
float hsv[3], factor[3];
- if (!is_stroke_affected_by_modifier(mmd->layername, mmd->passindex, 1, gpl, gps,
- (bool)mmd->flag & GP_COLOR_INVERSE_LAYER, (bool)mmd->flag & GP_COLOR_INVERSE_PASS)) {
+ if (!is_stroke_affected_by_modifier(
+ mmd->layername, mmd->passindex, 1, gpl, gps,
+ (bool)mmd->flag & GP_COLOR_INVERSE_LAYER, (bool)mmd->flag & GP_COLOR_INVERSE_PASS))
+ {
return;
}
@@ -480,14 +496,17 @@ void BKE_gpencil_color_modifier(int UNUSED(id), GpencilColorModifierData *mmd, O
}
/* opacity strokes */
-void BKE_gpencil_opacity_modifier(int UNUSED(id), GpencilOpacityModifierData *mmd, Object *ob, bGPDlayer *gpl, bGPDstroke *gps)
+void BKE_gpencil_opacity_modifier(
+ int UNUSED(id), GpencilOpacityModifierData *mmd, Object *ob, bGPDlayer *gpl, bGPDstroke *gps)
{
bGPDspoint *pt;
int vindex = get_vertex_group_index(ob, mmd->vgname);
float weight = 1.0f;
- if (!is_stroke_affected_by_modifier(mmd->layername, mmd->passindex, 3, gpl, gps,
- (bool)mmd->flag & GP_OPACITY_INVERSE_LAYER,
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list