[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [46367] trunk/blender/source/blender/ editors/sculpt_paint: Code cleanup: make changes suggested by check_style for sculpt-related files.
Nicholas Bishop
nicholasbishop at gmail.com
Mon May 7 00:12:26 CEST 2012
Revision: 46367
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=46367
Author: nicholasbishop
Date: 2012-05-06 22:12:26 +0000 (Sun, 06 May 2012)
Log Message:
-----------
Code cleanup: make changes suggested by check_style for sculpt-related files.
Modified Paths:
--------------
trunk/blender/source/blender/editors/sculpt_paint/paint_stroke.c
trunk/blender/source/blender/editors/sculpt_paint/paint_vertex.c
trunk/blender/source/blender/editors/sculpt_paint/sculpt.c
trunk/blender/source/blender/editors/sculpt_paint/sculpt_undo.c
Modified: trunk/blender/source/blender/editors/sculpt_paint/paint_stroke.c
===================================================================
--- trunk/blender/source/blender/editors/sculpt_paint/paint_stroke.c 2012-05-06 22:06:14 UTC (rev 46366)
+++ trunk/blender/source/blender/editors/sculpt_paint/paint_stroke.c 2012-05-06 22:12:26 UTC (rev 46367)
@@ -188,7 +188,11 @@
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 @@
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 @@
{ 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(
Modified: trunk/blender/source/blender/editors/sculpt_paint/paint_vertex.c
===================================================================
--- trunk/blender/source/blender/editors/sculpt_paint/paint_vertex.c 2012-05-06 22:06:14 UTC (rev 46366)
+++ trunk/blender/source/blender/editors/sculpt_paint/paint_vertex.c 2012-05-06 22:12:26 UTC (rev 46367)
@@ -239,7 +239,7 @@
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;
Modified: trunk/blender/source/blender/editors/sculpt_paint/sculpt.c
===================================================================
--- trunk/blender/source/blender/editors/sculpt_paint/sculpt.c 2012-05-06 22:06:14 UTC (rev 46366)
+++ trunk/blender/source/blender/editors/sculpt_paint/sculpt.c 2012-05-06 22:12:26 UTC (rev 46367)
@@ -108,7 +108,7 @@
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 @@
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 @@
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 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 @@
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 @@
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 @@
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 @@
}
/* 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);
Modified: trunk/blender/source/blender/editors/sculpt_paint/sculpt_undo.c
===================================================================
--- trunk/blender/source/blender/editors/sculpt_paint/sculpt_undo.c 2012-05-06 22:06:14 UTC (rev 46366)
+++ trunk/blender/source/blender/editors/sculpt_paint/sculpt_undo.c 2012-05-06 22:12:26 UTC (rev 46367)
@@ -76,7 +76,10 @@
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 @@
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)
More information about the Bf-blender-cvs
mailing list