Skip to content

BufferGeometryUtils: Validate morph attributes in mergeGeometries() - #34532

Merged
Mugen87 merged 1 commit into
mrdoob:devfrom
cuishuang:my_feature
Sep 10, 2026
Merged

BufferGeometryUtils: Validate morph attributes in mergeGeometries()#34532
Mugen87 merged 1 commit into
mrdoob:devfrom
cuishuang:my_feature

Conversation

@cuishuang

Copy link
Copy Markdown
Contributor

Related issue: None.

Description

mergeGeometries() checks for unexpected morph attributes but does not reject missing ones or inconsistent target counts.

A missing morph attribute produces merged morph data with fewer vertices than the base geometry. Inconsistent target counts either throw when a later geometry has fewer targets or silently discard targets when it has more.

This PR validates that all geometries have the same morph attribute names and the same target count for each corresponding attribute. Incompatible inputs log an error and return null, following the existing validation behavior.

Signed-off-by: cuishuang <imcusg@gmail.com>

// ensure geometries have the same number of morph attributes

if ( morphAttributesCount !== morphAttributesUsed.size ) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree it makes sense to apply the same type of attribute checks to morph target attributes.

This check maps to attributesCount !== attributesUsed.size further above and the per-name morph target-count makes sense as well 👍 .

@Mugen87 Mugen87 added this to the r187 milestone Sep 10, 2026
@Mugen87
Mugen87 merged commit febf65f into mrdoob:dev Sep 10, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants