[ue4] Skeletons in SpineWidget are centered now. Closes #1329.

This commit is contained in:
badlogic 2019-04-17 16:28:25 +02:00
parent d337f587b7
commit 145aaf27ce
8 changed files with 3532 additions and 2365 deletions

Binary file not shown.

View File

@ -1,250 +1,271 @@
raptor.png
size: 1022,1022
size: 1024,512
format: RGBA8888
filter: Linear,Linear
repeat: none
back_arm
back-arm
rotate: false
xy: 410, 545
size: 46, 29
orig: 46, 29
xy: 895, 295
size: 46, 25
orig: 46, 25
offset: 0, 0
index: -1
back_bracer
rotate: false
xy: 540, 548
back-bracer
rotate: true
xy: 992, 216
size: 39, 28
orig: 39, 28
offset: 0, 0
index: -1
back_hand
rotate: true
xy: 504, 538
back-hand
rotate: false
xy: 594, 58
size: 36, 34
orig: 36, 34
offset: 0, 0
index: -1
back_knee
rotate: false
xy: 299, 478
back-knee
rotate: true
xy: 729, 86
size: 49, 67
orig: 49, 67
offset: 0, 0
index: -1
back_thigh
rotate: true
xy: 140, 247
back-thigh
rotate: false
xy: 379, 2
size: 39, 24
orig: 39, 24
offset: 0, 0
index: -1
eyes_open
eyes-open
rotate: true
xy: 2, 2
xy: 902, 194
size: 47, 45
orig: 47, 45
offset: 0, 0
index: -1
front_arm
front-arm
rotate: false
xy: 360, 544
size: 48, 30
orig: 48, 30
xy: 945, 306
size: 48, 26
orig: 48, 26
offset: 0, 0
index: -1
front_bracer
front-bracer
rotate: false
xy: 538, 578
xy: 949, 197
size: 41, 29
orig: 41, 29
offset: 0, 0
index: -1
front_hand
front-hand
rotate: false
xy: 538, 609
xy: 949, 266
size: 41, 38
orig: 41, 38
offset: 0, 0
index: -1
front_open_hand
front-open-hand
rotate: false
xy: 894, 782
xy: 875, 148
size: 43, 44
orig: 43, 44
offset: 0, 0
index: -1
front_thigh
rotate: false
xy: 942, 849
front-thigh
rotate: true
xy: 793, 171
size: 57, 29
orig: 57, 29
offset: 0, 0
index: -1
gun
rotate: false
xy: 785, 774
rotate: true
xy: 379, 28
size: 107, 103
orig: 107, 103
offset: 0, 0
index: -1
gun_nohand
gun-nohand
rotate: false
xy: 614, 703
xy: 487, 87
size: 105, 102
orig: 105, 102
offset: 0, 0
index: -1
head
rotate: false
xy: 2, 137
xy: 807, 361
size: 136, 149
orig: 136, 149
offset: 0, 0
index: -1
lower_leg
rotate: true
xy: 780, 699
lower-leg
rotate: false
xy: 827, 195
size: 73, 98
orig: 73, 98
offset: 0, 0
index: -1
mouth_smile
mouth-grind
rotate: true
xy: 49, 2
xy: 920, 145
size: 47, 30
orig: 47, 30
offset: 0, 0
index: -1
mouth-smile
rotate: true
xy: 992, 257
size: 47, 30
orig: 47, 30
offset: 0, 0
index: -1
neck
rotate: true
xy: 1001, 860
rotate: false
xy: 359, 114
size: 18, 21
orig: 18, 21
offset: 0, 0
index: -1
raptor_arm_back
raptor-back-arm
rotate: false
xy: 940, 936
xy: 653, 142
size: 82, 86
orig: 82, 86
offset: 0, 0
index: -1
raptor_body
raptor-body
rotate: false
xy: 2, 737
size: 610, 285
orig: 610, 285
xy: 2, 277
size: 632, 233
orig: 632, 233
offset: 0, 0
index: -1
raptor_front_arm
raptor-front-arm
rotate: true
xy: 195, 464
xy: 484, 4
size: 81, 102
orig: 81, 102
offset: 0, 0
index: -1
raptor_front_leg
raptor-front-leg
rotate: false
xy: 2, 478
xy: 2, 18
size: 191, 257
orig: 191, 257
offset: 0, 0
index: -1
raptor_hindleg_back
raptor-hindleg-back
rotate: false
xy: 614, 807
xy: 636, 295
size: 169, 215
orig: 169, 215
offset: 0, 0
index: -1
raptor_horn
raptor-horn
rotate: false
xy: 360, 655
xy: 195, 22
size: 182, 80
orig: 182, 80
offset: 0, 0
index: -1
raptor_horn_back
rotate: false
xy: 360, 576
raptor-horn-back
rotate: true
xy: 945, 334
size: 176, 77
orig: 176, 77
offset: 0, 0
index: -1
raptor_jaw
raptor-jaw
rotate: false
xy: 785, 879
size: 153, 143
orig: 153, 143
xy: 359, 137
size: 126, 138
orig: 126, 138
offset: 0, 0
index: -1
raptor_saddle_noshadow
rotate: false
xy: 2, 288
size: 163, 188
orig: 163, 188
offset: 0, 0
index: -1
raptor_saddle_strap_front
rotate: false
xy: 721, 710
size: 57, 95
orig: 57, 95
offset: 0, 0
index: -1
raptor_saddle_strap_rear
raptor-jaw-tooth
rotate: true
xy: 940, 880
xy: 895, 322
size: 37, 48
orig: 37, 48
offset: 0, 0
index: -1
raptor-mouth-inside
rotate: true
xy: 949, 228
size: 36, 41
orig: 36, 41
offset: 0, 0
index: -1
raptor-saddle-strap-back
rotate: true
xy: 653, 86
size: 54, 74
orig: 54, 74
offset: 0, 0
index: -1
raptor_saddle_w_shadow
raptor-saddle-strap-front
rotate: false
xy: 195, 547
size: 163, 188
orig: 163, 188
xy: 594, 94
size: 57, 95
orig: 57, 95
offset: 0, 0
index: -1
raptor_tongue
rotate: true
xy: 544, 649
raptor-saddle-w-shadow
rotate: false
xy: 195, 104
size: 162, 171
orig: 162, 171
offset: 0, 0
index: -1
raptor-tail-shadow
rotate: false
xy: 636, 230
size: 189, 63
orig: 189, 63
offset: 0, 0
index: -1
raptor-tongue
rotate: false
xy: 807, 295
size: 86, 64
orig: 86, 64
offset: 0, 0
index: -1
stirrup_back
rotate: false
xy: 458, 539
stirrup-back
rotate: true
xy: 952, 151
size: 44, 35
orig: 44, 35
offset: 0, 0
index: -1
stirrup_front
rotate: true
xy: 81, 4
stirrup-front
rotate: false
xy: 902, 243
size: 45, 50
orig: 45, 50
offset: 0, 0
index: -1
stirrup_strap
rotate: true
xy: 894, 828
stirrup-strap
rotate: false
xy: 824, 147
size: 49, 46
orig: 49, 46
offset: 0, 0
index: -1
torso
rotate: true
xy: 610, 647
rotate: false
xy: 737, 137
size: 54, 91
orig: 54, 91
offset: 0, 0
index: -1
visor
rotate: false
xy: 2, 51
xy: 487, 191
size: 131, 84
orig: 131, 84
offset: 0, 0

