gd_cubism icon indicating copy to clipboard operation
gd_cubism copied to clipboard

Load motions as resources and use AnimationPlayer for control

Open erodozer opened this issue 10 months ago • 2 comments

Proposed Enhancement:

Similar to Unity, Godot has its own Animation system and timeline support that users should be leveraging for reproducible playback of motions. Native Cubism SDK comes with its own implementation, but it has a few shortcomings. To make Live2D resources feel more natural within Godot's workflow, motion playback should be controlled using Godot's own tooling and process cycles.

By converting motion files to Godot animations through a resource importer, it is also possible to take advantage of Godot's AnimationPlayer features that aren't reproduced in the Live2D SDK.

By being able to load motions as resources, we get the benefit of

  • being able to load motions from anywhere by being in control of the loading, instead of at the mercy of the SDK's rules
  • we can reuse motions between models that share common base rigging patterns
  • enhanced control of motion playback by control through Godot's Animation APIs
  • visual examination of the animation timeline within the Godot editor
  • resource caching and improved load speeds

Once motions are managed by Godot, we should remove exposing the motion API of the SDK.

Use Case:

The Cubism SDK when loading motions can only load ones defined in the model file. I have many Live2D models that do not have their motions bound in the model definition file. These are mostly models made with the intent of use with Vtube Studio. I need these models to be usable in Godot with no modification to them. As such, I need a way to load the motions without it being tied directly to the SDK.

Another thing I've noticed is some models end up having animations in a subfolder, others just dumped directly beside the model file. A trick I've looked into is walking the model's directory for detecting additional motions. I don't know if it would be recommended to have this kind of behavior out of the box in gd_cubism, bit it's been useful for my case in creating a comprehensive AnimationLibrary.

erodozer avatar Feb 09 '25 05:02 erodozer

Maybe it's worth creating a separate class for more advanced users, and leaving the old loading functions

JekSun97 avatar Feb 17 '25 13:02 JekSun97

After reading the related pull requests for this proposal, I understood that it aims to enable the Godot Engine to handle Live2D motion data using its built-in AnimationPlayer.

As for me, I believe that the current motions and expressions should remain as they are, with the standard implementation provided by the official source.

Therefore, instead of switching to a new method, it would be better to have the GDCubismUserModel dedicated solely to rendering when using this feature.

I was just testing the pull request and have created a pull request with a solution for the parts that are likely to cause issues.

MizunagiKB avatar Mar 02 '25 04:03 MizunagiKB