[ue4] Remove SpineWidget Scale property in favor of full support for the widget transform properties. Closes #1496.

This commit is contained in:
badlogic 2019-09-18 15:39:12 +02:00
parent 0ca78b6756
commit 3c6feff577
3 changed files with 7 additions and 5 deletions

View File

@ -18,12 +18,15 @@
* **Breaking Changes** * **Breaking Changes**
* **Additions** * **Additions**
* Removed dependency on STL throughout the code base, cutting down on the LOC that need parsing by 66%.
### Cocos2d-x ### Cocos2d-x
### SFML ### SFML
### UE4 ### UE4
* `SpineWidget` now supports the full widget transform, including rendering scale/shear.
* **Breaking changes**: `SpineWidget` no longer has the `Scale` property. Instead the size x/y properties can be used.
## C# ## ## C# ##
* **Breaking changes** * **Breaking changes**

View File

@ -171,12 +171,12 @@ void SSpineWidget::Flush(int32 LayerId, FSlateWindowElementList& OutDrawElements
if (Vertices.Num() == 0) return; if (Vertices.Num() == 0) return;
SSpineWidget* self = (SSpineWidget*)this; SSpineWidget* self = (SSpineWidget*)this;
const FVector2D widgetSize = AllottedGeometry.GetDrawSize(); const FVector2D widgetSize = AllottedGeometry.GetLocalSize();
const FVector2D sizeScale = widgetSize / FVector2D(boundsSize.X, boundsSize.Y); const FVector2D sizeScale = widgetSize / FVector2D(boundsSize.X, boundsSize.Y);
const float setupScale = sizeScale.GetMin(); const float setupScale = sizeScale.GetMin();
for (int i = 0; i < Vertices.Num(); i++) { for (int i = 0; i < Vertices.Num(); i++) {
Vertices[i] = (Vertices[i] + FVector(-boundsMin.X - boundsSize.X / 2, boundsMin.Y + boundsSize.Y / 2, 0)) * setupScale * widget->Scale + FVector(widgetSize.X / 2, widgetSize.Y / 2, 0); Vertices[i] = (Vertices[i] + FVector(-boundsMin.X - boundsSize.X / 2, boundsMin.Y + boundsSize.Y / 2, 0)) * setupScale + FVector(widgetSize.X / 2, widgetSize.Y / 2, 0);
} }
self->renderData.IndexData.SetNumUninitialized(Indices.Num()); self->renderData.IndexData.SetNumUninitialized(Indices.Num());
@ -189,9 +189,10 @@ void SSpineWidget::Flush(int32 LayerId, FSlateWindowElementList& OutDrawElements
FSlateVertex* vertexData = (FSlateVertex*)renderData.VertexData.GetData(); FSlateVertex* vertexData = (FSlateVertex*)renderData.VertexData.GetData();
FVector2D offset = AllottedGeometry.AbsolutePosition; FVector2D offset = AllottedGeometry.AbsolutePosition;
FColor white = FColor(0xffffffff); FColor white = FColor(0xffffffff);
const FSlateRenderTransform& Transform = AllottedGeometry.GetAccumulatedRenderTransform();
for (size_t i = 0; i < (size_t)Vertices.Num(); i++) { for (size_t i = 0; i < (size_t)Vertices.Num(); i++) {
setVertex(&vertexData[i], Vertices[i].X, Vertices[i].Y, Uvs[i].X, Uvs[i].Y, Colors[i], offset); setVertex(&vertexData[i], 0, 0, Uvs[i].X, Uvs[i].Y, Colors[i], Transform.TransformPoint(FVector2D(Vertices[i])));
} }
brush = &widget->Brush; brush = &widget->Brush;

View File

@ -51,8 +51,6 @@ public:
#if WITH_EDITOR #if WITH_EDITOR
virtual const FText GetPaletteCategory() override; virtual const FText GetPaletteCategory() override;
#endif #endif
UPROPERTY(Category = Spine, EditAnywhere, BlueprintReadWrite)
float Scale = 1;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Spine) UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Spine)
USpineAtlasAsset* Atlas; USpineAtlasAsset* Atlas;