diff options
author | Joseph Eagar <joeedh@gmail.com> | 2022-06-30 09:11:24 +0300 |
---|---|---|
committer | Thomas Dinges <blender@dingto.org> | 2022-07-15 16:02:51 +0300 |
commit | 746e2f02c4cea7aa51a74a3cdc76e1580589f4bf (patch) | |
tree | 76e239a14244bc76fc4ee53a707e13255671f9bd | |
parent | 7e814d155f25250a6e9c4f644de661ec1173ecdb (diff) |
Cleanup: Renamed SCULPT_TOOL_NEEDS_COLOR to SCULPT_tool_is_paint
Old name is confusing since SCULPT_TOOL_PAINT can paint
on images too, and it's planned for smear to as well.
-rw-r--r-- | source/blender/blenkernel/BKE_paint.h | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/paint.c | 6 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/sculpt.c | 14 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/sculpt_intern.h | 5 |
4 files changed, 15 insertions, 12 deletions
diff --git a/source/blender/blenkernel/BKE_paint.h b/source/blender/blenkernel/BKE_paint.h index 0f96c5d1ab8..05cf78179fd 100644 --- a/source/blender/blenkernel/BKE_paint.h +++ b/source/blender/blenkernel/BKE_paint.h @@ -675,7 +675,7 @@ void BKE_sculpt_update_object_for_edit(struct Depsgraph *depsgraph, struct Object *ob_orig, bool need_pmap, bool need_mask, - bool need_colors); + bool is_paint_tool); void BKE_sculpt_update_object_before_eval(const struct Scene *scene, struct Object *ob_eval); void BKE_sculpt_update_object_after_eval(struct Depsgraph *depsgraph, struct Object *ob_eval); diff --git a/source/blender/blenkernel/intern/paint.c b/source/blender/blenkernel/intern/paint.c index 00f362f17a8..dcf8034c0d5 100644 --- a/source/blender/blenkernel/intern/paint.c +++ b/source/blender/blenkernel/intern/paint.c @@ -1610,7 +1610,7 @@ static void sculpt_update_object(Depsgraph *depsgraph, Mesh *me_eval, bool need_pmap, bool need_mask, - bool UNUSED(need_colors)) + bool is_paint_tool) { Scene *scene = DEG_get_input_scene(depsgraph); Sculpt *sd = scene->toolsettings->sculpt; @@ -1903,7 +1903,7 @@ void BKE_sculpt_color_layer_create_if_needed(struct Object *object) } void BKE_sculpt_update_object_for_edit( - Depsgraph *depsgraph, Object *ob_orig, bool need_pmap, bool need_mask, bool need_colors) + Depsgraph *depsgraph, Object *ob_orig, bool need_pmap, bool need_mask, bool is_paint_tool) { BLI_assert(ob_orig == DEG_get_original_object(ob_orig)); @@ -1911,7 +1911,7 @@ void BKE_sculpt_update_object_for_edit( Mesh *me_eval = BKE_object_get_evaluated_mesh(ob_eval); BLI_assert(me_eval != NULL); - sculpt_update_object(depsgraph, ob_orig, me_eval, need_pmap, need_mask, need_colors); + sculpt_update_object(depsgraph, ob_orig, me_eval, need_pmap, need_mask, is_paint_tool); } int BKE_sculpt_mask_layers_ensure(Object *ob, MultiresModifierData *mmd) diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index f41b1e49ed8..f7d1b9bbe29 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -3209,7 +3209,7 @@ static void do_brush_action_task_cb(void *__restrict userdata, SCULPT_undo_push_node(data->ob, data->nodes[n], SCULPT_UNDO_MASK); BKE_pbvh_node_mark_update_mask(data->nodes[n]); } - else if (SCULPT_TOOL_NEEDS_COLOR(data->brush->sculpt_tool)) { + else if (SCULPT_tool_is_paint(data->brush->sculpt_tool)) { SCULPT_undo_push_node(data->ob, data->nodes[n], SCULPT_UNDO_COLOR); BKE_pbvh_node_mark_update_color(data->nodes[n]); } @@ -3232,7 +3232,7 @@ static void do_brush_action(Sculpt *sd, /* Check for unsupported features. */ PBVHType type = BKE_pbvh_type(ss->pbvh); - if (SCULPT_TOOL_NEEDS_COLOR(brush->sculpt_tool) && SCULPT_has_loop_colors(ob)) { + if (SCULPT_tool_is_paint(brush->sculpt_tool) && SCULPT_has_loop_colors(ob)) { if (type != PBVH_FACES) { return; } @@ -4669,8 +4669,8 @@ static bool sculpt_needs_connectivity_info(const Sculpt *sd, (brush->sculpt_tool == SCULPT_TOOL_POSE) || (brush->sculpt_tool == SCULPT_TOOL_BOUNDARY) || (brush->sculpt_tool == SCULPT_TOOL_SLIDE_RELAX) || - SCULPT_TOOL_NEEDS_COLOR(brush->sculpt_tool) || - (brush->sculpt_tool == SCULPT_TOOL_CLOTH) || (brush->sculpt_tool == SCULPT_TOOL_SMEAR) || + SCULPT_tool_is_paint(brush->sculpt_tool) || (brush->sculpt_tool == SCULPT_TOOL_CLOTH) || + (brush->sculpt_tool == SCULPT_TOOL_SMEAR) || (brush->sculpt_tool == SCULPT_TOOL_DRAW_FACE_SETS) || (brush->sculpt_tool == SCULPT_TOOL_DISPLACEMENT_SMEAR) || (brush->sculpt_tool == SCULPT_TOOL_PAINT)); @@ -5046,7 +5046,7 @@ static void sculpt_brush_stroke_init(bContext *C, wmOperator *op) sculpt_brush_init_tex(scene, sd, ss); need_pmap = sculpt_needs_connectivity_info(sd, brush, ss, mode); - needs_colors = SCULPT_TOOL_NEEDS_COLOR(brush->sculpt_tool); + needs_colors = SCULPT_tool_is_paint(brush->sculpt_tool); if (needs_colors) { BKE_sculpt_color_layer_create_if_needed(ob); @@ -5298,7 +5298,7 @@ static bool sculpt_stroke_test_start(bContext *C, struct wmOperator *op, const f /* NOTE: This should be removed when paint mode is available. Paint mode can force based on the * canvas it is painting on. (ref. use_sculpt_texture_paint). */ - if (brush && SCULPT_TOOL_NEEDS_COLOR(brush->sculpt_tool)) { + if (brush && SCULPT_tool_is_paint(brush->sculpt_tool)) { View3D *v3d = CTX_wm_view3d(C); if (v3d->shading.type == OB_SOLID) { v3d->shading.color_type = V3D_SHADING_VERTEX_COLOR; @@ -5482,7 +5482,7 @@ static int sculpt_brush_stroke_invoke(bContext *C, wmOperator *op, const wmEvent Sculpt *sd = CTX_data_tool_settings(C)->sculpt; Brush *brush = BKE_paint_brush(&sd->paint); - if (SCULPT_TOOL_NEEDS_COLOR(brush->sculpt_tool) && + if (SCULPT_tool_is_paint(brush->sculpt_tool) && !SCULPT_handles_colors_report(ob->sculpt, op->reports)) { return OPERATOR_CANCELLED; } diff --git a/source/blender/editors/sculpt_paint/sculpt_intern.h b/source/blender/editors/sculpt_paint/sculpt_intern.h index f9633c91087..628e5680ced 100644 --- a/source/blender/editors/sculpt_paint/sculpt_intern.h +++ b/source/blender/editors/sculpt_paint/sculpt_intern.h @@ -1781,7 +1781,10 @@ void SCULPT_OT_brush_stroke(struct wmOperatorType *ot); /* end sculpt_ops.c */ -#define SCULPT_TOOL_NEEDS_COLOR(tool) ELEM(tool, SCULPT_TOOL_PAINT, SCULPT_TOOL_SMEAR) +BLI_INLINE bool SCULPT_tool_is_paint(int tool) +{ + return ELEM(tool, SCULPT_TOOL_PAINT, SCULPT_TOOL_SMEAR); +} #ifdef __cplusplus } |