Fix #127713: propagate materials in Curve to Mesh node

This adds material propagation in two places to fix the bug:
* Conversion from legacy to new curves.
* From the main curve input to the output mesh in the Curve to Mesh node.

Pull Request: https://projects.blender.org/blender/blender/pulls/131862
This commit is contained in:
Jacques Lucke
2024-12-13 19:36:54 +01:00
parent b07835c9b4
commit b3a06149bb
2 changed files with 7 additions and 0 deletions

View File

@@ -204,6 +204,9 @@ Curves *curve_legacy_to_curves(const Curve &curve_legacy, const ListBase &nurbs_
radius_attribute.finish();
curves_id->mat = static_cast<Material **>(MEM_dupallocN(curve_legacy.mat));
curves_id->totcol = curve_legacy.totcol;
return curves_id;
}

View File

@@ -13,6 +13,8 @@
#include "GEO_join_geometries.hh"
#include "GEO_randomize.hh"
#include "DNA_mesh_types.h"
#include "node_geometry_util.hh"
namespace blender::nodes::node_geo_curve_to_mesh_cc {
@@ -113,6 +115,8 @@ static void node_geo_exec(GeoNodeExecParams params)
if (geometry_set.has_curves()) {
const Curves &curves = *geometry_set.get_curves();
Mesh *mesh = curve_to_mesh(curves.geometry.wrap(), profile_set, fill_caps, attribute_filter);
mesh->mat = static_cast<Material **>(MEM_dupallocN(curves.mat));
mesh->totcol = curves.totcol;
geometry_set.replace_mesh(mesh);
}
if (geometry_set.has_grease_pencil()) {