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:
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/include/ED_sculpt.h6
-rw-r--r--source/blender/editors/object/object_bake.c6
-rw-r--r--source/blender/editors/object/object_modifier.c5
-rw-r--r--source/blender/editors/sculpt_paint/paint_hide.c20
-rw-r--r--source/blender/editors/sculpt_paint/paint_intern.h24
-rw-r--r--source/blender/editors/sculpt_paint/paint_ops.c63
-rw-r--r--source/blender/editors/sculpt_paint/sculpt.c269
-rw-r--r--source/blender/editors/sculpt_paint/sculpt_intern.h16
-rw-r--r--source/blender/editors/sculpt_paint/sculpt_undo.c62
-rw-r--r--source/blender/editors/uvedit/uvedit_unwrap_ops.c7
10 files changed, 255 insertions, 223 deletions
diff --git a/source/blender/editors/include/ED_sculpt.h b/source/blender/editors/include/ED_sculpt.h
index d35fc8f4636..e8593e9b60d 100644
--- a/source/blender/editors/include/ED_sculpt.h
+++ b/source/blender/editors/include/ED_sculpt.h
@@ -46,15 +46,15 @@ void ED_sculpt_force_update(struct bContext *C);
float *ED_sculpt_get_last_stroke(struct Object *ob);
int ED_sculpt_minmax(struct bContext *C, float *min, float *max);
void ED_sculpt_mask_layers_ensure(struct Object *ob,
- struct MultiresModifierData *mmd);
+ struct MultiresModifierData *mmd);
/* paint_ops.c */
void ED_operatortypes_paint(void);
void ED_keymap_paint(struct wmKeyConfig *keyconf);
/* paint_undo.c */
-#define UNDO_PAINT_IMAGE 0
-#define UNDO_PAINT_MESH 1
+#define UNDO_PAINT_IMAGE 0
+#define UNDO_PAINT_MESH 1
int ED_undo_paint_step(struct bContext *C, int type, int step, const char *name);
void ED_undo_paint_free(void);
diff --git a/source/blender/editors/object/object_bake.c b/source/blender/editors/object/object_bake.c
index c6155b54aec..cea9a0aae6b 100644
--- a/source/blender/editors/object/object_bake.c
+++ b/source/blender/editors/object/object_bake.c
@@ -486,7 +486,7 @@ static void interp_bilinear_grid(CCGKey *key, CCGElem *grid, float crn_x, float
x1 = x0 >= (key->grid_size - 1) ? (key->grid_size - 1) : (x0 + 1);
y0 = (int) crn_y;
- y1 = y0 >= (key->grid_size - 1 ) ? (key->grid_size - 1) : (y0 + 1);
+ y1 = y0 >= (key->grid_size - 1) ? (key->grid_size - 1) : (y0 + 1);
u = crn_x - x0;
v = crn_y - y0;
@@ -1024,7 +1024,7 @@ static DerivedMesh *multiresbake_create_loresdm(Scene *scene, Object *ob, int *l
tmp_mmd.lvl = *lvl;
tmp_mmd.sculptlvl = *lvl;
dm = multires_make_derived_from_derived(cddm, &tmp_mmd, ob,
- MULTIRES_USE_LOCAL_MMD);
+ MULTIRES_USE_LOCAL_MMD);
cddm->release(cddm);
}
@@ -1045,7 +1045,7 @@ static DerivedMesh *multiresbake_create_hiresdm(Scene *scene, Object *ob, int *l
tmp_mmd.lvl = mmd->totlvl;
tmp_mmd.sculptlvl = mmd->totlvl;
dm = multires_make_derived_from_derived(cddm, &tmp_mmd, ob,
- MULTIRES_USE_LOCAL_MMD);
+ MULTIRES_USE_LOCAL_MMD);
cddm->release(cddm);
return dm;
diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c
index 7e9201a708d..191677989b9 100644
--- a/source/blender/editors/object/object_modifier.c
+++ b/source/blender/editors/object/object_modifier.c
@@ -153,7 +153,7 @@ ModifierData *ED_object_modifier_add(ReportList *reports, Main *bmain, Scene *sc
multiresModifier_set_levels_from_disps((MultiresModifierData *)new_md, ob);
/* ensure that grid paint mask layer is created */
- ED_sculpt_mask_layers_ensure(ob, (MultiresModifierData*)new_md);
+ ED_sculpt_mask_layers_ensure(ob, (MultiresModifierData *)new_md);
}
}
@@ -926,7 +926,8 @@ static int modifier_apply_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(ev
static EnumPropertyItem modifier_apply_as_items[] = {
{MODIFIER_APPLY_DATA, "DATA", 0, "Object Data", "Apply modifier to the object's data"},
{MODIFIER_APPLY_SHAPE, "SHAPE", 0, "New Shape", "Apply deform-only modifier to a new shape on this object"},
- {0, NULL, 0, NULL, NULL}};
+ {0, NULL, 0, NULL, NULL}
+};
void OBJECT_OT_modifier_apply(wmOperatorType *ot)
{
diff --git a/source/blender/editors/sculpt_paint/paint_hide.c b/source/blender/editors/sculpt_paint/paint_hide.c
index fd25bba2cec..87bc89f810c 100644
--- a/source/blender/editors/sculpt_paint/paint_hide.c
+++ b/source/blender/editors/sculpt_paint/paint_hide.c
@@ -83,9 +83,9 @@ static int planes_contain_v3(float (*planes)[4], int totplane, const float p[3])
/* 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)
+ float planes[4][4],
+ const float co[3],
+ const float mask)
{
if (area == PARTIALVIS_ALL)
return 1;
@@ -158,8 +158,8 @@ static void partialvis_update_grids(Object *ob,
/* get PBVH data */
BLI_pbvh_node_get_grids(pbvh, node,
- &grid_indices, &totgrid, NULL, NULL,
- &grids, NULL);
+ &grid_indices, &totgrid, NULL, NULL,
+ &grids, NULL);
grid_hidden = BLI_pbvh_grid_hidden(pbvh);
BLI_pbvh_get_grid_key(pbvh, &key);
@@ -176,7 +176,7 @@ static void partialvis_update_grids(Object *ob,
case PARTIALVIS_HIDE:
/* create grid flags data */
gh = grid_hidden[g] = BLI_BITMAP_NEW(key.grid_area,
- "partialvis_update_grids");
+ "partialvis_update_grids");
break;
case PARTIALVIS_SHOW:
/* entire grid is visible, nothing to show */
@@ -203,7 +203,7 @@ static void partialvis_update_grids(Object *ob,
if (is_effected(area, planes, co, mask)) {
/* set or clear the hide flag */
BLI_BITMAP_MODIFY(gh, y * key.grid_size + x,
- action == PARTIALVIS_HIDE);
+ action == PARTIALVIS_HIDE);
any_changed = 1;
}
@@ -368,14 +368,16 @@ void PAINT_OT_hide_show(struct wmOperatorType *ot)
static EnumPropertyItem action_items[] = {
{PARTIALVIS_HIDE, "HIDE", 0, "Hide", "Hide vertices"},
{PARTIALVIS_SHOW, "SHOW", 0, "Show", "Show vertices"},
- {0, NULL, 0, NULL, NULL}};
+ {0, NULL, 0, NULL, NULL}
+ };
static EnumPropertyItem area_items[] = {
{PARTIALVIS_OUTSIDE, "OUTSIDE", 0, "Outside", "Hide or show vertices outside the selection"},
{PARTIALVIS_INSIDE, "INSIDE", 0, "Inside", "Hide or show vertices inside the selection"},
{PARTIALVIS_ALL, "ALL", 0, "All", "Hide or show all vertices"},
{PARTIALVIS_MASKED, "MASKED", 0, "Masked", "Hide or show vertices that are masked (minimum mask value of 0.5)"},
- {0, NULL, 0, NULL, NULL}};
+ {0, NULL, 0, NULL, NULL}
+ };
/* identifiers */
ot->name = "Hide/Show";
diff --git a/source/blender/editors/sculpt_paint/paint_intern.h b/source/blender/editors/sculpt_paint/paint_intern.h
index cf6c6c626d0..a97563b258f 100644
--- a/source/blender/editors/sculpt_paint/paint_intern.h
+++ b/source/blender/editors/sculpt_paint/paint_intern.h
@@ -57,8 +57,8 @@ typedef void (*StrokeUpdateStep)(struct bContext *C, struct PaintStroke *stroke,
typedef void (*StrokeDone)(const struct bContext *C, struct PaintStroke *stroke);
struct PaintStroke *paint_stroke_new(struct bContext *C,
- StrokeGetLocation get_location, StrokeTestStart test_start,
- StrokeUpdateStep update_step, StrokeDone done, int event_type);
+ StrokeGetLocation get_location, StrokeTestStart test_start,
+ StrokeUpdateStep update_step, StrokeDone done, int event_type);
void paint_stroke_data_free(struct wmOperator *op);
int paint_space_stroke_enabled(struct Brush *br);
@@ -116,24 +116,24 @@ void SCULPT_OT_uv_sculpt_stroke(struct wmOperatorType *ot);
* its minimum and maximum corners) into a screen-space rectangle,
* returns zero if the result is empty */
int paint_convert_bb_to_rect(struct rcti *rect,
- const float bb_min[3],
- const float bb_max[3],
- const struct ARegion *ar,
- struct RegionView3D *rv3d,
- struct Object *ob);
+ const float bb_min[3],
+ const float bb_max[3],
+ const struct ARegion *ar,
+ struct RegionView3D *rv3d,
+ struct Object *ob);
/* Get four planes in object-space that describe the projection of
* screen_rect from screen into object-space (essentially converting a
* 2D screens-space bounding box into four 3D planes) */
void paint_calc_redraw_planes(float planes[4][4],
- const struct ARegion *ar,
- struct RegionView3D *rv3d,
- struct Object *ob,
- const struct rcti *screen_rect);
+ const struct ARegion *ar,
+ struct RegionView3D *rv3d,
+ struct Object *ob,
+ const struct rcti *screen_rect);
void projectf(struct bglMats *mats, const float v[3], float p[2]);
float paint_calc_object_space_radius(struct ViewContext *vc, const float center[3], float pixel_radius);
-float paint_get_tex_pixel(struct Brush* br, float u, float v);
+float paint_get_tex_pixel(struct Brush *br, float u, float v);
int imapaint_pick_face(struct ViewContext *vc, const int mval[2], unsigned int *index, unsigned int totface);
void imapaint_pick_uv(struct Scene *scene, struct Object *ob, unsigned int faceindex, const int xy[2], float uv[2]);
diff --git a/source/blender/editors/sculpt_paint/paint_ops.c b/source/blender/editors/sculpt_paint/paint_ops.c
index b1711817ead..f8ed20430e7 100644
--- a/source/blender/editors/sculpt_paint/paint_ops.c
+++ b/source/blender/editors/sculpt_paint/paint_ops.c
@@ -235,19 +235,20 @@ static Brush *brush_tool_cycle(Main *bmain, Brush *brush_orig, const int tool, c
static Brush *brush_tool_toggle(Main *bmain, Brush *brush_orig, const int tool, const size_t tool_offset, const int ob_mode)
{
- if(!brush_orig || brush_tool(brush_orig, tool_offset) != tool) {
+ if (!brush_orig || brush_tool(brush_orig, tool_offset) != tool) {
Brush *br;
/* if the current brush is not using the desired tool, look
for one that is */
- br= brush_tool_cycle(bmain, brush_orig, tool, tool_offset, ob_mode);
+ br = brush_tool_cycle(bmain, brush_orig, tool, tool_offset, ob_mode);
/* store the previously-selected brush */
- if(br)
- br->toggle_brush= brush_orig;
+ if (br)
+ br->toggle_brush = brush_orig;
return br;
}
- else if(brush_orig->toggle_brush &&
- BLI_findindex(bmain->brush.first, brush_orig->toggle_brush) != -1) {
+ else if (brush_orig->toggle_brush &&
+ BLI_findindex(bmain->brush.first, brush_orig->toggle_brush) != -1)
+ {
/* if current brush is using the desired tool, try to toggle
back to the previously selected brush (if it was set, and
if it still exists) */
@@ -258,22 +259,22 @@ 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 size_t tool_offset, const int ob_mode,
+ const char *tool_name, int create_missing,
+ int toggle)
{
struct Brush *brush, *brush_orig = paint_brush(paint);
- if(toggle)
+ if (toggle)
brush = brush_tool_toggle(bmain, brush_orig, tool, tool_offset, ob_mode);
else
brush = brush_tool_cycle(bmain, brush_orig, tool, tool_offset, ob_mode);
- if(!brush && brush_tool(brush_orig, tool_offset) != tool && create_missing) {
+ if (!brush && brush_tool(brush_orig, tool_offset) != tool && create_missing) {
brush = BKE_brush_add(tool_name);
brush_tool_set(brush, tool_offset, tool);
- brush->ob_mode= ob_mode;
- brush->toggle_brush= brush_orig;
+ brush->ob_mode = ob_mode;
+ brush->toggle_brush = brush_orig;
}
if (brush) {
@@ -315,30 +316,30 @@ static int brush_select_exec(bContext *C, wmOperator *op)
}
}
- switch(paint_mode) {
+ switch (paint_mode) {
case OB_MODE_SCULPT:
- paint= &toolsettings->sculpt->paint;
- tool_offset= offsetof(Brush, sculpt_tool);
- tool= RNA_enum_get(op->ptr, "sculpt_tool");
+ paint = &toolsettings->sculpt->paint;
+ tool_offset = offsetof(Brush, sculpt_tool);
+ tool = RNA_enum_get(op->ptr, "sculpt_tool");
RNA_enum_name_from_value(brush_sculpt_tool_items, tool, &tool_name);
break;
case OB_MODE_VERTEX_PAINT:
- paint= &toolsettings->vpaint->paint;
- tool_offset= offsetof(Brush, vertexpaint_tool);
- tool= RNA_enum_get(op->ptr, "vertex_paint_tool");
+ paint = &toolsettings->vpaint->paint;
+ tool_offset = offsetof(Brush, vertexpaint_tool);
+ tool = RNA_enum_get(op->ptr, "vertex_paint_tool");
RNA_enum_name_from_value(brush_vertex_tool_items, tool, &tool_name);
break;
case OB_MODE_WEIGHT_PAINT:
- paint= &toolsettings->wpaint->paint;
+ paint = &toolsettings->wpaint->paint;
/* vertexpaint_tool is used for weight paint mode */
- tool_offset= offsetof(Brush, vertexpaint_tool);
- tool= RNA_enum_get(op->ptr, "weight_paint_tool");
+ tool_offset = offsetof(Brush, vertexpaint_tool);
+ tool = RNA_enum_get(op->ptr, "weight_paint_tool");
RNA_enum_name_from_value(brush_vertex_tool_items, tool, &tool_name);
break;
case OB_MODE_TEXTURE_PAINT:
- paint= &toolsettings->imapaint.paint;
- tool_offset= offsetof(Brush, imagepaint_tool);
- tool= RNA_enum_get(op->ptr, "texture_paint_tool");
+ paint = &toolsettings->imapaint.paint;
+ tool_offset = offsetof(Brush, imagepaint_tool);
+ tool = RNA_enum_get(op->ptr, "texture_paint_tool");
RNA_enum_name_from_value(brush_image_tool_items, tool, &tool_name);
break;
default:
@@ -347,8 +348,8 @@ static int brush_select_exec(bContext *C, wmOperator *op)
}
return brush_generic_tool_set(bmain, paint, tool, tool_offset,
- paint_mode, tool_name, create_missing,
- toggle);
+ paint_mode, tool_name, create_missing,
+ toggle);
}
static void PAINT_OT_brush_select(wmOperatorType *ot)
@@ -635,12 +636,12 @@ void ED_keymap_paint(wmKeyConfig *keyconf)
RNA_int_set(WM_keymap_add_item(keymap, "OBJECT_OT_subdivision_set", ZEROKEY + i, KM_PRESS, KM_CTRL, 0)->ptr, "level", i);
/* Clear mask */
- kmi= WM_keymap_add_item(keymap, "PAINT_OT_mask_flood_fill", MKEY, KM_PRESS, KM_ALT, 0);
+ kmi = WM_keymap_add_item(keymap, "PAINT_OT_mask_flood_fill", MKEY, KM_PRESS, KM_ALT, 0);
RNA_enum_set(kmi->ptr, "mode", PAINT_MASK_FLOOD_VALUE);
RNA_float_set(kmi->ptr, "value", 0);
/* Invert mask */
- kmi= WM_keymap_add_item(keymap, "PAINT_OT_mask_flood_fill", IKEY, KM_PRESS, KM_CTRL, 0);
+ kmi = WM_keymap_add_item(keymap, "PAINT_OT_mask_flood_fill", IKEY, KM_PRESS, KM_CTRL, 0);
RNA_enum_set(kmi->ptr, "mode", PAINT_MASK_INVERT);
/* multires switch */
@@ -665,7 +666,7 @@ void ED_keymap_paint(wmKeyConfig *keyconf)
keymap_brush_select(keymap, OB_MODE_SCULPT, SCULPT_TOOL_FLATTEN, TKEY, KM_SHIFT);
keymap_brush_select(keymap, OB_MODE_SCULPT, SCULPT_TOOL_CLAY, CKEY, 0);
keymap_brush_select(keymap, OB_MODE_SCULPT, SCULPT_TOOL_CREASE, CKEY, KM_SHIFT);
- kmi= keymap_brush_select(keymap, OB_MODE_SCULPT, SCULPT_TOOL_MASK, MKEY, 0);
+ kmi = keymap_brush_select(keymap, OB_MODE_SCULPT, SCULPT_TOOL_MASK, MKEY, 0);
RNA_boolean_set(kmi->ptr, "toggle", 1);
RNA_boolean_set(kmi->ptr, "create_missing", 1);
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index b43217a9b8f..2d3a7680963 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -124,7 +124,7 @@ int ED_sculpt_minmax(bContext *C, float *min, float *max)
/* Sculpt mode handles multires differently from regular meshes, but only if
* it's the last modifier on the stack and it is not on the first level */
-struct MultiresModifierData *sculpt_multires_active(Scene *scene, Object *ob)
+MultiresModifierData *sculpt_multires_active(Scene *scene, Object *ob)
{
Mesh *me = (Mesh *)ob->data;
ModifierData *md;
@@ -291,7 +291,8 @@ static void paint_mesh_restore_co(Sculpt *sd, SculptSession *ss)
if (unode) {
PBVHVertexIter vd;
- BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) {
+ BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE)
+ {
if (unode->type == SCULPT_UNDO_COORDS) {
copy_v3_v3(vd.co, unode->co[vd.i]);
if (vd.no) copy_v3_v3_short(vd.no, unode->no[vd.i]);
@@ -649,10 +650,10 @@ static float brush_strength(Sculpt *sd, StrokeCache *cache, float feather)
case SCULPT_TOOL_MASK:
overlap = (1 + overlap) / 2;
switch ((BrushMaskTool)brush->mask_tool) {
- case BRUSH_MASK_DRAW:
- return alpha * flip * pressure * overlap * feather;
- case BRUSH_MASK_SMOOTH:
- return alpha * pressure * feather;
+ case BRUSH_MASK_DRAW:
+ return alpha * flip * pressure * overlap * feather;
+ case BRUSH_MASK_SMOOTH:
+ return alpha * pressure * feather;
}
case SCULPT_TOOL_CREASE:
@@ -713,11 +714,11 @@ static float brush_strength(Sculpt *sd, StrokeCache *cache, float feather)
/* Return a multiplier for brush strength on a particular vertex. */
static float tex_strength(SculptSession *ss, Brush *br, float point[3],
- const float len,
- const float sculpt_normal[3],
- const short vno[3],
- const float fno[3],
- const float mask)
+ const float len,
+ const float sculpt_normal[3],
+ const short vno[3],
+ const float fno[3],
+ const float mask)
{
MTex *mtex = &br->mtex;
float avg = 1;
@@ -901,7 +902,8 @@ static void calc_area_normal(Sculpt *sd, Object *ob, float an[3], PBVHNode **nod
sculpt_brush_test_init(ss, &test);
if (ss->cache->original) {
- BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) {
+ BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE)
+ {
if (sculpt_brush_test_fast(&test, unode->co[vd.i])) {
float fno[3];
@@ -912,7 +914,8 @@ static void calc_area_normal(Sculpt *sd, Object *ob, float an[3], PBVHNode **nod
BLI_pbvh_vertex_iter_end;
}
else {
- BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) {
+ BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE)
+ {
if (sculpt_brush_test_fast(&test, vd.co)) {
if (vd.no) {
float fno[3];
@@ -1072,11 +1075,12 @@ static void do_mesh_smooth_brush(Sculpt *sd, SculptSession *ss, PBVHNode *node,
sculpt_brush_test_init(ss, &test);
- BLI_pbvh_vertex_iter_begin(ss->pbvh, node, vd, PBVH_ITER_UNIQUE) {
+ BLI_pbvh_vertex_iter_begin(ss->pbvh, node, vd, PBVH_ITER_UNIQUE)
+ {
if (sculpt_brush_test(&test, vd.co)) {
- const float fade = bstrength*tex_strength(ss, brush, vd.co, test.dist,
- ss->cache->view_normal, vd.no, vd.fno,
- smooth_mask ? 0 : *vd.mask);
+ const float fade = bstrength * tex_strength(ss, brush, vd.co, test.dist,
+ ss->cache->view_normal, vd.no, vd.fno,
+ smooth_mask ? 0 : *vd.mask);
if (smooth_mask) {
float val = neighbor_average_mask(ss, vd.vert_indices[vd.i]) - *vd.mask;
val *= fade * bstrength;
@@ -1103,7 +1107,7 @@ static void do_mesh_smooth_brush(Sculpt *sd, SculptSession *ss, PBVHNode *node,
}
static void do_multires_smooth_brush(Sculpt *sd, SculptSession *ss, PBVHNode *node,
- float bstrength, int smooth_mask)
+ float bstrength, int smooth_mask)
{
Brush *brush = paint_brush(&sd->paint);
SculptBrushTest test;
@@ -1120,18 +1124,18 @@ static void do_multires_smooth_brush(Sculpt *sd, SculptSession *ss, PBVHNode *no
CLAMP(bstrength, 0.0f, 1.0f);
BLI_pbvh_node_get_grids(ss->pbvh, node, &grid_indices, &totgrid,
- NULL, &gridsize, &griddata, &gridadj);
+ NULL, &gridsize, &griddata, &gridadj);
BLI_pbvh_get_grid_key(ss->pbvh, &key);
#pragma omp critical
{
if (smooth_mask) {
- tmpgrid_mask = MEM_mallocN(sizeof(float)*gridsize*gridsize, "tmpgrid_mask");
- tmprow_mask = MEM_mallocN(sizeof(float)*gridsize, "tmprow_mask");
+ tmpgrid_mask = MEM_mallocN(sizeof(float) * gridsize * gridsize, "tmpgrid_mask");
+ tmprow_mask = MEM_mallocN(sizeof(float) * gridsize, "tmprow_mask");
}
else {
- tmpgrid_co = MEM_mallocN(sizeof(float)*3*gridsize*gridsize, "tmpgrid_co");
- tmprow_co = MEM_mallocN(sizeof(float)*3*gridsize, "tmprow_co");
+ tmpgrid_co = MEM_mallocN(sizeof(float) * 3 * gridsize * gridsize, "tmpgrid_co");
+ tmprow_co = MEM_mallocN(sizeof(float) * 3 * gridsize, "tmprow_co");
}
}
@@ -1140,20 +1144,20 @@ static void do_multires_smooth_brush(Sculpt *sd, SculptSession *ss, PBVHNode *no
adj = &gridadj[grid_indices[i]];
if (smooth_mask)
- memset(tmpgrid_mask, 0, sizeof(float)*gridsize*gridsize);
+ memset(tmpgrid_mask, 0, sizeof(float) * gridsize * gridsize);
else
- memset(tmpgrid_co, 0, sizeof(float)*3*gridsize*gridsize);
+ memset(tmpgrid_co, 0, sizeof(float) * 3 * gridsize * gridsize);
for (y = 0; y < gridsize - 1; y++) {
- v1 = y*gridsize;
+ v1 = y * gridsize;
if (smooth_mask) {
tmprow_mask[0] = (*CCG_elem_offset_mask(&key, data, v1) +
- *CCG_elem_offset_mask(&key, data, v1 + gridsize));
+ *CCG_elem_offset_mask(&key, data, v1 + gridsize));
}
else {
add_v3_v3v3(tmprow_co[0],
- CCG_elem_offset_co(&key, data, v1),
- CCG_elem_offset_co(&key, data, v1 + gridsize));
+ CCG_elem_offset_co(&key, data, v1),
+ CCG_elem_offset_co(&key, data, v1 + gridsize));
}
for (x = 0; x < gridsize - 1; x++) {
@@ -1166,7 +1170,7 @@ static void do_multires_smooth_brush(Sculpt *sd, SculptSession *ss, PBVHNode *no
float tmp;
tmprow_mask[x + 1] = (*CCG_elem_offset_mask(&key, data, v2) +
- *CCG_elem_offset_mask(&key, data, v4));
+ *CCG_elem_offset_mask(&key, data, v4));
tmp = tmprow_mask[x + 1] + tmprow_mask[x];
tmpgrid_mask[v1] += tmp;
@@ -1178,8 +1182,8 @@ static void do_multires_smooth_brush(Sculpt *sd, SculptSession *ss, PBVHNode *no
float tmp[3];
add_v3_v3v3(tmprow_co[x + 1],
- CCG_elem_offset_co(&key, data, v2),
- CCG_elem_offset_co(&key, data, v4));
+ CCG_elem_offset_co(&key, data, v2),
+ CCG_elem_offset_co(&key, data, v4));
add_v3_v3v3(tmp, tmprow_co[x + 1], tmprow_co[x]);
add_v3_v3(tmpgrid_co[v1], tmp);
@@ -1210,16 +1214,16 @@ static void do_multires_smooth_brush(Sculpt *sd, SculptSession *ss, PBVHNode *no
if (y == gridsize - 1 && adj->index[1] == -1)
continue;
- index = x + y*gridsize;
+ index = x + y * gridsize;
co = CCG_elem_offset_co(&key, data, index);
fno = CCG_elem_offset_no(&key, data, index);
mask = CCG_elem_offset_mask(&key, data, index);
if (sculpt_brush_test(&test, co)) {
const float strength_mask = (smooth_mask ? 0 : *mask);
- const float fade = bstrength*tex_strength(ss, brush, co, test.dist,
- ss->cache->view_normal,
- NULL, fno, strength_mask);
+ const float fade = bstrength * tex_strength(ss, brush, co, test.dist,
+ ss->cache->view_normal,
+ NULL, fno, strength_mask);
float n = 1.0f / 16.0f;
if (x == 0 || x == gridsize - 1)
@@ -1229,12 +1233,12 @@ static void do_multires_smooth_brush(Sculpt *sd, SculptSession *ss, PBVHNode *no
n *= 2;
if (smooth_mask) {
- *mask += ((tmpgrid_mask[x + y*gridsize] * n) - *mask) * fade;
+ *mask += ((tmpgrid_mask[x + y * gridsize] * n) - *mask) * fade;
}
else {
float *avg, val[3];
- avg = tmpgrid_co[x + y*gridsize];
+ avg = tmpgrid_co[x + y * gridsize];
mul_v3_fl(avg, n);
@@ -1264,7 +1268,7 @@ static void do_multires_smooth_brush(Sculpt *sd, SculptSession *ss, PBVHNode *no
}
static void smooth(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode,
- float bstrength, int smooth_mask)
+ float bstrength, int smooth_mask)
{
SculptSession *ss = ob->sculpt;
const int max_iterations = 4;
@@ -1282,11 +1286,11 @@ static void smooth(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode,
for (n = 0; n < totnode; n++) {
if (ss->multires) {
do_multires_smooth_brush(sd, ss, nodes[n],
- iteration != count ? 1.0f : last, smooth_mask);
+ iteration != count ? 1.0f : last, smooth_mask);
}
else if (ss->pmap) {
do_mesh_smooth_brush(sd, ss, nodes[n],
- iteration != count ? 1.0f : last, smooth_mask);
+ iteration != count ? 1.0f : last, smooth_mask);
}
}
@@ -1316,12 +1320,13 @@ static void do_mask_brush_draw(Sculpt *sd, Object *ob, PBVHNode **nodes, int tot
sculpt_brush_test_init(ss, &test);
- BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) {
+ BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE)
+ {
if (sculpt_brush_test(&test, vd.co)) {
float fade = tex_strength(ss, brush, vd.co, test.dist,
- ss->cache->view_normal, vd.no, vd.fno, 0);
+ ss->cache->view_normal, vd.no, vd.fno, 0);
- (*vd.mask) += fade*bstrength;
+ (*vd.mask) += fade * bstrength;
CLAMP(*vd.mask, 0, 1);
if (vd.mvert)
@@ -1338,12 +1343,12 @@ static void do_mask_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode)
Brush *brush = paint_brush(&sd->paint);
switch ((BrushMaskTool)brush->mask_tool) {
- case BRUSH_MASK_DRAW:
- do_mask_brush_draw(sd, ob, nodes, totnode);
- break;
- case BRUSH_MASK_SMOOTH:
- smooth(sd, ob, nodes, totnode, ss->cache->bstrength, TRUE);
- break;
+ case BRUSH_MASK_DRAW:
+ do_mask_brush_draw(sd, ob, nodes, totnode);
+ break;
+ case BRUSH_MASK_SMOOTH:
+ smooth(sd, ob, nodes, totnode, ss->cache->bstrength, TRUE);
+ break;
}
}
@@ -1373,11 +1378,12 @@ static void do_draw_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode)
sculpt_brush_test_init(ss, &test);
- BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) {
+ BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE)
+ {
if (sculpt_brush_test(&test, vd.co)) {
/* offset vertex */
float fade = tex_strength(ss, brush, vd.co, test.dist,
- area_normal, vd.no, vd.fno, *vd.mask);
+ area_normal, vd.no, vd.fno, *vd.mask);
mul_v3_v3fl(proxy[vd.i], offset, fade);
@@ -1429,7 +1435,8 @@ static void do_crease_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnod
sculpt_brush_test_init(ss, &test);
- BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) {
+ BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE)
+ {
if (sculpt_brush_test(&test, vd.co)) {
/* offset vertex */
const float fade = tex_strength(ss, brush, vd.co, test.dist,
@@ -1471,11 +1478,12 @@ static void do_pinch_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode
sculpt_brush_test_init(ss, &test);
- BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) {
+ BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE)
+ {
if (sculpt_brush_test(&test, vd.co)) {
- float fade = bstrength*tex_strength(ss, brush, vd.co, test.dist,
- ss->cache->view_normal, vd.no,
- vd.fno, *vd.mask);
+ float fade = bstrength * tex_strength(ss, brush, vd.co, test.dist,
+ ss->cache->view_normal, vd.no,
+ vd.fno, *vd.mask);
float val[3];
sub_v3_v3v3(val, test.location, vd.co);
@@ -1536,8 +1544,8 @@ static void do_grab_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode)
BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE)
{
if (sculpt_brush_test(&test, origco[vd.i])) {
- const float fade = bstrength*tex_strength(ss, brush, origco[vd.i], test.dist,
- an, origno[vd.i], NULL, *vd.mask);
+ const float fade = bstrength * tex_strength(ss, brush, origco[vd.i], test.dist,
+ an, origno[vd.i], NULL, *vd.mask);
mul_v3_v3fl(proxy[vd.i], grab_delta, fade);
@@ -1576,10 +1584,11 @@ static void do_nudge_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode
sculpt_brush_test_init(ss, &test);
- BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) {
+ BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE)
+ {
if (sculpt_brush_test(&test, vd.co)) {
- const float fade = bstrength*tex_strength(ss, brush, vd.co, test.dist,
- an, vd.no, vd.fno, *vd.mask);
+ const float fade = bstrength * tex_strength(ss, brush, vd.co, test.dist,
+ an, vd.no, vd.fno, *vd.mask);
mul_v3_v3fl(proxy[vd.i], cono, fade);
@@ -1626,10 +1635,11 @@ static void do_snake_hook_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int to
sculpt_brush_test_init(ss, &test);
- BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) {
+ BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE)
+ {
if (sculpt_brush_test(&test, vd.co)) {
- const float fade = bstrength*tex_strength(ss, brush, vd.co, test.dist,
- an, vd.no, vd.fno, *vd.mask);
+ const float fade = bstrength * tex_strength(ss, brush, vd.co, test.dist,
+ an, vd.no, vd.fno, *vd.mask);
mul_v3_v3fl(proxy[vd.i], grab_delta, fade);
@@ -1675,10 +1685,11 @@ static void do_thumb_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode
sculpt_brush_test_init(ss, &test);
- BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) {
+ BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE)
+ {
if (sculpt_brush_test(&test, origco[vd.i])) {
- const float fade = bstrength*tex_strength(ss, brush, origco[vd.i], test.dist,
- an, origno[vd.i], NULL, *vd.mask);
+ const float fade = bstrength * tex_strength(ss, brush, origco[vd.i], test.dist,
+ an, origno[vd.i], NULL, *vd.mask);
mul_v3_v3fl(proxy[vd.i], cono, fade);
@@ -1729,10 +1740,11 @@ static void do_rotate_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnod
sculpt_brush_test_init(ss, &test);
- BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) {
+ BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE)
+ {
if (sculpt_brush_test(&test, origco[vd.i])) {
- const float fade = bstrength*tex_strength(ss, brush, origco[vd.i], test.dist,
- an, origno[vd.i], NULL, *vd.mask);
+ const float fade = bstrength * tex_strength(ss, brush, origco[vd.i], test.dist,
+ an, origno[vd.i], NULL, *vd.mask);
mul_v3_m4v3(proxy[vd.i], m, origco[vd.i]);
sub_v3_v3(proxy[vd.i], origco[vd.i]);
@@ -1782,10 +1794,11 @@ static void do_layer_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode
sculpt_brush_test_init(ss, &test);
- BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) {
+ BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE)
+ {
if (sculpt_brush_test(&test, origco[vd.i])) {
- const float fade = bstrength*tex_strength(ss, brush, vd.co, test.dist,
- area_normal, vd.no, vd.fno, *vd.mask);
+ const float fade = bstrength * tex_strength(ss, brush, vd.co, test.dist,
+ area_normal, vd.no, vd.fno, *vd.mask);
float *disp = &layer_disp[vd.i];
float val[3];
@@ -1834,10 +1847,11 @@ static void do_inflate_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totno
sculpt_brush_test_init(ss, &test);
- BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) {
+ BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE)
+ {
if (sculpt_brush_test(&test, vd.co)) {
- const float fade = bstrength*tex_strength(ss, brush, vd.co, test.dist,
- ss->cache->view_normal, vd.no, vd.fno, *vd.mask);
+ const float fade = bstrength * tex_strength(ss, brush, vd.co, test.dist,
+ ss->cache->view_normal, vd.no, vd.fno, *vd.mask);
float val[3];
if (vd.fno) copy_v3_v3(val, vd.fno);
@@ -1877,7 +1891,8 @@ static void calc_flatten_center(Sculpt *sd, Object *ob, PBVHNode **nodes, int to
sculpt_brush_test_init(ss, &test);
if (ss->cache->original) {
- BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) {
+ BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE)
+ {
if (sculpt_brush_test_fast(&test, unode->co[vd.i])) {
add_v3_v3(private_fc, unode->co[vd.i]);
private_count++;
@@ -1886,7 +1901,8 @@ static void calc_flatten_center(Sculpt *sd, Object *ob, PBVHNode **nodes, int to
BLI_pbvh_vertex_iter_end;
}
else {
- BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) {
+ BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE)
+ {
if (sculpt_brush_test_fast(&test, vd.co)) {
add_v3_v3(private_fc, vd.co);
private_count++;
@@ -1942,7 +1958,8 @@ static void calc_area_normal_and_flatten_center(Sculpt *sd, Object *ob,
sculpt_brush_test_init(ss, &test);
if (ss->cache->original) {
- BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) {
+ BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE)
+ {
if (sculpt_brush_test_fast(&test, unode->co[vd.i])) {
/* for area normal */
float fno[3];
@@ -1958,7 +1975,8 @@ static void calc_area_normal_and_flatten_center(Sculpt *sd, Object *ob,
BLI_pbvh_vertex_iter_end;
}
else {
- BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) {
+ BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE)
+ {
if (sculpt_brush_test_fast(&test, vd.co)) {
/* for area normal */
if (vd.no) {
@@ -2088,7 +2106,7 @@ 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)));
+ ((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)
@@ -2162,7 +2180,8 @@ static void do_flatten_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totno
sculpt_brush_test_init(ss, &test);
- BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) {
+ BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE)
+ {
if (sculpt_brush_test_sq(&test, vd.co)) {
float intr[3];
float val[3];
@@ -2172,8 +2191,8 @@ static void do_flatten_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totno
sub_v3_v3v3(val, intr, vd.co);
if (plane_trim(ss->cache, brush, val)) {
- const float fade = bstrength*tex_strength(ss, brush, vd.co, sqrt(test.dist),
- an, vd.no, vd.fno, *vd.mask);
+ const float fade = bstrength * tex_strength(ss, brush, vd.co, sqrt(test.dist),
+ an, vd.no, vd.fno, *vd.mask);
mul_v3_v3fl(proxy[vd.i], val, fade);
@@ -2233,7 +2252,8 @@ static void do_clay_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode)
sculpt_brush_test_init(ss, &test);
- BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) {
+ BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE)
+ {
if (sculpt_brush_test_sq(&test, vd.co)) {
if (plane_point_side_flip(vd.co, an, fc, flip)) {
float intr[3];
@@ -2244,9 +2264,9 @@ static void do_clay_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode)
sub_v3_v3v3(val, intr, vd.co);
if (plane_trim(ss->cache, brush, val)) {
- const float fade = bstrength*tex_strength(ss, brush, vd.co,
- sqrt(test.dist),
- an, vd.no, vd.fno, *vd.mask);
+ const float fade = bstrength * tex_strength(ss, brush, vd.co,
+ sqrt(test.dist),
+ an, vd.no, vd.fno, *vd.mask);
mul_v3_v3fl(proxy[vd.i], val, fade);
@@ -2334,7 +2354,8 @@ static void do_clay_strips_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int t
sculpt_brush_test_init(ss, &test);
- BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) {
+ BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE)
+ {
if (sculpt_brush_test_cube(&test, vd.co, mat)) {
if (plane_point_side_flip(vd.co, sn, fc, flip)) {
float intr[3];
@@ -2345,9 +2366,9 @@ static void do_clay_strips_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int t
sub_v3_v3v3(val, intr, vd.co);
if (plane_trim(ss->cache, brush, val)) {
- const float fade = bstrength*tex_strength(ss, brush, vd.co,
- ss->cache->radius*test.dist,
- an, vd.no, vd.fno, *vd.mask);
+ const float fade = bstrength * tex_strength(ss, brush, vd.co,
+ ss->cache->radius * test.dist,
+ an, vd.no, vd.fno, *vd.mask);
mul_v3_v3fl(proxy[vd.i], val, fade);
@@ -2397,7 +2418,8 @@ static void do_fill_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode)
sculpt_brush_test_init(ss, &test);
- BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) {
+ BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE)
+ {
if (sculpt_brush_test_sq(&test, vd.co)) {
if (plane_point_side(vd.co, an, fc)) {
float intr[3];
@@ -2408,9 +2430,9 @@ static void do_fill_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode)
sub_v3_v3v3(val, intr, vd.co);
if (plane_trim(ss->cache, brush, val)) {
- const float fade = bstrength*tex_strength(ss, brush, vd.co,
- sqrt(test.dist),
- an, vd.no, vd.fno, *vd.mask);
+ const float fade = bstrength * tex_strength(ss, brush, vd.co,
+ sqrt(test.dist),
+ an, vd.no, vd.fno, *vd.mask);
mul_v3_v3fl(proxy[vd.i], val, fade);
@@ -2460,7 +2482,8 @@ static void do_scrape_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnod
sculpt_brush_test_init(ss, &test);
- BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) {
+ BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE)
+ {
if (sculpt_brush_test_sq(&test, vd.co)) {
if (!plane_point_side(vd.co, an, fc)) {
float intr[3];
@@ -2471,9 +2494,9 @@ static void do_scrape_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnod
sub_v3_v3v3(val, intr, vd.co);
if (plane_trim(ss->cache, brush, val)) {
- const float fade = bstrength*tex_strength(ss, brush, vd.co,
- sqrt(test.dist),
- an, vd.no, vd.fno, *vd.mask);
+ const float fade = bstrength * tex_strength(ss, brush, vd.co,
+ sqrt(test.dist),
+ an, vd.no, vd.fno, *vd.mask);
mul_v3_v3fl(proxy[vd.i], val, fade);
@@ -2532,8 +2555,8 @@ void sculpt_vertcos_to_key(Object *ob, KeyBlock *kb, float (*vertCos)[3])
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);
+ me->mpoly, me->totloop, me->totpoly,
+ NULL, NULL, 0, NULL, NULL);
}
/* apply new coords on active key block */
@@ -2552,10 +2575,10 @@ static void do_brush_action(Sculpt *sd, Object *ob, Brush *brush)
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);
+ 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 */
@@ -2627,7 +2650,7 @@ static void do_brush_action(Sculpt *sd, Object *ob, Brush *brush)
}
if (!ELEM(brush->sculpt_tool, SCULPT_TOOL_SMOOTH, SCULPT_TOOL_MASK) &&
- brush->autosmooth_factor > 0) {
+ brush->autosmooth_factor > 0) {
if (brush->flag & BRUSH_INVERSE_SMOOTH_PRESSURE) {
smooth(sd, ob, nodes, totnode, brush->autosmooth_factor * (1 - ss->cache->pressure), FALSE);
}
@@ -2685,7 +2708,8 @@ static void sculpt_combine_proxies(Sculpt *sd, Object *ob)
BLI_pbvh_node_get_proxies(nodes[n], &proxies, &proxy_count);
- BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) {
+ BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE)
+ {
float val[3];
int p;
@@ -2755,7 +2779,8 @@ static void sculpt_flush_stroke_deform(Sculpt *sd, Object *ob)
for (n = 0; n < totnode; n++) {
PBVHVertexIter vd;
- BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) {
+ BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE)
+ {
sculpt_flush_pbvhvert_deform(ob, &vd);
if (vertCos) {
@@ -2799,8 +2824,8 @@ static void calc_brushdata_symm(Sculpt *sd, StrokeCache *cache, const char symm,
* XXX However, a different approach appears to be needed */
#if 0
if (sd->flags & SCULPT_SYMMETRY_FEATHER) {
- float frac = 1.0f/max_overlap_count(sd);
- float reduce = (feather-frac)/(1-frac);
+ float frac = 1.0f / max_overlap_count(sd);
+ float reduce = (feather - frac) / (1 - frac);
printf("feather: %f frac: %f reduce: %f\n", feather, frac, reduce);
@@ -3060,7 +3085,7 @@ static void sculpt_init_mirror_clipping(Object *ob, SculptSession *ss)
ss->cache->clip_tolerance[i])
{
ss->cache->clip_tolerance[i] =
- mmd->tolerance;
+ mmd->tolerance;
}
}
}
@@ -3122,7 +3147,7 @@ static void sculpt_update_cache_invariants(bContext *C, Sculpt *sd, SculptSessio
Brush *br;
BLI_strncpy(cache->saved_active_brush_name, brush->id.name + 2,
- sizeof(cache->saved_active_brush_name));
+ sizeof(cache->saved_active_brush_name));
br = (Brush *)BKE_libblock_find_name(ID_BR, "Smooth");
if (br) {
@@ -3315,8 +3340,8 @@ 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->true_location,
+ BKE_brush_size_get(scene, brush));
BKE_brush_unprojected_radius_set(scene, brush, cache->initial_radius);
}
else {
@@ -3544,7 +3569,7 @@ static int sculpt_brush_stroke_init(bContext *C, wmOperator *op)
is_smooth |= mode == BRUSH_STROKE_SMOOTH;
is_smooth |= brush->sculpt_tool == SCULPT_TOOL_SMOOTH;
is_smooth |= ((brush->sculpt_tool == SCULPT_TOOL_MASK) &&
- (brush->mask_tool == BRUSH_MASK_SMOOTH));
+ (brush->mask_tool == BRUSH_MASK_SMOOTH));
sculpt_update_mesh_elements(scene, sd, ob, is_smooth);
@@ -3893,14 +3918,14 @@ void ED_sculpt_mask_layers_ensure(Object *ob, MultiresModifierData *mmd)
int i, j;
gmask = CustomData_add_layer(&me->ldata, CD_GRID_PAINT_MASK,
- CD_CALLOC, NULL, me->totloop);
+ CD_CALLOC, NULL, me->totloop);
for (i = 0; i < me->totloop; i++) {
GridPaintMask *gpm = &gmask[i];
gpm->level = level;
gpm->data = MEM_callocN(sizeof(float) * gridarea,
- "GridPaintMask.data");
+ "GridPaintMask.data");
}
/* if vertices already have mask, copy into multires data */
@@ -3925,9 +3950,9 @@ void ED_sculpt_mask_layers_ensure(Object *ob, MultiresModifierData *mmd)
gpm->data[0] = avg;
gpm->data[1] = (paint_mask[l->v] +
- paint_mask[next->v]) * 0.5f;
+ paint_mask[next->v]) * 0.5f;
gpm->data[2] = (paint_mask[l->v] +
- paint_mask[prev->v]) * 0.5f;
+ paint_mask[prev->v]) * 0.5f;
gpm->data[3] = paint_mask[l->v];
}
}
@@ -3937,7 +3962,7 @@ void ED_sculpt_mask_layers_ensure(Object *ob, MultiresModifierData *mmd)
/* create vertex paint mask layer if there isn't one already */
if (!paint_mask) {
CustomData_add_layer(&me->vdata, CD_PAINT_MASK,
- CD_CALLOC, NULL, me->totvert);
+ CD_CALLOC, NULL, me->totvert);
}
}
diff --git a/source/blender/editors/sculpt_paint/sculpt_intern.h b/source/blender/editors/sculpt_paint/sculpt_intern.h
index b67206df6c8..f4467dc22fc 100644
--- a/source/blender/editors/sculpt_paint/sculpt_intern.h
+++ b/source/blender/editors/sculpt_paint/sculpt_intern.h
@@ -78,8 +78,8 @@ typedef struct SculptUndoNode {
SculptUndoType type;
- char idname[MAX_ID_NAME]; /* name instead of pointer*/
- void *node; /* only during push, not valid afterwards! */
+ char idname[MAX_ID_NAME]; /* name instead of pointer*/
+ void *node; /* only during push, not valid afterwards! */
float (*co)[3];
float (*orig_co)[3];
@@ -88,15 +88,15 @@ typedef struct SculptUndoNode {
int totvert;
/* non-multires */
- int maxvert; /* to verify if totvert it still the same */
- int *index; /* to restore into right location */
+ int maxvert; /* to verify if totvert it still the same */
+ int *index; /* to restore into right location */
BLI_bitmap vert_hidden;
/* multires */
- int maxgrid; /* same for grid */
- int gridsize; /* same for grid */
- int totgrid; /* to restore into right location */
- int *grids; /* to restore into right location */
+ int maxgrid; /* same for grid */
+ int gridsize; /* same for grid */
+ int totgrid; /* to restore into right location */
+ int *grids; /* to restore into right location */
BLI_bitmap *grid_hidden;
/* layer brush */
diff --git a/source/blender/editors/sculpt_paint/sculpt_undo.c b/source/blender/editors/sculpt_paint/sculpt_undo.c
index 1ab93f1ce7b..d233c45a230 100644
--- a/source/blender/editors/sculpt_paint/sculpt_undo.c
+++ b/source/blender/editors/sculpt_paint/sculpt_undo.c
@@ -78,9 +78,9 @@ static void update_cb(PBVHNode *node, void *rebuild)
}
static void sculpt_undo_restore_deformed(const SculptSession *ss,
- SculptUndoNode *unode,
- int uindex, int oindex,
- float coord[3])
+ SculptUndoNode *unode,
+ int uindex, int oindex,
+ float coord[3])
{
if (unode->orig_co) {
swap_v3_v3(coord, unode->orig_co[uindex]);
@@ -171,7 +171,7 @@ static int sculpt_undo_restore_coords(bContext *C, DerivedMesh *dm, SculptUndoNo
for (j = 0; j < unode->totgrid; j++) {
grid = grids[unode->grids[j]];
- for (i = 0; i < gridsize*gridsize; i++, co++)
+ for (i = 0; i < gridsize * gridsize; i++, co++)
swap_v3_v3(CCG_elem_offset_co(&key, grid, i), co[0]);
}
}
@@ -219,40 +219,40 @@ static int sculpt_undo_restore_hidden(bContext *C, DerivedMesh *dm,
static int sculpt_undo_restore_mask(bContext *C, DerivedMesh *dm, SculptUndoNode *unode)
{
- Object *ob= CTX_data_active_object(C);
- SculptSession *ss= ob->sculpt;
+ Object *ob = CTX_data_active_object(C);
+ SculptSession *ss = ob->sculpt;
MVert *mvert;
float *vmask;
int *index, i, j;
- if(unode->maxvert) {
+ if (unode->maxvert) {
/* regular mesh restore */
- index= unode->index;
- mvert= ss->mvert;
- vmask= ss->vmask;
+ index = unode->index;
+ mvert = ss->mvert;
+ vmask = ss->vmask;
- for(i=0; i<unode->totvert; i++) {
+ for (i = 0; i < unode->totvert; i++) {
SWAP(float, vmask[index[i]], unode->mask[i]);
mvert[index[i]].flag |= ME_VERT_PBVH_UPDATE;
}
}
- else if(unode->maxgrid && dm->getGridData) {
+ else if (unode->maxgrid && dm->getGridData) {
/* multires restore */
CCGElem **grids, *grid;
CCGKey key;
float *mask;
int gridsize;
- grids= dm->getGridData(dm);
- gridsize= dm->getGridSize(dm);
+ grids = dm->getGridData(dm);
+ gridsize = dm->getGridSize(dm);
dm->getGridKey(dm, &key);
mask = unode->mask;
- for(j=0; j<unode->totgrid; j++) {
- grid= grids[unode->grids[j]];
+ for (j = 0; j < unode->totgrid; j++) {
+ grid = grids[unode->grids[j]];
- for(i=0; i<gridsize*gridsize; i++, mask++)
+ for (i = 0; i < gridsize * gridsize; i++, mask++)
SWAP(float, *CCG_elem_offset_mask(&key, grid, i), *mask);
}
}
@@ -294,18 +294,18 @@ static void sculpt_undo_restore(bContext *C, ListBase *lb)
continue;
}
- switch(unode->type) {
+ switch (unode->type) {
case SCULPT_UNDO_COORDS:
if (sculpt_undo_restore_coords(C, dm, unode))
- update= 1;
+ update = 1;
break;
case SCULPT_UNDO_HIDDEN:
if (sculpt_undo_restore_hidden(C, dm, unode))
- rebuild= 1;
+ rebuild = 1;
break;
case SCULPT_UNDO_MASK:
- if(sculpt_undo_restore_mask(C, dm, unode))
- update= 1;
+ if (sculpt_undo_restore_mask(C, dm, unode))
+ update = 1;
break;
}
}
@@ -371,7 +371,7 @@ static void sculpt_undo_free(ListBase *lb)
}
MEM_freeN(unode->grid_hidden);
}
- if(unode->mask)
+ if (unode->mask)
MEM_freeN(unode->mask);
}
}
@@ -441,9 +441,9 @@ static SculptUndoNode *sculpt_undo_alloc_node(Object *ob, PBVHNode *node,
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);
+ (sizeof(float) * 3 +
+ sizeof(short) * 3 +
+ sizeof(int)) * allvert);
break;
case SCULPT_UNDO_HIDDEN:
if (maxgrid)
@@ -453,8 +453,8 @@ static SculptUndoNode *sculpt_undo_alloc_node(Object *ob, PBVHNode *node,
break;
case SCULPT_UNDO_MASK:
- unode->mask= MEM_mapallocN(sizeof(float)*allvert, "SculptUndoNode.mask");
- undo_paint_push_count_alloc(UNDO_PAINT_MESH, (sizeof(float) * sizeof(int))*allvert);
+ unode->mask = MEM_mapallocN(sizeof(float) * allvert, "SculptUndoNode.mask");
+ undo_paint_push_count_alloc(UNDO_PAINT_MESH, (sizeof(float) * sizeof(int)) * allvert);
break;
}
@@ -484,7 +484,8 @@ static void sculpt_undo_store_coords(Object *ob, SculptUndoNode *unode)
SculptSession *ss = ob->sculpt;
PBVHVertexIter vd;
- BLI_pbvh_vertex_iter_begin(ss->pbvh, unode->node, vd, PBVH_ITER_ALL) {
+ BLI_pbvh_vertex_iter_begin(ss->pbvh, unode->node, vd, PBVH_ITER_ALL)
+ {
copy_v3_v3(unode->co[vd.i], vd.co);
if (vd.no) copy_v3_v3_short(unode->no[vd.i], vd.no);
else normal_float_to_short_v3(unode->no[vd.i], vd.fno);
@@ -522,7 +523,8 @@ static void sculpt_undo_store_mask(Object *ob, SculptUndoNode *unode)
SculptSession *ss = ob->sculpt;
PBVHVertexIter vd;
- BLI_pbvh_vertex_iter_begin(ss->pbvh, unode->node, vd, PBVH_ITER_ALL) {
+ BLI_pbvh_vertex_iter_begin(ss->pbvh, unode->node, vd, PBVH_ITER_ALL)
+ {
unode->mask[vd.i] = *vd.mask;
}
BLI_pbvh_vertex_iter_end;
diff --git a/source/blender/editors/uvedit/uvedit_unwrap_ops.c b/source/blender/editors/uvedit/uvedit_unwrap_ops.c
index 159e2fc3fe6..7c05d08a774 100644
--- a/source/blender/editors/uvedit/uvedit_unwrap_ops.c
+++ b/source/blender/editors/uvedit/uvedit_unwrap_ops.c
@@ -402,7 +402,7 @@ static ParamHandle *construct_param_handle_subsurfed(Scene *scene, BMEditMesh *e
initialDerived = CDDM_from_BMEditMesh(em, NULL, 0, 0);
derivedMesh = subsurf_make_derived_from_derived(initialDerived, &smd,
- NULL, SUBSURF_IN_EDIT_MODE);
+ NULL, SUBSURF_IN_EDIT_MODE);
initialDerived->release(initialDerived);
@@ -1182,7 +1182,7 @@ static int unwrap_exec(bContext *C, wmOperator *op)
BKE_report(op->reports, RPT_INFO, "Object scale is not 1.0. Unwrap will operate on a non-scaled version of the mesh.");
/* remember last method for live unwrap */
- if(RNA_struct_property_is_set(op->ptr, "method"))
+ if (RNA_struct_property_is_set(op->ptr, "method"))
scene->toolsettings->unwrapper = method;
scene->toolsettings->uv_subsurf_level = subsurf_level;
@@ -1210,7 +1210,8 @@ void UV_OT_unwrap(wmOperatorType *ot)
static EnumPropertyItem method_items[] = {
{0, "ANGLE_BASED", 0, "Angle Based", ""},
{1, "CONFORMAL", 0, "Conformal", ""},
- {0, NULL, 0, NULL, NULL}};
+ {0, NULL, 0, NULL, NULL}
+ };
/* identifiers */
ot->name = "Unwrap";