Merge branch 'blender-v3.4-release'
This commit is contained in:
commit
d1d2946f59
|
@ -1085,11 +1085,11 @@ static void create_subd_mesh(Scene *scene,
|
|||
const int edges_num = b_mesh.edges.length();
|
||||
|
||||
if (edges_num != 0 && b_mesh.edge_creases.length() > 0) {
|
||||
size_t num_creases = 0;
|
||||
const float *creases = static_cast<float *>(b_mesh.edge_creases[0].ptr.data);
|
||||
BL::MeshEdgeCreaseLayer creases = b_mesh.edge_creases[0];
|
||||
|
||||
size_t num_creases = 0;
|
||||
for (int i = 0; i < edges_num; i++) {
|
||||
if (creases[i] != 0.0f) {
|
||||
if (creases.data[i].value() != 0.0f) {
|
||||
num_creases++;
|
||||
}
|
||||
}
|
||||
|
@ -1098,17 +1098,18 @@ static void create_subd_mesh(Scene *scene,
|
|||
|
||||
const MEdge *edges = static_cast<MEdge *>(b_mesh.edges[0].ptr.data);
|
||||
for (int i = 0; i < edges_num; i++) {
|
||||
if (creases[i] != 0.0f) {
|
||||
const float crease = creases.data[i].value();
|
||||
if (crease != 0.0f) {
|
||||
const MEdge &b_edge = edges[i];
|
||||
mesh->add_edge_crease(b_edge.v1, b_edge.v2, creases[i]);
|
||||
mesh->add_edge_crease(b_edge.v1, b_edge.v2, crease);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (BL::MeshVertexCreaseLayer &c : b_mesh.vertex_creases) {
|
||||
for (int i = 0; i < c.data.length(); ++i) {
|
||||
if (c.data[i].value() != 0.0f) {
|
||||
mesh->add_vertex_crease(i, c.data[i].value());
|
||||
}
|
||||
for (BL::MeshVertexCreaseLayer &c : b_mesh.vertex_creases) {
|
||||
for (int i = 0; i < c.data.length(); ++i) {
|
||||
if (c.data[i].value() != 0.0f) {
|
||||
mesh->add_vertex_crease(i, c.data[i].value());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -520,8 +520,10 @@ static bool subdiv_mesh_topology_info(const SubdivForeachContext *foreach_contex
|
|||
* so don't try to preserve it and use memory. Crease values should also not be interpolated. */
|
||||
CustomData_MeshMasks mask = CD_MASK_EVERYTHING;
|
||||
mask.lmask &= ~CD_MASK_MULTIRES_GRIDS;
|
||||
/* Propagate edge creases so they can be used in another subdivision modifier (maintaining
|
||||
* existing behavior), but don't propagate vertex creases to avoid extra work when the result
|
||||
* isn't useful anyway. */
|
||||
mask.vmask &= ~CD_MASK_CREASE;
|
||||
mask.emask &= ~CD_MASK_CREASE;
|
||||
|
||||
SubdivMeshContext *subdiv_context = static_cast<SubdivMeshContext *>(foreach_context->user_data);
|
||||
subdiv_context->subdiv_mesh = BKE_mesh_new_nomain_from_template_ex(
|
||||
|
@ -791,7 +793,6 @@ static void subdiv_copy_edge_data(SubdivMeshContext *ctx,
|
|||
{
|
||||
const int subdiv_edge_index = subdiv_edge - ctx->subdiv_edges;
|
||||
if (coarse_edge == nullptr) {
|
||||
/* TODO: Ensure crease layer isn't copied to result. */
|
||||
subdiv_edge->flag = 0;
|
||||
if (!ctx->settings->use_optimal_display) {
|
||||
subdiv_edge->flag |= ME_EDGEDRAW;
|
||||
|
|
|
@ -170,6 +170,13 @@ static void node_geo_exec(GeoNodeExecParams params)
|
|||
|
||||
Mesh *mesh_out = BKE_subdiv_to_mesh(subdiv, &mesh_settings, &mesh);
|
||||
|
||||
if (use_creases) {
|
||||
/* Remove the layer in case it was created by the node from the field input. The fact
|
||||
* that this node uses #CD_CREASE to input creases to the subvision code is meant to be
|
||||
* an implementation detail ideally. */
|
||||
CustomData_free_layers(&mesh_out->edata, CD_CREASE, mesh_out->totedge);
|
||||
}
|
||||
|
||||
geometry_set.replace_mesh(mesh_out);
|
||||
|
||||
BKE_subdiv_free(subdiv);
|
||||
|
|
Loading…
Reference in New Issue