[ue] USpineWidget now reports its desired size.

This commit is contained in:
Mario Zechner 2023-08-03 13:09:51 +02:00
parent 3ae685fff5
commit 83fab4ad97
3 changed files with 16 additions and 5 deletions

View File

@ -539,6 +539,7 @@
* Added mix-and-match example to demonstrate the new Skin API.
* Materials on `SkeletonRendererComponent` are now blueprint read and writeable. This allows setting dynamic material instances at runtime.
* Added `InitialSkin` property to `USpineWidget`. This allows previewing different skins in the UMG Designer. Initial skins can still be overridden via blueprint events such as `On Initialized`.
* `USpineWidget` will now report its own desired size based on the setup pose dimensions of the skeleton. This is used when selecting `Size to content` on a `USpineWidget` in the designer.
## C# ##
* **Breaking changes**

View File

@ -228,6 +228,14 @@ void SSpineWidget::Flush(int32 LayerId, FSlateWindowElementList &OutDrawElements
Idx++;
}
FVector2D SSpineWidget::ComputeDesiredSize(float X) const {
if (widget && widget->skeleton && widget->Atlas) {
return FVector2D(boundsSize.X, boundsSize.Y);
} else {
return FVector2D(256, 256);
}
}
void SSpineWidget::UpdateMesh(int32 LayerId, FSlateWindowElementList &OutDrawElements, const FGeometry &AllottedGeometry, Skeleton *Skeleton) {
TArray<FVector> vertices;
TArray<int32> indices;

View File

@ -55,6 +55,8 @@ protected:
void Flush(int32 LayerId, FSlateWindowElementList &OutDrawElements, const FGeometry &AllottedGeometry, int &Idx, TArray<FVector> &Vertices, TArray<int32> &Indices, TArray<FVector2D> &Uvs, TArray<FColor> &Colors, TArray<FVector> &Colors2, UMaterialInstanceDynamic *Material);
virtual FVector2D ComputeDesiredSize(float) const override;
USpineWidget *widget;
FRenderData renderData;
FVector boundsMin;