Skip to content
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

Add skinning support to glTF exporter #7197

Merged
merged 5 commits into from
Dec 16, 2024
Merged

Add skinning support to glTF exporter #7197

merged 5 commits into from
Dec 16, 2024

Conversation

willeastcott
Copy link
Contributor

@willeastcott willeastcott commented Dec 15, 2024

Allows for exporting of skins to glTF.

Fixes #7144
Partially addresses #5001

I confirm I have read the contributing guidelines and signed the Contributor License Agreement.

Copy link
Member

@slimbuck slimbuck left a comment

Choose a reason for hiding this comment

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

nice!

@@ -472,6 +478,12 @@ class GltfExporter extends CoreExporter {
const entityMeshInstance = resources.entityMeshInstances.find(e => e.node === entity);
if (entityMeshInstance) {
node.mesh = resources.entityMeshInstances.indexOf(entityMeshInstance);

// Add skin reference if this node has a skinned mesh
const meshInstance = entityMeshInstance.meshInstances[0];
Copy link
Contributor

Choose a reason for hiding this comment

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

Slight problem here is that the engine supports different skin for each mesh instance in the array here, but glTF does not.
We should check all meshInstances in this array, and they must point to the same skin. If they point to different skins, or some do not link to any skin, we should probably log a warning and skip skinning.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm. Any objection to opening a new issue on this and fixing it in a follow up PR? I want to keep this PR reasonably simple and there might be some nuance to how we want to deal with the case you mention.

@willeastcott willeastcott merged commit c58fe2f into main Dec 16, 2024
8 checks passed
@willeastcott willeastcott deleted the gltf-exporter-skin branch December 16, 2024 13:47
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.

GltfExporter - GLB Files Compliance with glTF 2.0 Specifications
3 participants