From c8aecac0013195cd2fc6d0da9ccfc57fb394fac6 Mon Sep 17 00:00:00 2001 From: Hans Goudey Date: Thu, 14 Dec 2023 18:25:20 -0500 Subject: [PATCH] Cleanup: Remove unused sculpt code Remove abstract edge and face types. The design is to not abstract away the code data structures like this and focus on sharing code more with the rest of Blender rather than within sculpt mode. --- source/blender/blenkernel/BKE_paint.hh | 21 -------- source/blender/blenkernel/BKE_pbvh.hh | 14 ----- source/blender/blenkernel/BKE_pbvh_api.hh | 52 ------------------- .../editors/sculpt_paint/sculpt_intern.hh | 1 - .../editors/sculpt_paint/sculpt_undo.cc | 6 --- 5 files changed, 94 deletions(-) diff --git a/source/blender/blenkernel/BKE_paint.hh b/source/blender/blenkernel/BKE_paint.hh index 43451f9c750..59e12247d89 100644 --- a/source/blender/blenkernel/BKE_paint.hh +++ b/source/blender/blenkernel/BKE_paint.hh @@ -809,27 +809,6 @@ BLI_INLINE void *BKE_sculpt_vertex_attr_get(const PBVHVertRef vertex, const Scul return NULL; } -BLI_INLINE void *BKE_sculpt_face_attr_get(const PBVHFaceRef vertex, const SculptAttribute *attr) -{ - if (attr->data) { - char *p = (char *)attr->data; - int idx = (int)vertex.i; - - if (attr->data_for_bmesh) { - BMElem *v = (BMElem *)vertex.i; - idx = v->head.index; - } - - return p + attr->elem_size * (int)idx; - } - else { - BMElem *v = (BMElem *)vertex.i; - return BM_ELEM_CD_GET_VOID_P(v, attr->bmesh_cd_offset); - } - - return NULL; -} - /** * Create new color layer on object if it doesn't have one and if experimental feature set has * sculpt vertex color enabled. Returns truth if new layer has been added, false otherwise. diff --git a/source/blender/blenkernel/BKE_pbvh.hh b/source/blender/blenkernel/BKE_pbvh.hh index 6a9a0858b0f..15b184db036 100644 --- a/source/blender/blenkernel/BKE_pbvh.hh +++ b/source/blender/blenkernel/BKE_pbvh.hh @@ -65,20 +65,6 @@ struct PBVHVertRef { PBVH_REF_CXX_METHODS(PBVHVertRef) }; -/* NOTE: edges in PBVH_GRIDS are always pulled from the base mesh. */ -struct PBVHEdgeRef { - intptr_t i; - - PBVH_REF_CXX_METHODS(PBVHVertRef) -}; - -/* NOTE: faces in PBVH_GRIDS are always puled from the base mesh. */ -struct PBVHFaceRef { - intptr_t i; - - PBVH_REF_CXX_METHODS(PBVHVertRef) -}; - #define PBVH_REF_NONE -1LL /* Public members of PBVH, used for inlined functions. */ diff --git a/source/blender/blenkernel/BKE_pbvh_api.hh b/source/blender/blenkernel/BKE_pbvh_api.hh index 6255bf0f002..fd47624d961 100644 --- a/source/blender/blenkernel/BKE_pbvh_api.hh +++ b/source/blender/blenkernel/BKE_pbvh_api.hh @@ -111,18 +111,6 @@ BLI_INLINE PBVHVertRef BKE_pbvh_make_vref(intptr_t i) return ret; } -BLI_INLINE PBVHEdgeRef BKE_pbvh_make_eref(intptr_t i) -{ - PBVHEdgeRef ret = {i}; - return ret; -} - -BLI_INLINE PBVHFaceRef BKE_pbvh_make_fref(intptr_t i) -{ - PBVHFaceRef ret = {i}; - return ret; -} - BLI_INLINE int BKE_pbvh_vertex_to_index(PBVH *pbvh, PBVHVertRef v) { return (BKE_pbvh_type(pbvh) == PBVH_BMESH && v.i != PBVH_REF_NONE ? @@ -143,46 +131,6 @@ BLI_INLINE PBVHVertRef BKE_pbvh_index_to_vertex(PBVH *pbvh, int index) return BKE_pbvh_make_vref(PBVH_REF_NONE); } -BLI_INLINE int BKE_pbvh_edge_to_index(PBVH *pbvh, PBVHEdgeRef e) -{ - return (BKE_pbvh_type(pbvh) == PBVH_BMESH && e.i != PBVH_REF_NONE ? - BM_elem_index_get((BMEdge *)(e.i)) : - (e.i)); -} - -BLI_INLINE PBVHEdgeRef BKE_pbvh_index_to_edge(PBVH *pbvh, int index) -{ - switch (BKE_pbvh_type(pbvh)) { - case PBVH_FACES: - case PBVH_GRIDS: - return BKE_pbvh_make_eref(index); - case PBVH_BMESH: - return BKE_pbvh_make_eref((intptr_t)BKE_pbvh_get_bmesh(pbvh)->etable[index]); - } - - return BKE_pbvh_make_eref(PBVH_REF_NONE); -} - -BLI_INLINE int BKE_pbvh_face_to_index(PBVH *pbvh, PBVHFaceRef f) -{ - return (BKE_pbvh_type(pbvh) == PBVH_BMESH && f.i != PBVH_REF_NONE ? - BM_elem_index_get((BMFace *)(f.i)) : - (f.i)); -} - -BLI_INLINE PBVHFaceRef BKE_pbvh_index_to_face(PBVH *pbvh, int index) -{ - switch (BKE_pbvh_type(pbvh)) { - case PBVH_FACES: - case PBVH_GRIDS: - return BKE_pbvh_make_fref(index); - case PBVH_BMESH: - return BKE_pbvh_make_fref((intptr_t)BKE_pbvh_get_bmesh(pbvh)->ftable[index]); - } - - return BKE_pbvh_make_fref(PBVH_REF_NONE); -} - /* Callbacks */ /** diff --git a/source/blender/editors/sculpt_paint/sculpt_intern.hh b/source/blender/editors/sculpt_paint/sculpt_intern.hh index 412b767647d..135fac3e899 100644 --- a/source/blender/editors/sculpt_paint/sculpt_intern.hh +++ b/source/blender/editors/sculpt_paint/sculpt_intern.hh @@ -1886,4 +1886,3 @@ int SCULPT_vertex_island_get(const SculptSession *ss, PBVHVertRef vertex); /* Make SCULPT_ alias to a few blenkernel sculpt methods. */ #define SCULPT_vertex_attr_get BKE_sculpt_vertex_attr_get -#define SCULPT_face_attr_get BKE_sculpt_face_attr_get diff --git a/source/blender/editors/sculpt_paint/sculpt_undo.cc b/source/blender/editors/sculpt_paint/sculpt_undo.cc index 99fc44a2312..019a6d34399 100644 --- a/source/blender/editors/sculpt_paint/sculpt_undo.cc +++ b/source/blender/editors/sculpt_paint/sculpt_undo.cc @@ -159,7 +159,6 @@ struct SculptUndoStep { }; static UndoSculpt *get_nodes(); -static bool sculpt_attribute_ref_equals(SculptAttrRef *a, SculptAttrRef *b); static void sculpt_save_active_attribute(Object *ob, SculptAttrRef *attr); static UndoSculpt *sculpt_undosys_step_get_nodes(UndoStep *us_p); @@ -1589,11 +1588,6 @@ Node *push_node(Object *ob, PBVHNode *node, Type type) return unode; } -static bool sculpt_attribute_ref_equals(SculptAttrRef *a, SculptAttrRef *b) -{ - return a->domain == b->domain && a->type == b->type && STREQ(a->name, b->name); -} - static void sculpt_save_active_attribute(Object *ob, SculptAttrRef *attr) { Mesh *mesh = BKE_object_get_original_mesh(ob);