godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
91.12k stars 21.18k forks source link

Support Animations Stored Separately from Skinned Meshes #15560

Closed Cygon closed 4 years ago

Cygon commented 6 years ago

Godot version: 3.0 beta 2 (source build from 1748ce74cc10fd0bf79f3258f74509e5ad8cc4f7) OS/device including version: Gentoo Linux, Kernel 4.14.8, KDE 5, GTX 1080, NVidia drivers 387.22

Problem: An average game project usually needs dozens (if not hundreds) of animation clips for each individual character. Exporting these animations from Maya or Blender also takes a long time, so to improve iteration times (and to enable simultaneous editing), animations are commonly stored in separate files.

For example: dude.dae (original model), dude.acrobatics.dae (animations), dude.fighting.dae (animations)

Godot currently provides no automated way to handle these libraries. The only possible workflow is to import the character model and animations individually:

Individual Scenes in Godot

...and then use the copy and paste functionality of the AnimationPlayer to manually copy the animations into the character model's AnimationPlayer:

Copy and Paste in AnimationPlayer

Existing Solutions: Other engines have solved this as follows:

In Unity, it is possible to select the "Avatar" (= bone hierarchy) of the character model when importing an animation library. The animations will then reference the original bones and all animations can be used as if they had been in the character model's original file.

Reuse Avatar in Unity

In Unreal Engine 4, upon importing, the user can select an existing "Skeleton" to use when importing an animation library. The animations will then be assigned to the character model's original skeleton and can be used in the character's animation state machine.

Reuse Skeleton in Unreal Engine

Possible Implementations: I can think of several possible ways to implement this in Godot engine:

  1. Provide a MergedAnimationPlayer (or similar) that allows multiple other AnimationPlayers to be referenced and merges their animations

  2. Extend the AnimationPlayer so extra animations can be imported from other model files (i.e. by adding an 'ExtraAnimationSource' list referencing animation tracks like 'res://dude.acrobatics.dae::14' to include

  3. Provide external tooling so the copy and paste operation can somehow be automated

blurymind commented 6 years ago

Yes, this is one of 3d animation's biggest advantages for gamedev - animation reusal is must have!

ghost commented 6 years ago

how did you export the bone structure so you can animate it in Godot animation player

Cygon commented 6 years ago

In response to @trollworkout:

When I export a mesh w/bones from Blender (I used the Better Collada exporter), Godot 3.0 imports the .dae file as a scene including a Skeleton node and an AnimationPlayer node that is pre-filled with all animations exported from Blender.

It seems an AnimationPlayer with transform tracks using paths like SomeSkeletonNode:BoneName allows addressing of individual bone transforms in a Skeleton node.

Editing character animation tracks inside Godot is not feasible, however - you can edit bone keyframes by entering translation/rotation values by hand, but there's no move/rotate widgets in the editor view, no IK and the entire bone hierarchy has been flattened (= if you rotate the hips, chest and head don't follow.)

I'm using scripts to automate the exporting, but my export settings should match these: Blender Export Settings with Animations

tmathews commented 6 years ago

Any updates on this?

PepticPaladin commented 5 years ago

This would be super useful when downloading animations from Mixamo

JosephCatrambone commented 5 years ago

I was trying to support this via a BVH importer (with remapping), but I'm stuck on bugs in it. Here's the code so far: https://github.com/josephcatrambone/godot-bvh-import

It's possible, if nontrivial, to use the Godot Exporter in Blender and just export the armature with animations. You can then move them between scenes via the animation's copy/paste mechanism.

Calinou commented 4 years ago

Feature and improvement proposals for the Godot Engine are now being discussed and reviewed in a dedicated Godot Improvement Proposals (GIP) (godotengine/godot-proposals) issue tracker. The GIP tracker has a detailed issue template designed so that proposals include all the relevant information to start a productive discussion and help the community assess the validity of the proposal for the engine.

The main (godotengine/godot) tracker is now solely dedicated to bug reports and Pull Requests, enabling contributors to have a better focus on bug fixing work. Therefore, we are now closing all older feature proposals on the main issue tracker.

If you are interested in this feature proposal, please open a new proposal on the GIP tracker following the given issue template (after checking that it doesn't exist already). Be sure to reference this closed issue if it includes any relevant discussion (which you are also encouraged to summarize in the new proposal). Thanks in advance!