File diff suppressed because one or more lines are too long

Binary file not shown.

Before

Width:  |  Height:  |  Size: 487 KiB

After

Width:  |  Height:  |  Size: 469 KiB

View File

@ -172,9 +172,11 @@ void SSpineWidget::Flush(int32 LayerId, FSlateWindowElementList& OutDrawElements
SSpineWidget* self = (SSpineWidget*)this;
const FVector2D widgetSize = AllottedGeometry.GetDrawSize();
const float setupScale = (widgetSize / FVector2D(boundsSize.X, boundsSize.Y)).GetMin();
const FVector2D sizeScale = widgetSize / FVector2D(boundsSize.X, boundsSize.Y);
const float setupScale = sizeScale.GetMin();
for (int i = 0; i < Vertices.Num(); i++) {
Vertices[i] = (Vertices[i] - FVector(boundsMin.X, -(boundsMin.Y + boundsSize.Y), 0)) * setupScale * widget->Scale;
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);
}
self->renderData.IndexData.SetNumUninitialized(Indices.Num());
@ -186,9 +188,6 @@ void SSpineWidget::Flush(int32 LayerId, FSlateWindowElementList& OutDrawElements
FVector2D offset = AllottedGeometry.AbsolutePosition;
FColor white = FColor(0xffffffff);
float width = AllottedGeometry.GetAbsoluteSize().X;
float height = AllottedGeometry.GetAbsoluteSize().Y;
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);
}