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>2014-02-03 11:55:59 +0400
committerCampbell Barton <ideasman42@gmail.com>2014-02-03 12:35:44 +0400
commitd900f5be55d0812eb5c7dfd3ea47020c3edafd41 (patch)
tree7d5035e3dbafdcd4988e7ed57068e48c951a989a /source/blender/editors/sculpt_paint
parenta948ae2c5167c49819241572d3aacb4e4bf5b6d7 (diff)
Code cleanup: use bools where possible
Diffstat (limited to 'source/blender/editors/sculpt_paint')
-rw-r--r--source/blender/editors/sculpt_paint/paint_hide.c8
-rw-r--r--source/blender/editors/sculpt_paint/paint_image_2d.c6
-rw-r--r--source/blender/editors/sculpt_paint/paint_image_proj.c28
-rw-r--r--source/blender/editors/sculpt_paint/paint_ops.c8
-rw-r--r--source/blender/editors/sculpt_paint/paint_vertex.c15
-rw-r--r--source/blender/editors/sculpt_paint/sculpt.c4
-rw-r--r--source/blender/editors/sculpt_paint/sculpt_uv.c4
7 files changed, 37 insertions, 36 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_hide.c b/source/blender/editors/sculpt_paint/paint_hide.c
index 0eb019afbf7..6542bb2ca9b 100644
--- a/source/blender/editors/sculpt_paint/paint_hide.c
+++ b/source/blender/editors/sculpt_paint/paint_hide.c
@@ -72,10 +72,10 @@
#include <assert.h>
/* return true if the element should be hidden/shown */
-static int is_effected(PartialVisArea area,
- float planes[4][4],
- const float co[3],
- const float mask)
+static bool is_effected(PartialVisArea area,
+ float planes[4][4],
+ const float co[3],
+ const float mask)
{
if (area == PARTIALVIS_ALL)
return 1;
diff --git a/source/blender/editors/sculpt_paint/paint_image_2d.c b/source/blender/editors/sculpt_paint/paint_image_2d.c
index be2f8727ec4..19f2673d96a 100644
--- a/source/blender/editors/sculpt_paint/paint_image_2d.c
+++ b/source/blender/editors/sculpt_paint/paint_image_2d.c
@@ -653,7 +653,7 @@ static void brush_painter_2d_refresh_cache(ImagePaintState *s, BrushPainter *pai
}
/* keep these functions in sync */
-static void paint_2d_ibuf_rgb_get(ImBuf *ibuf, int x, int y, const short is_torus, float r_rgb[4])
+static void paint_2d_ibuf_rgb_get(ImBuf *ibuf, int x, int y, const bool is_torus, float r_rgb[4])
{
if (is_torus) {
x %= ibuf->x;
@@ -671,7 +671,7 @@ static void paint_2d_ibuf_rgb_get(ImBuf *ibuf, int x, int y, const short is_toru
straight_uchar_to_premul_float(r_rgb, rrgb);
}
}
-static void paint_2d_ibuf_rgb_set(ImBuf *ibuf, int x, int y, const short is_torus, const float rgb[4])
+static void paint_2d_ibuf_rgb_set(ImBuf *ibuf, int x, int y, const bool is_torus, const float rgb[4])
{
if (is_torus) {
x %= ibuf->x;
@@ -715,7 +715,7 @@ static int paint_2d_ibuf_add_if(ImBuf *ibuf, unsigned int x, unsigned int y, flo
return 1;
}
-static void paint_2d_lift_soften(ImBuf *ibuf, ImBuf *ibufb, int *pos, const short is_torus)
+static void paint_2d_lift_soften(ImBuf *ibuf, ImBuf *ibufb, int *pos, const bool is_torus)
{
int x, y, count, xi, yi, xo, yo;
int out_off[2], in_off[2], dim[2];
diff --git a/source/blender/editors/sculpt_paint/paint_image_proj.c b/source/blender/editors/sculpt_paint/paint_image_proj.c
index 2e8a8a32ce9..d2714639a56 100644
--- a/source/blender/editors/sculpt_paint/paint_image_proj.c
+++ b/source/blender/editors/sculpt_paint/paint_image_proj.c
@@ -234,14 +234,14 @@ typedef struct ProjPaintState {
int winx, winy; /* from the carea or from the projection render */
/* options for projection painting */
- int do_layer_clone;
- int do_layer_stencil;
- int do_layer_stencil_inv;
-
- short do_occlude; /* Use raytraced occlusion? - ortherwise will paint right through to the back*/
- short do_backfacecull; /* ignore faces with normals pointing away, skips a lot of raycasts if your normals are correctly flipped */
- short do_mask_normal; /* mask out pixels based on their normals */
- short do_new_shading_nodes; /* cache BKE_scene_use_new_shading_nodes value */
+ bool do_layer_clone;
+ bool do_layer_stencil;
+ bool do_layer_stencil_inv;
+
+ bool do_occlude; /* Use raytraced occlusion? - ortherwise will paint right through to the back*/
+ bool do_backfacecull; /* ignore faces with normals pointing away, skips a lot of raycasts if your normals are correctly flipped */
+ bool do_mask_normal; /* mask out pixels based on their normals */
+ bool do_new_shading_nodes; /* cache BKE_scene_use_new_shading_nodes value */
float normal_angle; /* what angle to mask at*/
float normal_angle_inner;
float normal_angle_range; /* difference between normal_angle and normal_angle_inner, for easy access */
@@ -1846,7 +1846,7 @@ static int float_z_sort(const void *p1, const void *p2)
}
static void project_bucket_clip_face(
- const int is_ortho,
+ const bool is_ortho,
rctf *bucket_bounds,
float *v1coSS, float *v2coSS, float *v3coSS,
float *uv1co, float *uv2co, float *uv3co,
@@ -2210,10 +2210,10 @@ static void project_paint_face_init(const ProjPaintState *ps, const int thread_i
float uv_clip[8][2];
int uv_clip_tot;
- const short is_ortho = ps->is_ortho;
- const short is_clone_other = ((ps->brush->imagepaint_tool == PAINT_TOOL_CLONE) && ps->dm_mtface_clone);
- const short do_backfacecull = ps->do_backfacecull;
- const short do_clip = ps->rv3d ? ps->rv3d->rflag & RV3D_CLIPPING : 0;
+ const bool is_ortho = ps->is_ortho;
+ const bool is_clone_other = ((ps->brush->imagepaint_tool == PAINT_TOOL_CLONE) && ps->dm_mtface_clone);
+ const bool do_backfacecull = ps->do_backfacecull;
+ const bool do_clip = ps->rv3d ? ps->rv3d->rflag & RV3D_CLIPPING : 0;
vCo[0] = ps->dm_mvert[mf->v1].co;
vCo[1] = ps->dm_mvert[mf->v2].co;
@@ -4244,7 +4244,7 @@ static void project_state_init(bContext *C, Object *ob, ProjPaintState *ps, int
ps->do_new_shading_nodes = BKE_scene_use_new_shading_nodes(scene); /* only cache the value */
if (ps->tool == PAINT_TOOL_CLONE)
- ps->do_layer_clone = (settings->imapaint.flag & IMAGEPAINT_PROJECT_LAYER_CLONE);
+ ps->do_layer_clone = (settings->imapaint.flag & IMAGEPAINT_PROJECT_LAYER_CLONE) ? 1 : 0;
ps->do_layer_stencil = (settings->imapaint.flag & IMAGEPAINT_PROJECT_LAYER_STENCIL) ? 1 : 0;
ps->do_layer_stencil_inv = (settings->imapaint.flag & IMAGEPAINT_PROJECT_LAYER_STENCIL_INV) ? 1 : 0;
diff --git a/source/blender/editors/sculpt_paint/paint_ops.c b/source/blender/editors/sculpt_paint/paint_ops.c
index 809e9911e09..ce57b12d0ba 100644
--- a/source/blender/editors/sculpt_paint/paint_ops.c
+++ b/source/blender/editors/sculpt_paint/paint_ops.c
@@ -313,8 +313,8 @@ static Brush *brush_tool_toggle(Main *bmain, Brush *brush_orig, const int tool,
static int brush_generic_tool_set(Main *bmain, Paint *paint, const int tool,
const size_t tool_offset, const int ob_mode,
- const char *tool_name, int create_missing,
- int toggle)
+ const char *tool_name, const bool create_missing,
+ const bool toggle)
{
Brush *brush, *brush_orig = BKE_paint_brush(paint);
@@ -350,8 +350,8 @@ static int brush_select_exec(bContext *C, wmOperator *op)
ToolSettings *toolsettings = CTX_data_tool_settings(C);
Paint *paint = NULL;
int tool, paint_mode = RNA_enum_get(op->ptr, "paint_mode");
- int create_missing = RNA_boolean_get(op->ptr, "create_missing");
- int toggle = RNA_boolean_get(op->ptr, "toggle");
+ const bool create_missing = RNA_boolean_get(op->ptr, "create_missing");
+ const bool toggle = RNA_boolean_get(op->ptr, "toggle");
const char *tool_name = "Brush";
size_t tool_offset;
diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c
index d6d13decf4d..a1ce39a4833 100644
--- a/source/blender/editors/sculpt_paint/paint_vertex.c
+++ b/source/blender/editors/sculpt_paint/paint_vertex.c
@@ -280,12 +280,13 @@ static void do_shared_vertex_tesscol(Mesh *me, bool *mfacetag)
MEM_freeN(scolmain);
}
-static void do_shared_vertexcol(Mesh *me, bool *mlooptag, bool *mfacetag, int do_tessface)
+static void do_shared_vertexcol(Mesh *me, bool *mlooptag, bool *mfacetag, const bool do_tessface)
{
const int use_face_sel = (me->editflag & ME_EDIT_PAINT_FACE_SEL);
MPoly *mp;
int (*scol)[4];
- int i, j, has_shared = 0;
+ int i, j;
+ bool has_shared = false;
/* if no mloopcol: do not do */
/* if mtexpoly: only the involved faces, otherwise all */
@@ -1464,7 +1465,7 @@ static void multipaint_selection(MDeformVert *dvert, const int defbase_tot, floa
static float redistribute_change(MDeformVert *ndv, const int defbase_tot,
char *change_status, const char change_me, int changeto,
float totchange, float total_valid,
- char do_auto_normalize)
+ bool do_auto_normalize)
{
bool changed;
float change;
@@ -1523,7 +1524,7 @@ static float get_mp_change(MDeformVert *odv, const int defbase_tot, const bool *
static void enforce_locks(MDeformVert *odv, MDeformVert *ndv,
const int defbase_tot, const bool *defbase_sel,
const bool *lock_flags, const bool *vgroup_validmap,
- char do_auto_normalize, char do_multipaint)
+ bool do_auto_normalize, bool do_multipaint)
{
float totchange = 0.0f;
float totchange_allowed = 0.0f;
@@ -1697,9 +1698,9 @@ typedef struct WeightPaintInfo {
const bool *vgroup_validmap; /* same as WeightPaintData.vgroup_validmap,
* only added here for convenience */
- char do_flip;
- char do_multipaint;
- char do_auto_normalize;
+ bool do_flip;
+ bool do_multipaint;
+ bool do_auto_normalize;
float brush_alpha_value; /* result of BKE_brush_alpha_get() */
} WeightPaintInfo;
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index 331701cb486..c8645b1f3de 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -995,7 +995,7 @@ typedef struct {
} SculptSearchSphereData;
/* Test AABB against sphere */
-static int sculpt_search_sphere_cb(PBVHNode *node, void *data_v)
+static bool sculpt_search_sphere_cb(PBVHNode *node, void *data_v)
{
SculptSearchSphereData *data = data_v;
float *center = data->ss->cache->location, nearest[3];
@@ -3552,7 +3552,7 @@ void sculpt_update_mesh_elements(Scene *scene, Sculpt *sd, Object *ob,
MultiresModifierData *mmd = sculpt_multires_active(scene, ob);
ss->modifiers_active = sculpt_modifiers_active(scene, sd, ob);
- ss->show_diffuse_color = sd->flags & SCULPT_SHOW_DIFFUSE;
+ ss->show_diffuse_color = (sd->flags & SCULPT_SHOW_DIFFUSE) != 0;
if (need_mask) {
if (mmd == NULL) {
diff --git a/source/blender/editors/sculpt_paint/sculpt_uv.c b/source/blender/editors/sculpt_paint/sculpt_uv.c
index 6d5025f1a22..20f78690188 100644
--- a/source/blender/editors/sculpt_paint/sculpt_uv.c
+++ b/source/blender/editors/sculpt_paint/sculpt_uv.c
@@ -500,7 +500,7 @@ static void uv_sculpt_stroke_exit(bContext *C, wmOperator *op)
op->customdata = NULL;
}
-static int uv_element_offset_from_face_get(UvElementMap *map, BMFace *efa, BMLoop *l, int island_index, int doIslands)
+static int uv_element_offset_from_face_get(UvElementMap *map, BMFace *efa, BMLoop *l, int island_index, const bool doIslands)
{
UvElement *element = BM_uv_element_get(map, efa, l);
if (!element || (doIslands && element->island != island_index)) {
@@ -555,7 +555,7 @@ static UvSculptData *uv_sculpt_stroke_init(bContext *C, wmOperator *op, const wm
GHash *edgeHash;
GHashIterator *ghi;
- int do_island_optimization = !(ts->uv_sculpt_settings & UV_SCULPT_ALL_ISLANDS);
+ bool do_island_optimization = !(ts->uv_sculpt_settings & UV_SCULPT_ALL_ISLANDS);
int island_index = 0;
/* Holds, for each UvElement in elementMap, a pointer to its unique uv.*/
int *uniqueUv;