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_uv_sphere.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_uv_sphere.cc')
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_uv_sphere.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_uv_sphere.cc b/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_uv_sphere.cc
index 7d340679269..599c59e4a2e 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_uv_sphere.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_uv_sphere.cc
@@ -267,6 +267,7 @@ static Mesh *create_uv_sphere_mesh(const float radius, const int segments, const
0,
sphere_corner_total(segments, rings),
sphere_face_total(segments, rings));
+ 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};
@@ -297,7 +298,6 @@ static void geo_node_mesh_primitive_uv_sphere_exec(GeoNodeExecParams params)
const float radius = params.extract_input<float>("Radius");
Mesh *mesh = create_uv_sphere_mesh(radius, segments_num, rings_num);
- BKE_id_material_eval_ensure_default_slot(&mesh->id);
params.set_output("Geometry", GeometrySet::create_with_mesh(mesh));
}