From f61b2714589684d8db98754b9d452e25ffc3246e Mon Sep 17 00:00:00 2001 From: Hans Goudey Date: Wed, 6 Dec 2023 11:45:14 -0500 Subject: [PATCH] Cleanup: Remove unused sculpt functions --- source/blender/blenkernel/BKE_paint.hh | 7 --- source/blender/blenkernel/intern/paint.cc | 25 --------- source/blender/editors/include/ED_sculpt.hh | 2 - source/blender/editors/sculpt_paint/sculpt.cc | 56 ------------------- .../sculpt_paint/sculpt_automasking.cc | 19 ++----- .../sculpt_paint/sculpt_filter_mask.cc | 16 ------ .../editors/sculpt_paint/sculpt_geodesic.cc | 10 ---- .../editors/sculpt_paint/sculpt_intern.hh | 19 ------- .../editors/sculpt_paint/sculpt_undo.cc | 34 ----------- 9 files changed, 5 insertions(+), 183 deletions(-) diff --git a/source/blender/blenkernel/BKE_paint.hh b/source/blender/blenkernel/BKE_paint.hh index 9b8c9e952a3..7402f79c1fb 100644 --- a/source/blender/blenkernel/BKE_paint.hh +++ b/source/blender/blenkernel/BKE_paint.hh @@ -196,7 +196,6 @@ const Brush *BKE_paint_brush_for_read(const Paint *p); void BKE_paint_brush_set(Paint *paint, Brush *br); Palette *BKE_paint_palette(Paint *paint); void BKE_paint_palette_set(Paint *p, Palette *palette); -void BKE_paint_curve_set(Brush *br, PaintCurve *pc); void BKE_paint_curve_clamp_endpoint_add_index(PaintCurve *pc, int add_index); /** @@ -775,11 +774,6 @@ SculptAttribute *BKE_sculpt_attribute_get(Object *ob, eCustomDataType proptype, const char *name); -bool BKE_sculpt_attribute_exists(Object *ob, - eAttrDomain domain, - eCustomDataType proptype, - const char *name); - bool BKE_sculpt_attribute_destroy(Object *ob, SculptAttribute *attr); /* Destroy all attributes and pseudo-attributes created by sculpt mode. */ @@ -874,7 +868,6 @@ PBVH *BKE_sculpt_object_pbvh_ensure(Depsgraph *depsgraph, Object *ob); void BKE_sculpt_bvh_update_from_ccg(PBVH *pbvh, SubdivCCG *subdiv_ccg); -void BKE_sculpt_ensure_orig_mesh_data(Scene *scene, Object *object); void BKE_sculpt_sync_face_visibility_to_grids(Mesh *mesh, SubdivCCG *subdiv_ccg); /** diff --git a/source/blender/blenkernel/intern/paint.cc b/source/blender/blenkernel/intern/paint.cc index 228af083d48..2bdedbb73fb 100644 --- a/source/blender/blenkernel/intern/paint.cc +++ b/source/blender/blenkernel/intern/paint.cc @@ -773,15 +773,6 @@ void BKE_paint_palette_set(Paint *p, Palette *palette) } } -void BKE_paint_curve_set(Brush *br, PaintCurve *pc) -{ - if (br) { - id_us_min((ID *)br->paint_curve); - br->paint_curve = pc; - id_us_plus((ID *)br->paint_curve); - } -} - void BKE_paint_curve_clamp_endpoint_add_index(PaintCurve *pc, const int add_index) { pc->add_index = (add_index || pc->tot_points == 1) ? (add_index + 1) : 0; @@ -2601,22 +2592,6 @@ static SculptAttribute *sculpt_get_cached_layer(SculptSession *ss, return nullptr; } -bool BKE_sculpt_attribute_exists(Object *ob, - eAttrDomain domain, - eCustomDataType proptype, - const char *name) -{ - SculptSession *ss = ob->sculpt; - SculptAttribute *attr = sculpt_get_cached_layer(ss, domain, proptype, name); - - if (attr) { - return true; - } - - CustomData *cdata = sculpt_get_cdata(ob, domain); - return CustomData_get_named_layer_index(cdata, proptype, name) != -1; -} - static SculptAttribute *sculpt_alloc_attr(SculptSession *ss) { for (int i = 0; i < SCULPT_MAX_ATTRIBUTES; i++) { diff --git a/source/blender/editors/include/ED_sculpt.hh b/source/blender/editors/include/ED_sculpt.hh index 4e5d5e088e9..8b4a01181f0 100644 --- a/source/blender/editors/include/ED_sculpt.hh +++ b/source/blender/editors/include/ED_sculpt.hh @@ -20,8 +20,6 @@ struct wmKeyConfig; /* sculpt.cc */ void ED_operatortypes_sculpt(); -void ED_sculpt_redraw_planes_get(float planes[4][4], ARegion *region, Object *ob); -bool ED_sculpt_mask_box_select(bContext *C, ViewContext *vc, const rcti *rect, bool select); void ED_keymap_sculpt(wmKeyConfig *keyconf); /* sculpt_transform.cc */ diff --git a/source/blender/editors/sculpt_paint/sculpt.cc b/source/blender/editors/sculpt_paint/sculpt.cc index deea5fd3a19..ec3f0585ec6 100644 --- a/source/blender/editors/sculpt_paint/sculpt.cc +++ b/source/blender/editors/sculpt_paint/sculpt.cc @@ -339,11 +339,6 @@ const float *SCULPT_active_vertex_co_get(SculptSession *ss) return SCULPT_vertex_co_get(ss, SCULPT_active_vertex_get(ss)); } -void SCULPT_active_vertex_normal_get(SculptSession *ss, float normal[3]) -{ - SCULPT_vertex_normal_get(ss, SCULPT_active_vertex_get(ss), normal); -} - MutableSpan SCULPT_mesh_deformed_positions_get(SculptSession *ss) { switch (BKE_pbvh_type(ss->pbvh)) { @@ -1648,28 +1643,6 @@ bool SCULPT_get_redraw_rect(ARegion *region, RegionView3D *rv3d, Object *ob, rct return true; } -void ED_sculpt_redraw_planes_get(float planes[4][4], ARegion *region, Object *ob) -{ - PBVH *pbvh = ob->sculpt->pbvh; - /* Copy here, original will be used below. */ - rcti rect = ob->sculpt->cache->current_r; - - sculpt_extend_redraw_rect_previous(ob, &rect); - - paint_calc_redraw_planes(planes, region, ob, &rect); - - /* We will draw this \a rect, so now we can set it as the previous partial \a rect. - * Note that we don't update with the union of previous/current (\a rect), only with - * the current. Thus we avoid the rectangle needlessly growing to include - * all the stroke area. */ - ob->sculpt->cache->previous_r = ob->sculpt->cache->current_r; - - /* Clear redraw flag from nodes. */ - if (pbvh) { - BKE_pbvh_update_bounds(pbvh, PBVH_UpdateRedraw); - } -} - /************************ Brush Testing *******************/ void SCULPT_brush_test_init(SculptSession *ss, SculptBrushTest *test) @@ -1723,22 +1696,6 @@ BLI_INLINE bool sculpt_brush_test_clipping(const SculptBrushTest *test, const fl return ED_view3d_clipping_test(rv3d, symm_co, true); } -bool SCULPT_brush_test_sphere(SculptBrushTest *test, const float co[3]) -{ - float distsq = len_squared_v3v3(co, test->location); - - if (distsq > test->radius_squared) { - return false; - } - - if (sculpt_brush_test_clipping(test, co)) { - return false; - } - - test->dist = sqrtf(distsq); - return true; -} - bool SCULPT_brush_test_sphere_sq(SculptBrushTest *test, const float co[3]) { float distsq = len_squared_v3v3(co, test->location); @@ -1753,14 +1710,6 @@ bool SCULPT_brush_test_sphere_sq(SculptBrushTest *test, const float co[3]) return true; } -bool SCULPT_brush_test_sphere_fast(const SculptBrushTest *test, const float co[3]) -{ - if (sculpt_brush_test_clipping(test, co)) { - return false; - } - return len_squared_v3v3(co, test->location) <= test->radius_squared; -} - bool SCULPT_brush_test_circle_sq(SculptBrushTest *test, const float co[3]) { float co_proj[3]; @@ -4145,11 +4094,6 @@ bool SCULPT_mode_poll_view3d(bContext *C) return (SCULPT_mode_poll(C) && CTX_wm_region_view3d(C)); } -bool SCULPT_poll_view3d(bContext *C) -{ - return (SCULPT_poll(C) && CTX_wm_region_view3d(C)); -} - bool SCULPT_poll(bContext *C) { return SCULPT_mode_poll(C) && PAINT_brush_tool_poll(C); diff --git a/source/blender/editors/sculpt_paint/sculpt_automasking.cc b/source/blender/editors/sculpt_paint/sculpt_automasking.cc index 0f92267bac9..5d428649811 100644 --- a/source/blender/editors/sculpt_paint/sculpt_automasking.cc +++ b/source/blender/editors/sculpt_paint/sculpt_automasking.cc @@ -687,9 +687,9 @@ static void sculpt_face_sets_automasking_init(Sculpt *sd, Object *ob) #define EDGE_DISTANCE_INF -1 -static void SCULPT_boundary_automasking_init(Object *ob, - eBoundaryAutomaskMode mode, - int propagation_steps) +static void boundary_automasking_init(Object *ob, + eBoundaryAutomaskMode mode, + int propagation_steps) { SculptSession *ss = ob->sculpt; @@ -945,12 +945,11 @@ AutomaskingCache *SCULPT_automasking_cache_init(Sculpt *sd, Brush *brush, Object if (SCULPT_is_automasking_mode_enabled(sd, brush, BRUSH_AUTOMASKING_BOUNDARY_EDGES)) { SCULPT_vertex_random_access_ensure(ss); - SCULPT_boundary_automasking_init(ob, AUTOMASK_INIT_BOUNDARY_EDGES, boundary_propagation_steps); + boundary_automasking_init(ob, AUTOMASK_INIT_BOUNDARY_EDGES, boundary_propagation_steps); } if (SCULPT_is_automasking_mode_enabled(sd, brush, BRUSH_AUTOMASKING_BOUNDARY_FACE_SETS)) { SCULPT_vertex_random_access_ensure(ss); - SCULPT_boundary_automasking_init( - ob, AUTOMASK_INIT_BOUNDARY_FACE_SETS, boundary_propagation_steps); + boundary_automasking_init(ob, AUTOMASK_INIT_BOUNDARY_FACE_SETS, boundary_propagation_steps); } /* Subtractive modes. */ @@ -963,11 +962,3 @@ AutomaskingCache *SCULPT_automasking_cache_init(Sculpt *sd, Brush *brush, Object return automasking; } - -bool SCULPT_automasking_needs_original(const Sculpt *sd, const Brush *brush) -{ - - return sculpt_automasking_mode_effective_bits(sd, brush) & - (BRUSH_AUTOMASKING_CAVITY_ALL | BRUSH_AUTOMASKING_BRUSH_NORMAL | - BRUSH_AUTOMASKING_VIEW_NORMAL); -} diff --git a/source/blender/editors/sculpt_paint/sculpt_filter_mask.cc b/source/blender/editors/sculpt_paint/sculpt_filter_mask.cc index 6bf12a354e7..28203aad165 100644 --- a/source/blender/editors/sculpt_paint/sculpt_filter_mask.cc +++ b/source/blender/editors/sculpt_paint/sculpt_filter_mask.cc @@ -223,22 +223,6 @@ static int sculpt_mask_filter_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -void SCULPT_mask_filter_smooth_apply(Sculpt * /*sd*/, - Object *ob, - blender::Span nodes, - const int smooth_iterations) -{ - using namespace blender; - const SculptMaskWriteInfo mask_write = SCULPT_mask_get_for_write(ob->sculpt); - for (int i = 0; i < smooth_iterations; i++) { - threading::parallel_for(nodes.index_range(), 1, [&](const IndexRange range) { - for (const int i : range) { - mask_filter_task(ob->sculpt, MASK_FILTER_SMOOTH, nullptr, mask_write, nodes[i]); - } - }); - } -} - void SCULPT_OT_mask_filter(wmOperatorType *ot) { /* Identifiers. */ diff --git a/source/blender/editors/sculpt_paint/sculpt_geodesic.cc b/source/blender/editors/sculpt_paint/sculpt_geodesic.cc index 1d878dfcd0e..9c593daf34b 100644 --- a/source/blender/editors/sculpt_paint/sculpt_geodesic.cc +++ b/source/blender/editors/sculpt_paint/sculpt_geodesic.cc @@ -307,13 +307,3 @@ float *SCULPT_geodesic_from_vertex_and_symm(Sculpt *sd, BLI_gset_free(initial_verts, nullptr); return dists; } - -float *SCULPT_geodesic_from_vertex(Object *ob, const PBVHVertRef vertex, const float limit_radius) -{ - GSet *initial_verts = BLI_gset_int_new("initial_verts"); - BLI_gset_add(initial_verts, - POINTER_FROM_INT(BKE_pbvh_vertex_to_index(ob->sculpt->pbvh, vertex))); - float *dists = SCULPT_geodesic_distances_create(ob, initial_verts, limit_radius); - BLI_gset_free(initial_verts, nullptr); - return dists; -} diff --git a/source/blender/editors/sculpt_paint/sculpt_intern.hh b/source/blender/editors/sculpt_paint/sculpt_intern.hh index 21b7245dff8..707fbb2b663 100644 --- a/source/blender/editors/sculpt_paint/sculpt_intern.hh +++ b/source/blender/editors/sculpt_paint/sculpt_intern.hh @@ -743,7 +743,6 @@ bool SCULPT_mode_poll_view3d(bContext *C); * Checks for a brush, not just sculpt mode. */ bool SCULPT_poll(bContext *C); -bool SCULPT_poll_view3d(bContext *C); /** * Returns true if sculpt session can handle color attributes @@ -872,9 +871,6 @@ inline void SCULPT_mask_vert_set(const PBVHType type, break; } } -void SCULPT_mask_write_array(SculptSession *ss, - blender::Span nodes, - blender::Span mask); /** Ensure random access; required for PBVH_BMESH */ void SCULPT_vertex_random_access_ensure(SculptSession *ss); @@ -955,7 +951,6 @@ void SCULPT_vertex_neighbors_get(SculptSession *ss, PBVHVertRef SCULPT_active_vertex_get(SculptSession *ss); const float *SCULPT_active_vertex_co_get(SculptSession *ss); -void SCULPT_active_vertex_normal_get(SculptSession *ss, float normal[3]); /* Returns PBVH deformed vertices array if shape keys or deform modifiers are used, otherwise * returns mesh original vertices array. */ @@ -1128,9 +1123,7 @@ void SCULPT_flip_quat_by_symm_area(float quat[4], */ void SCULPT_brush_test_init(SculptSession *ss, SculptBrushTest *test); -bool SCULPT_brush_test_sphere(SculptBrushTest *test, const float co[3]); bool SCULPT_brush_test_sphere_sq(SculptBrushTest *test, const float co[3]); -bool SCULPT_brush_test_sphere_fast(const SculptBrushTest *test, const float co[3]); bool SCULPT_brush_test_cube(SculptBrushTest *test, const float co[3], const float local[4][4], @@ -1312,14 +1305,9 @@ void SCULPT_automasking_cache_free(AutomaskingCache *automasking); bool SCULPT_is_automasking_mode_enabled(const Sculpt *sd, const Brush *br, eAutomasking_flag mode); bool SCULPT_is_automasking_enabled(const Sculpt *sd, const SculptSession *ss, const Brush *br); -float *SCULPT_boundary_automasking_init(Object *ob, - eBoundaryAutomaskMode mode, - int propagation_steps, - float *automask_factor); bool SCULPT_automasking_needs_normal(const SculptSession *ss, const Sculpt *sculpt, const Brush *brush); -bool SCULPT_automasking_needs_original(const Sculpt *sd, const Brush *brush); int SCULPT_automasking_settings_hash(Object *ob, AutomaskingCache *automasking); /** \} */ @@ -1339,7 +1327,6 @@ float *SCULPT_geodesic_from_vertex_and_symm(Sculpt *sd, Object *ob, PBVHVertRef vertex, float limit_radius); -float *SCULPT_geodesic_from_vertex(Object *ob, PBVHVertRef vertex, float limit_radius); /** \} */ /* -------------------------------------------------------------------- */ @@ -1356,11 +1343,6 @@ void SCULPT_filter_cache_init(bContext *C, void SCULPT_filter_cache_free(SculptSession *ss); void SCULPT_mesh_filter_properties(wmOperatorType *ot); -void SCULPT_mask_filter_smooth_apply(Sculpt *sd, - Object *ob, - blender::Span nodes, - int smooth_iterations); - /* Filter orientation utils. */ void SCULPT_filter_to_orientation_space(float r_v[3], FilterCache *filter_cache); void SCULPT_filter_to_object_space(float r_v[3], FilterCache *filter_cache); @@ -1511,7 +1493,6 @@ void SCULPT_cache_free(StrokeCache *cache); SculptUndoNode *SCULPT_undo_push_node(Object *ob, PBVHNode *node, SculptUndoType type); SculptUndoNode *SCULPT_undo_get_node(PBVHNode *node, SculptUndoType type); -SculptUndoNode *SCULPT_undo_get_first_node(); /** * Pushes an undo step using the operator name. This is necessary for diff --git a/source/blender/editors/sculpt_paint/sculpt_undo.cc b/source/blender/editors/sculpt_paint/sculpt_undo.cc index a721f393fbd..1910bcabb1e 100644 --- a/source/blender/editors/sculpt_paint/sculpt_undo.cc +++ b/source/blender/editors/sculpt_paint/sculpt_undo.cc @@ -1101,29 +1101,6 @@ static void sculpt_undo_free_list(ListBase *lb) } } -/* Most likely we don't need this. */ -#if 0 -static bool sculpt_undo_cleanup(bContext *C, ListBase *lb) -{ - Scene *scene = CTX_data_scene(C); - ViewLayer *view_layer = CTX_data_view_layer(C); - Object *ob = BKE_view_layer_active_object_get(view_layer); - SculptUndoNode *unode; - - unode = lb->first; - - if (unode && !STREQ(unode->idname, ob->id.name)) { - if (unode->bm_entry) { - BM_log_cleanup_entry(unode->bm_entry); - } - - return true; - } - - return false; -} -#endif - SculptUndoNode *SCULPT_undo_get_node(PBVHNode *node, SculptUndoType type) { UndoSculpt *usculpt = sculpt_undo_get_nodes(); @@ -1141,17 +1118,6 @@ SculptUndoNode *SCULPT_undo_get_node(PBVHNode *node, SculptUndoType type) return nullptr; } -SculptUndoNode *SCULPT_undo_get_first_node() -{ - UndoSculpt *usculpt = sculpt_undo_get_nodes(); - - if (usculpt == nullptr) { - return nullptr; - } - - return static_cast(usculpt->nodes.first); -} - static size_t sculpt_undo_alloc_and_store_hidden(SculptSession *ss, SculptUndoNode *unode) { PBVHNode *node = static_cast(unode->node);