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
Added support for multiple animated nodes in a .gltf file #8038
Conversation
Added support for models being a child to a bone
if (selectLongest) | ||
{ | ||
break; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug fix.
Previously, we stored all animations (just renaming them all to the same name).
Now we only store the longest.
(let [is-single-anim (or (empty? animation-set) | ||
(not (animation-set/is-animation-set? animations-resource)))] | ||
(if is-single-anim | ||
(if animations-resource | ||
[(resource/base-name animations-resource)] ; single animation file | ||
animation-ids |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While technically "breaking" the api here, I also consider it a bug fix.
Also, I believe few users actually set a single .gltf file here, and they got the longest animation in the file.
At most, they'll get a build error, which is easy to fix.
Note, I haven't change any code for the Collada code path, as we have deprecated that. So that should remain the same.
// If the mesh wasn't skinned, but uses same material as other skinned meshes, we need to create a duplicate | ||
// We also insert a bone index for the mesh (i.e. the parent) | ||
static void FixupNonSkinnedModels(Scene* scene, Bone* parent, Node* node) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the test case, both skinned and non-skinned models use the same material.
In the Defold editor, these materials will later be assigned .material
files, with different vertex formats.
If the user wanted these to have the same material, they can 1) assign the same .material twice to the model, or 2) skin all the models.
@@ -651,6 +667,25 @@ namespace dmGameSystem | |||
} | |||
} | |||
|
|||
// static void OutputVector4(const dmVMath::Vector4& v) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for debugging every now and then.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe wrap these under a #if 0 ... #endif
or something? Otherwise someone who isn't aware it's debug code might just remove it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it looks good. Do we want a unit test for the case you originally had issues with?
@@ -651,6 +667,25 @@ namespace dmGameSystem | |||
} | |||
} | |||
|
|||
// static void OutputVector4(const dmVMath::Vector4& v) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe wrap these under a #if 0 ... #endif
or something? Otherwise someone who isn't aware it's debug code might just remove it
Previously, we assumed that the first model in the scene was the one that was used for skinning.
However, that didn't cover all the use cases, and instead we now render all the models in the scene.
Additionally, we now also list all the animations from a .gltf/.glb file when it's selected as the animation set for a
.model
component. Previously, it always only selected the longest animation in the file.The previous behavior for
.animationset
's is not changed, any animation files used in an animation set will only pick one animation (the longest), just as before.Also, if there is a mesh in the model, that isn't skinned, but is a child to a bone, then that model will not be skinned at runtime, but get assigned a non-skinned material (if it didn't already have one)
Added
model.set_mesh_enabled()
andmodel.get_mesh_enabled()
to control visibility of meshes within a scene.PR checklist