godot-proposals icon indicating copy to clipboard operation
godot-proposals copied to clipboard

Refactor SkeletonModificationStack2D and SkeletonModifier2D* to Node2Ds

Open beicause opened this issue 7 months ago • 3 comments

Describe the project you are working on

A 2D game with heavy use of 2D skeletons.

Describe the problem or limitation you are having in your project

Current 2D skeleton modifications are resources, which is not a good design and has some bugs (see https://github.com/godotengine/godot/issues?q=is%3Aissue+is%3Aopen+skeleton+modification+2d). And it's not convinent to use or extend them since they are nested resources.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

As disscussed in https://github.com/godotengine/godot-proposals/issues/4863 and https://github.com/godotengine/godot/pull/71137

In the first place, it was pointed out that the ModificationStack as a resource is out of favor with Godot's design. It should not have an API for IK within the Skeleton class. By separating it from the Skeleton by making it a Node, it may be easier to share settings among multiple Skeletons and prioritize them with animations. At the very least, ModificationStack2D being a Resource is "not make sense" and "needs to be fixed". So, it should still keep being experimental and definitely needs to be ported as a Node in the future.

Refactoring the 2D skeleton modifications to Nodes is expected to fix these bugs above and improve usability, paving the way for future improvements in 2D skeleton modifiers.

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

Remove SkeletonModificationStack2D, implement SkeletonModifier2D that retrieves its Skeleton2D parent and applies modification, like SkeletonModifier3D and PhysicalBoneSimulator3D. And extend it to implement other modifiers such as IK and 2D physical bones.

If this enhancement will not be used often, can it be worked around with a few lines of script?

No, this needs lots of work if we start from scratch.

Is there a reason why this should be core and not an add-on in the asset library?

Skeleton2D is core.

beicause avatar Jul 19 '24 06:07 beicause