Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacques Lucke <jacques@blender.org>2021-06-01 16:24:29 +0300
committerJacques Lucke <jacques@blender.org>2021-06-01 16:25:01 +0300
commit6583fb67c6e1e5d714d723a09312e9dd25e02152 (patch)
tree94a17b12d56e1f91b056f990497d14b994225dcd /source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_cylinder.cc
parent8a63466ca3380479a92a65b670a074277d9a8671 (diff)
Geometry Nodes: add empty material slot to new meshes
This fixes T88455 by adding an empty material slot to newly generated meshes. This allows the object to overwrite the "default" material without any extra nodes. Technically, all polygons reference the material index 0 already, so it makes sense to add a material slot for this material index. Differential Revision: https://developer.blender.org/D11439
Diffstat (limited to 'source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_cylinder.cc')
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_cylinder.cc2
1 files changed, 2 insertions, 0 deletions
diff --git a/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_cylinder.cc b/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_cylinder.cc
index f443b4387d3..c7b9fb920f8 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_cylinder.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_cylinder.cc
@@ -17,6 +17,7 @@
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
+#include "BKE_material.h"
#include "BKE_mesh.h"
#include "UI_interface.h"
@@ -75,6 +76,7 @@ static void geo_node_mesh_primitive_cylinder_exec(GeoNodeExecParams params)
/* The cylinder is a special case of the cone mesh where the top and bottom radius are equal. */
Mesh *mesh = create_cylinder_or_cone_mesh(radius, radius, depth, verts_num, fill_type);
+ BKE_id_material_eval_ensure_default_slot(&mesh->id);
params.set_output("Geometry", GeometrySet::create_with_mesh(mesh));
}