Mesh: Replace auto smooth with node group #108014

Merged
Hans Goudey merged 149 commits from HooglyBoogly/blender:refactor-mesh-corner-normals-lazy into main 2023-10-20 16:54:20 +02:00
6 changed files with 10 additions and 8 deletions
Showing only changes of commit 1f9d3596b7 - Show all commits

View File

@ -2172,7 +2172,7 @@ void BKE_main_mesh_legacy_convert_auto_smooth(Main &bmain)
continue;
}
Mesh *mesh = static_cast<Mesh *>(object->data);
if (!(mesh->flag & ME_AUTOSMOOTH)) {
if (!(mesh->flag & ME_AUTOSMOOTH_LEGACY)) {
continue;
}
if (CustomData_has_layer(&mesh->loop_data, CD_CUSTOMLOOPNORMAL)) {
@ -2199,7 +2199,8 @@ void BKE_main_mesh_legacy_convert_auto_smooth(Main &bmain)
}
md->settings.properties = bke::idprop::create_group("Nodes Modifier Settings").release();
IDProperty *angle_prop = bke::idprop::create(DATA_("Socket_1"), mesh->smoothresh).release();
IDProperty *angle_prop =
bke::idprop::create(DATA_("Socket_1"), mesh->smoothresh_legacy).release();
auto *ui_data = reinterpret_cast<IDPropertyUIDataFloat *>(IDP_ui_data_ensure(angle_prop));
ui_data->base.rna_subtype = PROP_ANGLE;
IDP_AddToGroup(md->settings.properties, angle_prop);

View File

@ -521,9 +521,9 @@ void blo_do_versions_270(FileData *fd, Library * /*lib*/, Main *bmain)
}
if (!MAIN_VERSION_FILE_ATLEAST(bmain, 270, 2)) {
/* Mesh smoothresh deg->rad. */
/* Mesh smoothresh_legacy deg->rad. */
LISTBASE_FOREACH (Mesh *, me, &bmain->meshes) {
me->smoothresh = DEG2RADF(me->smoothresh);
me->smoothresh_legacy = DEG2RADF(me->smoothresh_legacy);
}
}

View File

@ -571,7 +571,7 @@ void BLO_update_defaults_startup_blend(Main *bmain, const char *app_template)
LISTBASE_FOREACH (Mesh *, mesh, &bmain->meshes) {
/* Match default for new meshes. */
mesh->smoothresh = DEG2RADF(30);
mesh->smoothresh_legacy = DEG2RADF(30);
/* Match voxel remesher options for all existing meshes in templates. */
mesh->flag |= ME_REMESH_REPROJECT_VOLUME | ME_REMESH_REPROJECT_PAINT_MASK |
ME_REMESH_REPROJECT_SCULPT_FACE_SETS | ME_REMESH_REPROJECT_VERTEX_COLORS;

View File

@ -635,7 +635,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
if (bmain->versionfile <= 164) {
Mesh *me = static_cast<Mesh *>(bmain->meshes.first);
while (me) {
me->smoothresh = 30;
me->smoothresh_legacy = 30;
me = static_cast<Mesh *>(me->id.next);
}
}

View File

@ -149,7 +149,7 @@ typedef struct Mesh {
/** Mostly more flags used when editing or displaying the mesh. */
uint16_t flag;
float smoothresh DNA_DEPRECATED;
float smoothresh_legacy DNA_DEPRECATED;
/** Per-mesh settings for voxel remesh. */
float remesh_voxel_size;
@ -438,7 +438,7 @@ enum {
ME_FLAG_DEPRECATED_2 = 1 << 2, /* deprecated */
ME_FLAG_UNUSED_3 = 1 << 3, /* cleared */
ME_FLAG_UNUSED_4 = 1 << 4, /* cleared */
ME_AUTOSMOOTH = 1 << 5, /* deprecated */
ME_AUTOSMOOTH_LEGACY = 1 << 5, /* deprecated */
ME_FLAG_UNUSED_6 = 1 << 6, /* cleared */
ME_FLAG_UNUSED_7 = 1 << 7, /* cleared */
ME_REMESH_REPROJECT_VERTEX_COLORS = 1 << 8,

View File

@ -110,6 +110,7 @@ DNA_STRUCT_RENAME_ELEM(Mesh, ldata, loop_data)
DNA_STRUCT_RENAME_ELEM(Mesh, pdata, face_data)
DNA_STRUCT_RENAME_ELEM(Mesh, poly_offset_indices, face_offset_indices)
DNA_STRUCT_RENAME_ELEM(Mesh, size, texspace_size)
DNA_STRUCT_RENAME_ELEM(Mesh, smoothresh, smoothresh_legacy)
DNA_STRUCT_RENAME_ELEM(Mesh, texflag, texspace_flag)
DNA_STRUCT_RENAME_ELEM(Mesh, totface, totface_legacy)
DNA_STRUCT_RENAME_ELEM(Mesh, totpoly, faces_num)