Code cleanup: make changes suggested by check_style for sculpt-related files.

This commit is contained in:
Nicholas Bishop 2012-05-06 22:12:26 +00:00
parent 2314b77eba
commit a8e8775cb8
4 changed files with 38 additions and 19 deletions

@ -188,7 +188,11 @@ static int paint_smooth_stroke(PaintStroke *stroke, float output[2], wmEvent *ev
output[1] = event->y;
if ((stroke->brush->flag & BRUSH_SMOOTH_STROKE) &&
!ELEM4(stroke->brush->sculpt_tool, SCULPT_TOOL_GRAB, SCULPT_TOOL_THUMB, SCULPT_TOOL_ROTATE, SCULPT_TOOL_SNAKE_HOOK) &&
!ELEM4(stroke->brush->sculpt_tool,
SCULPT_TOOL_GRAB,
SCULPT_TOOL_THUMB,
SCULPT_TOOL_ROTATE,
SCULPT_TOOL_SNAKE_HOOK) &&
!(stroke->brush->flag & BRUSH_ANCHORED) &&
!(stroke->brush->flag & BRUSH_RESTORE_MESH))
{
@ -279,7 +283,7 @@ PaintStroke *paint_stroke_new(bContext *C,
void paint_stroke_data_free(struct wmOperator *op)
{
MEM_freeN(op->customdata);
op->customdata= NULL;
op->customdata = NULL;
}
static void stroke_done(struct bContext *C, struct wmOperator *op)
@ -323,13 +327,13 @@ struct wmKeyMap *paint_stroke_modal_keymap(struct wmKeyConfig *keyconf)
{ 0 }
};
static const char *name= "Paint Stroke Modal";
static const char *name = "Paint Stroke Modal";
struct wmKeyMap *keymap= WM_modalkeymap_get(keyconf, name);
struct wmKeyMap *keymap = WM_modalkeymap_get(keyconf, name);
/* this function is called for each spacetype, only needs to add map once */
if (!keymap) {
keymap= WM_modalkeymap_add(keyconf, name, modal_items);
keymap = WM_modalkeymap_add(keyconf, name, modal_items);
/* items for modal map */
WM_modalkeymap_add_item(

@ -239,7 +239,7 @@ static void do_shared_vertex_tesscol(Mesh *me)
mface = me->mface;
mcol = (char *)me->mcol;
for (a = me->totface; a > 0; a--, mface++, mcol += 16) {
if ((use_face_sel == FALSE)|| (mface->flag & ME_FACE_SEL)) {
if ((use_face_sel == FALSE) || (mface->flag & ME_FACE_SEL)) {
scol = scolmain + 4 * mface->v1;
mcol[1] = scol[1]; mcol[2] = scol[2]; mcol[3] = scol[3];
scol = scolmain + 4 * mface->v2;

@ -108,7 +108,7 @@ float *ED_sculpt_get_last_stroke(struct Object *ob)
int ED_sculpt_minmax(bContext *C, float *min, float *max)
{
Object *ob= CTX_data_active_object(C);
Object *ob = CTX_data_active_object(C);
if (ob && ob->sculpt && ob->sculpt->last_stroke_valid) {
copy_v3_v3(min, ob->sculpt->last_stroke);
@ -1239,6 +1239,7 @@ static void do_crease_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnod
float offset[3], area_normal[3];
float bstrength = ss->cache->bstrength;
float flippedbstrength, crease_correction;
float brush_alpha;
int n;
calc_sculpt_normal(sd, ob, area_normal, nodes, totnode);
@ -1249,11 +1250,10 @@ static void do_crease_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnod
mul_v3_fl(offset, bstrength);
/* we divide out the squared alpha and multiply by the squared crease to give us the pinch strength */
if (BKE_brush_alpha_get(scene, brush) > 0.0f)
crease_correction = brush->crease_pinch_factor * brush->crease_pinch_factor / (BKE_brush_alpha_get(scene, brush) * BKE_brush_alpha_get(scene, brush));
else
crease_correction = brush->crease_pinch_factor * brush->crease_pinch_factor;
crease_correction = brush->crease_pinch_factor * brush->crease_pinch_factor;
brush_alpha = BKE_brush_alpha_get(scene, brush);
if (brush_alpha > 0.0f)
crease_correction /= brush_alpha * brush_alpha;
/* we always want crease to pinch or blob to relax even when draw is negative */
flippedbstrength = (bstrength < 0) ? -crease_correction * bstrength : crease_correction * bstrength;
@ -1928,7 +1928,8 @@ static void point_plane_project(float intr[3], float co[3], float plane_normal[3
static int plane_trim(StrokeCache *cache, Brush *brush, float val[3])
{
return !(brush->flag & BRUSH_PLANE_TRIM) || (dot_v3v3(val, val) <= cache->radius_squared * cache->plane_trim_squared);
return (!(brush->flag & BRUSH_PLANE_TRIM) ||
((dot_v3v3(val, val) <= cache->radius_squared * cache->plane_trim_squared)));
}
static int plane_point_side_flip(float co[3], float plane_normal[3], float plane_center[3], int flip)
@ -2371,7 +2372,9 @@ void sculpt_vertcos_to_key(Object *ob, KeyBlock *kb, float (*vertCos)[3])
for (a = 0; a < me->totvert; a++, mvert++)
copy_v3_v3(mvert->co, vertCos[a]);
BKE_mesh_calc_normals_mapping(me->mvert, me->totvert, me->mloop, me->mpoly, me->totloop, me->totpoly, NULL, NULL, 0, NULL, NULL);
BKE_mesh_calc_normals_mapping(me->mvert, me->totvert, me->mloop,
me->mpoly, me->totloop, me->totpoly,
NULL, NULL, 0, NULL, NULL);
}
/* apply new coords on active key block */
@ -2389,7 +2392,11 @@ static void do_brush_action(Sculpt *sd, Object *ob, Brush *brush)
data.ss = ss;
data.sd = sd;
data.radius_squared = ss->cache->radius_squared;
data.original = ELEM4(brush->sculpt_tool, SCULPT_TOOL_GRAB, SCULPT_TOOL_ROTATE, SCULPT_TOOL_THUMB, SCULPT_TOOL_LAYER);
data.original = ELEM4(brush->sculpt_tool,
SCULPT_TOOL_GRAB,
SCULPT_TOOL_ROTATE,
SCULPT_TOOL_THUMB,
SCULPT_TOOL_LAYER);
BLI_pbvh_search_gather(ss->pbvh, sculpt_search_sphere_cb, &data, &nodes, &totnode);
/* Only act if some verts are inside the brush area */
@ -3134,7 +3141,9 @@ static void sculpt_update_cache_variants(bContext *C, Sculpt *sd, Object *ob,
if (cache->first_time) {
if (!BKE_brush_use_locked_size(scene, brush)) {
cache->initial_radius = paint_calc_object_space_radius(cache->vc, cache->true_location, BKE_brush_size_get(scene, brush));
cache->initial_radius = paint_calc_object_space_radius(cache->vc,
cache->true_location,
BKE_brush_size_get(scene, brush));
BKE_brush_unprojected_radius_set(scene, brush, cache->initial_radius);
}
else {
@ -3515,7 +3524,7 @@ static void sculpt_stroke_done(const bContext *C, struct PaintStroke *UNUSED(str
}
/* update last stroke position */
ob->sculpt->last_stroke_valid= 1;
ob->sculpt->last_stroke_valid = 1;
copy_v3_v3(ob->sculpt->last_stroke, ss->cache->true_location);
mul_m4_v3(ob->obmat, ob->sculpt->last_stroke);

@ -76,7 +76,10 @@ static void update_cb(PBVHNode *node, void *rebuild)
BLI_pbvh_node_fully_hidden_set(node, 0);
}
static void sculpt_undo_restore_deformed(SculptSession *ss, SculptUndoNode *unode, int uindex, int oindex, float coord[3])
static void sculpt_undo_restore_deformed(const SculptSession *ss,
SculptUndoNode *unode,
int uindex, int oindex,
float coord[3])
{
if (unode->orig_co) {
swap_v3_v3(coord, unode->orig_co[uindex]);
@ -385,7 +388,10 @@ static SculptUndoNode *sculpt_undo_alloc_node(Object *ob, PBVHNode *node,
case SCULPT_UNDO_COORDS:
unode->co = MEM_mapallocN(sizeof(float) * 3 * allvert, "SculptUndoNode.co");
unode->no = MEM_mapallocN(sizeof(short) * 3 * allvert, "SculptUndoNode.no");
undo_paint_push_count_alloc(UNDO_PAINT_MESH, (sizeof(float) * 3 + sizeof(short) * 3 + sizeof(int)) * allvert);
undo_paint_push_count_alloc(UNDO_PAINT_MESH,
(sizeof(float) * 3 +
sizeof(short) * 3 +
sizeof(int)) * allvert);
break;
case SCULPT_UNDO_HIDDEN:
if (maxgrid)