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/sculpt_paint')
-rw-r--r--source/blender/editors/sculpt_paint/paint_cursor.c16
-rw-r--r--source/blender/editors/sculpt_paint/paint_curve.c12
-rw-r--r--source/blender/editors/sculpt_paint/paint_image.c10
-rw-r--r--source/blender/editors/sculpt_paint/paint_image_2d.c12
-rw-r--r--source/blender/editors/sculpt_paint/paint_image_proj.c28
-rw-r--r--source/blender/editors/sculpt_paint/paint_ops.c4
-rw-r--r--source/blender/editors/sculpt_paint/paint_stroke.c16
-rw-r--r--source/blender/editors/sculpt_paint/paint_vertex.c18
-rw-r--r--source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c2
-rw-r--r--source/blender/editors/sculpt_paint/sculpt.c14
-rw-r--r--source/blender/editors/sculpt_paint/sculpt_undo.c13
-rw-r--r--source/blender/editors/sculpt_paint/sculpt_uv.c2
12 files changed, 76 insertions, 71 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_cursor.c b/source/blender/editors/sculpt_paint/paint_cursor.c
index f503ab37230..90066a20e88 100644
--- a/source/blender/editors/sculpt_paint/paint_cursor.c
+++ b/source/blender/editors/sculpt_paint/paint_cursor.c
@@ -259,8 +259,8 @@ static int load_tex(Brush *br, ViewContext *vc, float zoom, bool col, bool prima
bool refresh;
eOverlayControlFlags invalid = (
(primary) ?
- (overlay_flags & PAINT_INVALID_OVERLAY_TEXTURE_PRIMARY) :
- (overlay_flags & PAINT_INVALID_OVERLAY_TEXTURE_SECONDARY));
+ (overlay_flags & PAINT_OVERLAY_INVALID_TEXTURE_PRIMARY) :
+ (overlay_flags & PAINT_OVERLAY_INVALID_TEXTURE_SECONDARY));
target = (primary) ? &primary_snap : &secondary_snap;
refresh =
@@ -414,7 +414,7 @@ static int load_tex_cursor(Brush *br, ViewContext *vc, float zoom)
int size;
const bool refresh =
!cursor_snap.overlay_texture ||
- (overlay_flags & PAINT_INVALID_OVERLAY_CURVE) ||
+ (overlay_flags & PAINT_OVERLAY_INVALID_CURVE) ||
cursor_snap.zoom != zoom;
init = (cursor_snap.overlay_texture != 0);
@@ -489,7 +489,7 @@ static int load_tex_cursor(Brush *br, ViewContext *vc, float zoom)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER);
- BKE_paint_reset_overlay_invalid(PAINT_INVALID_OVERLAY_CURVE);
+ BKE_paint_reset_overlay_invalid(PAINT_OVERLAY_INVALID_CURVE);
return 1;
}
@@ -788,7 +788,7 @@ static void paint_draw_alpha_overlay(
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;
+ bool col = ELEM(mode, PAINT_MODE_TEXTURE_3D, PAINT_MODE_TEXTURE_2D, PAINT_MODE_VERTEX) ? true : false;
eOverlayControlFlags flags = BKE_paint_get_overlay_flags();
/* save lots of GL state
* TODO: check on whether all of these are needed? */
@@ -814,7 +814,7 @@ static void paint_draw_alpha_overlay(
paint_draw_cursor_overlay(ups, brush, vc, x, y, zoom);
}
else {
- if (!(flags & PAINT_OVERLAY_OVERRIDE_PRIMARY) && (mode != ePaintWeight))
+ if (!(flags & PAINT_OVERLAY_OVERRIDE_PRIMARY) && (mode != PAINT_MODE_WEIGHT))
paint_draw_tex_overlay(ups, brush, vc, x, y, zoom, false, true);
if (!(flags & PAINT_OVERLAY_OVERRIDE_CURSOR))
paint_draw_cursor_overlay(ups, brush, vc, x, y, zoom);
@@ -990,7 +990,7 @@ static void paint_cursor_on_hit(
static bool ommit_cursor_drawing(Paint *paint, ePaintMode mode, Brush *brush)
{
if (paint->flags & PAINT_SHOW_BRUSH) {
- if (ELEM(mode, ePaintTexture2D, ePaintTextureProjective) && brush->imagepaint_tool == PAINT_TOOL_FILL) {
+ if (ELEM(mode, PAINT_MODE_TEXTURE_2D, PAINT_MODE_TEXTURE_3D) && brush->imagepaint_tool == PAINT_TOOL_FILL) {
return true;
}
return false;
@@ -1050,7 +1050,7 @@ static void paint_draw_cursor(bContext *C, int x, int y, void *UNUSED(unused))
/* TODO: as sculpt and other paint modes are unified, this
* special mode of drawing will go away */
- if ((mode == ePaintSculpt) && vc.obact->sculpt) {
+ if ((mode == PAINT_MODE_SCULPT) && vc.obact->sculpt) {
float location[3];
int pixel_radius;
bool hit;
diff --git a/source/blender/editors/sculpt_paint/paint_curve.c b/source/blender/editors/sculpt_paint/paint_curve.c
index 0e56a1187e3..55912733dc2 100644
--- a/source/blender/editors/sculpt_paint/paint_curve.c
+++ b/source/blender/editors/sculpt_paint/paint_curve.c
@@ -658,17 +658,17 @@ static int paintcurve_draw_exec(bContext *C, wmOperator *UNUSED(op))
const char *name;
switch (mode) {
- case ePaintTexture2D:
- case ePaintTextureProjective:
+ case PAINT_MODE_TEXTURE_2D:
+ case PAINT_MODE_TEXTURE_3D:
name = "PAINT_OT_image_paint";
break;
- case ePaintWeight:
+ case PAINT_MODE_WEIGHT:
name = "PAINT_OT_weight_paint";
break;
- case ePaintVertex:
+ case PAINT_MODE_VERTEX:
name = "PAINT_OT_vertex_paint";
break;
- case ePaintSculpt:
+ case PAINT_MODE_SCULPT:
name = "SCULPT_OT_brush_stroke";
break;
default:
@@ -698,7 +698,7 @@ static int paintcurve_cursor_invoke(bContext *C, wmOperator *UNUSED(op), const w
ePaintMode mode = BKE_paintmode_get_active_from_context(C);
switch (mode) {
- case ePaintTexture2D:
+ case PAINT_MODE_TEXTURE_2D:
{
ARegion *ar = CTX_wm_region(C);
SpaceImage *sima = CTX_wm_space_image(C);
diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c
index ab04a927573..59a5a87626c 100644
--- a/source/blender/editors/sculpt_paint/paint_image.c
+++ b/source/blender/editors/sculpt_paint/paint_image.c
@@ -729,7 +729,7 @@ void ED_space_image_paint_update(Main *bmain, wmWindowManager *wm, Scene *scene)
enabled = true;
if (enabled) {
- BKE_paint_init(bmain, scene, ePaintTexture2D, PAINT_CURSOR_TEXTURE_PAINT);
+ BKE_paint_init(bmain, scene, PAINT_MODE_TEXTURE_2D, PAINT_CURSOR_TEXTURE_PAINT);
paint_cursor_start_explicit(&imapaint->paint, wm, image_paint_poll);
}
@@ -878,7 +878,7 @@ static int sample_color_exec(bContext *C, wmOperator *op)
RNA_int_get_array(op->ptr, "location", location);
const bool use_palette = RNA_boolean_get(op->ptr, "palette");
- const bool use_sample_texture = (mode == ePaintTextureProjective) && !RNA_boolean_get(op->ptr, "merged");
+ const bool use_sample_texture = (mode == PAINT_MODE_TEXTURE_3D) && !RNA_boolean_get(op->ptr, "merged");
paint_sample_color(C, ar, location[0], location[1], use_sample_texture, use_palette);
@@ -918,7 +918,7 @@ static int sample_color_invoke(bContext *C, wmOperator *op, const wmEvent *event
RNA_int_set_array(op->ptr, "location", event->mval);
ePaintMode mode = BKE_paintmode_get_active_from_context(C);
- const bool use_sample_texture = (mode == ePaintTextureProjective) && !RNA_boolean_get(op->ptr, "merged");
+ const bool use_sample_texture = (mode == PAINT_MODE_TEXTURE_3D) && !RNA_boolean_get(op->ptr, "merged");
paint_sample_color(C, ar, event->mval[0], event->mval[1], use_sample_texture, false);
WM_cursor_modal_set(win, BC_EYEDROPPER_CURSOR);
@@ -954,7 +954,7 @@ static int sample_color_modal(bContext *C, wmOperator *op, const wmEvent *event)
}
ePaintMode mode = BKE_paintmode_get_active_from_context(C);
- const bool use_sample_texture = (mode == ePaintTextureProjective) && !RNA_boolean_get(op->ptr, "merged");
+ const bool use_sample_texture = (mode == PAINT_MODE_TEXTURE_3D) && !RNA_boolean_get(op->ptr, "merged");
switch (event->type) {
case MOUSEMOVE:
@@ -1093,7 +1093,7 @@ static int texture_paint_toggle_exec(bContext *C, wmOperator *op)
ob->mode |= mode_flag;
- BKE_paint_init(bmain, scene, ePaintTextureProjective, PAINT_CURSOR_TEXTURE_PAINT);
+ BKE_paint_init(bmain, scene, PAINT_MODE_TEXTURE_3D, PAINT_CURSOR_TEXTURE_PAINT);
if (U.glreslimit != 0)
GPU_free_images(bmain);
diff --git a/source/blender/editors/sculpt_paint/paint_image_2d.c b/source/blender/editors/sculpt_paint/paint_image_2d.c
index 76190b13b61..c5bd88d8047 100644
--- a/source/blender/editors/sculpt_paint/paint_image_2d.c
+++ b/source/blender/editors/sculpt_paint/paint_image_2d.c
@@ -409,7 +409,7 @@ static ImBuf *brush_painter_imbuf_new(BrushPainter *painter, int size, float pre
if (is_texbrush) {
brush_imbuf_tex_co(&tex_mapping, x, y, texco);
- BKE_brush_sample_tex_3D(scene, brush, texco, rgba, thread, pool);
+ BKE_brush_sample_tex_3d(scene, brush, texco, rgba, thread, pool);
/* TODO(sergey): Support texture paint color space. */
if (!use_float) {
IMB_colormanagement_scene_linear_to_display_v3(rgba, display);
@@ -484,7 +484,7 @@ static void brush_painter_imbuf_update(
if (!use_texture_old) {
if (is_texbrush) {
brush_imbuf_tex_co(&tex_mapping, x, y, texco);
- BKE_brush_sample_tex_3D(scene, brush, texco, rgba, thread, pool);
+ BKE_brush_sample_tex_3d(scene, brush, texco, rgba, thread, pool);
/* TODO(sergey): Support texture paint color space. */
if (!use_float) {
IMB_colormanagement_scene_linear_to_display_v3(rgba, display);
@@ -700,7 +700,7 @@ static void brush_painter_2d_refresh_cache(ImagePaintState *s, BrushPainter *pai
do_partial_update_mask = true;
renew_maxmask = true;
}
- /* explicilty disable partial update even if it has been enabled above */
+ /* explicitly disable partial update even if it has been enabled above */
if (brush->mask_pressure) {
do_partial_update_mask = false;
renew_maxmask = true;
@@ -1419,8 +1419,9 @@ static void paint_2d_fill_add_pixel_byte(
float color_f[4];
unsigned char *color_b = (unsigned char *)(ibuf->rect + coordinate);
rgba_uchar_to_float(color_f, color_b);
+ straight_to_premul_v4(color_f);
- if (compare_len_squared_v3v3(color_f, color, threshold_sq)) {
+ if (compare_len_squared_v4v4(color_f, color, threshold_sq)) {
BLI_stack_push(stack, &coordinate);
}
BLI_BITMAP_SET(touched, coordinate, true);
@@ -1439,7 +1440,7 @@ static void paint_2d_fill_add_pixel_float(
coordinate = ((size_t)y_px) * ibuf->x + x_px;
if (!BLI_BITMAP_TEST(touched, coordinate)) {
- if (compare_len_squared_v3v3(ibuf->rect_float + 4 * coordinate, color, threshold_sq)) {
+ if (compare_len_squared_v4v4(ibuf->rect_float + 4 * coordinate, color, threshold_sq)) {
BLI_stack_push(stack, &coordinate);
}
BLI_BITMAP_SET(touched, coordinate, true);
@@ -1546,6 +1547,7 @@ void paint_2d_bucket_fill(
else {
int pixel_color_b = *(ibuf->rect + coordinate);
rgba_uchar_to_float(pixel_color, (unsigned char *)&pixel_color_b);
+ straight_to_premul_v4(pixel_color);
}
BLI_stack_push(stack, &coordinate);
diff --git a/source/blender/editors/sculpt_paint/paint_image_proj.c b/source/blender/editors/sculpt_paint/paint_image_proj.c
index 6b13decd41b..bfde868c241 100644
--- a/source/blender/editors/sculpt_paint/paint_image_proj.c
+++ b/source/blender/editors/sculpt_paint/paint_image_proj.c
@@ -183,7 +183,7 @@ BLI_INLINE unsigned char f_to_char(const float val)
#define PROJ_VERT_CULL 1
/* to avoid locking in tile initialization */
-#define TILE_PENDING SET_INT_IN_POINTER(-1)
+#define TILE_PENDING POINTER_FROM_INT(-1)
/* This is mainly a convenience struct used so we can keep an array of images we use -
* their imbufs, etc, in 1 array, When using threads this array is copied for each thread
@@ -566,7 +566,7 @@ static float VecZDepthPersp(
}
else /* dummy values for zero area face */
w_tmp[0] = w_tmp[1] = w_tmp[2] = 1.0f / 3.0f;
- /* done mimicing barycentric_weights_v2() */
+ /* done mimicking barycentric_weights_v2() */
return (v1[2] * w_tmp[0]) + (v2[2] * w_tmp[1]) + (v3[2] * w_tmp[2]);
}
@@ -593,7 +593,7 @@ static int project_paint_PickFace(
* that the point its testing is only every originated from an existing face */
for (node = ps->bucketFaces[bucket_index]; node; node = node->next) {
- const int tri_index = GET_INT_FROM_POINTER(node->link);
+ const int tri_index = POINTER_AS_INT(node->link);
const MLoopTri *lt = &ps->dm_mlooptri[tri_index];
const float *vtri_ss[3] = {
ps->screenCoords[ps->dm_mloop[lt->tri[0]].v],
@@ -807,7 +807,7 @@ static bool project_bucket_point_occluded(
* that the point its testing is only every originated from an existing face */
for (; bucketFace; bucketFace = bucketFace->next) {
- const int tri_index = GET_INT_FROM_POINTER(bucketFace->link);
+ const int tri_index = POINTER_AS_INT(bucketFace->link);
if (orig_face != tri_index) {
const MLoopTri *lt = &ps->dm_mlooptri[tri_index];
@@ -1028,7 +1028,7 @@ static bool check_seam(
int i1_fidx = -1, i2_fidx = -1; /* index in face */
for (node = ps->vertFaces[i1]; node; node = node->next) {
- const int tri_index = GET_INT_FROM_POINTER(node->link);
+ const int tri_index = POINTER_AS_INT(node->link);
if (tri_index != orig_face) {
const MLoopTri *lt = &ps->dm_mlooptri[tri_index];
@@ -1690,7 +1690,7 @@ static ProjPixel *project_paint_uvpixel_init(
if (ibuf->rect_float) projPixel->pixel.f_pt[0] = 0;
else projPixel->pixel.ch_pt[0] = 0;
#endif
- /* pointer arithmetics */
+ /* pointer arithmetic */
projPixel->image_index = projima - ps->projImages;
return projPixel;
@@ -2582,7 +2582,7 @@ static void project_paint_face_init(
v2coSS = ps->screenCoords[lt_vtri[1]];
v3coSS = ps->screenCoords[lt_vtri[2]];
- /* This funtion gives is a concave polyline in UV space from the clipped tri*/
+ /* This function gives is a concave polyline in UV space from the clipped tri*/
project_bucket_clip_face(
is_ortho, is_flip_object,
clip_rect, bucket_bounds,
@@ -2627,7 +2627,7 @@ static void project_paint_face_init(
//uv[0] = (((float)x) + 0.5f) / ibuf->x;
uv[0] = (float)x / ibuf_xf; /* use pixel offset UV coords instead */
- /* Note about IsectPoly2Df_twoside, checking the face or uv flipping doesnt work,
+ /* Note about IsectPoly2Df_twoside, checking the face or uv flipping doesn't work,
* could check the poly direction but better to do this */
if ((do_backfacecull == true && IsectPoly2Df(uv, uv_clip, uv_clip_tot)) ||
(do_backfacecull == false && IsectPoly2Df_twoside(uv, uv_clip, uv_clip_tot)))
@@ -2720,7 +2720,7 @@ static void project_paint_face_init(
/* Now create new UV's for the seam face */
float (*outset_uv)[2] = ps->faceSeamUVs[tri_index];
- float insetCos[3][3]; /* inset face coords. NOTE!!! ScreenSace for ortho, Worldspace in prespective view */
+ float insetCos[3][3]; /* inset face coords. NOTE!!! ScreenSace for ortho, Worldspace in perspective view */
const float *vCoSS[3]; /* vertex screenspace coords */
@@ -2937,7 +2937,7 @@ static void project_bucket_init(
for (node = ps->bucketFaces[bucket_index]; node; node = node->next) {
project_paint_face_init(
- ps, thread_index, bucket_index, GET_INT_FROM_POINTER(node->link), 0,
+ ps, thread_index, bucket_index, POINTER_AS_INT(node->link), 0,
clip_rect, bucket_bounds, ibuf, &tmpibuf,
(ima->tpageflag & IMA_CLAMP_U) != 0, (ima->tpageflag & IMA_CLAMP_V) != 0);
}
@@ -2946,7 +2946,7 @@ static void project_bucket_init(
/* More complicated loop, switch between images */
for (node = ps->bucketFaces[bucket_index]; node; node = node->next) {
- tri_index = GET_INT_FROM_POINTER(node->link);
+ tri_index = POINTER_AS_INT(node->link);
/* Image context switching */
tpage = project_paint_face_paint_image(ps, tri_index);
@@ -3057,7 +3057,7 @@ static void project_paint_delayed_face_init(ProjPaintState *ps, const MLoopTri *
int bucket_index = bucket_x + (bucket_y * ps->buckets_x);
BLI_linklist_prepend_arena(
&ps->bucketFaces[bucket_index],
- SET_INT_IN_POINTER(tri_index), /* cast to a pointer to shut up the compiler */
+ POINTER_FROM_INT(tri_index), /* cast to a pointer to shut up the compiler */
arena
);
@@ -3415,7 +3415,7 @@ static void project_paint_bleed_add_face_user(
/* annoying but we need to add all faces even ones we never use elsewhere */
if (ps->seam_bleed_px > 0.0f) {
const int lt_vtri[3] = { PS_LOOPTRI_AS_VERT_INDEX_3(ps, lt) };
- void *tri_index_p = SET_INT_IN_POINTER(tri_index);
+ void *tri_index_p = POINTER_FROM_INT(tri_index);
BLI_linklist_prepend_arena(&ps->vertFaces[lt_vtri[0]], tri_index_p, arena);
BLI_linklist_prepend_arena(&ps->vertFaces[lt_vtri[1]], tri_index_p, arena);
BLI_linklist_prepend_arena(&ps->vertFaces[lt_vtri[2]], tri_index_p, arena);
@@ -4758,7 +4758,7 @@ static void *do_projectpaint_thread(void *ph_v)
}
/* note, for clone and smear, we only use the alpha, could be a special function */
- BKE_brush_sample_tex_3D(ps->scene, brush, samplecos, texrgba, thread_index, pool);
+ BKE_brush_sample_tex_3d(ps->scene, brush, samplecos, texrgba, thread_index, pool);
copy_v3_v3(texrgb, texrgba);
mask *= texrgba[3];
diff --git a/source/blender/editors/sculpt_paint/paint_ops.c b/source/blender/editors/sculpt_paint/paint_ops.c
index 74984d090f8..5a7dd0d5f2e 100644
--- a/source/blender/editors/sculpt_paint/paint_ops.c
+++ b/source/blender/editors/sculpt_paint/paint_ops.c
@@ -205,11 +205,11 @@ static int palette_color_add_exec(bContext *C, wmOperator *UNUSED(op))
color = BKE_palette_color_add(palette);
palette->active_color = BLI_listbase_count(&palette->colors) - 1;
- if (ELEM(mode, ePaintTextureProjective, ePaintTexture2D, ePaintVertex)) {
+ if (ELEM(mode, PAINT_MODE_TEXTURE_3D, PAINT_MODE_TEXTURE_2D, PAINT_MODE_VERTEX)) {
copy_v3_v3(color->rgb, BKE_brush_color_get(scene, brush));
color->value = 0.0;
}
- else if (mode == ePaintWeight) {
+ else if (mode == PAINT_MODE_WEIGHT) {
zero_v3(color->rgb);
color->value = brush->weight;
}
diff --git a/source/blender/editors/sculpt_paint/paint_stroke.c b/source/blender/editors/sculpt_paint/paint_stroke.c
index de804677de9..1bfa0bef2f2 100644
--- a/source/blender/editors/sculpt_paint/paint_stroke.c
+++ b/source/blender/editors/sculpt_paint/paint_stroke.c
@@ -197,7 +197,7 @@ static void paint_draw_line_cursor(bContext *C, int x, int y, void *customdata)
static bool paint_tool_require_location(Brush *brush, ePaintMode mode)
{
switch (mode) {
- case ePaintSculpt:
+ case PAINT_MODE_SCULPT:
if (ELEM(brush->sculpt_tool,
SCULPT_TOOL_GRAB, SCULPT_TOOL_ROTATE,
SCULPT_TOOL_SNAKE_HOOK, SCULPT_TOOL_THUMB))
@@ -426,7 +426,7 @@ static bool paint_stroke_use_jitter(ePaintMode mode, Brush *brush, bool invert)
/* jitter-ed brush gives weird and unpredictable result for this
* kinds of stroke, so manually disable jitter usage (sergey) */
use_jitter &= (brush->flag & (BRUSH_DRAG_DOT | BRUSH_ANCHORED)) == 0;
- use_jitter &= (!ELEM(mode, ePaintTexture2D, ePaintTextureProjective) ||
+ use_jitter &= (!ELEM(mode, PAINT_MODE_TEXTURE_2D, PAINT_MODE_TEXTURE_3D) ||
!(invert && brush->imagepaint_tool == PAINT_TOOL_CLONE));
@@ -819,13 +819,13 @@ bool paint_supports_dynamic_size(Brush *br, ePaintMode mode)
return false;
switch (mode) {
- case ePaintSculpt:
+ case PAINT_MODE_SCULPT:
if (sculpt_is_grab_tool(br))
return false;
break;
- case ePaintTexture2D: /* fall through */
- case ePaintTextureProjective:
+ case PAINT_MODE_TEXTURE_2D: /* fall through */
+ case PAINT_MODE_TEXTURE_3D:
if ((br->imagepaint_tool == PAINT_TOOL_FILL) &&
(br->flag & BRUSH_USE_GRADIENT))
{
@@ -848,7 +848,7 @@ bool paint_supports_smooth_stroke(Brush *br, ePaintMode mode)
}
switch (mode) {
- case ePaintSculpt:
+ case PAINT_MODE_SCULPT:
if (sculpt_is_grab_tool(br))
return false;
break;
@@ -861,7 +861,7 @@ bool paint_supports_smooth_stroke(Brush *br, ePaintMode mode)
bool paint_supports_texture(ePaintMode mode)
{
/* omit: PAINT_WEIGHT, PAINT_SCULPT_UV, PAINT_INVALID */
- return ELEM(mode, ePaintSculpt, ePaintVertex, ePaintTextureProjective, ePaintTexture2D);
+ return ELEM(mode, PAINT_MODE_SCULPT, PAINT_MODE_VERTEX, PAINT_MODE_TEXTURE_3D, PAINT_MODE_TEXTURE_2D);
}
/* return true if the brush size can change during paint (normally used for pressure) */
@@ -871,7 +871,7 @@ bool paint_supports_dynamic_tex_coords(Brush *br, ePaintMode mode)
return false;
switch (mode) {
- case ePaintSculpt:
+ case PAINT_MODE_SCULPT:
if (sculpt_is_grab_tool(br))
return false;
break;
diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c
index e1d8cfc3221..eb96425ee5b 100644
--- a/source/blender/editors/sculpt_paint/paint_vertex.c
+++ b/source/blender/editors/sculpt_paint/paint_vertex.c
@@ -317,7 +317,7 @@ static void tex_color_alpha(
const Brush *brush = BKE_paint_brush(&vp->paint);
BLI_assert(brush->mtex.tex != NULL);
if (brush->mtex.brush_map_mode == MTEX_MAP_MODE_3D) {
- BKE_brush_sample_tex_3D(vc->scene, brush, co, r_rgba, 0, NULL);
+ BKE_brush_sample_tex_3d(vc->scene, brush, co, r_rgba, 0, NULL);
}
else {
float co_ss[2]; /* screenspace */
@@ -327,7 +327,7 @@ static void tex_color_alpha(
V3D_PROJ_TEST_CLIP_BB | V3D_PROJ_TEST_CLIP_NEAR) == V3D_PROJ_RET_OK)
{
const float co_ss_3d[3] = {co_ss[0], co_ss[1], 0.0f}; /* we need a 3rd empty value */
- BKE_brush_sample_tex_3D(vc->scene, brush, co_ss_3d, r_rgba, 0, NULL);
+ BKE_brush_sample_tex_3d(vc->scene, brush, co_ss_3d, r_rgba, 0, NULL);
}
else {
zero_v4(r_rgba);
@@ -1046,7 +1046,7 @@ static void ed_vwpaintmode_enter_generic(
Mesh *me = BKE_mesh_from_object(ob);
if (mode_flag == OB_MODE_VERTEX_PAINT) {
- const ePaintMode paint_mode = ePaintVertex;
+ const ePaintMode paint_mode = PAINT_MODE_VERTEX;
ED_mesh_color_ensure(me, NULL);
if (scene->toolsettings->vpaint == NULL) {
@@ -1058,7 +1058,7 @@ static void ed_vwpaintmode_enter_generic(
BKE_paint_init(bmain, scene, paint_mode, PAINT_CURSOR_VERTEX_PAINT);
}
else if (mode_flag == OB_MODE_WEIGHT_PAINT) {
- const ePaintMode paint_mode = ePaintWeight;
+ const ePaintMode paint_mode = PAINT_MODE_WEIGHT;
if (scene->toolsettings->wpaint == NULL) {
scene->toolsettings->wpaint = new_vpaint();
@@ -1351,7 +1351,7 @@ static void vwpaint_update_cache_variants(bContext *C, VPaint *vp, Object *ob, P
Brush *brush = BKE_paint_brush(&vp->paint);
/* This effects the actual brush radius, so things farther away
- * are compared with a larger radius and vise versa. */
+ * are compared with a larger radius and vice versa. */
if (cache->first_time) {
RNA_float_get_array(ptr, "location", cache->true_location);
}
@@ -1363,7 +1363,7 @@ static void vwpaint_update_cache_variants(bContext *C, VPaint *vp, Object *ob, P
* brush coord/pressure/etc.
* It's more an events design issue, which doesn't split coordinate/pressure/angle
* changing events. We should avoid this after events system re-design */
- if (paint_supports_dynamic_size(brush, ePaintSculpt) || cache->first_time) {
+ if (paint_supports_dynamic_size(brush, PAINT_MODE_SCULPT) || cache->first_time) {
cache->pressure = RNA_float_get(ptr, "pressure");
}
@@ -1379,7 +1379,7 @@ static void vwpaint_update_cache_variants(bContext *C, VPaint *vp, Object *ob, P
}
}
- if (BKE_brush_use_size_pressure(scene, brush) && paint_supports_dynamic_size(brush, ePaintSculpt)) {
+ if (BKE_brush_use_size_pressure(scene, brush) && paint_supports_dynamic_size(brush, PAINT_MODE_SCULPT)) {
cache->radius = cache->initial_radius * cache->pressure;
}
else {
@@ -1673,7 +1673,7 @@ static void do_wpaint_brush_blur_task_cb_ex(
}
weight_final /= total_hit_loops;
- /* Only paint visable verts */
+ /* Only paint visible verts */
do_weight_paint_vertex(
data->vp, data->ob, data->wpi,
v_index, final_alpha, weight_final);
@@ -2394,7 +2394,7 @@ void PAINT_OT_vertex_paint_toggle(wmOperatorType *ot)
* (return OPERATOR_FINISHED also removes handler and operator)
*
* For future:
- * - implement a stroke event (or mousemove with past positons)
+ * - implement a stroke event (or mousemove with past positions)
* - revise whether op->customdata should be added in object, in set_vpaint
*/
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 1a37973cd7d..21965bb30d8 100644
--- a/source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c
+++ b/source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c
@@ -238,7 +238,7 @@ static int weight_sample_invoke(bContext *C, wmOperator *op, const wmEvent *even
}
if (changed) {
- /* not really correct since the brush didnt change, but redraws the toolbar */
+ /* not really correct since the brush didn't change, but redraws the toolbar */
WM_main_add_notifier(NC_BRUSH | NA_EDITED, NULL); /* ts->wpaint->paint.brush */
return OPERATOR_FINISHED;
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index 74baa267b69..80e9aef4a40 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -1212,7 +1212,7 @@ float tex_strength(SculptSession *ss, const Brush *br,
else if (mtex->brush_map_mode == MTEX_MAP_MODE_3D) {
/* Get strength by feeding the vertex
* location directly into a texture */
- avg = BKE_brush_sample_tex_3D(scene, br, point, rgba, 0, ss->tex_pool);
+ avg = BKE_brush_sample_tex_3d(scene, br, point, rgba, 0, ss->tex_pool);
}
else if (ss->texcache) {
float symm_point[3], point_2d[2];
@@ -1253,7 +1253,7 @@ float tex_strength(SculptSession *ss, const Brush *br,
}
else {
const float point_3d[3] = {point_2d[0], point_2d[1], 0.0f};
- avg = BKE_brush_sample_tex_3D(scene, br, point_3d, rgba, 0, ss->tex_pool);
+ avg = BKE_brush_sample_tex_3d(scene, br, point_3d, rgba, 0, ss->tex_pool);
}
}
@@ -4526,7 +4526,7 @@ static void sculpt_update_cache_variants(bContext *C, Sculpt *sd, Object *ob,
* brush coord/pressure/etc.
* It's more an events design issue, which doesn't split coordinate/pressure/angle
* changing events. We should avoid this after events system re-design */
- if (paint_supports_dynamic_size(brush, ePaintSculpt) || cache->first_time) {
+ if (paint_supports_dynamic_size(brush, PAINT_MODE_SCULPT) || cache->first_time) {
cache->pressure = RNA_float_get(ptr, "pressure");
}
@@ -4543,7 +4543,7 @@ static void sculpt_update_cache_variants(bContext *C, Sculpt *sd, Object *ob,
}
}
- if (BKE_brush_use_size_pressure(scene, brush) && paint_supports_dynamic_size(brush, ePaintSculpt)) {
+ if (BKE_brush_use_size_pressure(scene, brush) && paint_supports_dynamic_size(brush, PAINT_MODE_SCULPT)) {
cache->radius = cache->initial_radius * cache->pressure;
}
else {
@@ -4688,7 +4688,7 @@ static float sculpt_raycast_init(
RegionView3D *rv3d = vc->ar->regiondata;
/* TODO: what if the segment is totally clipped? (return == 0) */
- ED_view3d_win_to_segment(vc->ar, vc->v3d, mouse, ray_start, ray_end, true);
+ ED_view3d_win_to_segment_clipped(vc->ar, vc->v3d, mouse, ray_start, ray_end, true);
invert_m4_m4(obimat, ob->obmat);
mul_m4_v3(obimat, ray_start);
@@ -5667,8 +5667,8 @@ void ED_object_sculptmode_enter_ex(
"Object has negative scale, sculpting may be unpredictable");
}
- Paint *paint = BKE_paint_get_active_from_paintmode(scene, ePaintSculpt);
- BKE_paint_init(bmain, scene, ePaintSculpt, PAINT_CURSOR_SCULPT);
+ Paint *paint = BKE_paint_get_active_from_paintmode(scene, PAINT_MODE_SCULPT);
+ BKE_paint_init(bmain, scene, PAINT_MODE_SCULPT, PAINT_CURSOR_SCULPT);
paint_cursor_start_explicit(paint, bmain->wm.first, sculpt_poll_view3d);
diff --git a/source/blender/editors/sculpt_paint/sculpt_undo.c b/source/blender/editors/sculpt_paint/sculpt_undo.c
index bf5ddeb71ff..62e548f661c 100644
--- a/source/blender/editors/sculpt_paint/sculpt_undo.c
+++ b/source/blender/editors/sculpt_paint/sculpt_undo.c
@@ -589,10 +589,9 @@ static void sculpt_undo_restore_list(bContext *C, ListBase *lb)
static void sculpt_undo_free_list(ListBase *lb)
{
- SculptUndoNode *unode;
- int i;
-
- for (unode = lb->first; unode; unode = unode->next) {
+ SculptUndoNode *unode = lb->first;
+ while (unode != NULL) {
+ SculptUndoNode *unode_next = unode->next;
if (unode->co)
MEM_freeN(unode->co);
if (unode->no)
@@ -606,7 +605,7 @@ static void sculpt_undo_free_list(ListBase *lb)
if (unode->vert_hidden)
MEM_freeN(unode->vert_hidden);
if (unode->grid_hidden) {
- for (i = 0; i < unode->totgrid; i++) {
+ for (int i = 0; i < unode->totgrid; i++) {
if (unode->grid_hidden[i])
MEM_freeN(unode->grid_hidden[i]);
}
@@ -627,6 +626,10 @@ static void sculpt_undo_free_list(ListBase *lb)
CustomData_free(&unode->bm_enter_ldata, unode->bm_enter_totloop);
if (unode->bm_enter_totpoly)
CustomData_free(&unode->bm_enter_pdata, unode->bm_enter_totpoly);
+
+ MEM_freeN(unode);
+
+ unode = unode_next;
}
}
diff --git a/source/blender/editors/sculpt_paint/sculpt_uv.c b/source/blender/editors/sculpt_paint/sculpt_uv.c
index 7e30c8b5b23..a1514a65694 100644
--- a/source/blender/editors/sculpt_paint/sculpt_uv.c
+++ b/source/blender/editors/sculpt_paint/sculpt_uv.c
@@ -244,7 +244,7 @@ void ED_space_image_uv_sculpt_update(Main *bmain, wmWindowManager *wm, Scene *sc
settings->uvsculpt->paint.flags |= PAINT_SHOW_BRUSH;
}
- BKE_paint_init(bmain, scene, ePaintSculptUV, PAINT_CURSOR_SCULPT);
+ BKE_paint_init(bmain, scene, PAINT_MODE_SCULPT_UV, PAINT_CURSOR_SCULPT);
settings->uvsculpt->paint.paint_cursor = WM_paint_cursor_activate(
wm, uv_sculpt_brush_poll,