Sculpt: Remove dynamic topology "Smooth Shading" option #110548

Merged
Hans Goudey merged 1 commits from HooglyBoogly/blender:fix-dyntopo-remove-smooth-option into main 2023-07-28 13:44:08 +02:00
9 changed files with 3 additions and 50 deletions

View File

@ -900,8 +900,6 @@ class VIEW3D_PT_sculpt_dyntopo(Panel, View3DPaintPanel):
if sculpt.detail_type_method in {'CONSTANT', 'MANUAL'}:
col.operator("sculpt.detail_flood_fill")
col.prop(sculpt, "use_smooth_shading")
class VIEW3D_PT_sculpt_voxel_remesh(Panel, View3DPaintPanel):
bl_context = ".sculpt_mode" # dot on purpose (access from topbar)

View File

@ -644,7 +644,6 @@ typedef struct SculptSession {
/* BMesh for dynamic topology sculpting */
struct BMesh *bm;
bool bm_smooth_shading;
/* Undo/redo log for dynamic topology sculpting */
struct BMLog *bm_log;
@ -939,7 +938,6 @@ bool BKE_object_attributes_active_color_fill(struct Object *ob,
/** C accessor for #Object::sculpt::pbvh. */
struct PBVH *BKE_object_sculpt_pbvh_get(struct Object *object);
bool BKE_object_sculpt_use_dyntopo(const struct Object *object);
void BKE_object_sculpt_dyntopo_smooth_shading_set(struct Object *object, bool value);
/* paint_canvas.cc */

View File

@ -216,12 +216,8 @@ void BKE_pbvh_build_grids(PBVH *pbvh,
/**
* Build a PBVH from a BMesh.
*/
void BKE_pbvh_build_bmesh(PBVH *pbvh,
BMesh *bm,
bool smooth_shading,
BMLog *log,
int cd_vert_node_offset,
int cd_face_node_offset);
void BKE_pbvh_build_bmesh(
PBVH *pbvh, BMesh *bm, BMLog *log, int cd_vert_node_offset, int cd_face_node_offset);
void BKE_pbvh_update_bmesh_offsets(PBVH *pbvh, int cd_vert_node_offset, int cd_face_node_offset);

View File

@ -1448,11 +1448,6 @@ static void sculptsession_bm_to_me_update_data_only(Object *ob, bool reorder)
if (ss->bm) {
if (ob->data) {
BMIter iter;
BMFace *efa;
BM_ITER_MESH (efa, &iter, ss->bm, BM_FACES_OF_MESH) {
BM_elem_flag_set(efa, BM_ELEM_SMOOTH, ss->bm_smooth_shading);
}
if (reorder) {
BM_log_mesh_elems_reorder(ss->bm, ss->bm_log);
}
@ -2227,7 +2222,6 @@ static PBVH *build_pbvh_for_dynamic_topology(Object *ob)
BKE_pbvh_build_bmesh(pbvh,
ob->sculpt->bm,
ob->sculpt->bm_smooth_shading,
ob->sculpt->bm_log,
ob->sculpt->attrs.dyntopo_node_id_vertex->bmesh_cd_offset,
ob->sculpt->attrs.dyntopo_node_id_face->bmesh_cd_offset);
@ -2347,11 +2341,6 @@ bool BKE_object_sculpt_use_dyntopo(const Object *object)
return object->sculpt && object->sculpt->bm;
}
void BKE_object_sculpt_dyntopo_smooth_shading_set(Object *object, const bool value)
{
object->sculpt->bm_smooth_shading = value;
}
void BKE_sculpt_bvh_update_from_ccg(PBVH *pbvh, SubdivCCG *subdiv_ccg)
{
CCGKey key;

View File

@ -1899,7 +1899,6 @@ void BKE_pbvh_update_bmesh_offsets(PBVH *pbvh, int cd_vert_node_offset, int cd_f
void BKE_pbvh_build_bmesh(PBVH *pbvh,
BMesh *bm,
bool smooth_shading,
BMLog *log,
const int cd_vert_node_offset,
const int cd_face_node_offset)
@ -1916,10 +1915,6 @@ void BKE_pbvh_build_bmesh(PBVH *pbvh,
BKE_pbvh_update_bmesh_offsets(pbvh, cd_vert_node_offset, cd_face_node_offset);
if (smooth_shading) {
pbvh->flags |= PBVH_DYNTOPO_SMOOTH_SHADING;
}
/* bounding box array of all faces, no need to recalculate every time */
BBC *bbc_array = static_cast<BBC *>(MEM_mallocN(sizeof(BBC) * bm->totface, "BBC"));
BMFace **nodeinfo = static_cast<BMFace **>(

View File

@ -129,16 +129,10 @@ struct PBVHNode {
int debug_draw_gen;
};
enum PBVHFlags {
PBVH_DYNTOPO_SMOOTH_SHADING = 1,
};
ENUM_OPERATORS(PBVHFlags, PBVH_DYNTOPO_SMOOTH_SHADING);
typedef struct PBVHBMeshLog PBVHBMeshLog;
struct PBVH {
PBVHPublic header;
PBVHFlags flags;
PBVHNode *nodes;
int node_mem_count, totnode;

View File

@ -85,9 +85,6 @@ void SCULPT_dynamic_topology_enable_ex(Main *bmain, Depsgraph *depsgraph, Scene
SCULPT_pbvh_clear(ob);
ss->bm_smooth_shading = (scene->toolsettings->sculpt->flags & SCULPT_DYNTOPO_SMOOTH_SHADING) !=
0;
/* Dynamic topology doesn't ensure selection state is valid, so remove #36280. */
BKE_mesh_mselect_clear(me);

View File

@ -2541,7 +2541,7 @@ typedef enum eSculptFlags {
// SCULPT_SHOW_DIFFUSE = (1 << 9), /* deprecated */
/** If set, the mesh will be drawn with smooth-shading in dynamic-topology mode. */
SCULPT_DYNTOPO_SMOOTH_SHADING = (1 << 10),
SCULPT_FLAG_UNUSED_8 = (1 << 10), /* deprecated */
/** If set, dynamic-topology brushes will subdivide short edges. */
SCULPT_DYNTOPO_SUBDIVIDE = (1 << 12),

View File

@ -389,11 +389,6 @@ static void rna_Sculpt_update(bContext *C, PointerRNA * /*ptr*/)
if (ob) {
DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
WM_main_add_notifier(NC_OBJECT | ND_MODIFIER, ob);
if (ob->sculpt) {
BKE_object_sculpt_dyntopo_smooth_shading_set(
ob, ((scene->toolsettings->sculpt->flags & SCULPT_DYNTOPO_SMOOTH_SHADING) != 0));
}
}
}
@ -864,15 +859,6 @@ static void rna_def_sculpt(BlenderRNA *brna)
"of Blender unit - higher value means smaller edge length)");
RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, nullptr);
prop = RNA_def_property(srna, "use_smooth_shading", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, nullptr, "flags", SCULPT_DYNTOPO_SMOOTH_SHADING);
RNA_def_property_ui_text(prop,
"Smooth Shading",
"Show faces in dynamic-topology mode with smooth "
"shading rather than flat shaded");
RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Sculpt_update");
const EnumPropertyItem *entry = rna_enum_brush_automasking_flag_items;
do {
prop = RNA_def_property(srna, entry->identifier, PROP_BOOLEAN, PROP_NONE);