Mesh: Replace auto smooth with node group #108014
|
@ -332,11 +332,8 @@ static Mesh *mesh_wrapper_ensure_subdivision(Mesh *me)
|
||||||
if (use_clnors) {
|
if (use_clnors) {
|
||||||
/* If custom normals are present and the option is turned on calculate the split
|
/* If custom normals are present and the option is turned on calculate the split
|
||||||
* normals and clear flag so the normals get interpolated to the result mesh. */
|
* normals and clear flag so the normals get interpolated to the result mesh. */
|
||||||
blender::MutableSpan<float3> data(static_cast<float3 *>(CustomData_add_layer(
|
void *data = CustomData_add_layer(&me->ldata, CD_NORMAL, CD_CONSTRUCT, me->totloop);
|
||||||
&me->ldata, CD_NORMAL, CD_CONSTRUCT, me->totloop)),
|
memcpy(data, me->corner_normals().data(), me->corner_normals().size_in_bytes());
|
||||||
me->totloop);
|
|
||||||
data.copy_from(me->corner_normals());
|
|
||||||
CustomData_clear_layer_flag(&me->ldata, CD_NORMAL, CD_FLAG_TEMPORARY);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Mesh *subdiv_mesh = BKE_subdiv_to_mesh(subdiv, &mesh_settings, me);
|
Mesh *subdiv_mesh = BKE_subdiv_to_mesh(subdiv, &mesh_settings, me);
|
||||||
|
|
|
@ -261,11 +261,8 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh *
|
||||||
}
|
}
|
||||||
const bool use_clnors = BKE_subsurf_modifier_use_custom_loop_normals(smd, mesh);
|
const bool use_clnors = BKE_subsurf_modifier_use_custom_loop_normals(smd, mesh);
|
||||||
if (use_clnors) {
|
if (use_clnors) {
|
||||||
blender::MutableSpan<blender::float3> data(
|
void *data = CustomData_add_layer(&mesh->ldata, CD_NORMAL, CD_CONSTRUCT, mesh->totloop);
|
||||||
static_cast<blender::float3 *>(
|
memcpy(data, mesh->corner_normals().data(), mesh->corner_normals().size_in_bytes());
|
||||||
CustomData_add_layer(&mesh->ldata, CD_NORMAL, CD_CONSTRUCT, mesh->totloop)),
|
|
||||||
mesh->totloop);
|
|
||||||
data.copy_from(mesh->corner_normals());
|
|
||||||
}
|
}
|
||||||
/* TODO(sergey): Decide whether we ever want to use CCG for subsurf,
|
/* TODO(sergey): Decide whether we ever want to use CCG for subsurf,
|
||||||
* maybe when it is a last modifier in the stack? */
|
* maybe when it is a last modifier in the stack? */
|
||||||
|
|
|
@ -53,6 +53,7 @@ static Mesh *triangulate_mesh(Mesh *mesh,
|
||||||
if (keep_clnors) {
|
if (keep_clnors) {
|
||||||
void *data = CustomData_add_layer(&mesh->ldata, CD_NORMAL, CD_CONSTRUCT, mesh->totloop);
|
void *data = CustomData_add_layer(&mesh->ldata, CD_NORMAL, CD_CONSTRUCT, mesh->totloop);
|
||||||
memcpy(data, mesh->corner_normals().data(), mesh->corner_normals().size_in_bytes());
|
memcpy(data, mesh->corner_normals().data(), mesh->corner_normals().size_in_bytes());
|
||||||
|
cd_mask_extra.lmask |= CD_MASK_NORMAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
BMeshCreateParams bmesh_create_params{};
|
BMeshCreateParams bmesh_create_params{};
|
||||||
|
|
Loading…
Reference in New Issue