Skip to content

Let the user pick which animation stack to import in an fbx #1977

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

Merged
merged 4 commits into from
Nov 2, 2023

Conversation

adrsch
Copy link
Contributor

@adrsch adrsch commented Oct 22, 2023

PR Details

If multiple animation stacks are present in an fbx, let the user choose the index to import.

Description

This only allows it to be set after the asset is initially created and imported. Also, the index is clamped so it doesn't break if you set something out of bounds.

Tested with a mixamo animation, since they set everything in the 2nd stack and a t-pose in the first.

Related Issue

Motivation and Context

Types of changes

  • Docs change / refactoring / dependency upgrade
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • My change requires a change to the documentation.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • I have built and run the editor to try this change out.

@manio143
Copy link
Member

Code changes look fine. Since this is modifying the public API of the animation asset, does this scale to any other format than FBX? If so, we probably need to file an issue to get this implemented for other model importers. If not, we need to add to the property description that this is a special case for FBX and the value is ignored for other file types. Maybe even it would make sense to call it FbxAnimationStack if it's a feature specific to that file format. However, I imagine it's the case that other file formats would also support multiple animations. But would other formats also use an integer index or maybe a string identifier?

@adrsch
Copy link
Contributor Author

adrsch commented Oct 23, 2023

Code changes look fine. Since this is modifying the public API of the animation asset, does this scale to any other format than FBX? If so, we probably need to file an issue to get this implemented for other model importers. If not, we need to add to the property description that this is a special case for FBX and the value is ignored for other file types. Maybe even it would make sense to call it FbxAnimationStack if it's a feature specific to that file format. However, I imagine it's the case that other file formats would also support multiple animations. But would other formats also use an integer index or maybe a string identifier?

I totally forgot about other formats! I'll get that added.

Ideally I feel like the importer would have a nice little dropdown with the names of all the animations, or at least limited to valid indices. Not sure how I'd implement that with the UI framework, the only dropdowns I've seen have been bound to the names of a hardcoded enum and that would probably be more annoying than an integer field.

@tebjan
Copy link
Member

tebjan commented Oct 25, 2023

Isn't it possible to just import all and create the appropriate number of animation assets according to the names of the animations?

@adrsch
Copy link
Contributor Author

adrsch commented Oct 25, 2023

Yeah, I think that would be possible. Maybe with a way to skip certain animations if you want, since my use case is just to use the 2nd animation and ignore the first, lol. Not sure if the names have uniqueness enforced. If they don't the index may need to be used to keep it consistent across imports.

That being said my usage is probably a bit niche since I would bet I'm the only one working with stride who is using 3DS Max... and I'm upholding as my ideal, how 3DS Max handles files with multiple animations (a way to pick which animation is imported). But hey, the scope for that is very small XD

Copy link
Member

@manio143 manio143 left a comment

Choose a reason for hiding this comment

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

Looks good. One more comment about XML comment.
Hopefully this is a simple first step towards importing multiple animation assets.

/// Index for FbxAnimStack.
/// </summary>
/// <userdoc>
/// Index of animation to import if multiple are present in the FBX file
Copy link
Member

Choose a reason for hiding this comment

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

Can you adjust those comments, now that they're not FBX specific?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done! Yeah, I think something like the way material import from fbx is handled is very feasible.

Copy link
Member

Choose a reason for hiding this comment

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

@adrsch Did you not push after saying "Done"?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh... yeah I did forget to push. Oops...

…imationStack is supported by non-FBX formats
@tebjan
Copy link
Member

tebjan commented Oct 30, 2023

Looks good, a nice first step towards importing multiple at once.

@manio143 manio143 merged commit 5d2111a into stride3d:master Nov 2, 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.

3 participants