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 animation slices for individual animations #40274

Merged
merged 2 commits into from
Oct 11, 2022

Conversation

Juankz
Copy link
Contributor

@Juankz Juankz commented Jul 11, 2020

The clips method only worked if the imported model had an animation named "default". This PR allows clips to be created no matter what the one-track animation name is.

This closes my other PR #36709.

Bugsquad edit:

@Juankz Juankz force-pushed the clips_importing_improvement branch 2 times, most recently from 0343e19 to 824b668 Compare July 11, 2020 15:30
@Juankz
Copy link
Contributor Author

Juankz commented Jul 11, 2020

I attach a sample project anim-clips.zip

@akien-mga akien-mga requested a review from reduz July 14, 2020 07:54
@noidexe
Copy link
Contributor

noidexe commented Sep 17, 2020

Is this merged on stable? Any ETAs?

@akien-mga
Copy link
Member

Well this needs a review from @reduz who is more familiar with animation workflow.

For what it's worth, while I see value in allowing the use of other default animations than one named "default", I don't like that it arbitrarily picks the first one. It's a valid workflow to actually have an animation named "default", which may not be the first one, but which you want to be used as default.

@noidexe
Copy link
Contributor

noidexe commented Sep 17, 2020

I don't like that it arbitrarily picks the first one.

Me neither but I've noticed more than one animator struggling with this and it seems that when using clips having one animation is the most common use case, while having it named "default" isn't, but rather the default named assigned by the 3dcg sofware.

The engine doesn't report any error when you try to clip with a different name, it just creates the wrong animations, so it becomes a RTFM moment for the integrator/animator.

If you a dozen of purchased assets it means re exporting every one of those which might even involve getting the software and learning how to do it in what would otherwise work by default.

I think a way it can work without breaking the workflow of those who are following the docs would be the following:

  • If there is an animation named 'default' use that for clipping
  • Otherwise use the first one as a fallback rather than failing

That would work well for people explicitly using "default" as well as for assets with only one animation with whatever name.

@YuriSizov YuriSizov requested a review from a team August 24, 2021 23:26
@fire
Copy link
Member

fire commented Aug 25, 2021

The clips method only worked if the imported model had an animation named "default".

I can sense the usefulness of using the first track if it isn't named "default". However, the usage of "default" when there there are two tracks needs to be designed.

@reduz
Copy link
Member

reduz commented Jul 28, 2022

Is this still the case in 4.0?

@Juankz
Copy link
Contributor Author

Juankz commented Sep 5, 2022

I haven't been able to use clips successfully in master branch with the test model I attached above. It keeps being imported as one animation track

@YuriSizov
Copy link
Contributor

YuriSizov commented Sep 8, 2022

@godotengine/animation Can you confirm if this is still needed? And review, if it is :)

@TokageItLab
Copy link
Member

I think it is good, but @fire is the best judge of this feature.

@fire
Copy link
Member

fire commented Sep 8, 2022

Common workflow is to use one track and then split. Very wanted

@YuriSizov
Copy link
Contributor

Right, then this needs a rebase and a review.

@reduz
Copy link
Member

reduz commented Oct 10, 2022

This makes sense, would be good to salvage.

@Juankz
Copy link
Contributor Author

Juankz commented Oct 10, 2022

I'll take another look into it

This improves the workflow for animations in a single timeline.
The users are no longer forced to slice one animation named "default".
Instead users can choose which animation(s) to break and how.

Changes:

- Remove slicing options from the animation player import menu
- Add such options to the animation import menu
- Rename clips to slices wherever was left
@Juankz Juankz force-pushed the clips_importing_improvement branch from 824b668 to 8ad3f8f Compare October 10, 2022 23:55
@Juankz Juankz requested a review from a team as a code owner October 10, 2022 23:55
@Juankz
Copy link
Contributor Author

Juankz commented Oct 11, 2022

All right. Here's what I did:

  • Remove slicing options from the animation player import menu
  • Add such options to the animation import menu
  • Rename clips to slices wherever was left to be done. This was actually breaking the current workflow.

So the import menu looks like this.
Screenshot_20221010_191153

Now instead of using "default" or picking arbitrarily the first one, the user can decide which animation to slice.

Here for example there are two timelines that needed slicing: One the body movement and another for facial animations. Such workflow is now possible with this PR.

6344baf567c46316572123

Here is my demo project. Let me know what you think:
AnimationSlicesDemo.tar.gz

@Juankz Juankz changed the title Replace "default" for any animation name when importing clips Add animation slices for individual animations Oct 11, 2022
Copy link
Member

@fire fire left a comment

Choose a reason for hiding this comment

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

40274-sample.mp4

The animation slice feature works like this:

  1. for each animation ".anim" we have slices
  2. You can set the slice to 0, the clips in the files or some number.
  3. The point of this feature is for each "clip" you can remix the slices order and naming based on the frame count.
  4. When the number is less, less clips are output
  5. When the number is equal, there is no splitting
  6. When it is more, clips are invented.
  7. Might want to have a reset to default number of slices.

This is a feature review. Need to review the code.

bool save_to_file = p_clips[i + 4];
String save_to_path = p_clips[i + 5];
bool keep_current = p_clips[i + 6];
for (int i = 0; i < p_slices.size(); i += 7) {
Copy link
Member

Choose a reason for hiding this comment

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

What does 7 mean, can you make it a named constant and the same with the ones below?

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 didn't touch most of the slicing logic, I just updated the variable names. I see it's 7 because each slice contains 7 import options. But it was like that before. I can refactor it once I get some more free time. Also I would like to see if there are more comments on this PR.

@akien-mga akien-mga merged commit 042e81f into godotengine:master Oct 11, 2022
@akien-mga
Copy link
Member

akien-mga commented Oct 11, 2022

Thanks! And congrats for your first merged Godot contribution 🎉

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.

Godot 4 won't respect animation list Splitting animation clips on 3d model doesn't work.
10 participants