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:
-rw-r--r--source/blender/editors/sculpt_paint/paint_cursor.c50
-rw-r--r--source/blender/editors/sculpt_paint/paint_curve.c5
-rw-r--r--source/blender/editors/sculpt_paint/paint_hide.c135
-rw-r--r--source/blender/editors/sculpt_paint/paint_image.c63
-rw-r--r--source/blender/editors/sculpt_paint/paint_image_2d.c177
-rw-r--r--source/blender/editors/sculpt_paint/paint_image_proj.c91
-rw-r--r--source/blender/editors/sculpt_paint/paint_image_undo.c30
-rw-r--r--source/blender/editors/sculpt_paint/paint_intern.h40
-rw-r--r--source/blender/editors/sculpt_paint/paint_mask.c12
-rw-r--r--source/blender/editors/sculpt_paint/paint_ops.c45
-rw-r--r--source/blender/editors/sculpt_paint/paint_stroke.c73
-rw-r--r--source/blender/editors/sculpt_paint/paint_utils.c38
-rw-r--r--source/blender/editors/sculpt_paint/paint_vertex.c13
-rw-r--r--source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c12
14 files changed, 447 insertions, 337 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_cursor.c b/source/blender/editors/sculpt_paint/paint_cursor.c
index 94111c9939d..815bcd8a050 100644
--- a/source/blender/editors/sculpt_paint/paint_cursor.c
+++ b/source/blender/editors/sculpt_paint/paint_cursor.c
@@ -258,9 +258,10 @@ static int load_tex(Brush *br, ViewContext *vc, float zoom, bool col, bool prima
int size;
bool refresh;
- eOverlayControlFlags invalid = (primary) ? (overlay_flags & PAINT_INVALID_OVERLAY_TEXTURE_PRIMARY) :
- (overlay_flags & PAINT_INVALID_OVERLAY_TEXTURE_SECONDARY);
-
+ eOverlayControlFlags invalid = (
+ (primary) ?
+ (overlay_flags & PAINT_INVALID_OVERLAY_TEXTURE_PRIMARY) :
+ (overlay_flags & PAINT_INVALID_OVERLAY_TEXTURE_SECONDARY));
target = (primary) ? &primary_snap : &secondary_snap;
refresh =
@@ -494,9 +495,10 @@ static int load_tex_cursor(Brush *br, ViewContext *vc, float zoom)
-static int project_brush_radius(ViewContext *vc,
- float radius,
- const float location[3])
+static int project_brush_radius(
+ ViewContext *vc,
+ float radius,
+ const float location[3])
{
float view[3], nonortho[3], ortho[3], offset[3], p1[2], p2[2];
@@ -567,10 +569,8 @@ static bool sculpt_get_brush_geometry(
if (hit) {
Brush *brush = BKE_paint_brush(paint);
- *pixel_radius =
- project_brush_radius(vc,
- BKE_brush_unprojected_radius_get(scene, brush),
- location);
+ *pixel_radius = project_brush_radius(
+ vc, BKE_brush_unprojected_radius_get(scene, brush), location);
if (*pixel_radius == 0)
*pixel_radius = BKE_brush_size_get(scene, brush);
@@ -589,15 +589,18 @@ static bool sculpt_get_brush_geometry(
/* Draw an overlay that shows what effect the brush's texture will
* have on brush strength */
-static void paint_draw_tex_overlay(UnifiedPaintSettings *ups, Brush *brush,
- ViewContext *vc, int x, int y, float zoom, bool col, bool primary)
+static void paint_draw_tex_overlay(
+ UnifiedPaintSettings *ups, Brush *brush,
+ ViewContext *vc, int x, int y, float zoom, bool col, bool primary)
{
rctf quad;
/* check for overlay mode */
MTex *mtex = (primary) ? &brush->mtex : &brush->mask_mtex;
- bool valid = (primary) ? (brush->overlay_flags & BRUSH_OVERLAY_PRIMARY) != 0 :
- (brush->overlay_flags & BRUSH_OVERLAY_SECONDARY) != 0;
+ bool valid = (
+ (primary) ?
+ (brush->overlay_flags & BRUSH_OVERLAY_PRIMARY) != 0 :
+ (brush->overlay_flags & BRUSH_OVERLAY_SECONDARY) != 0);
int overlay_alpha = (primary) ? brush->texture_overlay_alpha : brush->mask_overlay_alpha;
if (!(mtex->tex) || !((mtex->brush_map_mode == MTEX_MAP_MODE_STENCIL) ||
@@ -714,8 +717,9 @@ static void paint_draw_tex_overlay(UnifiedPaintSettings *ups, Brush *brush,
/* Draw an overlay that shows what effect the brush's texture will
* have on brush strength */
-static void paint_draw_cursor_overlay(UnifiedPaintSettings *ups, Brush *brush,
- ViewContext *vc, int x, int y, float zoom)
+static void paint_draw_cursor_overlay(
+ UnifiedPaintSettings *ups, Brush *brush,
+ ViewContext *vc, int x, int y, float zoom)
{
rctf quad;
/* check for overlay mode */
@@ -796,8 +800,9 @@ static void paint_draw_cursor_overlay(UnifiedPaintSettings *ups, Brush *brush,
}
}
-static void paint_draw_alpha_overlay(UnifiedPaintSettings *ups, Brush *brush,
- ViewContext *vc, int x, int y, float zoom, ePaintMode mode)
+static void paint_draw_alpha_overlay(
+ UnifiedPaintSettings *ups, Brush *brush,
+ ViewContext *vc, int x, int y, float zoom, ePaintMode mode)
{
/* color means that primary brush texture is colured and secondary is used for alpha/mask control */
bool col = ELEM(mode, ePaintTextureProjective, ePaintTexture2D, ePaintVertex) ? true : false;
@@ -986,8 +991,9 @@ static void paint_draw_curve_cursor(Brush *brush)
/* Special actions taken when paint cursor goes over mesh */
/* TODO: sculpt only for now */
-static void paint_cursor_on_hit(UnifiedPaintSettings *ups, Brush *brush, ViewContext *vc,
- const float location[3])
+static void paint_cursor_on_hit(
+ UnifiedPaintSettings *ups, Brush *brush, ViewContext *vc,
+ const float location[3])
{
float unprojected_radius, projected_radius;
@@ -1004,8 +1010,8 @@ static void paint_cursor_on_hit(UnifiedPaintSettings *ups, Brush *brush, ViewCon
}
/* convert brush radius from 2D to 3D */
- unprojected_radius = paint_calc_object_space_radius(vc, location,
- projected_radius);
+ unprojected_radius = paint_calc_object_space_radius(
+ vc, location, projected_radius);
/* scale 3D brush radius by pressure */
if (ups->stroke_active && BKE_brush_use_size_pressure(vc->scene, brush))
diff --git a/source/blender/editors/sculpt_paint/paint_curve.c b/source/blender/editors/sculpt_paint/paint_curve.c
index 0c3c6e120ed..3213ee005cf 100644
--- a/source/blender/editors/sculpt_paint/paint_curve.c
+++ b/source/blender/editors/sculpt_paint/paint_curve.c
@@ -605,8 +605,9 @@ static int paintcurve_slide_modal(bContext *C, wmOperator *op, const wmEvent *ev
{
ARegion *ar = CTX_wm_region(C);
wmWindow *window = CTX_wm_window(C);
- float diff[2] = {event->mval[0] - psd->initial_loc[0],
- event->mval[1] - psd->initial_loc[1]};
+ float diff[2] = {
+ event->mval[0] - psd->initial_loc[0],
+ event->mval[1] - psd->initial_loc[1]};
if (psd->select == 1) {
int i;
for (i = 0; i < 3; i++)
diff --git a/source/blender/editors/sculpt_paint/paint_hide.c b/source/blender/editors/sculpt_paint/paint_hide.c
index 4deec54a5b3..a0589623f92 100644
--- a/source/blender/editors/sculpt_paint/paint_hide.c
+++ b/source/blender/editors/sculpt_paint/paint_hide.c
@@ -71,10 +71,11 @@
#include <assert.h>
/* return true if the element should be hidden/shown */
-static bool 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;
@@ -88,12 +89,13 @@ static bool is_effected(PartialVisArea area,
}
}
-static void partialvis_update_mesh(Object *ob,
- PBVH *pbvh,
- PBVHNode *node,
- PartialVisAction action,
- PartialVisArea area,
- float planes[4][4])
+static void partialvis_update_mesh(
+ Object *ob,
+ PBVH *pbvh,
+ PBVHNode *node,
+ PartialVisAction action,
+ PartialVisArea area,
+ float planes[4][4])
{
Mesh *me = ob->data;
MVert *mvert;
@@ -133,12 +135,13 @@ static void partialvis_update_mesh(Object *ob,
/* Hide or show elements in multires grids with a special GridFlags
* customdata layer. */
-static void partialvis_update_grids(Object *ob,
- PBVH *pbvh,
- PBVHNode *node,
- PartialVisAction action,
- PartialVisArea area,
- float planes[4][4])
+static void partialvis_update_grids(
+ Object *ob,
+ PBVH *pbvh,
+ PBVHNode *node,
+ PartialVisAction action,
+ PartialVisArea area,
+ float planes[4][4])
{
CCGElem **grids;
CCGKey key;
@@ -148,9 +151,10 @@ static void partialvis_update_grids(Object *ob,
/* get PBVH data */
- BKE_pbvh_node_get_grids(pbvh, node,
- &grid_indices, &totgrid, NULL, NULL,
- &grids);
+ BKE_pbvh_node_get_grids(
+ pbvh, node,
+ &grid_indices, &totgrid, NULL, NULL,
+ &grids);
grid_hidden = BKE_pbvh_grid_hidden(pbvh);
BKE_pbvh_get_grid_key(pbvh, &key);
@@ -165,8 +169,9 @@ static void partialvis_update_grids(Object *ob,
switch (action) {
case PARTIALVIS_HIDE:
/* create grid flags data */
- gh = grid_hidden[g] = BLI_BITMAP_NEW(key.grid_area,
- "partialvis_update_grids");
+ gh = grid_hidden[g] = BLI_BITMAP_NEW(
+ key.grid_area,
+ "partialvis_update_grids");
break;
case PARTIALVIS_SHOW:
/* entire grid is visible, nothing to show */
@@ -192,8 +197,9 @@ static void partialvis_update_grids(Object *ob,
/* skip grid element if not in the effected area */
if (is_effected(area, planes, co, mask)) {
/* set or clear the hide flag */
- BLI_BITMAP_SET(gh, y * key.grid_size + x,
- action == PARTIALVIS_HIDE);
+ BLI_BITMAP_SET(
+ gh, y * key.grid_size + x,
+ action == PARTIALVIS_HIDE);
any_changed = true;
}
@@ -222,21 +228,21 @@ static void partialvis_update_grids(Object *ob,
}
}
-static void partialvis_update_bmesh_verts(BMesh *bm,
- GSet *verts,
- PartialVisAction action,
- PartialVisArea area,
- float planes[4][4],
- bool *any_changed,
- bool *any_visible)
+static void partialvis_update_bmesh_verts(
+ BMesh *bm,
+ GSet *verts,
+ PartialVisAction action,
+ PartialVisArea area,
+ float planes[4][4],
+ bool *any_changed,
+ bool *any_visible)
{
GSetIterator gs_iter;
GSET_ITER (gs_iter, verts) {
BMVert *v = BLI_gsetIterator_getKey(&gs_iter);
- float *vmask = CustomData_bmesh_get(&bm->vdata,
- v->head.data,
- CD_PAINT_MASK);
+ float *vmask = CustomData_bmesh_get(
+ &bm->vdata, v->head.data, CD_PAINT_MASK);
/* hide vertex if in the hide volume */
if (is_effected(area, planes, v->co, *vmask)) {
@@ -266,12 +272,13 @@ static void partialvis_update_bmesh_faces(GSet *faces)
}
}
-static void partialvis_update_bmesh(Object *ob,
- PBVH *pbvh,
- PBVHNode *node,
- PartialVisAction action,
- PartialVisArea area,
- float planes[4][4])
+static void partialvis_update_bmesh(
+ Object *ob,
+ PBVH *pbvh,
+ PBVHNode *node,
+ PartialVisAction action,
+ PartialVisArea area,
+ float planes[4][4])
{
BMesh *bm;
GSet *unique, *other, *faces;
@@ -284,21 +291,23 @@ static void partialvis_update_bmesh(Object *ob,
sculpt_undo_push_node(ob, node, SCULPT_UNDO_HIDDEN);
- partialvis_update_bmesh_verts(bm,
- unique,
- action,
- area,
- planes,
- &any_changed,
- &any_visible);
-
- partialvis_update_bmesh_verts(bm,
- other,
- action,
- area,
- planes,
- &any_changed,
- &any_visible);
+ partialvis_update_bmesh_verts(
+ bm,
+ unique,
+ action,
+ area,
+ planes,
+ &any_changed,
+ &any_visible);
+
+ partialvis_update_bmesh_verts(
+ bm,
+ other,
+ action,
+ area,
+ planes,
+ &any_changed,
+ &any_visible);
/* finally loop over node faces and tag the ones that are fully hidden */
partialvis_update_bmesh_faces(faces);
@@ -317,9 +326,10 @@ static void rect_from_props(rcti *rect, PointerRNA *ptr)
rect->ymax = RNA_int_get(ptr, "ymax");
}
-static void clip_planes_from_rect(bContext *C,
- float clip_planes[4][4],
- const rcti *rect)
+static void clip_planes_from_rect(
+ bContext *C,
+ float clip_planes[4][4],
+ const rcti *rect)
{
ViewContext vc;
BoundBox bb;
@@ -334,11 +344,12 @@ static void clip_planes_from_rect(bContext *C,
* inside the clip_planes volume. If mode is outside, get all nodes
* that lie at least partially outside the volume. If showing all, get
* all nodes. */
-static void get_pbvh_nodes(PBVH *pbvh,
- PBVHNode ***nodes,
- int *totnode,
- float clip_planes[4][4],
- PartialVisArea mode)
+static void get_pbvh_nodes(
+ PBVH *pbvh,
+ PBVHNode ***nodes,
+ int *totnode,
+ float clip_planes[4][4],
+ PartialVisArea mode)
{
BKE_pbvh_SearchCallback cb = NULL;
diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c
index 02fd685719e..7f71270c52d 100644
--- a/source/blender/editors/sculpt_paint/paint_image.c
+++ b/source/blender/editors/sculpt_paint/paint_image.c
@@ -168,8 +168,9 @@ void imapaint_image_update(SpaceImage *sima, Image *image, ImBuf *ibuf, short te
if (imapaintpartial.x1 != imapaintpartial.x2 &&
imapaintpartial.y1 != imapaintpartial.y2)
{
- IMB_partial_display_buffer_update_delayed(ibuf, imapaintpartial.x1, imapaintpartial.y1,
- imapaintpartial.x2, imapaintpartial.y2);
+ IMB_partial_display_buffer_update_delayed(
+ ibuf, imapaintpartial.x1, imapaintpartial.y1,
+ imapaintpartial.x2, imapaintpartial.y2);
}
if (ibuf->mipmap[0])
@@ -339,15 +340,16 @@ typedef struct PaintOperation {
bool paint_use_opacity_masking(Brush *brush)
{
- return (brush->flag & BRUSH_AIRBRUSH) ||
- (brush->flag & BRUSH_DRAG_DOT) ||
- (brush->flag & BRUSH_ANCHORED) ||
- (brush->imagepaint_tool == PAINT_TOOL_SMEAR) ||
- (brush->imagepaint_tool == PAINT_TOOL_SOFTEN) ||
- (brush->imagepaint_tool == PAINT_TOOL_FILL) ||
- (brush->flag & BRUSH_USE_GRADIENT) ||
- (brush->mtex.tex && !ELEM(brush->mtex.brush_map_mode, MTEX_MAP_MODE_TILED, MTEX_MAP_MODE_STENCIL, MTEX_MAP_MODE_3D)) ?
- false : true;
+ return ((brush->flag & BRUSH_AIRBRUSH) ||
+ (brush->flag & BRUSH_DRAG_DOT) ||
+ (brush->flag & BRUSH_ANCHORED) ||
+ (brush->imagepaint_tool == PAINT_TOOL_SMEAR) ||
+ (brush->imagepaint_tool == PAINT_TOOL_SOFTEN) ||
+ (brush->imagepaint_tool == PAINT_TOOL_FILL) ||
+ (brush->flag & BRUSH_USE_GRADIENT) ||
+ (brush->mtex.tex &&
+ !ELEM(brush->mtex.brush_map_mode, MTEX_MAP_MODE_TILED, MTEX_MAP_MODE_STENCIL, MTEX_MAP_MODE_3D)) ?
+ false : true);
}
void paint_brush_color_get(
@@ -572,8 +574,9 @@ static void paint_stroke_done(const bContext *C, struct PaintStroke *stroke)
paint_2d_gradient_fill(C, brush, pop->startmouse, pop->prevmouse, pop->custom_paint);
}
else {
- paint_proj_stroke(C, pop->custom_paint, pop->startmouse, pop->prevmouse, paint_stroke_flipped(stroke),
- 1.0, 0.0, BKE_brush_size_get(scene, brush));
+ paint_proj_stroke(
+ C, pop->custom_paint, pop->startmouse, pop->prevmouse, paint_stroke_flipped(stroke),
+ 1.0, 0.0, BKE_brush_size_get(scene, brush));
/* two redraws, one for GPU update, one for notification */
paint_proj_redraw(C, pop->custom_paint, false);
paint_proj_redraw(C, pop->custom_paint, true);
@@ -587,8 +590,9 @@ static void paint_stroke_done(const bContext *C, struct PaintStroke *stroke)
paint_2d_bucket_fill(C, color, brush, pop->prevmouse, pop->custom_paint);
}
else {
- paint_proj_stroke(C, pop->custom_paint, pop->startmouse, pop->prevmouse, paint_stroke_flipped(stroke),
- 1.0, 0.0, BKE_brush_size_get(scene, brush));
+ paint_proj_stroke(
+ C, pop->custom_paint, pop->startmouse, pop->prevmouse, paint_stroke_flipped(stroke),
+ 1.0, 0.0, BKE_brush_size_get(scene, brush));
/* two redraws, one for GPU update, one for notification */
paint_proj_redraw(C, pop->custom_paint, false);
paint_proj_redraw(C, pop->custom_paint, true);
@@ -639,10 +643,11 @@ static int paint_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
int retval;
- op->customdata = paint_stroke_new(C, op, NULL, paint_stroke_test_start,
- paint_stroke_update_step,
- paint_stroke_redraw,
- paint_stroke_done, event->type);
+ op->customdata = paint_stroke_new(
+ C, op, NULL, paint_stroke_test_start,
+ paint_stroke_update_step,
+ paint_stroke_redraw,
+ paint_stroke_done, event->type);
if ((retval = op->type->modal(C, op, event)) == OPERATOR_FINISHED) {
paint_stroke_data_free(op);
@@ -670,10 +675,11 @@ static int paint_exec(bContext *C, wmOperator *op)
RNA_float_get_array(&firstpoint, "mouse", mouse);
- op->customdata = paint_stroke_new(C, op, NULL, paint_stroke_test_start,
- paint_stroke_update_step,
- paint_stroke_redraw,
- paint_stroke_done, 0);
+ op->customdata = paint_stroke_new(
+ C, op, NULL, paint_stroke_test_start,
+ paint_stroke_update_step,
+ paint_stroke_redraw,
+ paint_stroke_done, 0);
/* frees op->customdata */
return paint_stroke_exec(C, op);
}
@@ -882,11 +888,12 @@ static void sample_color_update_header(SampleColorData *data, bContext *C)
ScrArea *sa = CTX_wm_area(C);
if (sa) {
- BLI_snprintf(msg, sizeof(msg),
- IFACE_("Sample color for %s"),
- !data->sample_palette ?
- IFACE_("Brush. Use Left Click to sample for palette instead") :
- IFACE_("Palette. Use Left Click to sample more colors"));
+ BLI_snprintf(
+ msg, sizeof(msg),
+ IFACE_("Sample color for %s"),
+ !data->sample_palette ?
+ IFACE_("Brush. Use Left Click to sample for palette instead") :
+ IFACE_("Palette. Use Left Click to sample more colors"));
ED_workspace_status_text(C, msg);
}
}
diff --git a/source/blender/editors/sculpt_paint/paint_image_2d.c b/source/blender/editors/sculpt_paint/paint_image_2d.c
index a75d6344849..da08766b322 100644
--- a/source/blender/editors/sculpt_paint/paint_image_2d.c
+++ b/source/blender/editors/sculpt_paint/paint_image_2d.c
@@ -442,8 +442,9 @@ static ImBuf *brush_painter_imbuf_new(BrushPainter *painter, int size, float pre
}
/* update rectangular section of the brush image */
-static void brush_painter_imbuf_update(BrushPainter *painter, ImBuf *oldtexibuf,
- int origx, int origy, int w, int h, int xt, int yt)
+static void brush_painter_imbuf_update(
+ BrushPainter *painter, ImBuf *oldtexibuf,
+ int origx, int origy, int w, int h, int xt, int yt)
{
Scene *scene = painter->scene;
Brush *brush = painter->brush;
@@ -660,11 +661,12 @@ static void brush_painter_2d_refresh_cache(ImagePaintState *s, BrushPainter *pai
bool do_random = false;
bool do_partial_update = false;
- bool update_color = (brush->flag & BRUSH_USE_GRADIENT) &&
- ((ELEM(brush->gradient_stroke_mode,
- BRUSH_GRADIENT_SPACING_REPEAT,
- BRUSH_GRADIENT_SPACING_CLAMP)) ||
- (cache->last_pressure != pressure));
+ bool update_color = (
+ (brush->flag & BRUSH_USE_GRADIENT) &&
+ ((ELEM(brush->gradient_stroke_mode,
+ BRUSH_GRADIENT_SPACING_REPEAT,
+ BRUSH_GRADIENT_SPACING_CLAMP)) ||
+ (cache->last_pressure != pressure)));
float tex_rotation = -brush->mtex.rot;
float mask_rotation = -brush->mask_mtex.rot;
@@ -680,8 +682,9 @@ static void brush_painter_2d_refresh_cache(ImagePaintState *s, BrushPainter *pai
else if (!((brush->flag & BRUSH_ANCHORED) || update_color))
do_partial_update = true;
- brush_painter_2d_tex_mapping(s, diameter, painter->startpaintpos, pos, mouse,
- brush->mtex.brush_map_mode, &painter->tex_mapping);
+ brush_painter_2d_tex_mapping(
+ s, diameter, painter->startpaintpos, pos, mouse,
+ brush->mtex.brush_map_mode, &painter->tex_mapping);
}
if (painter->cache.is_maskbrush) {
@@ -713,8 +716,9 @@ static void brush_painter_2d_refresh_cache(ImagePaintState *s, BrushPainter *pai
cache->tex_mask = NULL;
}
- brush_painter_2d_tex_mapping(s, diameter, painter->startpaintpos, pos, mouse,
- brush->mask_mtex.brush_map_mode, &painter->mask_mapping);
+ brush_painter_2d_tex_mapping(
+ s, diameter, painter->startpaintpos, pos, mouse,
+ brush->mask_mtex.brush_map_mode, &painter->mask_mapping);
if (do_partial_update_mask)
brush_painter_mask_imbuf_partial_update(painter, pos, diameter);
@@ -862,8 +866,9 @@ static void paint_2d_lift_soften(ImagePaintState *s, ImBuf *ibuf, ImBuf *ibufb,
out_off[0] = out_off[1] = 0;
if (!tile) {
- IMB_rectclip(ibuf, ibufb, &in_off[0], &in_off[1], &out_off[0],
- &out_off[1], &dim[0], &dim[1]);
+ IMB_rectclip(
+ ibuf, ibufb, &in_off[0], &in_off[1], &out_off[0],
+ &out_off[1], &dim[0], &dim[1]);
if ((dim[0] == 0) || (dim[1] == 0))
return;
@@ -894,9 +899,10 @@ static void paint_2d_lift_soften(ImagePaintState *s, ImBuf *ibuf, ImBuf *ibufb,
for (yk = 0; yk < kernel->side; yk++) {
for (xk = 0; xk < kernel->side; xk++) {
- count += paint_2d_ibuf_add_if(ibuf, xi + xk - kernel->pixel_len,
- yi + yk - kernel->pixel_len, outrgb, tile,
- kernel->wdata[xk + yk * kernel->side]);
+ count += paint_2d_ibuf_add_if(
+ ibuf, xi + xk - kernel->pixel_len,
+ yi + yk - kernel->pixel_len, outrgb, tile,
+ kernel->wdata[xk + yk * kernel->side]);
}
}
@@ -995,10 +1001,11 @@ static void paint_2d_lift_smear(ImBuf *ibuf, ImBuf *ibufb, int *pos, short tile)
tot = paint_2d_torus_split_region(region, ibufb, ibuf, tile);
for (a = 0; a < tot; a++)
- IMB_rectblend(ibufb, ibufb, ibuf, NULL, NULL, NULL, 0, region[a].destx, region[a].desty,
- region[a].destx, region[a].desty,
- region[a].srcx, region[a].srcy,
- region[a].width, region[a].height, IMB_BLEND_COPY, false);
+ IMB_rectblend(
+ ibufb, ibufb, ibuf, NULL, NULL, NULL, 0, region[a].destx, region[a].desty,
+ region[a].destx, region[a].desty,
+ region[a].srcx, region[a].srcy,
+ region[a].width, region[a].height, IMB_BLEND_COPY, false);
}
static ImBuf *paint_2d_lift_clone(ImBuf *ibuf, ImBuf *ibufb, int *pos)
@@ -1009,10 +1016,12 @@ static ImBuf *paint_2d_lift_clone(ImBuf *ibuf, ImBuf *ibufb, int *pos)
ImBuf *clonebuf = IMB_allocImBuf(w, h, ibufb->planes, ibufb->flags);
IMB_rectclip(clonebuf, ibuf, &destx, &desty, &srcx, &srcy, &w, &h);
- IMB_rectblend(clonebuf, clonebuf, ibufb, NULL, NULL, NULL, 0, destx, desty, destx, desty, destx, desty, w, h,
- IMB_BLEND_COPY_ALPHA, false);
- IMB_rectblend(clonebuf, clonebuf, ibuf, NULL, NULL, NULL, 0, destx, desty, destx, desty, srcx, srcy, w, h,
- IMB_BLEND_COPY_RGB, false);
+ IMB_rectblend(
+ clonebuf, clonebuf, ibufb, NULL, NULL, NULL, 0, destx, desty, destx, desty, destx, desty, w, h,
+ IMB_BLEND_COPY_ALPHA, false);
+ IMB_rectblend(
+ clonebuf, clonebuf, ibuf, NULL, NULL, NULL, 0, destx, desty, destx, desty, srcx, srcy, w, h,
+ IMB_BLEND_COPY_RGB, false);
return clonebuf;
}
@@ -1023,15 +1032,16 @@ static void paint_2d_convert_brushco(ImBuf *ibufb, const float pos[2], int ipos[
ipos[1] = (int)floorf((pos[1] - ibufb->y / 2));
}
-static void paint_2d_do_making_brush(ImagePaintState *s,
- ImagePaintRegion *region,
- unsigned short *curveb,
- unsigned short *texmaskb,
- ImBuf *frombuf,
- float mask_max,
- short blend,
- int tilex, int tiley,
- int tilew, int tileh)
+static void paint_2d_do_making_brush(
+ ImagePaintState *s,
+ ImagePaintRegion *region,
+ unsigned short *curveb,
+ unsigned short *texmaskb,
+ ImBuf *frombuf,
+ float mask_max,
+ short blend,
+ int tilex, int tiley,
+ int tilew, int tileh)
{
ImBuf tmpbuf;
IMB_initImBuf(&tmpbuf, IMAPAINT_TILE_SIZE, IMAPAINT_TILE_SIZE, 32, 0);
@@ -1050,13 +1060,14 @@ static void paint_2d_do_making_brush(ImagePaintState *s,
else
tmpbuf.rect = image_undo_find_tile(undo_tiles, s->image, s->canvas, tx, ty, &mask, false);
- IMB_rectblend(s->canvas, &tmpbuf, frombuf, mask,
- curveb, texmaskb, mask_max,
- region->destx, region->desty,
- origx, origy,
- region->srcx, region->srcy,
- region->width, region->height,
- blend, ((s->brush->flag & BRUSH_ACCUMULATE) != 0));
+ IMB_rectblend(
+ s->canvas, &tmpbuf, frombuf, mask,
+ curveb, texmaskb, mask_max,
+ region->destx, region->desty,
+ origx, origy,
+ region->srcx, region->srcy,
+ region->width, region->height,
+ blend, ((s->brush->flag & BRUSH_ACCUMULATE) != 0));
}
}
}
@@ -1079,11 +1090,12 @@ static void paint_2d_op_foreach_do(
const ParallelRangeTLS *__restrict UNUSED(tls))
{
Paint2DForeachData *data = (Paint2DForeachData *)data_v;
- paint_2d_do_making_brush(data->s, data->region, data->curveb,
- data->texmaskb, data->frombuf, data->mask_max,
- data->blend,
- data->tilex, iter,
- data->tilew, iter);
+ paint_2d_do_making_brush(
+ data->s, data->region, data->curveb,
+ data->texmaskb, data->frombuf, data->mask_max,
+ data->blend,
+ data->tilex, iter,
+ data->tilew, iter);
}
static int paint_2d_op(void *state, ImBuf *ibufb, unsigned short *curveb, unsigned short *texmaskb, const float lastpos[2], const float pos[2])
@@ -1135,21 +1147,24 @@ static int paint_2d_op(void *state, ImBuf *ibufb, unsigned short *curveb, unsign
/* blend into canvas */
for (a = 0; a < tot; a++) {
- ED_imapaint_dirty_region(s->image, s->canvas,
- region[a].destx, region[a].desty,
- region[a].width, region[a].height, true);
+ ED_imapaint_dirty_region(
+ s->image, s->canvas,
+ region[a].destx, region[a].desty,
+ region[a].width, region[a].height, true);
if (s->do_masking) {
/* masking, find original pixels tiles from undo buffer to composite over */
int tilex, tiley, tilew, tileh;
- imapaint_region_tiles(s->canvas, region[a].destx, region[a].desty,
- region[a].width, region[a].height,
- &tilex, &tiley, &tilew, &tileh);
+ imapaint_region_tiles(
+ s->canvas, region[a].destx, region[a].desty,
+ region[a].width, region[a].height,
+ &tilex, &tiley, &tilew, &tileh);
if (tiley == tileh) {
- paint_2d_do_making_brush(s, &region[a], curveb, texmaskb, frombuf,
- mask_max, blend, tilex, tiley, tilew, tileh);
+ paint_2d_do_making_brush(
+ s, &region[a], curveb, texmaskb, frombuf,
+ mask_max, blend, tilex, tiley, tilew, tileh);
}
else {
Paint2DForeachData data;
@@ -1165,19 +1180,21 @@ static int paint_2d_op(void *state, ImBuf *ibufb, unsigned short *curveb, unsign
ParallelRangeSettings settings;
BLI_parallel_range_settings_defaults(&settings);
- BLI_task_parallel_range(tiley, tileh + 1, &data,
- paint_2d_op_foreach_do,
- &settings);
+ BLI_task_parallel_range(
+ tiley, tileh + 1, &data,
+ paint_2d_op_foreach_do,
+ &settings);
}
}
else {
/* no masking, composite brush directly onto canvas */
- IMB_rectblend_threaded(s->canvas, s->canvas, frombuf, NULL, curveb, texmaskb, mask_max,
- region[a].destx, region[a].desty,
- region[a].destx, region[a].desty,
- region[a].srcx, region[a].srcy,
- region[a].width, region[a].height, blend, false);
+ IMB_rectblend_threaded(
+ s->canvas, s->canvas, frombuf, NULL, curveb, texmaskb, mask_max,
+ region[a].destx, region[a].desty,
+ region[a].destx, region[a].desty,
+ region[a].srcx, region[a].srcy,
+ region[a].width, region[a].height, blend, false);
}
}
@@ -1478,16 +1495,18 @@ void paint_2d_bucket_fill(
if (do_float) {
for (x_px = 0; x_px < ibuf->x; x_px++) {
for (y_px = 0; y_px < ibuf->y; y_px++) {
- blend_color_mix_float(ibuf->rect_float + 4 * (((size_t)y_px) * ibuf->x + x_px),
- ibuf->rect_float + 4 * (((size_t)y_px) * ibuf->x + x_px), color_f);
+ blend_color_mix_float(
+ ibuf->rect_float + 4 * (((size_t)y_px) * ibuf->x + x_px),
+ ibuf->rect_float + 4 * (((size_t)y_px) * ibuf->x + x_px), color_f);
}
}
}
else {
for (x_px = 0; x_px < ibuf->x; x_px++) {
for (y_px = 0; y_px < ibuf->y; y_px++) {
- blend_color_mix_byte((unsigned char *)(ibuf->rect + ((size_t)y_px) * ibuf->x + x_px),
- (unsigned char *)(ibuf->rect + ((size_t)y_px) * ibuf->x + x_px), (unsigned char *)&color_b);
+ blend_color_mix_byte(
+ (unsigned char *)(ibuf->rect + ((size_t)y_px) * ibuf->x + x_px),
+ (unsigned char *)(ibuf->rect + ((size_t)y_px) * ibuf->x + x_px), (unsigned char *)&color_b);
}
}
}
@@ -1538,9 +1557,10 @@ void paint_2d_bucket_fill(
while (!BLI_stack_is_empty(stack)) {
BLI_stack_pop(stack, &coordinate);
- IMB_blend_color_float(ibuf->rect_float + 4 * (coordinate),
- ibuf->rect_float + 4 * (coordinate),
- color_f, br->blend);
+ IMB_blend_color_float(
+ ibuf->rect_float + 4 * (coordinate),
+ ibuf->rect_float + 4 * (coordinate),
+ color_f, br->blend);
/* reconstruct the coordinates here */
x_px = coordinate % width;
@@ -1569,9 +1589,10 @@ void paint_2d_bucket_fill(
while (!BLI_stack_is_empty(stack)) {
BLI_stack_pop(stack, &coordinate);
- IMB_blend_color_byte((unsigned char *)(ibuf->rect + coordinate),
- (unsigned char *)(ibuf->rect + coordinate),
- (unsigned char *)&color_b, br->blend);
+ IMB_blend_color_byte(
+ (unsigned char *)(ibuf->rect + coordinate),
+ (unsigned char *)(ibuf->rect + coordinate),
+ (unsigned char *)&color_b, br->blend);
/* reconstruct the coordinates here */
x_px = coordinate % width;
@@ -1679,9 +1700,10 @@ void paint_2d_gradient_fill(
/* convert to premultiplied */
mul_v3_fl(color_f, color_f[3]);
color_f[3] *= br->alpha;
- IMB_blend_color_float(ibuf->rect_float + 4 * (((size_t)y_px) * ibuf->x + x_px),
- ibuf->rect_float + 4 * (((size_t)y_px) * ibuf->x + x_px),
- color_f, br->blend);
+ IMB_blend_color_float(
+ ibuf->rect_float + 4 * (((size_t)y_px) * ibuf->x + x_px),
+ ibuf->rect_float + 4 * (((size_t)y_px) * ibuf->x + x_px),
+ color_f, br->blend);
}
}
}
@@ -1709,9 +1731,10 @@ void paint_2d_gradient_fill(
linearrgb_to_srgb_v3_v3(color_f, color_f);
rgba_float_to_uchar((unsigned char *)&color_b, color_f);
((unsigned char *)&color_b)[3] *= br->alpha;
- IMB_blend_color_byte((unsigned char *)(ibuf->rect + ((size_t)y_px) * ibuf->x + x_px),
- (unsigned char *)(ibuf->rect + ((size_t)y_px) * ibuf->x + x_px),
- (unsigned char *)&color_b, br->blend);
+ IMB_blend_color_byte(
+ (unsigned char *)(ibuf->rect + ((size_t)y_px) * ibuf->x + x_px),
+ (unsigned char *)(ibuf->rect + ((size_t)y_px) * ibuf->x + x_px),
+ (unsigned char *)&color_b, br->blend);
}
}
}
diff --git a/source/blender/editors/sculpt_paint/paint_image_proj.c b/source/blender/editors/sculpt_paint/paint_image_proj.c
index 8c5fdc617c6..04329697b54 100644
--- a/source/blender/editors/sculpt_paint/paint_image_proj.c
+++ b/source/blender/editors/sculpt_paint/paint_image_proj.c
@@ -2604,8 +2604,9 @@ static void project_paint_face_init(
if (pixel_bounds_array(uv_clip, &bounds_px, ibuf->x, ibuf->y, uv_clip_tot)) {
#if 0
- project_paint_undo_tiles_init(&bounds_px, ps->projImages + image_index, tmpibuf,
- tile_width, threaded, ps->do_masking);
+ project_paint_undo_tiles_init(
+ &bounds_px, ps->projImages + image_index, tmpibuf,
+ tile_width, threaded, ps->do_masking);
#endif
/* clip face and */
@@ -2654,10 +2655,10 @@ static void project_paint_face_init(
if (mask > 0.0f) {
BLI_linklist_prepend_arena(
bucketPixelNodes,
- project_paint_uvpixel_init(ps, arena, &tinf, x, y, mask, tri_index,
- pixelScreenCo, wco, w),
- arena
- );
+ project_paint_uvpixel_init(
+ ps, arena, &tinf, x, y, mask, tri_index,
+ pixelScreenCo, wco, w),
+ arena);
}
}
@@ -4187,8 +4188,9 @@ static void do_projectpaint_clone_f(ProjPaintState *ps, ProjPixel *projPixel, fl
* accumulation of color greater than 'projPixel->mask' however in the case of smear its not
* really that important to be correct as it is with clone and painting
*/
-static void do_projectpaint_smear(ProjPaintState *ps, ProjPixel *projPixel, float mask,
- MemArena *smearArena, LinkNode **smearPixels, const float co[2])
+static void do_projectpaint_smear(
+ ProjPaintState *ps, ProjPixel *projPixel, float mask,
+ MemArena *smearArena, LinkNode **smearPixels, const float co[2])
{
unsigned char rgba_ub[4];
@@ -4199,8 +4201,9 @@ static void do_projectpaint_smear(ProjPaintState *ps, ProjPixel *projPixel, floa
BLI_linklist_prepend_arena(smearPixels, (void *)projPixel, smearArena);
}
-static void do_projectpaint_smear_f(ProjPaintState *ps, ProjPixel *projPixel, float mask,
- MemArena *smearArena, LinkNode **smearPixels_f, const float co[2])
+static void do_projectpaint_smear_f(
+ ProjPaintState *ps, ProjPixel *projPixel, float mask,
+ MemArena *smearArena, LinkNode **smearPixels_f, const float co[2])
{
float rgba[4];
@@ -4211,8 +4214,9 @@ static void do_projectpaint_smear_f(ProjPaintState *ps, ProjPixel *projPixel, fl
BLI_linklist_prepend_arena(smearPixels_f, (void *)projPixel, smearArena);
}
-static void do_projectpaint_soften_f(ProjPaintState *ps, ProjPixel *projPixel, float mask,
- MemArena *softenArena, LinkNode **softenPixels)
+static void do_projectpaint_soften_f(
+ ProjPaintState *ps, ProjPixel *projPixel, float mask,
+ MemArena *softenArena, LinkNode **softenPixels)
{
float accum_tot = 0.0f;
int xk, yk;
@@ -4267,8 +4271,9 @@ static void do_projectpaint_soften_f(ProjPaintState *ps, ProjPixel *projPixel, f
}
}
-static void do_projectpaint_soften(ProjPaintState *ps, ProjPixel *projPixel, float mask,
- MemArena *softenArena, LinkNode **softenPixels)
+static void do_projectpaint_soften(
+ ProjPaintState *ps, ProjPixel *projPixel, float mask,
+ MemArena *softenArena, LinkNode **softenPixels)
{
float accum_tot = 0;
int xk, yk;
@@ -4549,8 +4554,9 @@ static void *do_projectpaint_thread(void *ph_v)
if (is_floatbuf) {
/* convert to premultipied */
mul_v3_fl(color_f, color_f[3]);
- IMB_blend_color_float(projPixel->pixel.f_pt, projPixel->origColor.f_pt,
- color_f, ps->blend);
+ IMB_blend_color_float(
+ projPixel->pixel.f_pt, projPixel->origColor.f_pt,
+ color_f, ps->blend);
}
else {
linearrgb_to_srgb_v3_v3(color_f, color_f);
@@ -4562,8 +4568,9 @@ static void *do_projectpaint_thread(void *ph_v)
unit_float_to_uchar_clamp_v3(projPixel->newColor.ch, color_f);
}
projPixel->newColor.ch[3] = unit_float_to_uchar_clamp(color_f[3]);
- IMB_blend_color_byte(projPixel->pixel.ch_pt, projPixel->origColor.ch_pt,
- projPixel->newColor.ch, ps->blend);
+ IMB_blend_color_byte(
+ projPixel->pixel.ch_pt, projPixel->origColor.ch_pt,
+ projPixel->newColor.ch, ps->blend);
}
}
else {
@@ -4572,16 +4579,18 @@ static void *do_projectpaint_thread(void *ph_v)
newColor_f[3] = ((float)projPixel->mask) * (1.0f / 65535.0f) * brush->alpha;
copy_v3_v3(newColor_f, ps->paint_color_linear);
- IMB_blend_color_float(projPixel->pixel.f_pt, projPixel->origColor.f_pt,
- newColor_f, ps->blend);
+ IMB_blend_color_float(
+ projPixel->pixel.f_pt, projPixel->origColor.f_pt,
+ newColor_f, ps->blend);
}
else {
float mask = ((float)projPixel->mask) * (1.0f / 65535.0f);
projPixel->newColor.ch[3] = mask * 255 * brush->alpha;
rgb_float_to_uchar(projPixel->newColor.ch, ps->paint_color);
- IMB_blend_color_byte(projPixel->pixel.ch_pt, projPixel->origColor.ch_pt,
- projPixel->newColor.ch, ps->blend);
+ IMB_blend_color_byte(
+ projPixel->pixel.ch_pt, projPixel->origColor.ch_pt,
+ projPixel->newColor.ch, ps->blend);
}
}
@@ -4609,15 +4618,17 @@ static void *do_projectpaint_thread(void *ph_v)
ps->reproject_ibuf_free_float = true;
}
- bicubic_interpolation_color(ps->reproject_ibuf, NULL, projPixel->newColor.f,
- projPixel->projCoSS[0], projPixel->projCoSS[1]);
+ bicubic_interpolation_color(
+ ps->reproject_ibuf, NULL, projPixel->newColor.f,
+ projPixel->projCoSS[0], projPixel->projCoSS[1]);
if (projPixel->newColor.f[3]) {
float mask = ((float)projPixel->mask) * (1.0f / 65535.0f);
mul_v4_v4fl(projPixel->newColor.f, projPixel->newColor.f, mask);
- blend_color_mix_float(projPixel->pixel.f_pt, projPixel->origColor.f_pt,
- projPixel->newColor.f);
+ blend_color_mix_float(
+ projPixel->pixel.f_pt, projPixel->origColor.f_pt,
+ projPixel->newColor.f);
}
}
else {
@@ -4626,14 +4637,16 @@ static void *do_projectpaint_thread(void *ph_v)
ps->reproject_ibuf_free_uchar = true;
}
- bicubic_interpolation_color(ps->reproject_ibuf, projPixel->newColor.ch, NULL,
- projPixel->projCoSS[0], projPixel->projCoSS[1]);
+ bicubic_interpolation_color(
+ ps->reproject_ibuf, projPixel->newColor.ch, NULL,
+ projPixel->projCoSS[0], projPixel->projCoSS[1]);
if (projPixel->newColor.ch[3]) {
float mask = ((float)projPixel->mask) * (1.0f / 65535.0f);
projPixel->newColor.ch[3] *= mask;
- blend_color_mix_byte(projPixel->pixel.ch_pt, projPixel->origColor.ch_pt,
- projPixel->newColor.ch);
+ blend_color_mix_byte(
+ projPixel->pixel.ch_pt, projPixel->origColor.ch_pt,
+ projPixel->newColor.ch);
}
}
}
@@ -5495,12 +5508,13 @@ void PAINT_OT_image_from_view(wmOperatorType *ot)
void BKE_paint_data_warning(struct ReportList *reports, bool uvs, bool mat, bool tex, bool stencil)
{
- BKE_reportf(reports, RPT_WARNING, "Missing%s%s%s%s detected!",
- !uvs ? " UVs," : "",
- !mat ? " Materials," : "",
- !tex ? " Textures," : "",
- !stencil ? " Stencil," : ""
- );
+ BKE_reportf(
+ reports, RPT_WARNING, "Missing%s%s%s%s detected!",
+ !uvs ? " UVs," : "",
+ !mat ? " Materials," : "",
+ !tex ? " Textures," : "",
+ !stencil ? " Stencil," : ""
+ );
}
/* Make sure that active object has a material, and assign UVs and image layers if they do not exist */
@@ -5628,8 +5642,9 @@ static Image *proj_paint_image_create(wmOperator *op, Main *bmain)
alpha = RNA_boolean_get(op->ptr, "alpha");
RNA_string_get(op->ptr, "name", imagename);
}
- ima = BKE_image_add_generated(bmain, width, height, imagename, alpha ? 32 : 24, use_float,
- gen_type, color, false);
+ ima = BKE_image_add_generated(
+ bmain, width, height, imagename, alpha ? 32 : 24, use_float,
+ gen_type, color, false);
return ima;
}
diff --git a/source/blender/editors/sculpt_paint/paint_image_undo.c b/source/blender/editors/sculpt_paint/paint_image_undo.c
index ade775d14e6..e26a4811afc 100644
--- a/source/blender/editors/sculpt_paint/paint_image_undo.c
+++ b/source/blender/editors/sculpt_paint/paint_image_undo.c
@@ -105,8 +105,9 @@ static void undo_copy_tile(UndoImageTile *tile, ImBuf *tmpibuf, ImBuf *ibuf, Cop
{
if (mode == COPY) {
/* copy or swap contents of tile->rect and region in ibuf->rect */
- IMB_rectcpy(tmpibuf, ibuf, 0, 0, tile->x * IMAPAINT_TILE_SIZE,
- tile->y * IMAPAINT_TILE_SIZE, IMAPAINT_TILE_SIZE, IMAPAINT_TILE_SIZE);
+ IMB_rectcpy(
+ tmpibuf, ibuf, 0, 0, tile->x * IMAPAINT_TILE_SIZE,
+ tile->y * IMAPAINT_TILE_SIZE, IMAPAINT_TILE_SIZE, IMAPAINT_TILE_SIZE);
if (ibuf->rect_float) {
SWAP(float *, tmpibuf->rect_float, tile->rect.fp);
@@ -117,8 +118,9 @@ static void undo_copy_tile(UndoImageTile *tile, ImBuf *tmpibuf, ImBuf *ibuf, Cop
}
else {
if (mode == RESTORE_COPY) {
- IMB_rectcpy(tmpibuf, ibuf, 0, 0, tile->x * IMAPAINT_TILE_SIZE,
- tile->y * IMAPAINT_TILE_SIZE, IMAPAINT_TILE_SIZE, IMAPAINT_TILE_SIZE);
+ IMB_rectcpy(
+ tmpibuf, ibuf, 0, 0, tile->x * IMAPAINT_TILE_SIZE,
+ tile->y * IMAPAINT_TILE_SIZE, IMAPAINT_TILE_SIZE, IMAPAINT_TILE_SIZE);
}
/* swap to the tmpbuf for easy copying */
if (ibuf->rect_float) {
@@ -128,8 +130,9 @@ static void undo_copy_tile(UndoImageTile *tile, ImBuf *tmpibuf, ImBuf *ibuf, Cop
SWAP(unsigned int *, tmpibuf->rect, tile->rect.uint);
}
- IMB_rectcpy(ibuf, tmpibuf, tile->x * IMAPAINT_TILE_SIZE,
- tile->y * IMAPAINT_TILE_SIZE, 0, 0, IMAPAINT_TILE_SIZE, IMAPAINT_TILE_SIZE);
+ IMB_rectcpy(
+ ibuf, tmpibuf, tile->x * IMAPAINT_TILE_SIZE,
+ tile->y * IMAPAINT_TILE_SIZE, 0, 0, IMAPAINT_TILE_SIZE, IMAPAINT_TILE_SIZE);
if (mode == RESTORE) {
if (ibuf->rect_float) {
@@ -156,8 +159,9 @@ void *image_undo_find_tile(
if (mask) {
/* allocate mask if requested */
if (!tile->mask) {
- tile->mask = MEM_callocN(sizeof(unsigned short) * IMAPAINT_TILE_SIZE * IMAPAINT_TILE_SIZE,
- "UndoImageTile.mask");
+ tile->mask = MEM_callocN(
+ sizeof(unsigned short) * IMAPAINT_TILE_SIZE * IMAPAINT_TILE_SIZE,
+ "UndoImageTile.mask");
}
*mask = tile->mask;
@@ -204,8 +208,9 @@ void *image_undo_push_tile(
/* add mask explicitly here */
if (mask) {
- *mask = tile->mask = MEM_callocN(sizeof(unsigned short) * IMAPAINT_TILE_SIZE * IMAPAINT_TILE_SIZE,
- "UndoImageTile.mask");
+ *mask = tile->mask = MEM_callocN(
+ sizeof(unsigned short) * IMAPAINT_TILE_SIZE * IMAPAINT_TILE_SIZE,
+ "UndoImageTile.mask");
}
allocsize = IMAPAINT_TILE_SIZE * IMAPAINT_TILE_SIZE * 4;
allocsize *= (ibuf->rect_float) ? sizeof(float) : sizeof(char);
@@ -253,8 +258,9 @@ static void image_undo_restore_runtime(ListBase *lb)
ImBuf *ibuf, *tmpibuf;
UndoImageTile *tile;
- tmpibuf = IMB_allocImBuf(IMAPAINT_TILE_SIZE, IMAPAINT_TILE_SIZE, 32,
- IB_rectfloat | IB_rect);
+ tmpibuf = IMB_allocImBuf(
+ IMAPAINT_TILE_SIZE, IMAPAINT_TILE_SIZE, 32,
+ IB_rectfloat | IB_rect);
for (tile = lb->first; tile; tile = tile->next) {
Image *ima = tile->ima;
diff --git a/source/blender/editors/sculpt_paint/paint_intern.h b/source/blender/editors/sculpt_paint/paint_intern.h
index a7041a5e9ea..7d3049434d6 100644
--- a/source/blender/editors/sculpt_paint/paint_intern.h
+++ b/source/blender/editors/sculpt_paint/paint_intern.h
@@ -65,10 +65,11 @@ typedef void (*StrokeUpdateStep)(struct bContext *C, struct PaintStroke *stroke,
typedef void (*StrokeRedraw)(const struct bContext *C, struct PaintStroke *stroke, bool final);
typedef void (*StrokeDone)(const struct bContext *C, struct PaintStroke *stroke);
-struct PaintStroke *paint_stroke_new(struct bContext *C, struct wmOperator *op,
- StrokeGetLocation get_location, StrokeTestStart test_start,
- StrokeUpdateStep update_step, StrokeRedraw redraw,
- StrokeDone done, int event_type);
+struct PaintStroke *paint_stroke_new(
+ struct bContext *C, struct wmOperator *op,
+ StrokeGetLocation get_location, StrokeTestStart test_start,
+ StrokeUpdateStep update_step, StrokeRedraw redraw,
+ StrokeDone done, int event_type);
void paint_stroke_data_free(struct wmOperator *op);
bool paint_space_stroke_enabled(struct Brush *br, enum ePaintMode mode);
@@ -248,24 +249,28 @@ void SCULPT_OT_uv_sculpt_stroke(struct wmOperatorType *ot);
/* Convert the object-space axis-aligned bounding box (expressed as
* its minimum and maximum corners) into a screen-space rectangle,
* returns zero if the result is empty */
-bool 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);
+bool 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);
/* 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 Object *ob,
- const struct rcti *screen_rect);
+void paint_calc_redraw_planes(
+ float planes[4][4],
+ const struct ARegion *ar,
+ struct Object *ob,
+ const struct rcti *screen_rect);
float paint_calc_object_space_radius(struct ViewContext *vc, const float center[3], float pixel_radius);
float paint_get_tex_pixel(const struct MTex *mtex, float u, float v, struct ImagePool *pool, int thread);
-void paint_get_tex_pixel_col(const struct MTex *mtex, float u, float v, float rgba[4], struct ImagePool *pool, int thread, bool convert, struct ColorSpace *colorspace);
+void paint_get_tex_pixel_col(
+ const struct MTex *mtex, float u, float v, float rgba[4],
+ struct ImagePool *pool, int thread, bool convert, struct ColorSpace *colorspace);
void paint_sample_color(struct bContext *C, struct ARegion *ar, int x, int y, bool texpaint_proj, bool palette);
@@ -307,8 +312,9 @@ typedef enum {
RC_COLOR_OVERRIDE = 32,
} RCFlags;
-void set_brush_rc_props(struct PointerRNA *ptr, const char *paint, const char *prop, const char *secondary_prop,
- RCFlags flags);
+void set_brush_rc_props(
+ struct PointerRNA *ptr, const char *paint, const char *prop, const char *secondary_prop,
+ RCFlags flags);
/* paint_hide.c */
diff --git a/source/blender/editors/sculpt_paint/paint_mask.c b/source/blender/editors/sculpt_paint/paint_mask.c
index 4a338e65d79..aed48aef3a9 100644
--- a/source/blender/editors/sculpt_paint/paint_mask.c
+++ b/source/blender/editors/sculpt_paint/paint_mask.c
@@ -75,9 +75,10 @@ static const EnumPropertyItem mode_items[] = {
{0}};
-static void mask_flood_fill_set_elem(float *elem,
- PaintMaskFloodMode mode,
- float value)
+static void mask_flood_fill_set_elem(
+ float *elem,
+ PaintMaskFloodMode mode,
+ float value)
{
switch (mode) {
case PAINT_MASK_FLOOD_VALUE:
@@ -162,8 +163,9 @@ static int mask_flood_fill_exec(bContext *C, wmOperator *op)
BLI_parallel_range_settings_defaults(&settings);
settings.use_threading = ((sd->flags & SCULPT_USE_OPENMP) && totnode > SCULPT_THREADED_LIMIT);
BLI_task_parallel_range(
- 0, totnode, &data, mask_flood_fill_task_cb,
- &settings);
+
+ 0, totnode, &data, mask_flood_fill_task_cb,
+ &settings);
if (multires)
multires_mark_as_modified(ob, MULTIRES_COORDS_MODIFIED);
diff --git a/source/blender/editors/sculpt_paint/paint_ops.c b/source/blender/editors/sculpt_paint/paint_ops.c
index f89236dbbc1..9f14a821613 100644
--- a/source/blender/editors/sculpt_paint/paint_ops.c
+++ b/source/blender/editors/sculpt_paint/paint_ops.c
@@ -366,10 +366,11 @@ static Brush *brush_tool_toggle(Main *bmain, Brush *brush_orig, const int tool,
return NULL;
}
-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, const bool create_missing,
- const bool toggle)
+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, const bool create_missing,
+ const bool toggle)
{
Brush *brush, *brush_orig = BKE_paint_brush(paint);
@@ -512,8 +513,9 @@ static wmKeyMapItem *keymap_brush_select(
int keymap_modifier)
{
wmKeyMapItem *kmi;
- kmi = WM_keymap_add_item(keymap, "PAINT_OT_brush_select",
- keymap_type, KM_PRESS, keymap_modifier, 0);
+ kmi = WM_keymap_add_item(
+ keymap, "PAINT_OT_brush_select",
+ keymap_type, KM_PRESS, keymap_modifier, 0);
RNA_enum_set(kmi->ptr, "paint_mode", paint_mode);
@@ -697,8 +699,7 @@ static void stencil_control_calculate(StencilControlData *scd, const int mval[2]
switch (scd->mode) {
case STENCIL_TRANSLATE:
sub_v2_v2v2(mdiff, mvalf, scd->init_mouse);
- add_v2_v2v2(scd->pos_target, scd->init_spos,
- mdiff);
+ add_v2_v2v2(scd->pos_target, scd->init_spos, mdiff);
CLAMP(scd->pos_target[0],
-scd->dim_target[0] + PIXEL_MARGIN,
scd->area_size[0] + scd->dim_target[0] - PIXEL_MARGIN);
@@ -1001,8 +1002,9 @@ void ED_operatormacros_paint(void)
wmOperatorType *ot;
wmOperatorTypeMacro *otmacro;
- ot = WM_operatortype_append_macro("PAINTCURVE_OT_add_point_slide", "Add Curve Point and Slide",
- "Add new curve point and slide it", OPTYPE_UNDO);
+ ot = WM_operatortype_append_macro(
+ "PAINTCURVE_OT_add_point_slide", "Add Curve Point and Slide",
+ "Add new curve point and slide it", OPTYPE_UNDO);
ot->description = "Add new curve point and slide it";
WM_operatortype_macro_define(ot, "PAINTCURVE_OT_add_point");
otmacro = WM_operatortype_macro_define(ot, "PAINTCURVE_OT_slide");
@@ -1105,8 +1107,9 @@ static void ed_keymap_paint_brush_size(wmKeyMap *keymap, const char *UNUSED(path
RNA_float_set(kmi->ptr, "scalar", 10.0 / 9.0); // 1.1111....
}
-static void set_brush_rc_path(PointerRNA *ptr, const char *brush_path,
- const char *output_name, const char *input_name)
+static void set_brush_rc_path(
+ PointerRNA *ptr, const char *brush_path,
+ const char *output_name, const char *input_name)
{
char *path;
@@ -1115,9 +1118,10 @@ static void set_brush_rc_path(PointerRNA *ptr, const char *brush_path,
MEM_freeN(path);
}
-void set_brush_rc_props(PointerRNA *ptr, const char *paint,
- const char *prop, const char *secondary_prop,
- RCFlags flags)
+void set_brush_rc_props(
+ PointerRNA *ptr, const char *paint,
+ const char *prop, const char *secondary_prop,
+ RCFlags flags)
{
const char *ups_path = "tool_settings.unified_paint_settings";
char *brush_path;
@@ -1166,8 +1170,9 @@ void set_brush_rc_props(PointerRNA *ptr, const char *paint,
MEM_freeN(brush_path);
}
-static void ed_keymap_paint_brush_radial_control(wmKeyMap *keymap, const char *paint,
- RCFlags flags)
+static void ed_keymap_paint_brush_radial_control(
+ wmKeyMap *keymap, const char *paint,
+ RCFlags flags)
{
wmKeyMapItem *kmi;
/* only size needs to follow zoom, strength shows fixed size circle */
@@ -1335,8 +1340,7 @@ void ED_keymap_paint(wmKeyConfig *keyconf)
WM_keymap_add_item(keymap, "PAINT_OT_brush_colors_flip", XKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "PAINT_OT_sample_color", SKEY, KM_PRESS, 0, 0);
- WM_keymap_add_item(keymap,
- "PAINT_OT_vertex_color_set", KKEY, KM_PRESS, KM_SHIFT, 0);
+ WM_keymap_add_item(keymap, "PAINT_OT_vertex_color_set", KKEY, KM_PRESS, KM_SHIFT, 0);
ed_keymap_paint_brush_size(keymap, "tool_settings.vertex_paint.brush.size");
ed_keymap_paint_brush_radial_control(keymap, "vertex_paint", RC_COLOR | RC_COLOR_OVERRIDE | RC_ROTATION);
@@ -1367,8 +1371,7 @@ void ED_keymap_paint(wmKeyConfig *keyconf)
RNA_enum_set(WM_keymap_add_item(keymap, "PAINT_OT_weight_gradient", LEFTMOUSE, KM_PRESS, KM_ALT, 0)->ptr, "type", WPAINT_GRADIENT_TYPE_LINEAR);
RNA_enum_set(WM_keymap_add_item(keymap, "PAINT_OT_weight_gradient", LEFTMOUSE, KM_PRESS, KM_ALT | KM_CTRL, 0)->ptr, "type", WPAINT_GRADIENT_TYPE_RADIAL);
- WM_keymap_add_item(keymap,
- "PAINT_OT_weight_set", KKEY, KM_PRESS, KM_SHIFT, 0);
+ WM_keymap_add_item(keymap, "PAINT_OT_weight_set", KKEY, KM_PRESS, KM_SHIFT, 0);
ed_keymap_paint_brush_size(keymap, "tool_settings.weight_paint.brush.size");
ed_keymap_paint_brush_radial_control(keymap, "weight_paint", RC_WEIGHT);
diff --git a/source/blender/editors/sculpt_paint/paint_stroke.c b/source/blender/editors/sculpt_paint/paint_stroke.c
index 45149e98536..8db78a41252 100644
--- a/source/blender/editors/sculpt_paint/paint_stroke.c
+++ b/source/blender/editors/sculpt_paint/paint_stroke.c
@@ -226,8 +226,9 @@ static bool paint_tool_require_location(Brush *brush, ePaintMode mode)
{
switch (mode) {
case ePaintSculpt:
- if (ELEM(brush->sculpt_tool, SCULPT_TOOL_GRAB, SCULPT_TOOL_ROTATE,
- SCULPT_TOOL_SNAKE_HOOK, SCULPT_TOOL_THUMB))
+ if (ELEM(brush->sculpt_tool,
+ SCULPT_TOOL_GRAB, SCULPT_TOOL_ROTATE,
+ SCULPT_TOOL_SNAKE_HOOK, SCULPT_TOOL_THUMB))
{
return false;
}
@@ -484,14 +485,24 @@ static void paint_brush_stroke_add_step(bContext *C, wmOperator *op, const float
#if 0
/* special exception here for too high pressure values on first touch in
* windows for some tablets, then we just skip first touch .. */
- if (tablet && (pressure >= 0.99f) && ((pop->s.brush->flag & BRUSH_SPACING_PRESSURE) || BKE_brush_use_alpha_pressure(scene, pop->s.brush) || BKE_brush_use_size_pressure(scene, pop->s.brush)))
+ if (tablet && (pressure >= 0.99f) &&
+ ((pop->s.brush->flag & BRUSH_SPACING_PRESSURE) ||
+ BKE_brush_use_alpha_pressure(scene, pop->s.brush) ||
+ BKE_brush_use_size_pressure(scene, pop->s.brush)))
+ {
return;
+ }
/* This can be removed once fixed properly in
* BKE_brush_painter_paint(BrushPainter *painter, BrushFunc func, float *pos, double time, float pressure, void *user)
* at zero pressure we should do nothing 1/2^12 is 0.0002 which is the sensitivity of the most sensitive pen tablet available */
- if (tablet && (pressure < 0.0002f) && ((pop->s.brush->flag & BRUSH_SPACING_PRESSURE) || BKE_brush_use_alpha_pressure(scene, pop->s.brush) || BKE_brush_use_size_pressure(scene, pop->s.brush)))
+ if (tablet && (pressure < 0.0002f) &&
+ ((pop->s.brush->flag & BRUSH_SPACING_PRESSURE) ||
+ BKE_brush_use_alpha_pressure(scene, pop->s.brush) ||
+ BKE_brush_use_size_pressure(scene, pop->s.brush)))
+ {
return;
+ }
#endif
/* copy last position -before- jittering, or space fill code
@@ -575,7 +586,8 @@ static bool paint_smooth_stroke(
return true;
}
-static float paint_space_stroke_spacing(const Scene *scene, PaintStroke *stroke, float size_pressure, float spacing_pressure)
+static float paint_space_stroke_spacing(
+ const Scene *scene, PaintStroke *stroke, float size_pressure, float spacing_pressure)
{
/* brushes can have a minimum size of 1.0 but with pressure it can be smaller then a pixel
* causing very high step sizes, hanging blender [#32381] */
@@ -645,7 +657,8 @@ static float paint_stroke_integrate_overlap(Brush *br, float factor)
return 1.0f / max;
}
-static float paint_space_stroke_spacing_variable(const Scene *scene, PaintStroke *stroke, float pressure, float dpressure, float length)
+static float paint_space_stroke_spacing_variable(
+ const Scene *scene, PaintStroke *stroke, float pressure, float dpressure, float length)
{
if (BKE_brush_use_size_pressure(scene, stroke->brush)) {
/* use pressure to modify size. set spacing so that at 100%, the circles
@@ -720,13 +733,14 @@ static int paint_space_stroke(bContext *C, wmOperator *op, const float final_mou
/**** Public API ****/
-PaintStroke *paint_stroke_new(bContext *C,
- wmOperator *op,
- StrokeGetLocation get_location,
- StrokeTestStart test_start,
- StrokeUpdateStep update_step,
- StrokeRedraw redraw,
- StrokeDone done, int event_type)
+PaintStroke *paint_stroke_new(
+ bContext *C,
+ wmOperator *op,
+ StrokeGetLocation get_location,
+ StrokeTestStart test_start,
+ StrokeUpdateStep update_step,
+ StrokeRedraw redraw,
+ StrokeDone done, int event_type)
{
PaintStroke *stroke = MEM_callocN(sizeof(PaintStroke), "PaintStroke");
ToolSettings *toolsettings = CTX_data_tool_settings(C);
@@ -827,11 +841,12 @@ bool paint_space_stroke_enabled(Brush *br, ePaintMode mode)
static bool sculpt_is_grab_tool(Brush *br)
{
- return ELEM(br->sculpt_tool,
- SCULPT_TOOL_GRAB,
- SCULPT_TOOL_THUMB,
- SCULPT_TOOL_ROTATE,
- SCULPT_TOOL_SNAKE_HOOK);
+ return ELEM(
+ br->sculpt_tool,
+ SCULPT_TOOL_GRAB,
+ SCULPT_TOOL_THUMB,
+ SCULPT_TOOL_ROTATE,
+ SCULPT_TOOL_SNAKE_HOOK);
}
/* return true if the brush size can change during paint (normally used for pressure) */
@@ -932,9 +947,10 @@ struct wmKeyMap *paint_stroke_modal_keymap(struct wmKeyConfig *keyconf)
return keymap;
}
-static void paint_stroke_add_sample(const Paint *paint,
- PaintStroke *stroke,
- float x, float y, float pressure)
+static void paint_stroke_add_sample(
+ const Paint *paint,
+ PaintStroke *stroke,
+ float x, float y, float pressure)
{
PaintSample *sample = &stroke->samples[stroke->cur_sample];
int max_samples = CLAMPIS(paint->num_input_samples, 1, PAINT_MAX_INPUT_SAMPLES);
@@ -950,8 +966,9 @@ static void paint_stroke_add_sample(const Paint *paint,
stroke->num_samples++;
}
-static void paint_stroke_sample_average(const PaintStroke *stroke,
- PaintSample *average)
+static void paint_stroke_sample_average(
+ const PaintStroke *stroke,
+ PaintSample *average)
{
int i;
@@ -1096,11 +1113,13 @@ static bool paint_stroke_curve_end(bContext *C, wmOperator *op, PaintStroke *str
if (stroke->stroke_started) {
paint_brush_stroke_add_step(C, op, data + 2 * j, 1.0);
- paint_line_strokes_spacing(C, op, stroke, spacing, &length_residue, data + 2 * j, data + 2 * (j + 1));
+ paint_line_strokes_spacing(
+ C, op, stroke, spacing, &length_residue, data + 2 * j, data + 2 * (j + 1));
}
}
else {
- paint_line_strokes_spacing(C, op, stroke, spacing, &length_residue, data + 2 * j, data + 2 * (j + 1));
+ paint_line_strokes_spacing(
+ C, op, stroke, spacing, &length_residue, data + 2 * j, data + 2 * (j + 1));
}
}
}
@@ -1160,7 +1179,9 @@ int paint_stroke_modal(bContext *C, wmOperator *op, const wmEvent *event)
float pressure;
/* see if tablet affects event. Line, anchored and drag dot strokes do not support pressure */
- pressure = (br->flag & (BRUSH_LINE | BRUSH_ANCHORED | BRUSH_DRAG_DOT)) ? 1.0f : WM_event_tablet_data(event, &stroke->pen_flip, NULL);
+ pressure = (
+ (br->flag & (BRUSH_LINE | BRUSH_ANCHORED | BRUSH_DRAG_DOT)) ?
+ 1.0f : WM_event_tablet_data(event, &stroke->pen_flip, NULL));
paint_stroke_add_sample(p, stroke, event->mval[0], event->mval[1], pressure);
paint_stroke_sample_average(stroke, &sample_average);
diff --git a/source/blender/editors/sculpt_paint/paint_utils.c b/source/blender/editors/sculpt_paint/paint_utils.c
index 99b319f422a..697ffc32759 100644
--- a/source/blender/editors/sculpt_paint/paint_utils.c
+++ b/source/blender/editors/sculpt_paint/paint_utils.c
@@ -87,12 +87,13 @@
/* Convert the object-space axis-aligned bounding box (expressed as
* its minimum and maximum corners) into a screen-space rectangle,
* returns zero if the result is empty */
-bool paint_convert_bb_to_rect(rcti *rect,
- const float bb_min[3],
- const float bb_max[3],
- const ARegion *ar,
- RegionView3D *rv3d,
- Object *ob)
+bool paint_convert_bb_to_rect(
+ rcti *rect,
+ const float bb_min[3],
+ const float bb_max[3],
+ const ARegion *ar,
+ RegionView3D *rv3d,
+ Object *ob)
{
float projection_mat[4][4];
int i, j, k;
@@ -133,10 +134,11 @@ bool paint_convert_bb_to_rect(rcti *rect,
/* 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 ARegion *ar,
- Object *ob,
- const rcti *screen_rect)
+void paint_calc_redraw_planes(
+ float planes[4][4],
+ const ARegion *ar,
+ Object *ob,
+ const rcti *screen_rect)
{
BoundBox bb;
rcti rect;
@@ -152,8 +154,9 @@ void paint_calc_redraw_planes(float planes[4][4],
negate_m4(planes);
}
-float paint_calc_object_space_radius(ViewContext *vc, const float center[3],
- float pixel_radius)
+float paint_calc_object_space_radius(
+ ViewContext *vc, const float center[3],
+ float pixel_radius)
{
Object *ob = vc->obact;
float delta[3], scale, loc[3];
@@ -182,7 +185,9 @@ float paint_get_tex_pixel(const MTex *mtex, float u, float v, struct ImagePool *
return intensity;
}
-void paint_get_tex_pixel_col(const MTex *mtex, float u, float v, float rgba[4], struct ImagePool *pool, int thread, bool convert_to_linear, struct ColorSpace *colorspace)
+void paint_get_tex_pixel_col(
+ const MTex *mtex, float u, float v, float rgba[4], struct ImagePool *pool,
+ int thread, bool convert_to_linear, struct ColorSpace *colorspace)
{
float co[3] = {u, v, 0.0f};
int hasrgb;
@@ -238,9 +243,10 @@ static void imapaint_project(float matrix[4][4], const float co[3], float pco[4]
mul_m4_v4(matrix, pco);
}
-static void imapaint_tri_weights(float matrix[4][4], GLint view[4],
- const float v1[3], const float v2[3], const float v3[3],
- const float co[2], float w[3])
+static void imapaint_tri_weights(
+ float matrix[4][4], GLint view[4],
+ const float v1[3], const float v2[3], const float v3[3],
+ const float co[2], float w[3])
{
float pv1[4], pv2[4], pv3[4], h[3], divw;
float wmat[3][3], invwmat[3][3];
diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c
index 59a9ee8f0d2..dd03c07a43f 100644
--- a/source/blender/editors/sculpt_paint/paint_vertex.c
+++ b/source/blender/editors/sculpt_paint/paint_vertex.c
@@ -1510,8 +1510,9 @@ static bool wpaint_stroke_test_start(bContext *C, wmOperator *op, const float mo
wpd = MEM_callocN(sizeof(struct WPaintData), "WPaintData");
paint_stroke_set_mode_data(stroke, wpd);
ED_view3d_viewcontext_init(C, &wpd->vc);
- view_angle_limits_init(&wpd->normal_angle_precalc, vp->paint.brush->falloff_angle,
- (vp->paint.brush->flag & BRUSH_FRONTFACE_FALLOFF) != 0);
+ view_angle_limits_init(
+ &wpd->normal_angle_precalc, vp->paint.brush->falloff_angle,
+ (vp->paint.brush->flag & BRUSH_FRONTFACE_FALLOFF) != 0);
wpd->active.index = vgroup_index.active;
wpd->mirror.index = vgroup_index.mirror;
@@ -2512,13 +2513,13 @@ static bool vpaint_stroke_test_start(bContext *C, struct wmOperator *op, const f
vpd = MEM_callocN(sizeof(*vpd), "VPaintData");
paint_stroke_set_mode_data(stroke, vpd);
ED_view3d_viewcontext_init(C, &vpd->vc);
- view_angle_limits_init(&vpd->normal_angle_precalc, vp->paint.brush->falloff_angle,
- (vp->paint.brush->flag & BRUSH_FRONTFACE_FALLOFF) != 0);
+ view_angle_limits_init(
+ &vpd->normal_angle_precalc, vp->paint.brush->falloff_angle,
+ (vp->paint.brush->flag & BRUSH_FRONTFACE_FALLOFF) != 0);
vpd->paintcol = vpaint_get_current_col(scene, vp);
- vpd->is_texbrush = !(brush->vertexpaint_tool == PAINT_BLEND_BLUR) &&
- brush->mtex.tex;
+ vpd->is_texbrush = !(brush->vertexpaint_tool == PAINT_BLEND_BLUR) && brush->mtex.tex;
/* are we painting onto a modified mesh?,
* if not we can skip face map trickiness */
diff --git a/source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c b/source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c
index d19a1d3a189..436f4ac5993 100644
--- a/source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c
+++ b/source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c
@@ -151,8 +151,9 @@ void PAINT_OT_weight_from_bones(wmOperatorType *ot)
/* identifiers */
ot->name = "Weight from Bones";
ot->idname = "PAINT_OT_weight_from_bones";
- ot->description = "Set the weights of the groups matching the attached armature's selected bones, "
- "using the distance between the vertices and the bones";
+ ot->description = (
+ "Set the weights of the groups matching the attached armature's selected bones, "
+ "using the distance between the vertices and the bones");
/* api callbacks */
ot->exec = weight_from_bones_exec;
@@ -643,9 +644,10 @@ static void gradientVertInit__mapFunc(
if (BLI_BITMAP_TEST(grad_data->vert_visit, index) == 0) {
WPGradient_vertStore *vs = &grad_data->vert_cache->elem[index];
- if (ED_view3d_project_float_object(grad_data->ar,
- co, vs->sco,
- V3D_PROJ_TEST_CLIP_BB | V3D_PROJ_TEST_CLIP_NEAR) == V3D_PROJ_RET_OK)
+ if (ED_view3d_project_float_object(
+ grad_data->ar,
+ co, vs->sco,
+ V3D_PROJ_TEST_CLIP_BB | V3D_PROJ_TEST_CLIP_NEAR) == V3D_PROJ_RET_OK)
{
/* ok */
MDeformVert *dv = &me->dvert[index];