• Runtimes
  • [UE] Spine widget render to use actual size

If I create a Spine actor, it will render the spine in its actual size. But if I create spine widget, and tick "size to content", it will render it in 1:1 aspect ratio. Now, If I have a short character and a tall character, and I tick "size to content" they will be at the same size.
Is there any method to widget render them in the proper size / aspect ratio?

Related Discussions
...

I'm afraid I don't quite follow what the issue is. Here's our UMG example, with and without the size to content flag set.


When you click "Size to Content", then the widget reports a desired size to the UI system. Our current widget implementation delegates that calculation to the SMeshWidget class from which it derrives. That uses a hardcoded value.

I've now implemented the desired size calculation for USpineWidget. You can update your copy of the spine-ue4 code from the 4.1 or 4.2-beta branches.

Thanks for reporting!

    Mario Yes, that is what I needed. Thanks for implementing it.

    I also have another question, is it possible to change the center / pivot point of the Spine widget to be like the actor?
    For example, as an actor the default pivot of the Raptor is at the feet. So if I put this in level at location xy 0, the feet will be at the center of the level right?

    But for widget, if I put it at position xy 0, it will render like this.

    Is there any way to make it like the pivot of the actor in the 1st image? So by default if I put the spine widget at the xy 0 position it will render like this?

    That's something you can do via alignement. In this case, I set the anchor to be a center anchor, then adjusted the alignement such that the anchor lines up with the skeleton's coordinate system origin.

    You can then press CTRL (CMD on macOS) to draw the anchor around, which will also drag the widget around.

    Thanks for replying.

    Yes, but is there any way to set it automatically in the code / blueprint as the default for the widget? If as an actor the default pivot is at the raptor's feet, is there any way to make the widget like that too? I guess there are variables that store the actor's default pivot xy location, because for every Spine animation actor, the default pivot location is different. For example, raptor's is at the feet, and dragon's is at the middle of the body.

    The problem is if I have plenty of Spine animation, I don't think it is a good idea to do make each of them a widget blueprint, then adjust it manually.

    Spine doesn't really have the concept of a pivot per se. It has a skeleton coordinate system with an origin around which the skeleton components are defined. Whether that origin coincides with the intended pivot for the skeleton is a different matter.

    For SkeletonRendererComponent, which you'd use if you aren't using UMG, the location of that skeleton origin coincides with the location of the actor the component is on.

    In UMG, things are different because of the way UMG works. It doesn't use the same concepts as you are used to in a "game" environment, but is geared towards UI like buttons etc. We can probably provide a function/Blueprint node that sets the alignement and anchor, but I can't think of a way to do this out of the box when you create a UMG SpineWidget. We simply do not know the sizes involved at initialization time, and once we render in the editor viewport, we have no idea if we are "allowed" to modify those properties, or if the user has already manipulated them.

    Is there a reason you are using UMG as if it was a 2D game engine instead of going with actors and components?

    I'm trying to make dialogue. Also I've figured out how to set the root at the center, but it needs to be added to viewport first like you said.
    It is from the SSpineWidget::SetData function. Half WH is BoundsSize / 2.
    Anyway, thanks for the help!