diff --git a/source/blender/editors/sculpt_paint/paint_cursor.cc b/source/blender/editors/sculpt_paint/paint_cursor.cc index e247627c98d..c0a1f14fdf0 100644 --- a/source/blender/editors/sculpt_paint/paint_cursor.cc +++ b/source/blender/editors/sculpt_paint/paint_cursor.cc @@ -1350,7 +1350,7 @@ static bool paint_cursor_context_init(bContext *C, copy_v3_fl(pcontext->outline_col, 0.8f); } - const bool is_brush_tool = PAINT_brush_tool_poll(C); + const bool is_brush_tool = blender::ed::sculpt_paint::paint_brush_tool_poll(C); if (!is_brush_tool) { /* Use a default color for tools that are not brushes. */ pcontext->outline_alpha = 0.8f; @@ -1796,7 +1796,7 @@ static void paint_cursor_draw_3d_view_brush_cursor_inactive(PaintCursorContext * pcontext->radius); } - const bool is_brush_tool = PAINT_brush_tool_poll(pcontext->C); + const bool is_brush_tool = paint_brush_tool_poll(pcontext->C); /* Pose brush updates and rotation origins. */ diff --git a/source/blender/editors/sculpt_paint/paint_intern.hh b/source/blender/editors/sculpt_paint/paint_intern.hh index f51874c6c86..e202bd286b1 100644 --- a/source/blender/editors/sculpt_paint/paint_intern.hh +++ b/source/blender/editors/sculpt_paint/paint_intern.hh @@ -27,7 +27,6 @@ struct ImagePool; struct MTex; struct Object; struct Paint; -struct PaintStroke; struct PointerRNA; struct RegionView3D; struct Scene; @@ -42,6 +41,9 @@ struct wmKeyMap; struct wmOperator; struct wmOperatorType; struct VertProjHandle; +namespace blender::ed::sculpt_paint { +struct PaintStroke; +} struct CoNo { float co[3]; @@ -50,6 +52,8 @@ struct CoNo { /* paint_stroke.cc */ +namespace blender::ed::sculpt_paint { + using StrokeGetLocation = bool (*)(bContext *C, float location[3], const float mouse[2], @@ -86,7 +90,6 @@ bool paint_supports_dynamic_size(Brush *br, enum ePaintMode mode); bool paint_supports_dynamic_tex_coords(Brush *br, enum ePaintMode mode); bool paint_supports_smooth_stroke(Brush *br, enum ePaintMode mode); bool paint_supports_texture(enum ePaintMode mode); -bool paint_supports_jitter(enum ePaintMode mode); /** * Called in paint_ops.cc, on each regeneration of key-maps. @@ -103,7 +106,10 @@ float paint_stroke_distance_get(PaintStroke *stroke); void paint_stroke_set_mode_data(PaintStroke *stroke, void *mode_data); bool paint_stroke_started(PaintStroke *stroke); -bool PAINT_brush_tool_poll(bContext *C); +bool paint_brush_tool_poll(bContext *C); + +} // namespace blender::ed::sculpt_paint + /** * Delete overlay cursor textures to preserve memory and invalidate all overlay flags. */ diff --git a/source/blender/editors/sculpt_paint/paint_ops.cc b/source/blender/editors/sculpt_paint/paint_ops.cc index c7216eca0ac..4d49d765210 100644 --- a/source/blender/editors/sculpt_paint/paint_ops.cc +++ b/source/blender/editors/sculpt_paint/paint_ops.cc @@ -1266,7 +1266,7 @@ static bool stencil_control_poll(bContext *C) Paint *paint; Brush *br; - if (!paint_supports_texture(mode)) { + if (!blender::ed::sculpt_paint::paint_supports_texture(mode)) { return false; } diff --git a/source/blender/editors/sculpt_paint/paint_stroke.cc b/source/blender/editors/sculpt_paint/paint_stroke.cc index 016ac13aaa5..f6124c41571 100644 --- a/source/blender/editors/sculpt_paint/paint_stroke.cc +++ b/source/blender/editors/sculpt_paint/paint_stroke.cc @@ -51,6 +51,8 @@ # include "BLI_time_utildefines.h" #endif +namespace blender::ed::sculpt_paint { + struct PaintSample { float mouse[2]; float pressure; @@ -211,7 +213,6 @@ static void paint_draw_line_cursor(bContext *C, int x, int y, void *customdata) static bool paint_tool_require_location(Brush *brush, ePaintMode mode) { - using namespace blender::ed::sculpt_paint; switch (mode) { case PAINT_MODE_SCULPT: if (ELEM(brush->sculpt_tool, @@ -679,7 +680,6 @@ static float paint_space_stroke_spacing(bContext *C, float size_pressure, float spacing_pressure) { - using namespace blender::ed::sculpt_paint; Paint *paint = BKE_paint_get_active_from_context(C); ePaintMode mode = BKE_paintmode_get_active_from_context(C); Brush *brush = BKE_paint_brush(paint); @@ -1035,7 +1035,6 @@ static bool curves_sculpt_brush_uses_spacing(const eBrushCurvesSculptTool tool) bool paint_space_stroke_enabled(Brush *br, ePaintMode mode) { - using namespace blender::ed::sculpt_paint; if ((br->flag & BRUSH_SPACE) == 0) { return false; } @@ -1501,7 +1500,7 @@ int paint_stroke_modal(bContext *C, wmOperator *op, const wmEvent *event, PaintS if (paint_supports_smooth_stroke(br, mode)) { stroke->stroke_cursor = WM_paint_cursor_activate( - SPACE_TYPE_ANY, RGN_TYPE_ANY, PAINT_brush_tool_poll, paint_draw_smooth_cursor, stroke); + SPACE_TYPE_ANY, RGN_TYPE_ANY, paint_brush_tool_poll, paint_draw_smooth_cursor, stroke); } stroke->stroke_init = true; @@ -1527,7 +1526,7 @@ int paint_stroke_modal(bContext *C, wmOperator *op, const wmEvent *event, PaintS if (br->flag & BRUSH_LINE) { stroke->stroke_cursor = WM_paint_cursor_activate( - SPACE_TYPE_ANY, RGN_TYPE_ANY, PAINT_brush_tool_poll, paint_draw_line_cursor, stroke); + SPACE_TYPE_ANY, RGN_TYPE_ANY, paint_brush_tool_poll, paint_draw_line_cursor, stroke); } first_dab = true; @@ -1704,7 +1703,7 @@ bool paint_stroke_started(PaintStroke *stroke) return stroke->stroke_started; } -bool PAINT_brush_tool_poll(bContext *C) +bool paint_brush_tool_poll(bContext *C) { Paint *p = BKE_paint_get_active_from_context(C); Object *ob = CTX_data_active_object(C); @@ -1723,3 +1722,5 @@ bool PAINT_brush_tool_poll(bContext *C) } return false; } + +} // namespace blender::ed::sculpt_paint diff --git a/source/blender/editors/sculpt_paint/sculpt.cc b/source/blender/editors/sculpt_paint/sculpt.cc index 22d5e8e3fc1..1adaaed0c5c 100644 --- a/source/blender/editors/sculpt_paint/sculpt.cc +++ b/source/blender/editors/sculpt_paint/sculpt.cc @@ -3959,7 +3959,7 @@ bool SCULPT_mode_poll_view3d(bContext *C) bool SCULPT_poll(bContext *C) { - return SCULPT_mode_poll(C) && PAINT_brush_tool_poll(C); + return SCULPT_mode_poll(C) && blender::ed::sculpt_paint::paint_brush_tool_poll(C); } static const char *sculpt_tool_name(Sculpt *sd) @@ -5441,6 +5441,8 @@ bool SCULPT_handles_colors_report(SculptSession *ss, ReportList *reports) return false; } +namespace blender::ed::sculpt_paint { + static bool sculpt_stroke_test_start(bContext *C, wmOperator *op, const float mval[2]) { /* Don't start the stroke until `mval` goes over the mesh. @@ -5487,7 +5489,6 @@ static void sculpt_stroke_update_step(bContext *C, PaintStroke *stroke, PointerRNA *itemptr) { - using namespace blender::ed::sculpt_paint; UnifiedPaintSettings *ups = &CTX_data_tool_settings(C)->unified_paint_settings; Sculpt *sd = CTX_data_tool_settings(C)->sculpt; Object *ob = CTX_data_active_object(C); @@ -5574,7 +5575,6 @@ static void sculpt_brush_exit_tex(Sculpt *sd) static void sculpt_stroke_done(const bContext *C, PaintStroke * /*stroke*/) { - using namespace blender::ed::sculpt_paint; Object *ob = CTX_data_active_object(C); SculptSession *ss = ob->sculpt; Sculpt *sd = CTX_data_tool_settings(C)->sculpt; @@ -5809,7 +5809,7 @@ enum { SCULPT_TOPOLOGY_ID_DEFAULT, }; -static void SCULPT_fake_neighbor_init(SculptSession *ss, const float max_dist) +static void fake_neighbor_init(SculptSession *ss, const float max_dist) { const int totvert = SCULPT_vertex_count_get(ss); ss->fake_neighbors.fake_neighbor_index = static_cast( @@ -5821,7 +5821,7 @@ static void SCULPT_fake_neighbor_init(SculptSession *ss, const float max_dist) ss->fake_neighbors.current_max_distance = max_dist; } -static void SCULPT_fake_neighbor_add(SculptSession *ss, PBVHVertRef v_a, PBVHVertRef v_b) +static void fake_neighbor_add(SculptSession *ss, PBVHVertRef v_a, PBVHVertRef v_b) { int v_index_a = BKE_pbvh_vertex_to_index(ss->pbvh, v_a); int v_index_b = BKE_pbvh_vertex_to_index(ss->pbvh, v_b); @@ -5869,8 +5869,6 @@ static void do_fake_neighbor_search_task(SculptSession *ss, static PBVHVertRef fake_neighbor_search(Object *ob, const PBVHVertRef vertex, float max_distance) { - using namespace blender; - using namespace blender::ed::sculpt_paint; SculptSession *ss = ob->sculpt; const float3 center = SCULPT_vertex_co_get(ss, vertex); @@ -5921,6 +5919,8 @@ struct SculptTopologyIDFloodFillData { int next_id; }; +} // namespace blender::ed::sculpt_paint + void SCULPT_boundary_info_ensure(Object *object) { using namespace blender; @@ -5947,6 +5947,7 @@ void SCULPT_boundary_info_ensure(Object *object) void SCULPT_fake_neighbors_ensure(Object *ob, const float max_dist) { + using namespace blender::ed::sculpt_paint; SculptSession *ss = ob->sculpt; const int totvert = SCULPT_vertex_count_get(ss); @@ -5960,7 +5961,7 @@ void SCULPT_fake_neighbors_ensure(Object *ob, const float max_dist) } SCULPT_topology_islands_ensure(ob); - SCULPT_fake_neighbor_init(ss, max_dist); + fake_neighbor_init(ss, max_dist); for (int i = 0; i < totvert; i++) { const PBVHVertRef from_v = BKE_pbvh_index_to_vertex(ss->pbvh, i); @@ -5970,7 +5971,7 @@ void SCULPT_fake_neighbors_ensure(Object *ob, const float max_dist) const PBVHVertRef to_v = fake_neighbor_search(ob, from_v, max_dist); if (to_v.i != PBVH_REF_NONE) { /* Add the fake neighbor if available. */ - SCULPT_fake_neighbor_add(ss, from_v, to_v); + fake_neighbor_add(ss, from_v, to_v); } } } @@ -5992,6 +5993,7 @@ void SCULPT_fake_neighbors_disable(Object *ob) void SCULPT_fake_neighbors_free(Object *ob) { + using namespace blender::ed::sculpt_paint; SculptSession *ss = ob->sculpt; sculpt_pose_fake_neighbors_free(ss); } diff --git a/source/blender/editors/sculpt_paint/sculpt_intern.hh b/source/blender/editors/sculpt_paint/sculpt_intern.hh index 23f6f789f15..2b1f95e0f1c 100644 --- a/source/blender/editors/sculpt_paint/sculpt_intern.hh +++ b/source/blender/editors/sculpt_paint/sculpt_intern.hh @@ -1845,9 +1845,11 @@ void SCULPT_bmesh_topology_rake(Sculpt *sd, /* sculpt_ops.cc */ +namespace blender::ed::sculpt_paint { + void SCULPT_OT_brush_stroke(wmOperatorType *ot); -/* end sculpt_ops.cc */ +} inline bool SCULPT_tool_is_paint(int tool) {