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 an option to only export deform bones of an armature #8

Merged
merged 5 commits into from
Jun 10, 2023

Conversation

Lamoot
Copy link

@Lamoot Lamoot commented Jun 10, 2023

A properly done rig in Blender contains many more bones than strictly those required to deform geometry. These extra bones allow for complex rigs that make animation easier but are not needed in the exported file.

This MR adds an option to filter bones (and their corresponding animation data) based on the bones' Deform flag. It's the same option available in fbx, gltf, and collada exporters.

When a bone with Deform enabled is present in the rig's hierarchy, its parents need to be exported as well. This ensures predictable exported animation result but requires users to set up their rigs properly with non-deform bones in their own branch of the rig's hierarchy. Again, its the same behaviour as with other exporters.

I tested this on OpenMW's Land racer and everything looks to perform as expected - only the deform bones and animation channels get included in the exported file. land_racer.osgt.zip

The option is exposed in the exporter's UI.
osg_deform_only

Now when the option is enabled a bone is exported:
- Only when marked "Deform" in Blender.
- If any of its children are marked "Deform", even if the bone itself has "Deform" disabled. 

This works the same way as Blender's FBX's and Collada exporters.
Animation data for other bones still gets exported and will be fixed.
When the corresponding exporter option is enabled of course.
- Put the common bone deform check function to osgutils
- Write a nicer if trees without code duplication
- add missing mathutils import to bake script
@psi29a psi29a merged commit 544f6df into OpenMW:master Jun 10, 2023
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