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:
authorHans Goudey <h.goudey@me.com>2021-06-08 16:27:13 +0300
committerHans Goudey <h.goudey@me.com>2021-06-08 16:27:13 +0300
commita2ebbeb836ae765e98daaf502d49f545f43916fd (patch)
tree648b8c1b108d9ea857e3aa1fae284140e522ee49 /source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_cone.cc
parent5b014911a51651d736671da1a0ca96bfe0cd8eba (diff)
Fix T88934: Crash with line node count input < 0
Some of the primitive nodes can return null in an error condition. This is confusing mixed with adding a maderial slot in calling functions. This is the second crash caused by that confusion. It's simpler to add the slot right when allocating the mesh, and it will lend itself better to copy & paste coding in the future. Differential Revision: https://developer.blender.org/D11530
Diffstat (limited to 'source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_cone.cc')
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_cone.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_cone.cc b/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_cone.cc
index 4c1521aa6f1..925ed0f8da8 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_cone.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_cone.cc
@@ -309,6 +309,7 @@ Mesh *create_cylinder_or_cone_mesh(const float radius_top,
0,
corner_total(fill_type, verts_num, top_is_point, bottom_is_point),
face_total(fill_type, verts_num, top_is_point, bottom_is_point));
+ BKE_id_material_eval_ensure_default_slot(&mesh->id);
MutableSpan<MVert> verts{mesh->mvert, mesh->totvert};
MutableSpan<MLoop> loops{mesh->mloop, mesh->totloop};
MutableSpan<MEdge> edges{mesh->medge, mesh->totedge};
@@ -562,7 +563,6 @@ static void geo_node_mesh_primitive_cone_exec(GeoNodeExecParams params)
Mesh *mesh = create_cylinder_or_cone_mesh(
radius_top, radius_bottom, depth, verts_num, fill_type);
- BKE_id_material_eval_ensure_default_slot(&mesh->id);
/* Transform the mesh so that the base of the cone is at the origin. */
BKE_mesh_translate(mesh, float3(0.0f, 0.0f, depth * 0.5f), false);