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.
This commit is contained in:
parent
3cefa13770
commit
f7c6d3705d
Notes:
blender-bot
2023-02-14 06:23:08 +01:00
Referenced by issue #99196, Regression: Rendering in the viewport is constantly restarted by some sculpting brushes and the position of mouse cursor
|
@ -679,7 +679,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);
|
||||
|
||||
|
|
|
@ -1613,7 +1613,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)
|
||||
|
|
|
@ -3219,7 +3219,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]);
|
||||
}
|
||||
|
@ -3246,7 +3246,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;
|
||||
}
|
||||
|
@ -4693,8 +4693,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));
|
||||
|
@ -5069,7 +5069,7 @@ static void sculpt_brush_stroke_init(bContext *C, wmOperator *op)
|
|||
sculpt_brush_init_tex(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);
|
||||
|
@ -5316,7 +5316,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;
|
||||
|
@ -5501,7 +5501,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;
|
||||
}
|
||||
|
|
|
@ -1805,7 +1805,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
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue