Fix #143333: Custom bone shape does not include subdivision surface

This was caused by a mismatch in the conditions that enabled GPU
subdivision. The mesh normals domain for meshes with no faces was
reported incorrectly, causing the code to think there are auto-smooth
style split normals when there actually aren't.

Also the GPU subdiv normals extraction had a crash binding a vertex
buffer that doesn't exist when there are no faces. Add an early return
for the wire-only mesh case to avoid that.

Pull Request: https://projects.blender.org/blender/blender/pulls/143961
This commit is contained in:
Hans Goudey
2025-08-04 23:13:31 +02:00
committed by Hans Goudey
parent 21fcf524b1
commit bf40023aa4
2 changed files with 8 additions and 0 deletions

View File

@@ -294,6 +294,10 @@ blender::bke::MeshNormalDomain Mesh::normals_domain(const bool support_sharp_fac
{
using namespace blender;
using namespace blender::bke;
if (this->faces_num == 0) {
return MeshNormalDomain::Point;
}
const bke::AttributeAccessor attributes = this->attributes();
if (const std::optional<AttributeMetaData> custom = attributes.lookup_meta_data("custom_normal"))
{

View File

@@ -315,6 +315,10 @@ gpu::VertBufPtr extract_normals_subdiv(const MeshRenderData &mr,
gpu::VertBufPtr lnor = gpu::VertBufPtr(
GPU_vertbuf_create_on_device(get_normals_format(), vbo_size));
if (subdiv_cache.num_subdiv_loops == 0) {
update_loose_normals(mr, subdiv_cache, *lnor);
return lnor;
}
if (subdiv_cache.use_custom_loop_normals) {
const Mesh *coarse_mesh = subdiv_cache.mesh;