Skip to content

Add 8-bone support for MeshDataTool #107966

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

gongpha
Copy link
Contributor

@gongpha gongpha commented Jun 25, 2025

The current MeshDataTool supports only 4 bones. Making 8-bone mesh corrupted when committing

Reference :

var mdt := MeshDataTool.new()
mdt.create_from_surface(meshinstance3d.mesh, 0)
var m := ArrayMesh.new()
mdt.commit_to_surface(m)
meshinstance3d.mesh = m
Before After
image image

Comment on lines +433 to +437
if (format & Mesh::ARRAY_FLAG_USE_8_BONE_WEIGHTS) {
ERR_FAIL_COND(p_bones.size() != 8);
} else {
ERR_FAIL_COND(p_bones.size() != 4);
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure if ERR_* inside the if clause is a decent code style. I didn't see it used much elsewhere

Copy link
Member

Choose a reason for hiding this comment

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

In this case it's good (clearer than the confusing message if combining the two), but these should be given a descriptive error message to clarify why it's four or eight bones, in case someone intends to use 8 but doesn't know to set the flag, or forgets to not set the flag

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants