Merge branch 'master' of https://github.com/esotericsoftware/spine-runtimes
@ -1,5 +1,5 @@
|
||||
{
|
||||
"skeleton": { "hash": "V4Hi+nECzrockiU2TB2cDcvEn38", "spine": "3.4.00", "width": 0, "height": 0, "images": "./images/" },
|
||||
"skeleton": { "hash": "V4Hi+nECzrockiU2TB2cDcvEn38", "spine": "3.4.00", "width": 365.8, "height": 429.96, "images": "./images/" },
|
||||
"bones": [
|
||||
{ "name": "root" },
|
||||
{ "name": "hip", "parent": "root", "x": -8.17, "y": 73.5, "color": "fff200ff" },
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
{
|
||||
"skeleton": { "hash": "9MKo2cmJTDc3IPV4B3LRJxWbl04", "spine": "3.4.00", "width": 0, "height": 0, "images": "./images/" },
|
||||
"skeleton": { "hash": "9MKo2cmJTDc3IPV4B3LRJxWbl04", "spine": "3.4.00", "width": 897, "height": 716.36, "images": "./images/" },
|
||||
"bones": [
|
||||
{ "name": "root", "y": -176.12 },
|
||||
{ "name": "COG", "parent": "root", "y": 176.12 },
|
||||
|
||||
@ -10,6 +10,7 @@ del /q ..\speedy\export\*
|
||||
del /q ..\spineboy\export\*
|
||||
del /q ..\spineboy-old\export\*
|
||||
del /q ..\spinosaurus\export\*
|
||||
del /q ..\stretchyman\export\*
|
||||
del /q ..\raptor\export\*
|
||||
del /q ..\tank\export\*
|
||||
del /q ..\vine\export\*
|
||||
@ -68,6 +69,11 @@ echo Exporting...
|
||||
-i ../spinosaurus/spinosaurus.spine -o ../spinosaurus/export -e json.json ^
|
||||
-i ../spinosaurus/spinosaurus.spine -o ../spinosaurus/export -e binary.json ^
|
||||
|
||||
-i ../stretchyman/stretchyman.spine -o ../stretchyman/export -e json.json ^
|
||||
-i ../stretchyman/stretchyman.spine -o ../stretchyman/export -e binary.json ^
|
||||
-i ../stretchyman/images -o ../stretchyman/export -n stretchyman -p atlas-1.0.json ^
|
||||
-i ../stretchyman/images -o ../stretchyman/export -n stretchyman-pma -p atlas-1.0-pma.json ^
|
||||
|
||||
-i ../raptor/raptor.spine -o ../raptor/export -e json.json ^
|
||||
-i ../raptor/raptor.spine -o ../raptor/export -e binary.json ^
|
||||
-i ../raptor/images -o ../raptor/export -n raptor -p atlas-0.5.json ^
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
{
|
||||
"skeleton": { "hash": "P7CQ4ImK+tcAICATgSttlZ5HOSM", "spine": "3.4.00", "width": 0, "height": 0, "images": "./images/" },
|
||||
"skeleton": { "hash": "3Z6FWT/Kylgd8cbSWBEwAsOcPEM", "spine": "3.4.00", "width": 266.87, "height": 349.55, "images": "./images/" },
|
||||
"bones": [
|
||||
{ "name": "root" },
|
||||
{ "name": "hip", "parent": "root", "x": 0.64, "y": 114.41 },
|
||||
@ -55,7 +55,7 @@
|
||||
"spear": {
|
||||
"type": "mesh",
|
||||
"uvs": [ 1, 0.11236, 0.77096, 0.13278, 0.76608, 0.21781, 0.75642, 0.386, 0.74723, 0.54607, 0.72117, 1, 0.28838, 1, 0.24208, 0.54327, 0.22589, 0.38361, 0.2089, 0.21605, 0.20043, 0.13242, 0, 0.11519, 0.4527, 0, 0.58399, 0 ],
|
||||
"triangles": [ 4, 7, 3, 6, 7, 4, 5, 6, 4, 10, 11, 12, 1, 13, 0, 12, 13, 1, 10, 12, 1, 9, 10, 1, 2, 9, 1, 8, 9, 2, 3, 8, 2, 7, 8, 3 ],
|
||||
"triangles": [ 5, 6, 4, 6, 7, 4, 4, 7, 3, 2, 9, 1, 9, 10, 1, 10, 12, 1, 12, 13, 1, 1, 13, 0, 10, 11, 12, 3, 8, 2, 8, 9, 2, 7, 8, 3 ],
|
||||
"vertices": [ 1, 20, 38.54, -10.88, 1, 1, 20, 30.97, -5.93, 1, 2, 19, 61.48, -5.58, 0.5116, 20, -0.31, -6.16, 0.48839, 2, 18, 64.73, -5.03, 0.50272, 19, -0.4, -5.06, 0.49728, 1, 10, 4.56, 23.91, 1, 1, 10, 41.7, -138.95, 1, 1, 10, 32.41999, -141.1, 1, 1, 10, -6.49, 22.4, 1, 2, 18, 65.48, 6.64, 0.50272, 19, 0.52999, 6.59, 0.49728, 2, 19, 62.18, 6.66, 0.5116, 20, 0.2, 6.09, 0.48839, 1, 20, 30.96, 6.61, 1, 1, 20, 37.25999, 11.09, 1, 1, 20, 79.75, 1.59, 1, 1, 20, 79.78, -1.29, 1 ],
|
||||
"hull": 14,
|
||||
"edges": [ 24, 22, 22, 20, 10, 12, 2, 0, 24, 26, 0, 26, 8, 10, 12, 14, 6, 8, 14, 16, 2, 4, 4, 6, 16, 18, 18, 20, 20, 2 ],
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
{
|
||||
"skeleton": { "hash": "XWev9W//Ru9qTfd6z9xOs5YG8F0", "spine": "3.4.00", "width": 0, "height": 0, "images": "./images/" },
|
||||
"skeleton": { "hash": "XWev9W//Ru9qTfd6z9xOs5YG8F0", "spine": "3.4.00", "width": 234.01, "height": 354.84, "images": "./images/" },
|
||||
"bones": [
|
||||
{ "name": "root" },
|
||||
{ "name": "hip", "parent": "root", "x": 0.64, "y": 114.41 },
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
{
|
||||
"skeleton": { "hash": "LuvsC/99prpPdtD87iWNAg526z8", "spine": "3.4.00", "width": 0, "height": 0, "images": "./images/" },
|
||||
"skeleton": { "hash": "9LrmMaI967fC0/XZwO4Ntbo7Ww8", "spine": "3.4.00", "width": 318.71, "height": 333.7, "images": "./images/" },
|
||||
"bones": [
|
||||
{ "name": "root" },
|
||||
{ "name": "Hip", "parent": "root", "y": 94.88 },
|
||||
@ -94,7 +94,7 @@
|
||||
"cape": {
|
||||
"type": "mesh",
|
||||
"uvs": [ 0.1298, 0.04145, 0.25, 0, 0.5, 0, 0.75, 0, 1, 0, 0.94074, 0.25, 0.90405, 0.5, 0.90969, 0.75259, 0.82336, 1, 0.55643, 1, 0.28104, 1, 0, 1, 0, 0.75518, 0.02821, 0.5, 0.05926, 0.25, 0.25, 0.25, 0.25, 0.5, 0.25, 0.75, 0.5, 0.25, 0.5, 0.5, 0.5, 0.75, 0.75, 0.25, 0.75, 0.5, 0.75, 0.75 ],
|
||||
"triangles": [ 20, 22, 23, 23, 6, 7, 12, 13, 17, 11, 12, 17, 10, 17, 20, 11, 17, 10, 9, 20, 23, 10, 20, 9, 8, 23, 7, 9, 23, 8, 13, 16, 17, 17, 19, 20, 14, 15, 16, 13, 14, 16, 16, 18, 19, 19, 21, 22, 17, 16, 19, 20, 19, 22, 23, 22, 6, 0, 1, 15, 14, 0, 15, 15, 2, 18, 18, 3, 21, 16, 15, 18, 19, 18, 21, 6, 22, 21, 5, 6, 21, 15, 1, 2, 18, 2, 3, 5, 21, 3, 4, 5, 3 ],
|
||||
"triangles": [ 9, 23, 8, 8, 23, 7, 10, 20, 9, 9, 20, 23, 11, 17, 10, 10, 17, 20, 11, 12, 17, 12, 13, 17, 23, 6, 7, 20, 22, 23, 17, 19, 20, 13, 16, 17, 23, 22, 6, 20, 19, 22, 17, 16, 19, 19, 21, 22, 16, 18, 19, 13, 14, 16, 14, 15, 16, 5, 6, 21, 6, 22, 21, 19, 18, 21, 16, 15, 18, 18, 3, 21, 15, 2, 18, 14, 0, 15, 0, 1, 15, 4, 5, 3, 5, 21, 3, 18, 2, 3, 15, 1, 2 ],
|
||||
"vertices": [ 2, 12, -71.4, 10.27, 0.46604, 13, -9.13, -72.39, 0.53394, 2, 12, -47.49, 12.58, 0.68358, 13, -16.73, -49.61, 0.31641, 1, 12, -10.99, 12.58, 1, 1, 12, 25.5, 12.58, 1, 1, 12, 62, 12.58, 1, 5, 12, 62, -27.16, 0.46827, 13, -2.49, 66, 0.34919, 14, -29.04, 67.26, 0.138, 15, -57.05, 68.86, 0.03802, 16, -83.3, 76.26, 0.0065, 5, 12, 62, -66.91, 0.10393, 13, 36.24, 74.89, 0.24994, 14, 10.01, 74.62, 0.32221, 15, -17.77, 74.99, 0.22166, 16, -43.64, 78.98, 0.10223, 5, 12, 62, -106.66, 0.00721, 13, 74.98, 83.79, 0.07037, 14, 49.07, 81.98, 0.23464, 15, 21.49, 81.11, 0.35566, 16, -3.99, 81.69, 0.3321, 4, 13, 121.89, 57.11, 6.8E-4, 14, 94.89, 53.47, 0.03735, 15, 66.39, 51.18, 0.18593, 16, 38.16, 48, 0.77602, 3, 14, 101.65, 17.6, 1.8E-4, 15, 72.01999, 15.11, 0.0066, 16, 40.65, 11.58, 0.9932, 2, 15, 77.64, -20.94, 0.05302, 16, 43.15, -24.82, 0.94697, 3, 14, 115.16, -54.13, 0.00351, 15, 83.26999, -57, 0.13964, 16, 45.65, -61.23, 0.85684, 4, 13, 107.65, -58.5, 0.02404, 14, 76.1, -61.49, 0.08882, 15, 43.99, -63.13, 0.31703, 16, 5.99, -63.95, 0.57009, 5, 12, -83.99, -66.91, 0.00248, 13, 68.91, -67.39, 0.18233, 14, 37.04, -68.85, 0.31987, 15, 4.71999, -69.26, 0.35134, 16, -33.66, -66.67, 0.14396, 5, 12, -80.23, -27.03, 0.05345, 13, 29.2, -72.66, 0.47788, 14, -2.84, -72.54, 0.33484, 15, -35.25999, -71.69, 0.12468, 16, -73.69999, -65.65, 0.00913, 5, 12, -47.49, -27.16, 0.04861, 13, 22, -40.71, 0.52446, 14, -8.77, -40.34, 0.34709, 15, -40.16999, -39.32, 0.07735, 16, -75.81, -32.98, 0.00247, 4, 13, 60.74, -31.82, 0.12714, 14, 30.28, -32.98, 0.45018, 15, -0.9, -33.18999, 0.37754, 16, -36.15, -30.26, 0.04511, 4, 13, 99.48, -22.92, 0.00851, 14, 69.33999, -25.62, 0.04332, 15, 38.37, -27.07, 0.37472, 16, 3.49, -27.54, 0.57342, 1, 13, 13.83, -5.14, 1, 2, 14, 23.52, 2.88, 0.74116, 15, -6.52, 2.86, 0.25883, 3, 14, 62.59, 10.24, 0.01792, 15, 32.74, 8.99, 0.48072, 16, 1, 8.87, 0.50133, 5, 12, 25.5, -27.16, 0.37653, 13, 5.66, 30.42, 0.49807, 14, -22.29, 31.39, 0.10748, 15, -51.42, 32.8, 0.01629, 16, -80.8, 39.84, 0.0016, 5, 12, 25.5, -66.91, 0.05159, 13, 44.41, 39.32, 0.2736, 14, 16.77, 38.75, 0.45121, 15, -12.15, 38.91999, 0.18086, 16, -41.15, 42.56, 0.0427, 5, 12, 25.5, -106.66, 1.7E-4, 13, 83.15, 48.21, 0.01708, 14, 55.83, 46.11, 0.12238, 15, 27.12, 45.05, 0.35747, 16, -1.49, 45.28, 0.50287 ],
|
||||
"hull": 15,
|
||||
"edges": [ 0, 2, 2, 4, 4, 6, 6, 8, 8, 10, 10, 12, 12, 14, 16, 18, 18, 20, 20, 22, 22, 24, 24, 26, 26, 28, 28, 0, 14, 16 ],
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
{
|
||||
"skeleton": { "hash": "G8Hn+I+pLLpQJV630iP0YYkYAHQ", "spine": "3.4.00", "width": 0, "height": 0, "images": "./images/" },
|
||||
"skeleton": { "hash": "G8Hn+I+pLLpQJV630iP0YYkYAHQ", "spine": "3.4.00", "width": 319.35, "height": 337.01, "images": "./images/" },
|
||||
"bones": [
|
||||
{ "name": "root" },
|
||||
{ "name": "Hip", "parent": "root", "y": 94.88 },
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
{
|
||||
"skeleton": { "hash": "NDIwB/eCc9kyjtXoMAlUrSBw0+Q", "spine": "3.4.00", "width": 0, "height": 0, "images": "./images/" },
|
||||
"skeleton": { "hash": "NDIwB/eCc9kyjtXoMAlUrSBw0+Q", "spine": "3.4.00", "width": 413.18, "height": 195.71, "images": "./images/" },
|
||||
"bones": [
|
||||
{ "name": "root" },
|
||||
{ "name": "powerup", "parent": "root", "x": 1.48, "y": 134.02 },
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
{
|
||||
"skeleton": { "hash": "tmPhvJxT1yYlfE25wzds+8X1E44", "spine": "3.4.00", "width": 0, "height": 0, "images": "./images/" },
|
||||
"skeleton": { "hash": "tmPhvJxT1yYlfE25wzds+8X1E44", "spine": "3.4.00", "width": 196.03, "height": 305.44, "images": "./images/" },
|
||||
"bones": [
|
||||
{ "name": "root" },
|
||||
{ "name": "hip", "parent": "root", "x": -0.02, "y": 51.91 },
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
{
|
||||
"skeleton": { "hash": "DIwMYpCxf9hwB7YgCS6TSSPK/5A", "spine": "3.4.00", "width": 0, "height": 0, "images": "./images/" },
|
||||
"skeleton": { "hash": "DIwMYpCxf9hwB7YgCS6TSSPK/5A", "spine": "3.4.00", "width": 161.12, "height": 343.58, "images": "./images/" },
|
||||
"bones": [
|
||||
{ "name": "root" },
|
||||
{ "name": "hip", "parent": "root", "x": 0.64, "y": 114.41 },
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
{
|
||||
"skeleton": { "hash": "YRJQeZQfL0LYebk3R3xgGRhUrlY", "spine": "3.4.00", "width": 0, "height": 0, "images": "./images/" },
|
||||
"skeleton": { "hash": "kLwY39chXP87A04aUX8jh92jUjs", "spine": "3.4.00", "width": 511.47, "height": 739.87, "images": "./images/" },
|
||||
"bones": [
|
||||
{ "name": "root" },
|
||||
{ "name": "hip", "parent": "root", "x": -49.89, "y": 290.95 },
|
||||
@ -164,7 +164,7 @@
|
||||
"front_foot": {
|
||||
"type": "mesh",
|
||||
"uvs": [ 0.59416, 0.23421, 0.62256, 0.30335, 0.65008, 0.37035, 0.67637, 0.38403, 0.72068, 0.40709, 0.76264, 0.42894, 1, 0.70375, 1, 1, 0.65517, 1, 0.3644, 1, 0, 1, 0, 0.39196, 0, 0, 0.17845, 0, 0.49795, 0 ],
|
||||
"triangles": [ 8, 6, 7, 8, 5, 6, 8, 4, 5, 4, 8, 3, 8, 9, 3, 9, 2, 3, 2, 10, 1, 2, 9, 10, 1, 11, 0, 0, 11, 13, 13, 14, 0, 11, 1, 10, 11, 12, 13 ],
|
||||
"triangles": [ 8, 9, 3, 4, 8, 3, 8, 4, 5, 8, 5, 6, 8, 6, 7, 11, 12, 13, 11, 1, 10, 13, 14, 0, 0, 11, 13, 1, 11, 0, 2, 9, 10, 2, 10, 1, 9, 2, 3 ],
|
||||
"vertices": [ 2, 17, 18.17, 41.57, 0.72255, 18, 12.46, 46.04, 0.27744, 2, 17, 24.08, 40.75, 0.57406, 18, 16.12, 41.34, 0.42592, 2, 17, 29.8, 39.97, 0.47663, 18, 19.67, 36.77, 0.52336, 2, 17, 32.8, 41.66, 0.37452, 18, 22.99, 35.89, 0.62547, 2, 17, 37.86, 44.51, 0.24772, 18, 28.6, 34.4, 0.75227, 2, 17, 42.65, 47.21, 0.17783, 18, 33.91, 32.98, 0.82216, 1, 18, 64.15, 14.56, 1, 1, 18, 64.51, -5.87, 1, 1, 18, 21.07, -6.63, 1, 2, 17, 35.38, -16.16, 0.99998, 18, -15.54, -7.28, 1.0E-5, 1, 17, 3.1, -48.81, 1, 1, 17, -26.72, -19.31, 1, 1, 17, -45.95, -0.29, 1, 1, 17, -30.14, 15.69, 1, 2, 17, -1.84, 44.31, 0.91511, 18, 0.05, 61.98, 0.08488 ],
|
||||
"hull": 15,
|
||||
"edges": [ 14, 16, 16, 18, 18, 20, 4, 18, 20, 22, 22, 24, 24, 26, 26, 28, 22, 26, 12, 14, 10, 12, 2, 4, 2, 20, 4, 6, 6, 16, 2, 0, 0, 28, 6, 8, 8, 10 ],
|
||||
@ -202,7 +202,7 @@
|
||||
"head": {
|
||||
"type": "mesh",
|
||||
"uvs": [ 0.75918, 0.06107, 0.88392, 0.17892, 0.90174, 0.30856, 0.94223, 0.1966, 1, 0.26584, 1, 0.42199, 0.95863, 0.46992, 0.92118, 0.51333, 0.85957, 0.53469, 0.78388, 0.65605, 0.74384, 0.74838, 0.85115, 0.75151, 0.84828, 0.82563, 0.8178, 0.85367, 0.75598, 0.85906, 0.76236, 0.90467, 0.65875, 1, 0.38336, 1, 0.18579, 0.85403, 0.1274, 0.8109, 0.06024, 0.69209, 0, 0.58551, 0, 0.41021, 0.08529, 0.20691, 0.24243, 0.14504, 0.49999, 0.14208, 0.50322, 0.07433, 0.41738, 0, 0.57612, 0, 0.85059, 0.36086, 0.73431, 0.43206, 0.6848, 0.3127, 0.72164, 0.16717, 0.55931, 0.04153, 0.44763, 0.22894, 0.23925, 0.26559, 0.71271, 0.44035, 0.56992, 0.38299, 0.41678, 0.3351, 0.29299, 0.31496, 0.70801, 0.44501, 0.56676, 0.38976, 0.4152, 0.34416, 0.28753, 0.33017, 0.88988, 0.50176, 0.30388, 0.73462, 0.2646, 0.65674, 0.21414, 0.61583, 0.14612, 0.62193, 0.10315, 0.66636, 0.10357, 0.72556, 0.14505, 0.79163, 0.20263, 0.81355, 0.27872, 0.80158, 0.34946, 0.7376, 0.23073, 0.57072, 0.08878, 0.60706, 0.2946, 0.8129, 0.73005, 0.87883, 0.69804, 0.87348, 0.66165, 0.79681 ],
|
||||
"triangles": [ 34, 24, 25, 35, 23, 24, 35, 24, 34, 39, 35, 34, 39, 22, 35, 38, 39, 34, 42, 39, 38, 43, 39, 42, 41, 42, 38, 22, 23, 35, 43, 22, 39, 40, 37, 36, 41, 37, 40, 7, 44, 6, 8, 36, 44, 40, 36, 8, 8, 44, 7, 55, 22, 43, 56, 21, 22, 55, 56, 22, 55, 48, 56, 47, 48, 55, 9, 40, 8, 55, 54, 46, 42, 55, 43, 47, 55, 46, 49, 56, 48, 20, 21, 56, 20, 56, 49, 50, 49, 48, 20, 49, 50, 46, 54, 45, 54, 55, 41, 55, 42, 41, 9, 60, 40, 46, 51, 50, 60, 41, 40, 10, 60, 9, 54, 41, 60, 46, 52, 51, 19, 50, 51, 50, 48, 47, 47, 46, 50, 46, 45, 52, 20, 50, 19, 57, 53, 45, 57, 45, 54, 53, 52, 45, 12, 10, 11, 13, 10, 12, 18, 51, 52, 19, 51, 18, 18, 52, 53, 18, 53, 57, 14, 10, 13, 60, 10, 14, 59, 60, 14, 58, 59, 14, 58, 14, 15, 17, 54, 60, 16, 17, 60, 57, 54, 17, 18, 57, 17, 59, 16, 60, 16, 59, 58, 16, 58, 15, 30, 36, 31, 30, 29, 6, 44, 30, 6, 36, 30, 44, 34, 25, 31, 37, 38, 34, 31, 32, 29, 31, 37, 34, 37, 41, 38, 30, 31, 29, 36, 37, 31, 33, 27, 28, 26, 27, 33, 0, 33, 28, 32, 33, 0, 32, 0, 1, 33, 25, 26, 33, 32, 25, 31, 25, 32, 2, 32, 1, 2, 3, 4, 2, 29, 32, 2, 4, 5, 29, 2, 5, 6, 29, 5 ],
|
||||
"triangles": [ 16, 58, 15, 16, 59, 58, 59, 16, 60, 18, 57, 17, 57, 54, 17, 16, 17, 60, 17, 54, 60, 58, 14, 15, 58, 59, 14, 59, 60, 14, 60, 10, 14, 14, 10, 13, 18, 53, 57, 18, 52, 53, 19, 51, 18, 18, 51, 52, 13, 10, 12, 12, 10, 11, 53, 52, 45, 57, 45, 54, 57, 53, 45, 20, 50, 19, 46, 45, 52, 47, 46, 50, 50, 48, 47, 19, 50, 51, 46, 52, 51, 54, 41, 60, 10, 60, 9, 60, 41, 40, 46, 51, 50, 9, 60, 40, 55, 42, 41, 54, 55, 41, 46, 54, 45, 20, 49, 50, 50, 49, 48, 20, 56, 49, 20, 21, 56, 49, 56, 48, 47, 55, 46, 42, 55, 43, 55, 54, 46, 9, 40, 8, 47, 48, 55, 55, 48, 56, 55, 56, 22, 56, 21, 22, 55, 22, 43, 8, 44, 7, 40, 36, 8, 8, 36, 44, 7, 44, 6, 41, 37, 40, 40, 37, 36, 43, 22, 39, 22, 23, 35, 41, 42, 38, 43, 39, 42, 42, 39, 38, 38, 39, 34, 39, 22, 35, 39, 35, 34, 35, 24, 34, 35, 23, 24, 34, 24, 25, 36, 30, 44, 44, 30, 6, 30, 29, 6, 30, 36, 31, 36, 37, 31, 30, 31, 29, 37, 41, 38, 31, 37, 34, 31, 32, 29, 37, 38, 34, 34, 25, 31, 2, 32, 1, 31, 25, 32, 33, 32, 25, 33, 25, 26, 32, 0, 1, 32, 33, 0, 0, 33, 28, 26, 27, 33, 33, 27, 28, 6, 29, 5, 29, 2, 5, 2, 4, 5, 2, 29, 32, 2, 3, 4 ],
|
||||
"vertices": [ 1, 29, 41.97, -41.79, 1, 3, 27, 73.46, 27.54, 0.18925, 29, -5.75, -51.7, 0.72418, 28, 112.98, -11.43, 0.08656, 3, 27, 38.23, 10.98, 0.84284, 29, -41.00999, -35.22, 0.09705, 28, 92.72, -44.67, 0.0601, 1, 27, 73.35, 10.89, 1, 1, 27, 58.59, -10.38, 1, 2, 27, 14.35, -24.8, 0.89742, 26, 75.49, -4.55, 0.10257, 2, 27, -2.69, -18.57, 0.58265, 26, 59.82, -13.72, 0.41734, 1, 25, 163.06, -108.68, 1, 1, 25, 151.52, -95.04, 1, 1, 25, 110.6, -87.69, 1, 1, 25, 81.05, -86.58, 1, 1, 25, 89.81, -114.32, 1, 1, 25, 68.72, -120.91, 1, 1, 25, 58.1, -115.89, 1, 1, 25, 51.03, -100.62, 1, 1, 25, 38.78, -106.76, 1, 1, 25, 2.67, -89.69, 1, 1, 25, -22.07, -19.29, 1, 1, 25, 1.19, 45.62, 1, 1, 25, 8.07, 64.81, 1, 1, 25, 35.43, 93.72, 1, 1, 25, 59.98, 119.66, 1, 1, 25, 109.25, 136.98, 1, 1, 25, 174.07, 135.27, 1, 2, 28, -16.79, 104.63, 0.16236, 25, 205.58, 101.22, 0.83763, 2, 29, 58.93, 30.5, 0.60735, 28, 38.37, 61.89, 0.39264, 2, 29, 75.55, 19, 0.94502, 28, 51.62, 77.15, 0.05497, 1, 29, 106.69, 26.9, 1, 1, 29, 83.78, -9.5, 1, 4, 27, 19.12, 19.33, 0.58067, 29, -46.82, -15.19, 0.07453, 28, 72.17, -48.24, 0.14877, 26, 44.52, 27.24, 0.19601, 2, 28, 34.31, -45.24, 0.20796, 26, 7.42, 19.08, 0.79203, 1, 28, 45.94, -9.06, 1, 1, 29, 20.62, -16.35, 1, 1, 29, 75.73, 0.94, 1, 3, 29, 44.58, 56.29, 0.14949, 28, 11.16, 50.46, 0.3683, 25, 200.44, 40.47, 0.4822, 1, 25, 171.41, 90.11, 1, 2, 28, 28.19, -43.54, 0.20796, 26, 1.07, 18.93, 0.79203, 3, 28, 8.54, -6.08, 0.75382, 26, -28.63, 49.03, 0.13133, 25, 168.13, -6.01, 0.11484, 2, 28, -15.06, 30.9, 0.72898, 25, 167.82, 37.86, 0.27101, 1, 25, 162.36, 71.5, 1, 1, 25, 163.1, -47.44, 1, 1, 25, 165.94, -5.87, 1, 1, 25, 165.14, 37.37, 1, 1, 25, 157.6, 71.39, 1, 1, 25, 163.5, -99.53, 1, 1, 25, 45.37, 27.24, 1, 1, 25, 63.73, 44.98, 1, 1, 25, 70.69, 61.92, 1, 1, 25, 62.87, 78.69, 1, 1, 25, 46.52, 85.3, 1, 1, 25, 29.92, 79.33, 1, 1, 25, 15.07, 62.21, 1, 1, 25, 14.09, 45.32, 1, 1, 25, 24.29, 27.05, 1, 1, 25, 48.63, 15.29, 1, 1, 25, 84.87, 62.14, 1, 1, 25, 61.9, 94.83, 1, 1, 25, 22.54, 21.87, 1, 1, 25, 43.14, -95.94, 1, 1, 25, 41.77, -87.23, 1, 1, 25, 60.05, -70.35, 1 ],
|
||||
"hull": 29,
|
||||
"edges": [ 10, 8, 8, 6, 6, 4, 4, 2, 2, 0, 0, 56, 54, 56, 54, 52, 52, 50, 50, 48, 48, 46, 46, 44, 42, 44, 32, 34, 4, 58, 58, 60, 62, 64, 64, 66, 66, 54, 50, 68, 68, 70, 70, 44, 60, 72, 62, 74, 72, 74, 74, 76, 76, 78, 78, 44, 16, 80, 80, 82, 82, 84, 84, 86, 86, 44, 14, 88, 88, 72, 14, 16, 10, 12, 12, 14, 12, 60, 90, 92, 92, 94, 94, 96, 96, 98, 98, 100, 100, 102, 102, 104, 104, 106, 106, 90, 108, 110, 110, 112, 38, 40, 40, 42, 112, 40, 34, 36, 36, 38, 36, 114, 114, 108, 30, 32, 30, 28, 24, 26, 28, 26, 22, 24, 22, 20, 20, 18, 18, 16, 28, 116, 116, 118, 118, 120, 120, 20 ],
|
||||
@ -259,7 +259,7 @@
|
||||
"rear_foot": {
|
||||
"type": "mesh",
|
||||
"uvs": [ 0.48368, 0.13869, 0.5199, 0.21423, 0.55099, 0.27906, 0.58837, 0.29815, 0.63488, 0.32191, 0.77342, 0.39266, 1, 0.73346, 1, 1, 0.59434, 1, 0.3116, 1, 0, 1, 0, 0.41396, 0.1363, 0, 0.41716, 0 ],
|
||||
"triangles": [ 8, 6, 7, 6, 8, 5, 5, 8, 4, 4, 8, 3, 8, 9, 3, 9, 2, 3, 2, 10, 1, 2, 9, 10, 1, 11, 0, 0, 11, 12, 12, 13, 0, 11, 1, 10 ],
|
||||
"triangles": [ 4, 8, 3, 5, 8, 4, 6, 8, 5, 8, 6, 7, 11, 1, 10, 12, 13, 0, 0, 11, 12, 1, 11, 0, 2, 9, 10, 2, 10, 1, 9, 2, 3, 8, 9, 3 ],
|
||||
"vertices": [ 2, 4, 10.45, 29.41, 0.88824, 5, -6.74, 49.62, 0.11175, 2, 4, 16.54, 29.27, 0.83163, 5, -2.65, 45.08, 0.16836, 2, 4, 21.79, 29.15, 0.78305, 5, 0.85, 41.18999, 0.21694, 2, 4, 25.53, 31.43, 0.67844, 5, 5.07, 40.04, 0.32155, 2, 4, 30.17, 34.27, 0.54832, 5, 10.33, 38.61, 0.45167, 2, 4, 44.01, 42.72, 0.16068, 5, 25.97, 34.36, 0.83929, 1, 5, 51.56, 13.89, 1, 1, 5, 51.54, -2.08, 1, 2, 4, 56.58, 2.98, 0.02959, 5, 5.71, -2.05, 0.9704, 1, 4, 34.63, -20.20999, 0.99999, 1, 4, 10.43, -45.8, 0.99999, 1, 4, -15.1, -21.64, 1, 1, 4, -22.56, 6.61, 0.99999, 2, 4, -0.76, 29.67, 0.99219, 5, -14.25, 57.94, 0.0078 ],
|
||||
"hull": 14,
|
||||
"edges": [ 14, 12, 10, 12, 14, 16, 16, 18, 18, 20, 4, 18, 20, 22, 24, 26, 22, 24, 4, 2, 2, 20, 4, 6, 6, 16, 6, 8, 8, 10, 2, 0, 0, 26 ],
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
{
|
||||
"skeleton": { "hash": "yUm986bGxUBwWNMdriWMHAzx6v4", "spine": "3.4.00", "width": 0, "height": 0, "images": "./images/" },
|
||||
"skeleton": { "hash": "VINkfhwM1ewwp32eV9+fiLvUsH0", "spine": "3.4.00", "width": 0, "height": 0, "images": "./images/" },
|
||||
"bones": [
|
||||
{ "name": "root" },
|
||||
{ "name": "hip", "parent": "root", "y": 247.26 },
|
||||
@ -137,7 +137,7 @@
|
||||
"front_foot": {
|
||||
"type": "mesh",
|
||||
"uvs": [ 0.59417, 0.23421, 0.62257, 0.30335, 0.65009, 0.37035, 0.67637, 0.38403, 0.72068, 0.40709, 0.76264, 0.42894, 1, 0.70375, 1, 1, 0.65517, 1, 0.3644, 1, 0, 1, 0, 0.39196, 0, 0, 0.17845, 0, 0.49795, 0 ],
|
||||
"triangles": [ 8, 9, 3, 4, 8, 3, 8, 4, 5, 8, 5, 6, 8, 6, 7, 11, 12, 13, 11, 1, 10, 13, 14, 0, 0, 11, 13, 1, 11, 0, 2, 9, 10, 2, 10, 1, 9, 2, 3 ],
|
||||
"triangles": [ 8, 6, 7, 8, 5, 6, 8, 4, 5, 4, 8, 3, 8, 9, 3, 9, 2, 3, 2, 10, 1, 2, 9, 10, 1, 11, 0, 0, 11, 13, 13, 14, 0, 11, 1, 10, 11, 12, 13 ],
|
||||
"vertices": [ 2, 14, 18.17, 41.57, 0.72255, 15, 12.46, 46.04, 0.27744, 2, 14, 24.08, 40.75999, 0.57406, 15, 16.12, 41.34, 0.42592, 2, 14, 29.8, 39.97, 0.47663, 15, 19.67, 36.77, 0.52336, 2, 14, 32.8, 41.66, 0.37452, 15, 22.99, 35.89, 0.62547, 2, 14, 37.86, 44.51, 0.24772, 15, 28.6, 34.4, 0.75227, 2, 14, 42.65, 47.21, 0.17783, 15, 33.91, 32.98, 0.82216, 1, 15, 64.15, 14.56, 1, 1, 15, 64.51, -5.87, 1, 1, 15, 21.07, -6.63, 1, 2, 14, 35.38, -16.16, 0.99998, 15, -15.54, -7.28, 1.0E-5, 2, 14, 3.1, -48.81, 1, 15, -61.44, -8.09, 0, 2, 14, -26.72, -19.31, 1, 15, -62.18, 33.84, 0, 2, 14, -45.95, -0.29, 1, 15, -62.66, 60.88, 0, 1, 14, -30.14, 15.69, 1, 2, 14, -1.84, 44.31, 0.91511, 15, 0.05, 61.98, 0.08488 ],
|
||||
"hull": 15,
|
||||
"edges": [ 14, 16, 16, 18, 18, 20, 4, 18, 20, 22, 22, 24, 24, 26, 26, 28, 22, 26, 12, 14, 10, 12, 2, 4, 2, 20, 4, 6, 6, 16, 2, 0, 0, 28, 6, 8, 8, 10 ],
|
||||
@ -175,7 +175,7 @@
|
||||
"head": {
|
||||
"type": "mesh",
|
||||
"uvs": [ 0.75918, 0.06107, 0.88392, 0.17892, 0.90174, 0.30856, 0.94223, 0.1966, 1, 0.26584, 1, 0.42199, 0.95863, 0.46992, 0.92118, 0.51333, 0.85957, 0.53469, 0.78388, 0.65605, 0.74384, 0.74838, 0.85115, 0.75151, 0.84828, 0.82563, 0.8178, 0.85367, 0.75598, 0.85906, 0.76236, 0.90467, 0.65875, 1, 0.38336, 1, 0.18579, 0.85403, 0.12741, 0.8109, 0.06024, 0.69209, 0, 0.58551, 0, 0.41021, 0.08529, 0.20691, 0.24243, 0.14504, 0.49999, 0.14209, 0.50323, 0.07433, 0.41738, 0, 0.57613, 0, 0.85059, 0.36086, 0.73431, 0.43206, 0.6848, 0.3127, 0.72164, 0.16717, 0.55931, 0.04153, 0.44763, 0.22894, 0.23925, 0.26559, 0.71271, 0.44035, 0.56992, 0.38299, 0.41678, 0.3351, 0.29299, 0.31496, 0.70801, 0.44501, 0.56676, 0.38976, 0.4152, 0.34416, 0.28753, 0.33017, 0.88988, 0.50176, 0.30388, 0.73462, 0.2646, 0.65674, 0.21414, 0.61583, 0.14612, 0.62193, 0.10315, 0.66636, 0.10357, 0.72556, 0.14505, 0.79163, 0.20263, 0.81355, 0.27872, 0.80158, 0.34946, 0.7376, 0.23073, 0.57073, 0.08878, 0.60706, 0.2946, 0.8129, 0.73005, 0.87883, 0.69804, 0.87348, 0.66165, 0.79681 ],
|
||||
"triangles": [ 36, 37, 31, 30, 31, 29, 37, 41, 38, 31, 37, 34, 31, 32, 29, 37, 38, 34, 34, 25, 31, 2, 32, 1, 31, 25, 32, 33, 32, 25, 33, 25, 26, 32, 0, 1, 32, 33, 0, 0, 33, 28, 26, 27, 33, 33, 27, 28, 6, 29, 5, 29, 2, 5, 2, 4, 5, 2, 29, 32, 2, 3, 4, 36, 30, 44, 44, 30, 6, 30, 29, 6, 30, 36, 31, 16, 58, 15, 16, 59, 58, 59, 16, 60, 18, 57, 17, 57, 54, 17, 16, 17, 60, 17, 54, 60, 58, 14, 15, 58, 59, 14, 59, 60, 14, 60, 10, 14, 14, 10, 13, 18, 53, 57, 18, 52, 53, 19, 51, 18, 18, 51, 52, 13, 10, 12, 12, 10, 11, 53, 52, 45, 57, 45, 54, 57, 53, 45, 20, 50, 19, 46, 45, 52, 47, 46, 50, 50, 48, 47, 19, 50, 51, 46, 52, 51, 54, 41, 60, 10, 60, 9, 60, 41, 40, 46, 51, 50, 9, 60, 40, 55, 42, 41, 54, 55, 41, 46, 54, 45, 20, 49, 50, 50, 49, 48, 20, 56, 49, 20, 21, 56, 49, 56, 48, 47, 55, 46, 42, 55, 43, 55, 54, 46, 9, 40, 8, 47, 48, 55, 55, 48, 56, 55, 56, 22, 56, 21, 22, 55, 22, 43, 8, 44, 7, 40, 36, 8, 8, 36, 44, 7, 44, 6, 41, 37, 40, 40, 37, 36, 43, 22, 39, 22, 23, 35, 41, 42, 38, 43, 39, 42, 42, 39, 38, 38, 39, 34, 39, 22, 35, 39, 35, 34, 35, 24, 34, 35, 23, 24, 34, 24, 25 ],
|
||||
"triangles": [ 34, 25, 31, 37, 38, 34, 31, 32, 29, 31, 37, 34, 37, 41, 38, 30, 31, 29, 36, 37, 31, 33, 27, 28, 26, 27, 33, 0, 33, 28, 32, 33, 0, 32, 0, 1, 33, 25, 26, 33, 32, 25, 31, 25, 32, 2, 32, 1, 2, 3, 4, 2, 29, 32, 2, 4, 5, 29, 2, 5, 6, 29, 5, 30, 36, 31, 30, 29, 6, 44, 30, 6, 36, 30, 44, 34, 24, 25, 35, 23, 24, 35, 24, 34, 39, 35, 34, 39, 22, 35, 38, 39, 34, 42, 39, 38, 43, 39, 42, 41, 42, 38, 22, 23, 35, 43, 22, 39, 40, 37, 36, 41, 37, 40, 7, 44, 6, 8, 36, 44, 40, 36, 8, 8, 44, 7, 55, 22, 43, 56, 21, 22, 55, 56, 22, 55, 48, 56, 47, 48, 55, 9, 40, 8, 55, 54, 46, 42, 55, 43, 47, 55, 46, 49, 56, 48, 20, 21, 56, 20, 56, 49, 50, 49, 48, 20, 49, 50, 46, 54, 45, 54, 55, 41, 55, 42, 41, 9, 60, 40, 46, 51, 50, 60, 41, 40, 10, 60, 9, 54, 41, 60, 46, 52, 51, 19, 50, 51, 50, 48, 47, 47, 46, 50, 46, 45, 52, 20, 50, 19, 57, 53, 45, 57, 45, 54, 53, 52, 45, 12, 10, 11, 13, 10, 12, 18, 51, 52, 19, 51, 18, 18, 52, 53, 18, 53, 57, 14, 10, 13, 60, 10, 14, 59, 60, 14, 58, 59, 14, 58, 14, 15, 17, 54, 60, 16, 17, 60, 57, 54, 17, 18, 57, 17, 59, 16, 60, 16, 59, 58, 16, 58, 15 ],
|
||||
"vertices": [ 1, 25, 41.97, -41.79, 1, 3, 23, 73.46, 27.54, 0.18925, 25, -5.75, -51.7, 0.72418, 24, 112.98, -11.43, 0.08656, 3, 23, 38.23, 10.98, 0.84283, 25, -41.00999, -35.22, 0.09705, 24, 92.72, -44.67, 0.0601, 1, 23, 73.35, 10.89, 1, 1, 23, 58.59, -10.38, 1, 2, 22, 75.49, -4.55, 0.10257, 23, 14.35, -24.8, 0.89742, 2, 22, 59.82, -13.72, 0.41734, 23, -2.69, -18.57, 0.58265, 1, 21, 163.06, -108.68, 1, 1, 21, 151.52, -95.04, 1, 1, 21, 110.6, -87.69, 1, 1, 21, 81.05, -86.58, 1, 1, 21, 89.81, -114.32, 1, 1, 21, 68.72, -120.91, 1, 1, 21, 58.1, -115.89, 1, 1, 21, 51.03, -100.62, 1, 1, 21, 38.78, -106.76, 1, 1, 21, 2.67, -89.69, 1, 1, 21, -22.07, -19.29999, 1, 1, 21, 1.19, 45.62, 1, 1, 21, 8.07, 64.81, 1, 1, 21, 35.43, 93.72, 1, 1, 21, 59.98, 119.66, 1, 1, 21, 109.25, 136.98, 1, 1, 21, 174.07, 135.27, 1, 2, 21, 205.58, 101.22, 0.83763, 24, -16.79999, 104.63, 0.16236, 2, 25, 58.93, 30.5, 0.60735, 24, 38.37, 61.89, 0.39264, 2, 25, 75.55, 19, 0.94502, 24, 51.62, 77.15, 0.05497, 1, 25, 106.69, 26.9, 1, 1, 25, 83.78, -9.5, 1, 4, 22, 44.52, 27.24, 0.19601, 23, 19.12, 19.33, 0.58066, 25, -46.82, -15.19, 0.07453, 24, 72.17, -48.24, 0.14877, 2, 22, 7.42, 19.08, 0.79203, 24, 34.31, -45.24, 0.20796, 1, 24, 45.94, -9.06, 1, 1, 25, 20.62, -16.35, 1, 1, 25, 75.73, 0.94, 1, 3, 21, 200.44, 40.47, 0.4822, 25, 44.58, 56.29, 0.14949, 24, 11.16, 50.46, 0.3683, 1, 21, 171.41, 90.11, 1, 2, 22, 1.07, 18.93, 0.79203, 24, 28.19, -43.54, 0.20796, 3, 21, 168.13, -6.01, 0.11484, 22, -28.63, 49.03, 0.13133, 24, 8.54, -6.08, 0.75382, 2, 21, 167.82, 37.86, 0.27101, 24, -15.06, 30.9, 0.72898, 1, 21, 162.36, 71.5, 1, 1, 21, 163.1, -47.44, 1, 1, 21, 165.94, -5.87, 1, 1, 21, 165.14, 37.37, 1, 1, 21, 157.6, 71.39, 1, 1, 21, 163.5, -99.53, 1, 1, 21, 45.37, 27.24, 1, 1, 21, 63.73, 44.98, 1, 1, 21, 70.69999, 61.92, 1, 1, 21, 62.87, 78.69999, 1, 1, 21, 46.52, 85.3, 1, 1, 21, 29.92, 79.33999, 1, 1, 21, 15.07, 62.21, 1, 1, 21, 14.09, 45.32, 1, 1, 21, 24.29, 27.05, 1, 1, 21, 48.63, 15.29, 1, 1, 21, 84.87, 62.14, 1, 1, 21, 61.9, 94.83, 1, 1, 21, 22.54, 21.87, 1, 1, 21, 43.14, -95.94, 1, 1, 21, 41.77, -87.23, 1, 1, 21, 60.05, -70.35, 1 ],
|
||||
"hull": 29,
|
||||
"edges": [ 10, 8, 8, 6, 6, 4, 4, 2, 2, 0, 0, 56, 54, 56, 54, 52, 52, 50, 50, 48, 48, 46, 46, 44, 42, 44, 32, 34, 4, 58, 58, 60, 62, 64, 64, 66, 66, 54, 50, 68, 68, 70, 70, 44, 60, 72, 62, 74, 72, 74, 74, 76, 76, 78, 78, 44, 16, 80, 80, 82, 82, 84, 84, 86, 86, 44, 14, 88, 88, 72, 14, 16, 10, 12, 12, 14, 12, 60, 90, 92, 92, 94, 94, 96, 96, 98, 98, 100, 100, 102, 102, 104, 104, 106, 106, 90, 108, 110, 110, 112, 38, 40, 40, 42, 112, 40, 34, 36, 36, 38, 36, 114, 114, 108, 30, 32, 30, 28, 24, 26, 28, 26, 22, 24, 22, 20, 20, 18, 18, 16, 28, 116, 116, 118, 118, 120, 120, 20 ],
|
||||
@ -217,7 +217,7 @@
|
||||
"rear_foot": {
|
||||
"type": "mesh",
|
||||
"uvs": [ 0.48368, 0.1387, 0.5199, 0.21423, 0.55099, 0.27906, 0.58838, 0.29816, 0.63488, 0.32191, 0.77342, 0.39266, 1, 0.73346, 1, 1, 0.59435, 1, 0.3116, 1, 0, 1, 0, 0.41396, 0.1363, 0, 0.41716, 0 ],
|
||||
"triangles": [ 4, 8, 3, 5, 8, 4, 6, 8, 5, 8, 6, 7, 11, 1, 10, 12, 13, 0, 0, 11, 12, 1, 11, 0, 2, 9, 10, 2, 10, 1, 9, 2, 3, 8, 9, 3 ],
|
||||
"triangles": [ 8, 6, 7, 6, 8, 5, 5, 8, 4, 4, 8, 3, 8, 9, 3, 9, 2, 3, 2, 10, 1, 2, 9, 10, 1, 11, 0, 0, 11, 12, 12, 13, 0, 11, 1, 10 ],
|
||||
"vertices": [ 2, 4, 10.45, 29.41, 0.88824, 5, -6.74, 49.62, 0.11175, 2, 4, 16.54999, 29.27, 0.83163, 5, -2.65, 45.08, 0.16836, 2, 4, 21.79, 29.15, 0.78305, 5, 0.85, 41.18999, 0.21694, 2, 4, 25.53, 31.43, 0.67844, 5, 5.07, 40.04, 0.32155, 2, 4, 30.17, 34.27, 0.54832, 5, 10.33, 38.61, 0.45167, 2, 4, 44.01, 42.72, 0.16069, 5, 25.97, 34.36, 0.83929, 1, 5, 51.56, 13.89, 1, 2, 4, 88.08, 36.28, 0, 5, 51.54, -2.08999, 1, 2, 4, 56.58, 2.98, 0.02959, 5, 5.71, -2.05, 0.9704, 2, 4, 34.63, -20.21999, 0.99999, 5, -26.22, -2.03, 0, 2, 4, 10.43, -45.8, 0.99999, 5, -61.43, -2, 0, 2, 4, -15.1, -21.64, 1, 5, -61.4, 33.15, 0, 2, 4, -22.56, 6.61, 0.99999, 5, -45.98, 57.97, 0, 2, 4, -0.76, 29.67, 0.99219, 5, -14.25, 57.94, 0.0078 ],
|
||||
"hull": 14,
|
||||
"edges": [ 14, 12, 10, 12, 14, 16, 16, 18, 18, 20, 4, 18, 20, 22, 24, 26, 22, 24, 4, 2, 2, 20, 4, 6, 6, 16, 6, 8, 8, 10, 2, 0, 0, 26 ],
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
{
|
||||
"skeleton": { "hash": "rPoYyBLFG6F0CGZ5wsUEBKDJU9U", "spine": "3.4.00", "width": 0, "height": 0, "images": "./images/" },
|
||||
"skeleton": { "hash": "rPoYyBLFG6F0CGZ5wsUEBKDJU9U", "spine": "3.4.00", "width": 470.9, "height": 731.49, "images": "./images/" },
|
||||
"bones": [
|
||||
{ "name": "hip", "y": 247.47 },
|
||||
{ "name": "torso", "parent": "hip", "length": 127.55, "rotation": 103.82, "x": -1.61, "y": 4.9, "color": "e0da19ff" },
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
{
|
||||
"skeleton": { "hash": "+jy97FaQm8tosWwFNGbQGD2+FlY", "spine": "3.4.00", "width": 0, "height": 0, "images": "./images/" },
|
||||
"skeleton": { "hash": "+jy97FaQm8tosWwFNGbQGD2+FlY", "spine": "3.4.00", "width": 1680, "height": 1782.27, "images": "./images/" },
|
||||
"bones": [
|
||||
{ "name": "root", "y": -526.31 },
|
||||
{ "name": "leaves", "parent": "root", "x": -0.16, "y": 1310.1 },
|
||||
|
||||
41
examples/stretchyman/export/stretchyman-pma.atlas
Normal file
@ -0,0 +1,41 @@
|
||||
|
||||
stretchyman-pma.png
|
||||
size: 1024,256
|
||||
format: RGBA8888
|
||||
filter: Linear,Linear
|
||||
repeat: none
|
||||
back arm
|
||||
rotate: true
|
||||
xy: 679, 173
|
||||
size: 72, 202
|
||||
orig: 72, 202
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
back leg
|
||||
rotate: true
|
||||
xy: 2, 2
|
||||
size: 100, 318
|
||||
orig: 100, 318
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
body
|
||||
rotate: true
|
||||
xy: 2, 104
|
||||
size: 141, 452
|
||||
orig: 141, 452
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
front arm
|
||||
rotate: true
|
||||
xy: 456, 100
|
||||
size: 145, 221
|
||||
orig: 145, 221
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
head
|
||||
rotate: true
|
||||
xy: 322, 15
|
||||
size: 87, 102
|
||||
orig: 87, 102
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
BIN
examples/stretchyman/export/stretchyman-pma.png
Normal file
|
After Width: | Height: | Size: 111 KiB |
41
examples/stretchyman/export/stretchyman.atlas
Normal file
@ -0,0 +1,41 @@
|
||||
|
||||
stretchyman.png
|
||||
size: 1024,256
|
||||
format: RGBA8888
|
||||
filter: Linear,Linear
|
||||
repeat: none
|
||||
back arm
|
||||
rotate: true
|
||||
xy: 679, 173
|
||||
size: 72, 202
|
||||
orig: 72, 202
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
back leg
|
||||
rotate: true
|
||||
xy: 2, 2
|
||||
size: 100, 318
|
||||
orig: 100, 318
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
body
|
||||
rotate: true
|
||||
xy: 2, 104
|
||||
size: 141, 452
|
||||
orig: 141, 452
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
front arm
|
||||
rotate: true
|
||||
xy: 456, 100
|
||||
size: 145, 221
|
||||
orig: 145, 221
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
head
|
||||
rotate: true
|
||||
xy: 322, 15
|
||||
size: 87, 102
|
||||
orig: 87, 102
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
762
examples/stretchyman/export/stretchyman.json
Normal file
BIN
examples/stretchyman/export/stretchyman.png
Normal file
|
After Width: | Height: | Size: 131 KiB |
BIN
examples/stretchyman/export/stretchyman.skel
Normal file
BIN
examples/stretchyman/images/back arm.png
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
examples/stretchyman/images/back leg.png
Normal file
|
After Width: | Height: | Size: 17 KiB |
BIN
examples/stretchyman/images/body.png
Normal file
|
After Width: | Height: | Size: 40 KiB |
BIN
examples/stretchyman/images/front arm.png
Normal file
|
After Width: | Height: | Size: 18 KiB |
BIN
examples/stretchyman/images/head.png
Normal file
|
After Width: | Height: | Size: 13 KiB |
8
examples/stretchyman/license.txt
Normal file
@ -0,0 +1,8 @@
|
||||
Copyright (c) 2016, Esoteric Software
|
||||
|
||||
The images in this project may be redistributed as long as they are accompanied
|
||||
by this license file. The images may not be used for commercial use of any
|
||||
kind.
|
||||
|
||||
The project file is released into the public domain. It may be used as the basis
|
||||
for derivative work.
|
||||
BIN
examples/stretchyman/stretchyman.spine
Normal file
@ -1,5 +1,5 @@
|
||||
{
|
||||
"skeleton": { "hash": "eyBEg78jnHpBZJz2yWiIyq/gj24", "spine": "3.4.00", "width": 0, "height": 0, "images": "" },
|
||||
"skeleton": { "hash": "prAbugErg4ObQ7MEDGj8zq4mn74", "spine": "3.4.00", "width": 1914.53, "height": 964.03, "images": "" },
|
||||
"bones": [
|
||||
{ "name": "root" },
|
||||
{ "name": "tankRoot", "parent": "root", "y": 200 },
|
||||
@ -422,7 +422,7 @@
|
||||
"images/antenna": {
|
||||
"type": "mesh",
|
||||
"uvs": [ 0.64286, 0.07875, 0.65354, 0.15349, 0.66324, 0.22137, 0.67367, 0.29433, 0.68383, 0.36543, 0.69359, 0.43374, 0.7031, 0.50029, 0.71311, 0.5703, 0.72327, 0.64138, 0.73406, 0.71688, 0.7444, 0.78929, 0.75614, 0.8714, 0.76905, 0.9431, 1, 0.9431, 1, 1, 0, 1, 0, 0.9431, 0.20105, 0.9431, 0.20105, 0.87093, 0.21461, 0.78846, 0.22651, 0.71606, 0.23885, 0.64098, 0.25035, 0.57104, 0.26206, 0.49983, 0.27306, 0.4329, 0.2843, 0.36453, 0.29592, 0.29381, 0.308, 0.22037, 0.319, 0.15345, 0.33141, 0.07795, 0.34423, 0, 0.6316, 0 ],
|
||||
"triangles": [ 30, 31, 0, 29, 30, 0, 29, 0, 1, 28, 29, 1, 28, 1, 2, 27, 28, 2, 27, 2, 3, 26, 3, 4, 25, 26, 4, 25, 4, 5, 26, 27, 3, 24, 5, 6, 23, 24, 6, 7, 23, 6, 24, 25, 5, 22, 7, 8, 21, 22, 8, 21, 8, 9, 7, 22, 23, 20, 9, 10, 19, 20, 10, 20, 21, 9, 19, 10, 11, 18, 19, 11, 17, 18, 11, 17, 11, 12, 15, 16, 17, 12, 13, 14, 15, 17, 12, 14, 15, 12 ],
|
||||
"triangles": [ 29, 0, 1, 29, 30, 0, 30, 31, 0, 27, 2, 3, 27, 28, 2, 28, 1, 2, 28, 29, 1, 26, 27, 3, 25, 4, 5, 25, 26, 4, 26, 3, 4, 24, 25, 5, 7, 23, 6, 23, 24, 6, 24, 5, 6, 7, 22, 23, 21, 8, 9, 21, 22, 8, 22, 7, 8, 20, 21, 9, 19, 20, 10, 20, 9, 10, 14, 15, 12, 15, 17, 12, 12, 13, 14, 15, 16, 17, 17, 11, 12, 17, 18, 11, 18, 19, 11, 19, 10, 11 ],
|
||||
"vertices": [ 2, 10, 65.37999, -3.14, 0.3125, 11, 23.38, -3.14, 0.6875, 3, 9, 84.73, -3.37, 0.0625, 10, 42.73, -3.37, 0.625, 11, 0.73, -3.37, 0.3125, 3, 9, 64.16, -3.59, 0.3125, 10, 22.16, -3.59, 0.625, 11, -19.83, -3.59, 0.0625, 3, 8, 84.06, -3.82, 0.0625, 9, 42.06, -3.82, 0.625, 10, 0.06, -3.82, 0.3125, 3, 8, 62.51, -4.04, 0.3125, 9, 20.51, -4.04, 0.625, 10, -21.48, -4.04, 0.0625, 3, 7, 83.81, -4.25, 0.0625, 8, 41.81, -4.25, 0.625, 9, -0.18, -4.25, 0.3125, 3, 7, 63.65, -4.46, 0.3125, 8, 21.65, -4.46, 0.625, 9, -20.34, -4.46, 0.0625, 3, 6, 84.43, -4.67999, 0.0625, 7, 42.43, -4.67999, 0.625, 8, 0.43, -4.67999, 0.3125, 3, 6, 62.9, -4.91, 0.3125, 7, 20.9, -4.91, 0.625, 8, -21.09, -4.91, 0.0625, 3, 5, 5.14, 80.01999, 0.0625, 6, 40.02, -5.14, 0.625, 7, -1.97, -5.14, 0.3125, 3, 5, 5.37, 58.08, 0.375, 6, 18.08, -5.37, 0.5625, 7, -23.91, -5.37, 0.0625, 1, 5, 5.63, 33.2, 1, 1, 5, 5.91, 11.48, 1, 1, 5, 11, 11.48, 1, 1, 5, 10.99, -5.75, 1, 1, 5, -11, -5.75, 1, 1, 5, -10.99, 11.48, 1, 1, 5, -6.57, 11.48, 1, 1, 5, -6.57, 33.34, 1, 3, 5, -6.27, 58.33, 0.375, 6, 18.33, 6.27, 0.5625, 7, -23.66, 6.27, 0.0625, 3, 5, -6.01, 80.26999, 0.0625, 6, 40.27, 6.01, 0.625, 7, -1.72, 6.01, 0.3125, 3, 6, 63.02, 5.74, 0.3125, 7, 21.02, 5.74, 0.625, 8, -20.96999, 5.74, 0.0625, 3, 6, 84.21, 5.49, 0.0625, 7, 42.21, 5.49, 0.625, 8, 0.21, 5.49, 0.3125, 3, 7, 63.79, 5.23, 0.3125, 8, 21.79, 5.23, 0.625, 9, -20.2, 5.23, 0.0625, 3, 7, 84.07, 4.98999, 0.0625, 8, 42.07, 4.98999, 0.625, 9, 0.07, 4.98999, 0.3125, 3, 8, 62.78, 4.73999, 0.3125, 9, 20.78, 4.73999, 0.625, 10, -21.21, 4.73999, 0.0625, 3, 8, 84.21, 4.48, 0.0625, 9, 42.21, 4.48, 0.625, 10, 0.21, 4.48, 0.3125, 3, 9, 64.46, 4.21999, 0.3125, 10, 22.46, 4.21999, 0.625, 11, -19.53, 4.21999, 0.0625, 3, 9, 84.74, 3.98, 0.0625, 10, 42.74, 3.98, 0.625, 11, 0.74, 3.98, 0.3125, 2, 10, 65.62, 3.7, 0.3125, 11, 23.62, 3.7, 0.6875, 1, 11, 47.24, 3.42, 1, 1, 11, 47.24, -2.89, 1 ],
|
||||
"hull": 32,
|
||||
"edges": [ 28, 30, 28, 26, 30, 32, 26, 24, 24, 22, 32, 34, 34, 24, 34, 36, 36, 22, 60, 62, 38, 36, 20, 22, 38, 20, 40, 38, 18, 20, 40, 18, 42, 40, 16, 18, 42, 16, 44, 42, 14, 16, 44, 14, 46, 44, 12, 14, 46, 12, 48, 46, 10, 12, 48, 10, 50, 48, 8, 10, 50, 8, 52, 50, 6, 8, 52, 6, 54, 52, 4, 6, 54, 4, 56, 54, 2, 4, 56, 2, 60, 58, 58, 56, 62, 0, 0, 2, 58, 0 ],
|
||||
@ -440,7 +440,7 @@
|
||||
"images/cannonConnector": {
|
||||
"type": "mesh",
|
||||
"uvs": [ 1, 0.03236, 1, 0.10602, 0.90987, 0.32859, 0.81975, 0.55116, 0.72962, 0.77372, 0.6395, 0.99629, 0.42157, 0.99629, 0.20364, 0.99629, 0, 0.85433, 0, 0.69901, 0.02267, 0.52884, 0, 0.31444, 0.21601, 0.12998, 0.43367, 0, 0.63546, 0.0037, 0.48407, 0.77059, 0.31496, 0.52496, 0.64132, 0.19648, 0.21516, 0.76765, 0.58345, 0.5647, 0.68444, 0.40146, 0.46758, 0.36649, 0.28934, 0.34603 ],
|
||||
"triangles": [ 21, 22, 12, 11, 12, 22, 17, 21, 13, 17, 13, 14, 21, 12, 13, 21, 17, 20, 16, 22, 21, 10, 11, 22, 10, 22, 16, 19, 21, 20, 16, 21, 19, 18, 10, 16, 9, 10, 18, 15, 16, 19, 18, 16, 15, 8, 9, 18, 7, 8, 18, 6, 18, 15, 7, 18, 6, 14, 0, 1, 17, 14, 1, 2, 17, 1, 20, 17, 2, 3, 20, 2, 19, 20, 3, 4, 19, 3, 15, 19, 4, 5, 15, 4, 6, 15, 5 ],
|
||||
"triangles": [ 7, 18, 6, 6, 18, 15, 7, 8, 18, 8, 9, 18, 18, 16, 15, 15, 16, 19, 9, 10, 18, 18, 10, 16, 16, 21, 19, 19, 21, 20, 10, 22, 16, 10, 11, 22, 16, 22, 21, 21, 17, 20, 21, 12, 13, 17, 13, 14, 17, 21, 13, 11, 12, 22, 21, 22, 12, 6, 15, 5, 5, 15, 4, 15, 19, 4, 4, 19, 3, 19, 20, 3, 3, 20, 2, 20, 17, 2, 2, 17, 1, 17, 14, 1, 14, 0, 1 ],
|
||||
"vertices": [ 1, 12, 35.91, 69.08, 1, 1, 12, 35.91, 59.13, 1, 1, 12, 25.81, 29.09, 1, 1, 12, 15.72, -0.95, 1, 1, 12, 5.63, -31, 1, 1, 12, -4.46, -61.04, 1, 2, 12, -28.87, -61.04, 0.33333, 13, 28.87, 61.03, 0.66666, 1, 13, 53.27, 61.01, 1, 1, 13, 76.08, 41.83, 1, 1, 13, 71.17, 21.62, 1, 1, 13, 72.83, -1.62, 1, 1, 13, 70.37, -29.12, 1, 1, 13, 50.66, -56.13, 1, 2, 12, -28.43, 74.37, 0.41, 13, 28.43, -74.39, 0.58999, 2, 12, -4.91, 72.94999, 0.52, 13, 4.91, -72.94999, 0.48, 2, 12, -21.87, -30.57, 0.49, 13, 21.87, 30.56, 0.51, 1, 13, 40.81, -2.59999, 1, 2, 12, -4.25, 46.92, 0.49, 13, 4.25, -46.92, 0.51, 1, 13, 51.98, 30.15, 1, 2, 12, -10.74, -2.78, 0.49, 13, 10.74, 2.77, 0.51, 2, 12, 0.56, 19.25, 0.49, 13, -0.56, -19.25, 0.51, 1, 13, 23.71, -23.98, 1, 1, 13, 43.68, -26.76, 1 ],
|
||||
"hull": 15,
|
||||
"edges": [ 0, 2, 2, 4, 4, 6, 6, 8, 8, 10, 10, 12, 12, 14, 14, 16, 16, 18, 18, 20, 20, 22, 22, 24, 24, 26, 26, 28, 28, 0 ],
|
||||
@ -796,7 +796,8 @@
|
||||
"closed": true,
|
||||
"lengths": [ 182.41, 349, 472.77, 602.99, 780.46, 1052.96, 1133.44, 1218.43, 1298.34, 1382.7, 1465.57, 1546.11, 1628.02, 1707.73, 1794.36, 1876.75, 2158.69, 2321.34, 2438.56, 2579.42, 2745.35, 2919.23 ],
|
||||
"vertexCount": 66,
|
||||
"vertices": [ 1, 83, 11.23, 41.86, 1, 1, 83, 0.78, 41.93999, 1, 1, 83, -34.72, 42.23, 1, 1, 63, -104.21, 0.41, 1, 1, 63, 0.07, 0.55, 1, 1, 63, 68.8, 0.64, 1, 1, 81, 20.5, 43.47, 1, 1, 81, 1.13, 40.81, 1, 1, 81, -27.38, 36.84, 1, 1, 65, 147.06, 105, 1, 1, 65, 96.21, 96.63, 1, 1, 65, 43.87, 87.71, 1, 1, 65, 16.18, 103.34, 1, 1, 65, -33.66999, 94.2, 1, 1, 65, -99.35, 81.25, 1, 1, 65, -122.04, -1.69, 1, 1, 65, -83.58, -47.92, 1, 1, 65, -33.53, -109.36, 1, 1, 69, -83.56, -66.08999, 1, 1, 69, -2.16, -67.89, 1, 2, 69, 56.68, -41.48, 0.67999, 58, -24.31, -41.49, 0.32, 1, 58, -26.58, 16.69, 1, 1, 58, -2.69, 16.69, 1, 1, 58, 13.51, 16.69, 1, 2, 71, -52.41, -46.51, 0.74399, 58, 30.2, -46.51, 0.256, 1, 71, -0.32, -68.92, 1, 2, 71, 52.09, -44.72, 0.712, 59, -28.9, -44.73, 0.28799, 1, 59, -22.8, 16.24, 1, 1, 59, -1.42, 16.24, 1, 1, 59, 20.46999, 16.24, 1, 2, 73, -47.21, -47.45, 0.744, 59, 36.00999, -47.46, 0.25599, 1, 73, -0.28, -69.65, 1, 2, 73, 45.23, -47.26, 0.736, 60, -37.48, -47.26, 0.26399, 1, 60, -23.76, 15.27, 1, 1, 60, -0.13, 15.27, 1, 1, 60, 24.45, 15.27, 1, 2, 75, -47.36, -48.7, 0.74399, 60, 33.52, -48.7, 0.256, 1, 75, -0.49, -70.39, 1, 2, 75, 49.09, -48.33, 0.744, 61, -33.57, -48.34, 0.25599, 1, 61, -20.89, 15.83, 1, 1, 61, -1.25, 15.83, 1, 1, 61, 15.78, 15.83, 1, 2, 77, -52.49, -48.21, 0.75999, 61, 28.45, -48.21, 0.24, 1, 77, -2.5, -68.92, 1, 2, 77, 55.72, -47.82, 0.752, 62, -28.88, -47.82, 0.248, 1, 62, -21.64, 16.69, 1, 1, 62, -0.48, 16.69, 1, 1, 62, 20.73, 16.69, 1, 2, 79, -53.65, -48.89, 0.76, 62, 25.96, -48.89, 0.23999, 1, 79, 2.27, -69.65, 1, 1, 79, 44.94, -69.74, 1, 1, 65, 1172.98, -85.6, 1, 1, 65, 1190.53, -42.24, 1, 1, 65, 1215.63, 19.75, 1, 1, 65, 1175.55, 76.62, 1, 1, 65, 1134.22, 95.07, 1, 1, 65, 1128.4, 97.66, 1, 1, 65, 1081.79, 87.47, 1, 1, 65, 1017.16, 92.52, 1, 1, 65, 977.9, 95.58, 1, 1, 85, 47.07, 42.29, 1, 1, 85, 0.24, 42.74, 1, 1, 85, -29.63, 43.28, 1, 1, 64, -86.64, 1.35, 1, 1, 64, 0.49, 0.25, 1, 1, 64, 92.42, -0.89, 1 ]
|
||||
"vertices": [ 1, 83, 11.23, 41.86, 1, 1, 83, 0.78, 41.93999, 1, 1, 83, -34.72, 42.23, 1, 1, 63, -104.21, 0.41, 1, 1, 63, 0.07, 0.55, 1, 1, 63, 68.8, 0.64, 1, 1, 81, 20.5, 43.47, 1, 1, 81, 1.13, 40.81, 1, 1, 81, -27.38, 36.84, 1, 1, 65, 147.06, 105, 1, 1, 65, 96.21, 96.63, 1, 1, 65, 43.87, 87.71, 1, 1, 65, 16.18, 103.34, 1, 1, 65, -33.66999, 94.2, 1, 1, 65, -99.35, 81.25, 1, 1, 65, -122.04, -1.69, 1, 1, 65, -83.58, -47.92, 1, 1, 65, -33.53, -109.36, 1, 1, 69, -83.56, -66.08999, 1, 1, 69, -2.16, -67.89, 1, 2, 69, 56.68, -41.48, 0.67999, 58, -24.31, -41.49, 0.32, 1, 58, -26.58, 16.69, 1, 1, 58, -2.69, 16.69, 1, 1, 58, 13.51, 16.69, 1, 2, 71, -52.41, -46.51, 0.74399, 58, 30.2, -46.51, 0.256, 1, 71, -0.32, -68.92, 1, 2, 71, 52.09, -44.72, 0.712, 59, -28.9, -44.73, 0.28799, 1, 59, -22.8, 16.24, 1, 1, 59, -1.42, 16.24, 1, 1, 59, 20.46999, 16.24, 1, 2, 73, -47.21, -47.45, 0.744, 59, 36.00999, -47.46, 0.25599, 1, 73, -0.28, -69.65, 1, 2, 73, 45.23, -47.26, 0.736, 60, -37.48, -47.26, 0.26399, 1, 60, -23.76, 15.27, 1, 1, 60, -0.13, 15.27, 1, 1, 60, 24.45, 15.27, 1, 2, 75, -47.36, -48.7, 0.74399, 60, 33.52, -48.7, 0.256, 1, 75, -0.49, -70.39, 1, 2, 75, 49.09, -48.33, 0.744, 61, -33.57, -48.34, 0.25599, 1, 61, -20.89, 15.83, 1, 1, 61, -1.25, 15.83, 1, 1, 61, 15.78, 15.83, 1, 2, 77, -52.49, -48.21, 0.75999, 61, 28.45, -48.21, 0.24, 1, 77, -2.5, -68.92, 1, 2, 77, 55.72, -47.82, 0.752, 62, -28.88, -47.82, 0.248, 1, 62, -21.64, 16.69, 1, 1, 62, -0.48, 16.69, 1, 1, 62, 20.73, 16.69, 1, 2, 79, -53.65, -48.89, 0.76, 62, 25.96, -48.89, 0.23999, 1, 79, 2.27, -69.65, 1, 1, 79, 44.94, -69.74, 1, 1, 65, 1172.98, -85.6, 1, 1, 65, 1190.53, -42.24, 1, 1, 65, 1215.63, 19.75, 1, 1, 65, 1175.55, 76.62, 1, 1, 65, 1134.22, 95.07, 1, 1, 65, 1128.4, 97.66, 1, 1, 65, 1081.79, 87.47, 1, 1, 65, 1017.16, 92.52, 1, 1, 65, 977.9, 95.58, 1, 1, 85, 47.07, 42.29, 1, 1, 85, 0.24, 42.74, 1, 1, 85, -29.63, 43.28, 1, 1, 64, -86.64, 1.35, 1, 1, 64, 0.49, 0.25, 1, 1, 64, 92.42, -0.89, 1 ],
|
||||
"color": "ff8819ff"
|
||||
}
|
||||
},
|
||||
"wheel-big": {
|
||||
|
||||
@ -10,18 +10,32 @@ The Spine Runtimes are developed with the intent to be used with data exported f
|
||||
|
||||
## Spine version
|
||||
|
||||
spine-as3 works with data exported from Spine 3.1.08. Updating spine-as3 to [v3.2](https://github.com/EsotericSoftware/spine-runtimes/issues/586) and [v3.3](https://github.com/EsotericSoftware/spine-runtimes/issues/613) is in progress.
|
||||
spine-as3 works with data exported from the latest Spine version.
|
||||
|
||||
spine-as3 supports all Spine features, including meshes. If using the `spine.flash` classes for rendering, meshes are not supported.
|
||||
|
||||
spine-as3 does not yet support loading the binary format.
|
||||
|
||||
## Setup
|
||||
## Usage
|
||||
1. Create a new Flex or Adobe AIR project in your preferred IDE.
|
||||
2. Download the Spine Runtimes source using git (`git clone https://github.com/esotericsoftware/spine-runtimes`) or download it [as a zip](https://github.com/EsotericSoftware/spine-runtimes/archive/master.zip)
|
||||
3. Add the sources from `spine-as3/spine-as3/src/` to your project
|
||||
|
||||
1. Download the Spine Runtimes source using [git](https://help.github.com/articles/set-up-git) or by downloading it [as a zip](https://github.com/EsotericSoftware/spine-runtimes/archive/master.zip).
|
||||
1. Using [FDT](http://fdt.powerflasher.com/), import the spine-as3 project by choosing File -> Import -> Existing projects. For other IDEs you will need to create a new project and import the source.
|
||||
## Example
|
||||
The Spine AS3 example works on Windows, Linux and Mac OS X. This guide assumes you are using [FDT Free](http://fdt.powerflasher.com/) as your development environment.
|
||||
|
||||
Alternatively, the contents of the `spine-as3/src` directory can be copied into your project.
|
||||
1. Download [FDT free](http://fdt.powerflasher.com/buy-download/) for your operating system.
|
||||
3. Download and install Adobe Flash Player 22 with debugging support](https://www.adobe.com/support/flashplayer/debug_downloads.html#fp15)
|
||||
2. Download the latest [Flex SDK](http://www.adobe.com/devnet/flex/flex-sdk-download.html). We assume it will be installed to some folder on your disk called `flex_sdk`.
|
||||
3. Download the latest [Adobe AIR SDK](http://www.adobe.com/devnet/air/air-sdk-download.html)
|
||||
4. Extract the AIR SDK contents, and copy them to your `flex_sdk` folder. This will replace the Adobe AIR version shipped with Flex.
|
||||
5. Open FDT, go to `Preferences -> FDT -> Installed SDKs`
|
||||
6. Click `Add` and browse to `flex_sdk`
|
||||
7. Go to `File -> Import -> General -> Existing Projects into Workspace`
|
||||
6. Browse to `spine-as3/`. You should see both the `spine-as3` and `spine-as3-example` project in the import dialog. Click `Finish`
|
||||
8. Right click the `Main.as` file in `spine-as3-example/src/spine` in the FDT explorer and select `Debug As -> FDT SWF Application`
|
||||
|
||||
**Note**: FDT Free does not allow project dependencies. If you modify the sources of `spine-as3`, you will have to compile the project to an `.swc` and place it in `spine-as3-example/libs`.
|
||||
|
||||
## Demos
|
||||
|
||||
|
||||
@ -3,6 +3,7 @@ com.powerflasher.fdt.core.CompilerArguments=-static-link-runtime-shared-librarie
|
||||
com.powerflasher.fdt.core.CompilerConstants=CONFIG\:\:AUTHOR\!"{user.name}"\nCONFIG\:\:DEBUG\!{debug}
|
||||
com.powerflasher.fdt.core.DefaultOutputFolder=bin
|
||||
com.powerflasher.fdt.core.DefaultPlayer=External_SWF_Viewer
|
||||
com.powerflasher.fdt.core.IncludeTestResources=false
|
||||
com.powerflasher.fdt.core.Language=AS3
|
||||
com.powerflasher.fdt.core.Manifests=
|
||||
com.powerflasher.fdt.core.PassClasspath=true
|
||||
@ -13,7 +14,7 @@ com.powerflasher.fdt.core.PassManifests=true
|
||||
com.powerflasher.fdt.core.PassRsls=false
|
||||
com.powerflasher.fdt.core.PassSwcs=true
|
||||
com.powerflasher.fdt.core.PlatformType=WEB
|
||||
com.powerflasher.fdt.core.PlayerVersion=11.1
|
||||
com.powerflasher.fdt.core.PlayerVersion=22.0
|
||||
com.powerflasher.fdt.core.ProjectTypeHint=Web
|
||||
com.powerflasher.fdt.core.Runtime=Flash_Player
|
||||
com.powerflasher.fdt.core.SdkName=Flex 4.6.0
|
||||
|
||||
@ -13,7 +13,7 @@
|
||||
<booleanAttribute key="FORCE_FRESH_COMPILATION" value="false"/>
|
||||
<booleanAttribute key="KILL_PREVIOUS_VIEWER" value="true"/>
|
||||
<stringAttribute key="LAUNCHER_DEPENDENCIES" value="[Self]"/>
|
||||
<stringAttribute key="MAIN_CLASS" value="src/spine/Main.as"/>
|
||||
<stringAttribute key="MAIN_CLASS" value="src/spine/examples/Main.as"/>
|
||||
<stringAttribute key="MOBILE_PRESET" value=""/>
|
||||
<booleanAttribute key="NEW_WINDOW_EACH_LAUNCH" value="false"/>
|
||||
<stringAttribute key="OUTPUT" value="bin/spine-as3-example.swf"/>
|
||||
|
||||
@ -1,292 +0,0 @@
|
||||
|
||||
goblins-mesh.png
|
||||
format: RGBA8888
|
||||
filter: Linear,Linear
|
||||
repeat: none
|
||||
dagger
|
||||
rotate: true
|
||||
xy: 372, 100
|
||||
size: 26, 108
|
||||
orig: 26, 108
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
goblin/eyes-closed
|
||||
rotate: false
|
||||
xy: 2, 7
|
||||
size: 34, 12
|
||||
orig: 34, 12
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
goblin/head
|
||||
rotate: false
|
||||
xy: 107, 36
|
||||
size: 103, 66
|
||||
orig: 103, 66
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
goblin/left-arm
|
||||
rotate: false
|
||||
xy: 901, 56
|
||||
size: 37, 35
|
||||
orig: 37, 35
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
goblin/left-foot
|
||||
rotate: false
|
||||
xy: 929, 95
|
||||
size: 65, 31
|
||||
orig: 65, 31
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
goblin/left-hand
|
||||
rotate: false
|
||||
xy: 452, 2
|
||||
size: 36, 41
|
||||
orig: 36, 41
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
goblin/left-lower-leg
|
||||
rotate: true
|
||||
xy: 713, 93
|
||||
size: 33, 70
|
||||
orig: 33, 70
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
goblin/left-shoulder
|
||||
rotate: false
|
||||
xy: 610, 44
|
||||
size: 29, 44
|
||||
orig: 29, 44
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
goblin/left-upper-leg
|
||||
rotate: true
|
||||
xy: 638, 93
|
||||
size: 33, 73
|
||||
orig: 33, 73
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
goblin/neck
|
||||
rotate: false
|
||||
xy: 490, 2
|
||||
size: 36, 41
|
||||
orig: 36, 41
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
goblin/pelvis
|
||||
rotate: false
|
||||
xy: 482, 45
|
||||
size: 62, 43
|
||||
orig: 62, 43
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
goblin/right-arm
|
||||
rotate: true
|
||||
xy: 690, 2
|
||||
size: 23, 50
|
||||
orig: 23, 50
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
goblin/right-foot
|
||||
rotate: false
|
||||
xy: 771, 58
|
||||
size: 63, 33
|
||||
orig: 63, 33
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
goblin/right-hand
|
||||
rotate: false
|
||||
xy: 940, 56
|
||||
size: 36, 37
|
||||
orig: 36, 37
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
goblin/right-lower-leg
|
||||
rotate: true
|
||||
xy: 482, 90
|
||||
size: 36, 76
|
||||
orig: 36, 76
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
goblin/right-shoulder
|
||||
rotate: true
|
||||
xy: 602, 3
|
||||
size: 39, 45
|
||||
orig: 39, 45
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
goblin/right-upper-leg
|
||||
rotate: true
|
||||
xy: 641, 57
|
||||
size: 34, 63
|
||||
orig: 34, 63
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
goblin/torso
|
||||
rotate: true
|
||||
xy: 212, 34
|
||||
size: 68, 96
|
||||
orig: 68, 96
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
goblin/undie-straps
|
||||
rotate: false
|
||||
xy: 380, 5
|
||||
size: 55, 19
|
||||
orig: 55, 19
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
goblin/undies
|
||||
rotate: false
|
||||
xy: 174, 5
|
||||
size: 36, 29
|
||||
orig: 36, 29
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
goblingirl/eyes-closed
|
||||
rotate: false
|
||||
xy: 269, 11
|
||||
size: 37, 21
|
||||
orig: 37, 21
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
goblingirl/head
|
||||
rotate: false
|
||||
xy: 2, 21
|
||||
size: 103, 81
|
||||
orig: 103, 81
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
goblingirl/left-arm
|
||||
rotate: true
|
||||
xy: 978, 56
|
||||
size: 37, 35
|
||||
orig: 37, 35
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
goblingirl/left-foot
|
||||
rotate: false
|
||||
xy: 107, 3
|
||||
size: 65, 31
|
||||
orig: 65, 31
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
goblingirl/left-hand
|
||||
rotate: false
|
||||
xy: 565, 2
|
||||
size: 35, 40
|
||||
orig: 35, 40
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
goblingirl/left-lower-leg
|
||||
rotate: true
|
||||
xy: 785, 93
|
||||
size: 33, 70
|
||||
orig: 33, 70
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
goblingirl/left-shoulder
|
||||
rotate: true
|
||||
xy: 690, 27
|
||||
size: 28, 46
|
||||
orig: 28, 46
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
goblingirl/left-upper-leg
|
||||
rotate: true
|
||||
xy: 857, 93
|
||||
size: 33, 70
|
||||
orig: 33, 70
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
goblingirl/neck
|
||||
rotate: false
|
||||
xy: 528, 2
|
||||
size: 35, 41
|
||||
orig: 35, 41
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
goblingirl/pelvis
|
||||
rotate: false
|
||||
xy: 546, 45
|
||||
size: 62, 43
|
||||
orig: 62, 43
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
goblingirl/right-arm
|
||||
rotate: false
|
||||
xy: 452, 48
|
||||
size: 28, 50
|
||||
orig: 28, 50
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
goblingirl/right-foot
|
||||
rotate: false
|
||||
xy: 836, 58
|
||||
size: 63, 33
|
||||
orig: 63, 33
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
goblingirl/right-hand
|
||||
rotate: true
|
||||
xy: 771, 20
|
||||
size: 36, 37
|
||||
orig: 36, 37
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
goblingirl/right-lower-leg
|
||||
rotate: true
|
||||
xy: 560, 90
|
||||
size: 36, 76
|
||||
orig: 36, 76
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
goblingirl/right-shoulder
|
||||
rotate: false
|
||||
xy: 649, 10
|
||||
size: 39, 45
|
||||
orig: 39, 45
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
goblingirl/right-upper-leg
|
||||
rotate: true
|
||||
xy: 706, 57
|
||||
size: 34, 63
|
||||
orig: 34, 63
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
goblingirl/torso
|
||||
rotate: false
|
||||
xy: 310, 2
|
||||
size: 68, 96
|
||||
orig: 68, 96
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
goblingirl/undie-straps
|
||||
rotate: false
|
||||
xy: 212, 13
|
||||
size: 55, 19
|
||||
orig: 55, 19
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
goblingirl/undies
|
||||
rotate: false
|
||||
xy: 810, 27
|
||||
size: 36, 29
|
||||
orig: 36, 29
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
shield
|
||||
rotate: false
|
||||
xy: 380, 26
|
||||
size: 70, 72
|
||||
orig: 70, 72
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
spear
|
||||
rotate: true
|
||||
xy: 2, 104
|
||||
size: 22, 368
|
||||
orig: 22, 368
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
|
Before Width: | Height: | Size: 217 KiB |
@ -29,10 +29,11 @@
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*****************************************************************************/
|
||||
|
||||
package spine {
|
||||
package spine.examples {
|
||||
|
||||
import flash.display.Sprite;
|
||||
|
||||
import spine.*;
|
||||
import spine.animation.AnimationStateData;
|
||||
import spine.atlas.Atlas;
|
||||
import spine.attachments.AtlasAttachmentLoader;
|
||||
@ -68,7 +69,7 @@ public class Main extends Sprite {
|
||||
skeleton.y = 560;
|
||||
|
||||
skeleton.state.onStart.add(function (trackIndex:int) : void {
|
||||
trace(trackIndex + " start: " + skeleton.state.getCurrent(trackIndex));
|
||||
trace(trackIndex + " fuu start: " + skeleton.state.getCurrent(trackIndex));
|
||||
});
|
||||
skeleton.state.onEnd.add(function (trackIndex:int) : void {
|
||||
trace(trackIndex + " end: " + skeleton.state.getCurrent(trackIndex));
|
||||
@ -1,194 +1,216 @@
|
||||
|
||||
spineboy.png
|
||||
size: 1024,1024
|
||||
format: RGBA8888
|
||||
filter: Linear,Linear
|
||||
repeat: none
|
||||
eye_indifferent
|
||||
rotate: true
|
||||
xy: 389, 5
|
||||
size: 56, 53
|
||||
orig: 56, 53
|
||||
xy: 648, 629
|
||||
size: 93, 89
|
||||
orig: 93, 89
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
eye_surprised
|
||||
rotate: false
|
||||
xy: 580, 34
|
||||
size: 56, 53
|
||||
orig: 56, 53
|
||||
rotate: true
|
||||
xy: 233, 179
|
||||
size: 93, 89
|
||||
orig: 93, 89
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
front_bracer
|
||||
rotate: false
|
||||
xy: 732, 85
|
||||
size: 35, 48
|
||||
orig: 35, 48
|
||||
xy: 245, 2
|
||||
size: 58, 80
|
||||
orig: 58, 80
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
front_fist_closed
|
||||
rotate: false
|
||||
xy: 556, 91
|
||||
size: 45, 49
|
||||
orig: 45, 49
|
||||
xy: 168, 45
|
||||
size: 75, 82
|
||||
orig: 75, 82
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
front_fist_open
|
||||
rotate: false
|
||||
xy: 668, 32
|
||||
size: 52, 52
|
||||
orig: 52, 52
|
||||
xy: 844, 646
|
||||
size: 86, 87
|
||||
orig: 86, 87
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
front_foot
|
||||
rotate: false
|
||||
xy: 924, 201
|
||||
size: 76, 41
|
||||
orig: 76, 41
|
||||
rotate: true
|
||||
xy: 310, 326
|
||||
size: 126, 69
|
||||
orig: 126, 69
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
front_foot_bend1
|
||||
rotate: false
|
||||
xy: 845, 200
|
||||
size: 77, 42
|
||||
orig: 77, 42
|
||||
rotate: true
|
||||
xy: 951, 894
|
||||
size: 128, 70
|
||||
orig: 128, 70
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
front_foot_bend2
|
||||
rotate: false
|
||||
xy: 778, 186
|
||||
size: 65, 56
|
||||
orig: 65, 56
|
||||
xy: 2, 33
|
||||
size: 108, 93
|
||||
orig: 108, 93
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
front_shin
|
||||
rotate: true
|
||||
xy: 444, 91
|
||||
size: 49, 110
|
||||
orig: 49, 110
|
||||
xy: 739, 735
|
||||
size: 82, 184
|
||||
orig: 82, 184
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
front_thigh
|
||||
rotate: true
|
||||
xy: 603, 89
|
||||
size: 29, 67
|
||||
orig: 29, 67
|
||||
rotate: false
|
||||
xy: 381, 340
|
||||
size: 48, 112
|
||||
orig: 48, 112
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
front_upper_arm
|
||||
rotate: true
|
||||
xy: 672, 86
|
||||
size: 32, 58
|
||||
orig: 32, 58
|
||||
rotate: false
|
||||
xy: 112, 29
|
||||
size: 54, 97
|
||||
orig: 54, 97
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
goggles
|
||||
rotate: false
|
||||
xy: 444, 142
|
||||
size: 157, 100
|
||||
orig: 157, 100
|
||||
xy: 156, 454
|
||||
size: 261, 166
|
||||
orig: 261, 166
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
gun
|
||||
rotate: false
|
||||
xy: 603, 120
|
||||
size: 126, 122
|
||||
orig: 126, 122
|
||||
xy: 739, 819
|
||||
size: 210, 203
|
||||
orig: 210, 203
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
head
|
||||
rotate: false
|
||||
xy: 279, 63
|
||||
size: 163, 179
|
||||
orig: 163, 179
|
||||
xy: 466, 724
|
||||
size: 271, 298
|
||||
orig: 271, 298
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
hoverboard_board
|
||||
rotate: true
|
||||
xy: 2, 128
|
||||
size: 492, 152
|
||||
orig: 492, 152
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
hoverboard_thruster
|
||||
rotate: false
|
||||
xy: 602, 558
|
||||
size: 60, 64
|
||||
orig: 60, 64
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
hoverglow_small
|
||||
rotate: true
|
||||
xy: 156, 178
|
||||
size: 274, 75
|
||||
orig: 274, 75
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
mouth_grind
|
||||
rotate: false
|
||||
xy: 845, 163
|
||||
size: 56, 35
|
||||
orig: 56, 35
|
||||
rotate: true
|
||||
xy: 951, 799
|
||||
size: 93, 59
|
||||
orig: 93, 59
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
mouth_oooo
|
||||
rotate: false
|
||||
xy: 842, 126
|
||||
size: 56, 35
|
||||
orig: 56, 35
|
||||
rotate: true
|
||||
xy: 245, 84
|
||||
size: 93, 59
|
||||
orig: 93, 59
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
mouth_smile
|
||||
rotate: false
|
||||
xy: 769, 97
|
||||
size: 56, 35
|
||||
orig: 56, 35
|
||||
xy: 925, 738
|
||||
size: 93, 59
|
||||
orig: 93, 59
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
muzzle
|
||||
rotate: false
|
||||
xy: 2, 2
|
||||
size: 275, 240
|
||||
orig: 277, 240
|
||||
xy: 2, 622
|
||||
size: 462, 400
|
||||
orig: 462, 400
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
neck
|
||||
rotate: false
|
||||
xy: 903, 173
|
||||
size: 22, 25
|
||||
orig: 22, 25
|
||||
xy: 168, 2
|
||||
size: 36, 41
|
||||
orig: 36, 41
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
rear_bracer
|
||||
rotate: false
|
||||
xy: 722, 40
|
||||
size: 34, 43
|
||||
orig: 34, 43
|
||||
xy: 932, 664
|
||||
size: 56, 72
|
||||
orig: 56, 72
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
rear_foot
|
||||
rotate: false
|
||||
xy: 444, 11
|
||||
size: 68, 36
|
||||
orig: 68, 36
|
||||
xy: 487, 562
|
||||
size: 113, 60
|
||||
orig: 113, 60
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
rear_foot_bend1
|
||||
rotate: false
|
||||
xy: 444, 49
|
||||
size: 70, 40
|
||||
orig: 70, 40
|
||||
rotate: true
|
||||
xy: 419, 503
|
||||
size: 117, 66
|
||||
orig: 117, 66
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
rear_foot_bend2
|
||||
rotate: false
|
||||
xy: 778, 134
|
||||
size: 62, 50
|
||||
orig: 62, 50
|
||||
xy: 739, 650
|
||||
size: 103, 83
|
||||
orig: 103, 83
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
rear_shin
|
||||
rotate: false
|
||||
xy: 731, 135
|
||||
size: 45, 107
|
||||
orig: 45, 107
|
||||
xy: 233, 274
|
||||
size: 75, 178
|
||||
orig: 75, 178
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
rear_thigh
|
||||
rotate: true
|
||||
xy: 516, 50
|
||||
size: 39, 62
|
||||
orig: 39, 62
|
||||
xy: 487, 495
|
||||
size: 65, 104
|
||||
orig: 65, 104
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
rear_upper_arm
|
||||
rotate: false
|
||||
xy: 638, 35
|
||||
size: 28, 52
|
||||
orig: 28, 52
|
||||
rotate: true
|
||||
xy: 156, 129
|
||||
size: 47, 87
|
||||
orig: 47, 87
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
torso
|
||||
rotate: true
|
||||
xy: 279, 2
|
||||
size: 59, 108
|
||||
orig: 59, 108
|
||||
xy: 466, 624
|
||||
size: 98, 180
|
||||
orig: 98, 180
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
|
||||
@ -1,39 +1,31 @@
|
||||
{
|
||||
"skeleton": { "hash": "rPoYyBLFG6F0CGZ5wsUEBKDJU9U", "spine": "3.4.00", "width": 0, "height": 0, "images": "./images/" },
|
||||
"bones": [
|
||||
{ "name": "hip", "y": 247.47 },
|
||||
{ "name": "front_thigh", "parent": "hip", "length": 74.8, "x": -17.45, "y": -11.64, "rotation": -95.51, "color": "00ff04ff" },
|
||||
{ "name": "rear_thigh", "parent": "hip", "length": 85.71, "x": 8.91, "y": -5.62, "rotation": -72.54, "color": "ff000dff" },
|
||||
{ "name": "torso", "parent": "hip", "length": 127.55, "x": -1.61, "y": 4.9, "rotation": 103.82, "color": "e0da19ff" },
|
||||
{
|
||||
"name": "front_shin",
|
||||
"parent": "front_thigh",
|
||||
"length": 128.76,
|
||||
"x": 78.69,
|
||||
"y": 1.6,
|
||||
"rotation": -2.21,
|
||||
"inheritScale": false,
|
||||
"color": "00ff04ff"
|
||||
},
|
||||
{ "name": "front_upper_arm", "parent": "torso", "length": 69.45, "x": 103.75, "y": 19.32, "rotation": 168.37, "color": "00ff04ff" },
|
||||
{ "name": "neck", "parent": "torso", "length": 25.45, "x": 127.49, "y": -0.3, "rotation": -31.53, "color": "e0da19ff" },
|
||||
{ "name": "rear_shin", "parent": "rear_thigh", "length": 121.87, "x": 86.1, "y": -1.32, "rotation": -19.83, "color": "ff000dff" },
|
||||
{ "name": "rear_upper_arm", "parent": "torso", "length": 51.93, "x": 92.35, "y": -19.22, "rotation": -169.55, "color": "ff000dff" },
|
||||
{ "name": "torso", "parent": "hip", "length": 127.55, "rotation": 103.82, "x": -1.61, "y": 4.9, "color": "e0da19ff" },
|
||||
{ "name": "front_upper_arm", "parent": "torso", "length": 69.45, "rotation": 168.37, "x": 103.75, "y": 19.32, "color": "00ff04ff" },
|
||||
{
|
||||
"name": "front_bracer",
|
||||
"parent": "front_upper_arm",
|
||||
"length": 40.57,
|
||||
"rotation": 18.29,
|
||||
"x": 68.8,
|
||||
"y": -0.68,
|
||||
"rotation": 18.29,
|
||||
"color": "00ff04ff"
|
||||
},
|
||||
{ "name": "front_foot", "parent": "front_shin", "length": 91.34, "x": 128.75, "y": -0.33, "rotation": 77.9, "color": "00ff04ff" },
|
||||
{ "name": "head", "parent": "neck", "length": 263.57, "x": 27.66, "y": -0.25, "rotation": 23.18, "color": "e0da19ff" },
|
||||
{ "name": "rear_bracer", "parent": "rear_upper_arm", "length": 34.55, "x": 51.35, "rotation": 23.15, "color": "ff000dff" },
|
||||
{ "name": "rear_foot", "parent": "rear_shin", "length": 82.57, "x": 121.45, "y": -0.75, "rotation": 69.3, "color": "ff000dff" },
|
||||
{ "name": "front_fist", "parent": "front_bracer", "length": 65.38, "x": 40.56, "y": 0.19, "rotation": 12.43, "color": "00ff04ff" },
|
||||
{ "name": "gun", "parent": "rear_bracer", "length": 43.1, "x": 34.42, "y": -0.45, "rotation": 5.34, "color": "ff000dff" },
|
||||
{ "name": "gunTip", "parent": "gun", "x": 201.04, "y": 52.13, "rotation": 6.83, "color": "ff000dff" }
|
||||
{ "name": "front_fist", "parent": "front_bracer", "length": 65.38, "rotation": 12.43, "x": 40.56, "y": 0.19, "color": "00ff04ff" },
|
||||
{ "name": "front_thigh", "parent": "hip", "length": 74.8, "rotation": -95.51, "x": -17.45, "y": -11.64, "color": "00ff04ff" },
|
||||
{ "name": "front_shin", "parent": "front_thigh", "length": 128.76, "rotation": -2.21, "x": 78.69, "y": 1.6, "color": "00ff04ff" },
|
||||
{ "name": "front_foot", "parent": "front_shin", "length": 91.34, "rotation": 77.9, "x": 128.75, "y": -0.33, "color": "00ff04ff" },
|
||||
{ "name": "rear_upper_arm", "parent": "torso", "length": 51.93, "rotation": -169.55, "x": 92.35, "y": -19.22, "color": "ff000dff" },
|
||||
{ "name": "rear_bracer", "parent": "rear_upper_arm", "length": 34.55, "rotation": 23.15, "x": 51.35, "color": "ff000dff" },
|
||||
{ "name": "gun", "parent": "rear_bracer", "length": 43.1, "rotation": 5.34, "x": 34.42, "y": -0.45, "color": "ff000dff" },
|
||||
{ "name": "gunTip", "parent": "gun", "rotation": 6.83, "x": 201.04, "y": 52.13, "color": "ff000dff" },
|
||||
{ "name": "neck", "parent": "torso", "length": 25.45, "rotation": -31.53, "x": 127.49, "y": -0.3, "color": "e0da19ff" },
|
||||
{ "name": "head", "parent": "neck", "length": 263.57, "rotation": 23.18, "x": 27.66, "y": -0.25, "color": "e0da19ff" },
|
||||
{ "name": "rear_thigh", "parent": "hip", "length": 85.71, "rotation": -72.54, "x": 8.91, "y": -5.62, "color": "ff000dff" },
|
||||
{ "name": "rear_shin", "parent": "rear_thigh", "length": 121.87, "rotation": -19.83, "x": 86.1, "y": -1.32, "color": "ff000dff" },
|
||||
{ "name": "rear_foot", "parent": "rear_shin", "length": 82.57, "rotation": 69.3, "x": 121.45, "y": -0.75, "color": "ff000dff" }
|
||||
],
|
||||
"slots": [
|
||||
{ "name": "rear_upper_arm", "bone": "rear_upper_arm", "attachment": "rear_upper_arm" },
|
||||
@ -96,7 +88,8 @@
|
||||
"head-bb": {
|
||||
"head": {
|
||||
"type": "boundingbox",
|
||||
"vertices": [ -19.143097, -70.30209, 40.80313, -118.074234, 257.77155, -115.61827, 285.16193, 57.18005, 120.77191, 164.95125, -5.067627, 76.94907 ]
|
||||
"vertexCount": 6,
|
||||
"vertices": [ -19.14, -70.3, 40.8, -118.07, 257.77, -115.61, 285.16, 57.18, 120.77, 164.95, -5.06, 76.94 ]
|
||||
}
|
||||
},
|
||||
"mouth": {
|
||||
@ -1832,10 +1825,6 @@
|
||||
]
|
||||
},
|
||||
"muzzle": {
|
||||
"attachment": [
|
||||
{ "time": 0.1333, "name": "muzzle" },
|
||||
{ "time": 0.2666, "name": null }
|
||||
],
|
||||
"color": [
|
||||
{
|
||||
"time": 0.1333,
|
||||
@ -1848,6 +1837,10 @@
|
||||
"curve": [ 0.821, 0, 0.909, 0.89 ]
|
||||
},
|
||||
{ "time": 0.2666, "color": "ffffff00" }
|
||||
],
|
||||
"attachment": [
|
||||
{ "time": 0.1333, "name": "muzzle" },
|
||||
{ "time": 0.2666, "name": null }
|
||||
]
|
||||
}
|
||||
},
|
||||
@ -2015,7 +2008,7 @@
|
||||
]
|
||||
}
|
||||
},
|
||||
"draworder": [
|
||||
"drawOrder": [
|
||||
{
|
||||
"time": 0.6666,
|
||||
"offsets": [
|
||||
|
||||
|
Before Width: | Height: | Size: 253 KiB After Width: | Height: | Size: 678 KiB |
@ -1,5 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<AS3Classpath>
|
||||
<AS3Classpath generateProblems="true" sdkBased="true" type="lib" useAsSharedCode="false">frameworks/libs/player/{playerVersion}/playerglobal.swc</AS3Classpath>
|
||||
<AS3Classpath generateProblems="true" sdkBased="false" type="source" useAsSharedCode="false">src</AS3Classpath>
|
||||
<AS3Classpath generateProblems="true" sdkBased="true" type="lib" useAsSharedCode="false">frameworks/libs/player/{playerVersion}/playerglobal.swc</AS3Classpath>
|
||||
<AS3Classpath generateProblems="true" sdkBased="true" type="lib" useAsSharedCode="false">frameworks/libs/textLayout.swc</AS3Classpath>
|
||||
<AS3Classpath generateProblems="true" sdkBased="true" type="lib" useAsSharedCode="false">frameworks/libs/osmf.swc</AS3Classpath>
|
||||
<AS3Classpath generateProblems="true" sdkBased="true" type="lib" useAsSharedCode="false">frameworks/libs/authoringsupport.swc</AS3Classpath>
|
||||
<AS3Classpath generateProblems="true" sdkBased="true" type="lib" useAsSharedCode="false">frameworks/libs/core.swc</AS3Classpath>
|
||||
</AS3Classpath>
|
||||
|
||||
@ -3,6 +3,7 @@ com.powerflasher.fdt.core.CompilerArguments=-static-link-runtime-shared-librarie
|
||||
com.powerflasher.fdt.core.CompilerConstants=CONFIG\:\:AUTHOR\!"{user.name}"\nCONFIG\:\:DEBUG\!{debug}
|
||||
com.powerflasher.fdt.core.DefaultOutputFolder=bin
|
||||
com.powerflasher.fdt.core.DefaultPlayer=External_SWF_Viewer
|
||||
com.powerflasher.fdt.core.IncludeTestResources=false
|
||||
com.powerflasher.fdt.core.Language=AS3
|
||||
com.powerflasher.fdt.core.Manifests=
|
||||
com.powerflasher.fdt.core.PassClasspath=true
|
||||
@ -13,7 +14,7 @@ com.powerflasher.fdt.core.PassManifests=true
|
||||
com.powerflasher.fdt.core.PassRsls=false
|
||||
com.powerflasher.fdt.core.PassSwcs=true
|
||||
com.powerflasher.fdt.core.PlatformType=WEB
|
||||
com.powerflasher.fdt.core.PlayerVersion=11.1
|
||||
com.powerflasher.fdt.core.PlayerVersion=22.0
|
||||
com.powerflasher.fdt.core.ProjectTypeHint=Web
|
||||
com.powerflasher.fdt.core.Runtime=Flash_Player
|
||||
com.powerflasher.fdt.core.SdkName=Flex 4.6.0
|
||||
|
||||
13
spine-as3/spine-as3/.settings/com.powerflasher.fdt.exclude
Normal file
@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<exclude>
|
||||
<resource>frameworks/libs/air/aircore.swc</resource>
|
||||
<resource>frameworks/libs/air/airglobal.swc</resource>
|
||||
<resource>frameworks/libs/air/applicationupdater.swc</resource>
|
||||
<resource>frameworks/libs/air/applicationupdater_ui.swc</resource>
|
||||
<resource>frameworks/libs/air/servicemonitor.swc</resource>
|
||||
<resource>frameworks/libs/authoringsupport.swc</resource>
|
||||
<resource>frameworks/libs/core.swc</resource>
|
||||
<resource>frameworks/libs/osmf.swc</resource>
|
||||
<resource>frameworks/libs/textLayout.swc</resource>
|
||||
</exclude>
|
||||
|
||||
@ -37,14 +37,15 @@ public class Bone implements Updatable {
|
||||
internal var _data:BoneData;
|
||||
internal var _skeleton:Skeleton;
|
||||
internal var _parent:Bone;
|
||||
internal var _children:Vector.<Bone> = new Vector.<Bone>();
|
||||
public var x:Number;
|
||||
public var y:Number;
|
||||
public var rotation:Number;
|
||||
public var scaleX:Number;
|
||||
public var scaleY:Number;
|
||||
public var shearX:Number;
|
||||
public var shearY:Number;
|
||||
public var appliedRotation:Number;
|
||||
public var appliedScaleX:Number;
|
||||
public var appliedScaleY:Number;
|
||||
|
||||
internal var _a:Number;
|
||||
internal var _b:Number;
|
||||
@ -55,6 +56,8 @@ public class Bone implements Updatable {
|
||||
internal var _worldSignX:Number;
|
||||
internal var _worldSignY:Number;
|
||||
|
||||
internal var _sorted:Boolean;
|
||||
|
||||
/** @param parent May be null. */
|
||||
public function Bone (data:BoneData, skeleton:Skeleton, parent:Bone) {
|
||||
if (data == null) throw new ArgumentError("data cannot be null.");
|
||||
@ -65,25 +68,24 @@ public class Bone implements Updatable {
|
||||
setToSetupPose();
|
||||
}
|
||||
|
||||
/** Computes the world SRT using the parent bone and this bone's local SRT. */
|
||||
public function updateWorldTransform () : void {
|
||||
updateWorldTransformWith(x, y, rotation, scaleX, scaleY);
|
||||
}
|
||||
|
||||
/** Same as updateWorldTransform(). This method exists for Bone to implement Updatable. */
|
||||
public function update () : void {
|
||||
updateWorldTransformWith(x, y, rotation, scaleX, scaleY);
|
||||
updateWorldTransformWith(x, y, rotation, scaleX, scaleY, shearX, shearY);
|
||||
}
|
||||
|
||||
/** Computes the world SRT using the parent bone and this bone's local SRT. */
|
||||
public function updateWorldTransform () : void {
|
||||
updateWorldTransformWith(x, y, rotation, scaleX, scaleY, shearX, shearY);
|
||||
}
|
||||
|
||||
/** Computes the world SRT using the parent bone and the specified local SRT. */
|
||||
public function updateWorldTransformWith (x:Number, y:Number, rotation:Number, scaleX:Number, scaleY:Number) : void {
|
||||
public function updateWorldTransformWith (x:Number, y:Number, rotation:Number, scaleX:Number, scaleY:Number, shearX:Number, shearY:Number) : void {
|
||||
appliedRotation = rotation;
|
||||
appliedScaleX = scaleX;
|
||||
appliedScaleY = scaleY;
|
||||
|
||||
var radians:Number = rotation * MathUtils.degRad;
|
||||
var cos:Number = Math.cos(radians), sin:Number = Math.sin(radians);
|
||||
var la:Number = cos * scaleX, lb:Number = -sin * scaleY, lc:Number = sin * scaleX, ld:Number = cos * scaleY;
|
||||
var rotationY:Number = rotation + 90 + shearY;
|
||||
var la:Number = MathUtils.cosDeg(rotation + shearX) * scaleX, lb:Number = MathUtils.cosDeg(rotationY) * scaleY;
|
||||
var lc:Number = MathUtils.sinDeg(rotation + shearX) * scaleX, ld:Number = MathUtils.sinDeg(rotationY) * scaleY;
|
||||
|
||||
var parent:Bone = _parent;
|
||||
if (!parent) { // Root bone.
|
||||
var skeleton:Skeleton = _skeleton;
|
||||
@ -126,15 +128,13 @@ public class Bone implements Updatable {
|
||||
pc = 0;
|
||||
pd = 1;
|
||||
do {
|
||||
radians = parent.appliedRotation * MathUtils.degRad;
|
||||
cos = Math.cos(radians);
|
||||
sin = Math.sin(radians);
|
||||
var temp1:Number = pa * cos + pb * sin;
|
||||
pb = pa * -sin + pb * cos;
|
||||
pa = temp1;
|
||||
temp1 = pc * cos + pd * sin;
|
||||
pd = pc * -sin + pd * cos;
|
||||
pc = temp1;
|
||||
var cos:Number = MathUtils.cosDeg(parent.appliedRotation), sin:Number = MathUtils.sinDeg(parent.appliedRotation);
|
||||
var temp:Number = pa * cos + pb * sin;
|
||||
pb = pb * cos - pa * sin;
|
||||
pa = temp;
|
||||
temp = pc * cos + pd * sin;
|
||||
pd = pd * cos - pc * sin;
|
||||
pc = temp;
|
||||
|
||||
if (!parent.data.inheritRotation) break;
|
||||
parent = parent.parent;
|
||||
@ -149,27 +149,23 @@ public class Bone implements Updatable {
|
||||
pc = 0;
|
||||
pd = 1;
|
||||
do {
|
||||
radians = parent.rotation * MathUtils.degRad;
|
||||
cos = Math.cos(radians);
|
||||
sin = Math.sin(radians);
|
||||
var psx:Number = parent.appliedScaleX, psy:Number = parent.appliedScaleY;
|
||||
var za:Number = cos * psx, zb:Number = -sin * psy, zc:Number = sin * psx, zd:Number = cos * psy;
|
||||
var temp2:Number = pa * za + pb * zc;
|
||||
pb = pa * zb + pb * zd;
|
||||
pa = temp2;
|
||||
temp2 = pc * za + pd * zc;
|
||||
pd = pc * zb + pd * zd;
|
||||
pc = temp2;
|
||||
cos = MathUtils.cosDeg(parent.appliedRotation), sin = MathUtils.sinDeg(parent.appliedRotation);
|
||||
var psx:Number = parent.scaleX, psy:Number = parent.scaleY;
|
||||
var za:Number = cos * psx, zb:Number = sin * psy, zc:Number = sin * psx, zd:Number = cos * psy;
|
||||
temp = pa * za + pb * zc;
|
||||
pb = pb * zd - pa * zb;
|
||||
pa = temp;
|
||||
temp = pc * za + pd * zc;
|
||||
pd = pd * zd - pc * zb;
|
||||
pc = temp;
|
||||
|
||||
if (psx < 0) radians = -radians;
|
||||
cos = Math.cos(-radians);
|
||||
sin = Math.sin(-radians);
|
||||
temp2 = pa * cos + pb * sin;
|
||||
pb = pa * -sin + pb * cos;
|
||||
pa = temp2;
|
||||
temp2 = pc * cos + pd * sin;
|
||||
pd = pc * -sin + pd * cos;
|
||||
pc = temp2;
|
||||
if (psx >= 0) sin = -sin;
|
||||
temp = pa * cos + pb * sin;
|
||||
pb = pb * cos - pa * sin;
|
||||
pa = temp;
|
||||
temp = pc * cos + pd * sin;
|
||||
pd = pd * cos - pc * sin;
|
||||
pc = temp;
|
||||
|
||||
if (!parent.data.inheritScale) break;
|
||||
parent = parent.parent;
|
||||
@ -201,18 +197,24 @@ public class Bone implements Updatable {
|
||||
rotation = _data.rotation;
|
||||
scaleX = _data.scaleX;
|
||||
scaleY = _data.scaleY;
|
||||
shearX = _data.shearX;
|
||||
shearY = _data.shearY;
|
||||
}
|
||||
|
||||
public function get data () : BoneData {
|
||||
return _data;
|
||||
}
|
||||
|
||||
public function get skeleton () : Skeleton {
|
||||
return _skeleton;
|
||||
}
|
||||
|
||||
public function get parent () : Bone {
|
||||
return _parent;
|
||||
}
|
||||
|
||||
public function get skeleton () : Skeleton {
|
||||
return _skeleton;
|
||||
public function get children () : Vector.<Bone> {;
|
||||
return _children;
|
||||
}
|
||||
|
||||
public function get a () : Number {
|
||||
@ -263,10 +265,80 @@ public class Bone implements Updatable {
|
||||
return Math.sqrt(_c * _c + _d * _d) * _worldSignY;
|
||||
}
|
||||
|
||||
public function worldToLocalRotationX () : Number {
|
||||
var parent:Bone = _parent;
|
||||
if (parent == null) return rotation;
|
||||
var pa:Number = parent.a, pb:Number = parent.b, pc:Number = parent.c, pd:Number = parent.d, a:Number = this.a, c:Number = this.c;
|
||||
return Math.atan2(pa * c - pc * a, pd * a - pb * c) * MathUtils.radDeg;
|
||||
}
|
||||
|
||||
public function worldToLocalRotationY () : Number {
|
||||
var parent:Bone = _parent;
|
||||
if (parent == null) return rotation;
|
||||
var pa:Number = parent.a, pb:Number = parent.b, pc:Number = parent.c, pd:Number = parent.d, b:Number = this.b, d:Number = this.d;
|
||||
return Math.atan2(pa * d - pc * b, pd * b - pb * d) * MathUtils.radDeg;
|
||||
}
|
||||
|
||||
public function rotateWorld (degrees:Number) : void {
|
||||
var a:Number = this.a, b:Number = this.b, c:Number = this.c, d:Number = this.d;
|
||||
var cos:Number = MathUtils.cosDeg(degrees), sin:Number = MathUtils.sinDeg(degrees);
|
||||
this._a = cos * a - sin * c;
|
||||
this._b = cos * b - sin * d;
|
||||
this._c = sin * a + cos * c;
|
||||
this._d = sin * b + cos * d;
|
||||
}
|
||||
|
||||
/** Computes the local transform from the world transform. This can be useful to perform processing on the local transform
|
||||
* after the world transform has been modified directly (eg, by a constraint).
|
||||
* <p>
|
||||
* Some redundant information is lost by the world transform, such as -1,-1 scale versus 180 rotation. The computed local
|
||||
* transform values may differ from the original values but are functionally the same. */
|
||||
public function updateLocalTransform () : void {
|
||||
var parent:Bone = this.parent;
|
||||
if (parent == null) {
|
||||
x = worldX;
|
||||
y = worldY;
|
||||
rotation = Math.atan2(c, a) * MathUtils.radDeg;
|
||||
scaleX = Math.sqrt(a * a + c * c);
|
||||
scaleY = Math.sqrt(b * b + d * d);
|
||||
var det:Number = a * d - b * c;
|
||||
shearX = 0;
|
||||
shearY = Math.atan2(a * b + c * d, det) * MathUtils.radDeg;
|
||||
return;
|
||||
}
|
||||
var pa:Number = parent.a, pb:Number = parent.b, pc:Number = parent.c, pd:Number = parent.d;
|
||||
var pid:Number = 1 / (pa * pd - pb * pc);
|
||||
var dx:Number = worldX - parent.worldX, dy:Number = worldY - parent.worldY;
|
||||
x = (dx * pd * pid - dy * pb * pid);
|
||||
y = (dy * pa * pid - dx * pc * pid);
|
||||
var ia:Number = pid * pd;
|
||||
var id:Number = pid * pa;
|
||||
var ib:Number = pid * pb;
|
||||
var ic:Number = pid * pc;
|
||||
var ra:Number = ia * a - ib * c;
|
||||
var rb:Number = ia * b - ib * d;
|
||||
var rc:Number = id * c - ic * a;
|
||||
var rd:Number = id * d - ic * b;
|
||||
shearX = 0;
|
||||
scaleX = Math.sqrt(ra * ra + rc * rc);
|
||||
if (scaleX > 0.0001) {
|
||||
det = ra * rd - rb * rc;
|
||||
scaleY = det / scaleX;
|
||||
shearY = Math.atan2(ra * rb + rc * rd, det) * MathUtils.radDeg;
|
||||
rotation = Math.atan2(rc, ra) * MathUtils.radDeg;
|
||||
} else {
|
||||
scaleX = 0;
|
||||
scaleY = Math.sqrt(rb * rb + rd * rd);
|
||||
shearY = 0;
|
||||
rotation = 90 - Math.atan2(rd, rb) * MathUtils.radDeg;
|
||||
}
|
||||
appliedRotation = rotation;
|
||||
}
|
||||
|
||||
public function worldToLocal (world:Vector.<Number>) : void {
|
||||
var x:Number = world[0] - _worldX, y:Number = world[1] - _worldY;
|
||||
var a:Number = _a, b:Number = _b, c:Number = _c, d:Number = _d;
|
||||
var invDet:Number = 1 / (a * d - b * c);
|
||||
var x:Number = world[0] - _worldX, y:Number = world[1] - _worldY;
|
||||
world[0] = (x * d * invDet - y * b * invDet);
|
||||
world[1] = (y * a * invDet - x * c * invDet);
|
||||
}
|
||||
|
||||
@ -32,6 +32,7 @@
|
||||
package spine {
|
||||
|
||||
public class BoneData {
|
||||
internal var _index:int;
|
||||
internal var _name:String;
|
||||
internal var _parent:BoneData;
|
||||
public var length:Number;
|
||||
@ -40,16 +41,24 @@ public class BoneData {
|
||||
public var rotation:Number;
|
||||
public var scaleX:Number = 1;
|
||||
public var scaleY:Number = 1;
|
||||
public var inheritScale:Boolean = true;
|
||||
public var shearX:Number;
|
||||
public var shearY:Number;
|
||||
public var inheritRotation:Boolean = true;
|
||||
public var inheritScale:Boolean = true;
|
||||
|
||||
/** @param parent May be null. */
|
||||
public function BoneData (name:String, parent:BoneData) {
|
||||
public function BoneData (index:int, name:String, parent:BoneData) {
|
||||
if (index < 0) throw new ArgumentError("index must be >= 0");
|
||||
if (name == null) throw new ArgumentError("name cannot be null.");
|
||||
_index = index;
|
||||
_name = name;
|
||||
_parent = parent;
|
||||
}
|
||||
|
||||
public function get index () : int {
|
||||
return _index;
|
||||
}
|
||||
|
||||
public function get name () : String {
|
||||
return _name;
|
||||
}
|
||||
|
||||
@ -35,8 +35,10 @@ public class IkConstraint implements Updatable {
|
||||
internal var _data:IkConstraintData;
|
||||
public var bones:Vector.<Bone>;
|
||||
public var target:Bone;
|
||||
public var bendDirection:int;
|
||||
public var mix:Number;
|
||||
public var bendDirection:int;
|
||||
|
||||
public var level:int;
|
||||
|
||||
public function IkConstraint (data:IkConstraintData, skeleton:Skeleton) {
|
||||
if (data == null) throw new ArgumentError("data cannot be null.");
|
||||
@ -77,121 +79,128 @@ public class IkConstraint implements Updatable {
|
||||
/** Adjusts the bone rotation so the tip is as close to the target position as possible. The target is specified in the world
|
||||
* coordinate system. */
|
||||
static public function apply1 (bone:Bone, targetX:Number, targetY:Number, alpha:Number) : void {
|
||||
var parentRotation:Number = bone._parent == null ? 0 : bone._parent.worldRotationX;
|
||||
var rotation:Number = bone.rotation;
|
||||
var rotationIK:Number = Math.atan2(targetY - bone._worldY, targetX - bone._worldX) * MathUtils.radDeg - parentRotation;
|
||||
if ((bone._worldSignX != bone._worldSignY) != (bone._skeleton.flipX != (bone._skeleton.flipY != Bone.yDown)))
|
||||
rotationIK = 360 - rotationIK;
|
||||
if (rotationIK > 180) rotationIK -= 360;
|
||||
var pp:Bone = bone.parent;
|
||||
var id:Number = 1 / (pp.a * pp.d - pp.b * pp.c);
|
||||
var x:Number = targetX - pp.worldX, y:Number = targetY - pp.worldY;
|
||||
var tx:Number = (x * pp.d - y * pp.b) * id - bone.x, ty:Number = (y * pp.a - x * pp.c) * id - bone.y;
|
||||
var rotationIK:Number = Math.atan2(ty, tx) * MathUtils.radDeg - bone.shearX - bone.rotation;
|
||||
if (bone.scaleX < 0) rotationIK += 180;
|
||||
if (rotationIK > 180)
|
||||
rotationIK -= 360;
|
||||
else if (rotationIK < -180) rotationIK += 360;
|
||||
bone.updateWorldTransformWith(bone.x, bone.y, rotation + (rotationIK - rotation) * alpha, bone.appliedScaleX, bone.appliedScaleY);
|
||||
bone.updateWorldTransformWith(bone.x, bone.y, bone.rotation + rotationIK * alpha, bone.scaleX, bone.scaleY, bone.shearX,
|
||||
bone.shearY);
|
||||
}
|
||||
|
||||
/** Adjusts the parent and child bone rotations so the tip of the child is as close to the target position as possible. The
|
||||
* target is specified in the world coordinate system.
|
||||
* @param child Any descendant bone of the parent. */
|
||||
static public function apply2 (parent:Bone, child:Bone, targetX:Number, targetY:Number, bendDir:int, alpha:Number) : void {
|
||||
if (alpha == 0) return;
|
||||
var px:Number = parent.x, py:Number = parent.y, psx:Number = parent.appliedScaleX, psy:Number = parent.appliedScaleY;
|
||||
var o1:int, o2:int, s2:int;
|
||||
if (alpha == 0) {
|
||||
child.updateWorldTransform();
|
||||
return;
|
||||
}
|
||||
var px:Number = parent.x, py:Number = parent.y, psx:Number = parent.scaleX, psy:Number = parent.scaleY, csx:Number = child.scaleX;;
|
||||
var os1:int, os2:int, s2:int;
|
||||
if (psx < 0) {
|
||||
psx = -psx;
|
||||
o1 = 180;
|
||||
os1 = 180;
|
||||
s2 = -1;
|
||||
} else {
|
||||
o1 = 0;
|
||||
os1 = 0;
|
||||
s2 = 1;
|
||||
}
|
||||
if (psy < 0) {
|
||||
psy = -psy;
|
||||
s2 = -s2;
|
||||
}
|
||||
var cx:Number = child.x, cy:Number = child.y, csx:Number = child.appliedScaleX;
|
||||
var u:Boolean = Math.abs(psx - psy) <= 0.0001;
|
||||
if (!u && cy != 0) {
|
||||
child._worldX = parent.a * cx + parent.worldX;
|
||||
child._worldY = parent.c * cx + parent.worldY;
|
||||
cy = 0;
|
||||
}
|
||||
if (csx < 0) {
|
||||
csx = -csx;
|
||||
o2 = 180;
|
||||
os2 = 180;
|
||||
} else
|
||||
o2 = 0;
|
||||
var pp:Bone = parent.parent;
|
||||
var tx:Number, ty:Number, dx:Number, dy:Number;
|
||||
if (!pp) {
|
||||
tx = targetX - px;
|
||||
ty = targetY - py;
|
||||
dx = child._worldX - px;
|
||||
dy = child._worldY - py;
|
||||
os2 = 0;
|
||||
var cx:Number = child.x, cy:Number, cwx:Number, cwy:Number, a:Number = parent.a, b:Number = parent.b, c:Number = parent.c, d:Number = parent.d;
|
||||
var u:Boolean = Math.abs(psx - psy) <= 0.0001;
|
||||
if (!u) {
|
||||
cy = 0;
|
||||
cwx = a * cx + parent.worldX;
|
||||
cwy = c * cx + parent.worldY;
|
||||
} else {
|
||||
var ppa:Number = pp.a, ppb:Number = pp.b, ppc:Number = pp.c, ppd:Number = pp.d;
|
||||
var invDet:Number = 1 / (ppa * ppd - ppb * ppc);
|
||||
var wx:Number = pp._worldX, wy:Number = pp._worldY, twx:Number = targetX - wx, twy:Number = targetY - wy;
|
||||
tx = (twx * ppd - twy * ppb) * invDet - px;
|
||||
ty = (twy * ppa - twx * ppc) * invDet - py;
|
||||
twx = child._worldX - wx;
|
||||
twy = child._worldY - wy;
|
||||
dx = (twx * ppd - twy * ppb) * invDet - px;
|
||||
dy = (twy * ppa - twx * ppc) * invDet - py;
|
||||
cy = child.y;
|
||||
cwx = a * cx + b * cy + parent.worldX;
|
||||
cwy = c * cx + d * cy + parent.worldY;
|
||||
}
|
||||
var pp:Bone = parent.parent;
|
||||
a = pp.a;
|
||||
b = pp.b;
|
||||
c = pp.c;
|
||||
d = pp.d;
|
||||
var id:Number = 1 / (a * d - b * c), x:Number = targetX - pp.worldX, y:Number = targetY - pp.worldY;
|
||||
var tx:Number = (x * d - y * b) * id - px, ty:Number = (y * a - x * c) * id - py;
|
||||
x = cwx - pp.worldX;
|
||||
y = cwy - pp.worldY;
|
||||
var dx:Number = (x * d - y * b) * id - px, dy:Number = (y * a - x * c) * id - py;
|
||||
var l1:Number = Math.sqrt(dx * dx + dy * dy), l2:Number = child.data.length * csx, a1:Number, a2:Number;
|
||||
outer:
|
||||
if (u) {
|
||||
l2 *= psx;
|
||||
var cos:Number = (tx * tx + ty * ty - l1 * l1 - l2 * l2) / (2 * l1 * l2);
|
||||
if (cos < -1) cos = -1;
|
||||
if (cos < -1)
|
||||
cos = -1;
|
||||
else if (cos > 1) cos = 1;
|
||||
a2 = Math.acos(cos) * bendDir;
|
||||
var ad:Number = l1 + l2 * cos, o:Number = l2 * Math.sin(a2);
|
||||
a1 = Math.atan2(ty * ad - tx * o, tx * ad + ty * o);
|
||||
a = l1 + l2 * cos;
|
||||
b = l2 * Math.sin(a2);
|
||||
a1 = Math.atan2(ty * a - tx * b, tx * a + ty * b);
|
||||
} else {
|
||||
var a:Number = psx * l2, b:Number = psy * l2, ta:Number = Math.atan2(ty, tx);
|
||||
var aa:Number = a * a, bb:Number = b * b, ll:Number = l1 * l1, dd:Number = tx * tx + ty * ty;
|
||||
var c0:Number = bb * ll + aa * dd - aa * bb, c1:Number = -2 * bb * l1, c2:Number = bb - aa;
|
||||
var d:Number = c1 * c1 - 4 * c2 * c0;
|
||||
a = psx * l2;
|
||||
b = psy * l2;
|
||||
var aa:Number = a * a, bb:Number = b * b, dd:Number = tx * tx + ty * ty, ta:Number = Math.atan2(ty, tx);
|
||||
c = bb * l1 * l1 + aa * dd - aa * bb;
|
||||
var c1:Number = -2 * bb * l1, c2:Number = bb - aa;
|
||||
d = c1 * c1 - 4 * c2 * c;
|
||||
if (d >= 0) {
|
||||
var q:Number = Math.sqrt(d);
|
||||
if (c1 < 0) q = -q;
|
||||
q = -(c1 + q) / 2;
|
||||
var r0:Number = q / c2, r1:Number = c0 / q;
|
||||
var r0:Number = q / c2, r1:Number = c / q;
|
||||
var r:Number = Math.abs(r0) < Math.abs(r1) ? r0 : r1;
|
||||
if (r * r <= dd) {
|
||||
var y1:Number = Math.sqrt(dd - r * r) * bendDir;
|
||||
a1 = ta - Math.atan2(y1, r);
|
||||
a2 = Math.atan2(y1 / psy, (r - l1) / psx);
|
||||
y = Math.sqrt(dd - r * r) * bendDir;
|
||||
a1 = ta - Math.atan2(y, r);
|
||||
a2 = Math.atan2(y / psy, (r - l1) / psx);
|
||||
break outer;
|
||||
}
|
||||
}
|
||||
var minAngle:Number = 0, minDist:Number = Number.MAX_VALUE, minX:Number = 0, minY:Number = 0;
|
||||
var maxAngle:Number = 0, maxDist:Number = 0, maxX:Number = 0, maxY:Number = 0;
|
||||
var x:Number = l1 + a, dist:Number = x * x;
|
||||
if (dist > maxDist) {
|
||||
x = l1 + a;
|
||||
d = x * x;
|
||||
if (d > maxDist) {
|
||||
maxAngle = 0;
|
||||
maxDist = dist;
|
||||
maxDist = d;
|
||||
maxX = x;
|
||||
}
|
||||
x = l1 - a;
|
||||
dist = x * x;
|
||||
if (dist < minDist) {
|
||||
d = x * x;
|
||||
if (d < minDist) {
|
||||
minAngle = Math.PI;
|
||||
minDist = dist;
|
||||
minDist = d;
|
||||
minX = x;
|
||||
}
|
||||
var angle:Number = Math.acos(-a * l1 / (aa - bb));
|
||||
x = a * Math.cos(angle) + l1;
|
||||
var y:Number = b * Math.sin(angle);
|
||||
dist = x * x + y * y;
|
||||
if (dist < minDist) {
|
||||
y = b * Math.sin(angle);
|
||||
d = x * x + y * y;
|
||||
if (d < minDist) {
|
||||
minAngle = angle;
|
||||
minDist = dist;
|
||||
minDist = d;
|
||||
minX = x;
|
||||
minY = y;
|
||||
}
|
||||
if (dist > maxDist) {
|
||||
if (d > maxDist) {
|
||||
maxAngle = angle;
|
||||
maxDist = dist;
|
||||
maxDist = d;
|
||||
maxX = x;
|
||||
maxY = y;
|
||||
}
|
||||
@ -204,16 +213,18 @@ public class IkConstraint implements Updatable {
|
||||
}
|
||||
}
|
||||
var os:Number = Math.atan2(cy, cx) * s2;
|
||||
a1 = (a1 - os) * MathUtils.radDeg + o1;
|
||||
a2 = (a2 + os) * MathUtils.radDeg * s2 + o2;
|
||||
if (a1 > 180) a1 -= 360;
|
||||
else if (a1 < -180) a1 += 360;
|
||||
if (a2 > 180) a2 -= 360;
|
||||
else if (a2 < -180) a2 += 360;
|
||||
var rotation:Number = parent.rotation;
|
||||
parent.updateWorldTransformWith(px, py, rotation + (a1 - rotation) * alpha, parent.appliedScaleX, parent.appliedScaleY);
|
||||
a1 = (a1 - os) * MathUtils.radDeg + os1 - rotation;
|
||||
if (a1 > 180)
|
||||
a1 -= 360;
|
||||
else if (a1 < -180) a1 += 360;
|
||||
parent.updateWorldTransformWith(px, py, rotation + a1 * alpha, parent.scaleX, parent.scaleY, 0, 0);
|
||||
rotation = child.rotation;
|
||||
child.updateWorldTransformWith(cx, cy, rotation + (a2 - rotation) * alpha, child.appliedScaleX, child.appliedScaleY);
|
||||
a2 = ((a2 + os) * MathUtils.radDeg - child.shearX) * s2 + os2 - rotation;
|
||||
if (a2 > 180)
|
||||
a2 -= 360;
|
||||
else if (a2 < -180) a2 += 360;
|
||||
child.updateWorldTransformWith(cx, cy, rotation + a2 * alpha, child.scaleX, child.scaleY, child.shearX, child.shearY);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -34,6 +34,20 @@ package spine {
|
||||
public class MathUtils {
|
||||
static public var radDeg:Number = 180 / Math.PI;
|
||||
static public var degRad:Number = Math.PI / 180;
|
||||
|
||||
static public function cosDeg(degrees:Number): Number {
|
||||
return Math.cos(degrees * degRad);
|
||||
}
|
||||
|
||||
static public function sinDeg(degrees:Number): Number {
|
||||
return Math.sin(degrees * degRad);
|
||||
}
|
||||
|
||||
static public function clamp (value:Number, min:Number, max:Number) : Number {
|
||||
if (value < min) return min;
|
||||
if (value > max) return max;
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
420
spine-as3/spine-as3/src/spine/PathConstraint.as
Normal file
@ -0,0 +1,420 @@
|
||||
/******************************************************************************
|
||||
* Spine Runtimes Software License
|
||||
* Version 2.3
|
||||
*
|
||||
* Copyright (c) 2013-2015, Esoteric Software
|
||||
* All rights reserved.
|
||||
*
|
||||
* You are granted a perpetual, non-exclusive, non-sublicensable and
|
||||
* non-transferable license to use, install, execute and perform the Spine
|
||||
* Runtimes Software (the "Software") and derivative works solely for personal
|
||||
* or internal use. Without the written permission of Esoteric Software (see
|
||||
* Section 2 of the Spine Software License Agreement), you may not (a) modify,
|
||||
* translate, adapt or otherwise create derivative works, improvements of the
|
||||
* Software or develop new applications using the Software or (b) remove,
|
||||
* delete, alter or obscure any trademarks or any copyright, trademark, patent
|
||||
* or other intellectual property or proprietary rights notices on or in the
|
||||
* Software, including any copy thereof. Redistributions in binary or source
|
||||
* form must include this license and terms.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
||||
* EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*****************************************************************************/
|
||||
|
||||
package spine {
|
||||
import spine.attachments.PathAttachment;
|
||||
|
||||
public class PathConstraint implements Updatable {
|
||||
private static const NONE:int = -1, BEFORE:int = -2, AFTER:int = -3;
|
||||
|
||||
internal var _data:PathConstraintData;
|
||||
internal var _bones:Vector.<Bone>;
|
||||
public var target:Slot;
|
||||
public var position:Number, spacing:Number, rotateMix:Number, translateMix:Number;
|
||||
|
||||
internal const _spaces:Vector.<Number> = new Vector.<Number>();
|
||||
internal const _positions:Vector.<Number> = new Vector.<Number>();
|
||||
internal const _world:Vector.<Number> = new Vector.<Number>();
|
||||
internal const _curves:Vector.<Number> = new Vector.<Number>();
|
||||
internal const _lengths:Vector.<Number> = new Vector.<Number>();
|
||||
internal const _segments:Vector.<Number> = new Vector.<Number>(10);
|
||||
|
||||
public function PathConstraint (data:PathConstraintData, skeleton:Skeleton) {
|
||||
if (data == null) throw new ArgumentError("data cannot be null.");
|
||||
if (skeleton == null) throw new ArgumentError("skeleton cannot be null.");
|
||||
_data = data;
|
||||
_bones = new Vector.<Bone>();
|
||||
for each (var boneData:BoneData in data.bones)
|
||||
_bones.push(skeleton.findBone(boneData.name));
|
||||
target = skeleton.findSlot(data.target.name);
|
||||
position = data.position;
|
||||
spacing = data.spacing;
|
||||
rotateMix = data.rotateMix;
|
||||
translateMix = data.translateMix;
|
||||
}
|
||||
|
||||
public function apply () : void {
|
||||
update();
|
||||
}
|
||||
|
||||
public function update () : void {
|
||||
var attachment:PathAttachment = target.attachment as PathAttachment;
|
||||
if (attachment == null) return;
|
||||
|
||||
var rotateMix:Number = this.rotateMix, translateMix:Number = this.translateMix;
|
||||
var translate:Boolean = translateMix > 0, rotate:Boolean = rotateMix > 0;
|
||||
if (!translate && !rotate) return;
|
||||
|
||||
var data:PathConstraintData = this._data;
|
||||
var spacingMode:SpacingMode = data.spacingMode;
|
||||
var lengthSpacing:Boolean = spacingMode == SpacingMode.length;
|
||||
var rotateMode:RotateMode = data.rotateMode;
|
||||
var tangents:Boolean = rotateMode == RotateMode.tangent, scale:Boolean = rotateMode == RotateMode.chainScale;
|
||||
var boneCount:int = this._bones.length, spacesCount:int = tangents ? boneCount : boneCount + 1;
|
||||
var bones:Vector.<Bone> = this._bones;
|
||||
this._spaces.length = spacesCount;
|
||||
var spaces:Vector.<Number> = this._spaces, lengths:Vector.<Number> = null;
|
||||
var spacing:Number = this.spacing;
|
||||
if (scale || lengthSpacing) {
|
||||
if (scale) {
|
||||
this._lengths.length = boneCount;
|
||||
lengths = this._lengths;
|
||||
}
|
||||
for (var i:int = 0, n:int = spacesCount - 1; i < n;) {
|
||||
var bone:Bone = bones[i];
|
||||
var length:Number = bone.data.length, x:Number = length * bone.a, y:Number = length * bone.c;
|
||||
length = Math.sqrt(x * x + y * y);
|
||||
if (scale) lengths[i] = length;
|
||||
spaces[++i] = lengthSpacing ? Math.max(0, length + spacing) : spacing;
|
||||
}
|
||||
} else {
|
||||
for (i = 1; i < spacesCount; i++)
|
||||
spaces[i] = spacing;
|
||||
}
|
||||
|
||||
var positions:Vector.<Number> = computeWorldPositions(attachment, spacesCount, tangents,
|
||||
data.positionMode == PositionMode.percent, spacingMode == SpacingMode.percent);
|
||||
var skeleton:Skeleton = target.skeleton;
|
||||
var skeletonX:Number = skeleton.x, skeletonY:Number = skeleton.y;
|
||||
var boneX:Number = positions[0], boneY:Number = positions[1], offsetRotation:Number = data.offsetRotation;
|
||||
var tip:Boolean = rotateMode == RotateMode.chain && offsetRotation == 0;
|
||||
var p:Number;
|
||||
for (i = 0, p = 3; i < boneCount; i++, p += 3) {
|
||||
bone = bones[i];
|
||||
bone._worldX += (boneX - skeletonX - bone.worldX) * translateMix;
|
||||
bone._worldY += (boneY - skeletonY - bone.worldY) * translateMix;
|
||||
x = positions[p]; y = positions[p + 1]; var dx:Number = x - boneX, dy:Number = y - boneY;
|
||||
if (scale) {
|
||||
length = lengths[i];
|
||||
if (length != 0) {
|
||||
var s:Number = (Math.sqrt(dx * dx + dy * dy) / length - 1) * rotateMix + 1;
|
||||
bone._a *= s;
|
||||
bone._c *= s;
|
||||
}
|
||||
}
|
||||
boneX = x;
|
||||
boneY = y;
|
||||
if (rotate) {
|
||||
var a:Number = bone.a, b:Number = bone.b, c:Number = bone.c, d:Number = bone.d, r:Number, cos:Number, sin:Number;
|
||||
if (tangents)
|
||||
r = positions[p - 1];
|
||||
else if (spaces[i + 1] == 0)
|
||||
r = positions[p + 2];
|
||||
else
|
||||
r = Math.atan2(dy, dx);
|
||||
r -= Math.atan2(c, a) - offsetRotation * MathUtils.degRad;
|
||||
if (tip) {
|
||||
cos = Math.cos(r);
|
||||
sin = Math.sin(r);
|
||||
length = bone.data.length;
|
||||
boneX += (length * (cos * a - sin * c) - dx) * rotateMix;
|
||||
boneY += (length * (sin * a + cos * c) - dy) * rotateMix;
|
||||
}
|
||||
if (r > Math.PI)
|
||||
r -= (Math.PI * 2);
|
||||
else if (r < -Math.PI) //
|
||||
r += (Math.PI * 2);
|
||||
r *= rotateMix;
|
||||
cos = Math.cos(r);
|
||||
sin = Math.sin(r);
|
||||
bone._a = cos * a - sin * c;
|
||||
bone._b = cos * b - sin * d;
|
||||
bone._c = sin * a + cos * c;
|
||||
bone._d = sin * b + cos * d;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected function computeWorldPositions (path:PathAttachment, spacesCount:int, tangents:Boolean, percentPosition:Boolean,
|
||||
percentSpacing:Boolean) : Vector.<Number> {
|
||||
var target:Slot = this.target;
|
||||
var position:Number = this.position;
|
||||
var spaces:Vector.<Number> = this._spaces;
|
||||
this._positions.length = spacesCount * 3 + 2;
|
||||
var out:Vector.<Number> = this._positions, world:Vector.<Number>;
|
||||
var closed:Boolean = path.closed;
|
||||
var verticesLength:int = path.worldVerticesLength, curveCount:int = verticesLength / 6, prevCurve:int = NONE;
|
||||
|
||||
if (!path.constantSpeed) {
|
||||
var lengths:Vector.<Number> = path.lengths;
|
||||
curveCount -= closed ? 1 : 2;
|
||||
var pathLength:Number = lengths[curveCount];
|
||||
if (percentPosition) position *= pathLength;
|
||||
if (percentSpacing) {
|
||||
for (var i:int = 0; i < spacesCount; i++)
|
||||
spaces[i] *= pathLength;
|
||||
}
|
||||
this._world.length = 8;
|
||||
world = this._world;
|
||||
var o:int, curve:int;
|
||||
for (i = 0, o = 0, curve = 0; i < spacesCount; i++, o += 3) {
|
||||
var space:Number = spaces[i];
|
||||
position += space;
|
||||
var p:Number = position;
|
||||
|
||||
if (closed) {
|
||||
p %= pathLength;
|
||||
if (p < 0) p += pathLength;
|
||||
curve = 0;
|
||||
} else if (p < 0) {
|
||||
if (prevCurve != BEFORE) {
|
||||
prevCurve = BEFORE;
|
||||
path.computeWorldVertices2(target, 2, 4, world, 0);
|
||||
}
|
||||
addBeforePosition(p, world, 0, out, o);
|
||||
continue;
|
||||
} else if (p > pathLength) {
|
||||
if (prevCurve != AFTER) {
|
||||
prevCurve = AFTER;
|
||||
path.computeWorldVertices2(target, verticesLength - 6, 4, world, 0);
|
||||
}
|
||||
addAfterPosition(p - pathLength, world, 0, out, o);
|
||||
continue;
|
||||
}
|
||||
|
||||
// Determine curve containing position.
|
||||
for (;; curve++) {
|
||||
var length:Number = lengths[curve];
|
||||
if (p > length) continue;
|
||||
if (curve == 0)
|
||||
p /= length;
|
||||
else {
|
||||
var prev:Number = lengths[curve - 1];
|
||||
p = (p - prev) / (length - prev);
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (curve != prevCurve) {
|
||||
prevCurve = curve;
|
||||
if (closed && curve == curveCount) {
|
||||
path.computeWorldVertices2(target, verticesLength - 4, 4, world, 0);
|
||||
path.computeWorldVertices2(target, 0, 4, world, 4);
|
||||
} else
|
||||
path.computeWorldVertices2(target, curve * 6 + 2, 8, world, 0);
|
||||
}
|
||||
addCurvePosition(p, world[0], world[1], world[2], world[3], world[4], world[5], world[6], world[7], out, o,
|
||||
tangents || (i > 0 && space == 0));
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
// World vertices.
|
||||
if (closed) {
|
||||
verticesLength += 2;
|
||||
this._world.length = verticesLength;
|
||||
world = this._world;
|
||||
path.computeWorldVertices2(target, 2, verticesLength - 4, world, 0);
|
||||
path.computeWorldVertices2(target, 0, 2, world, verticesLength - 4);
|
||||
world[verticesLength - 2] = world[0];
|
||||
world[verticesLength - 1] = world[1];
|
||||
} else {
|
||||
curveCount--;
|
||||
verticesLength -= 4;
|
||||
this._world.length = verticesLength;
|
||||
world = this._world;
|
||||
path.computeWorldVertices2(target, 2, verticesLength, world, 0);
|
||||
}
|
||||
|
||||
// Curve lengths.
|
||||
this._curves.length = curveCount;
|
||||
var curves:Vector.<Number> = this._curves;
|
||||
pathLength = 0;
|
||||
var x1:Number = world[0], y1:Number = world[1], cx1:Number = 0, cy1:Number = 0, cx2:Number = 0, cy2:Number = 0, x2:Number = 0, y2:Number = 0;
|
||||
var tmpx:Number, tmpy:Number, dddfx:Number, dddfy:Number, ddfx:Number, ddfy:Number, dfx:Number, dfy:Number;
|
||||
var w:int;
|
||||
for (i = 0, w = 2; i < curveCount; i++, w += 6) {
|
||||
cx1 = world[w];
|
||||
cy1 = world[w + 1];
|
||||
cx2 = world[w + 2];
|
||||
cy2 = world[w + 3];
|
||||
x2 = world[w + 4];
|
||||
y2 = world[w + 5];
|
||||
tmpx = (x1 - cx1 * 2 + cx2) * 0.1875;
|
||||
tmpy = (y1 - cy1 * 2 + cy2) * 0.1875;
|
||||
dddfx = ((cx1 - cx2) * 3 - x1 + x2) * 0.09375;
|
||||
dddfy = ((cy1 - cy2) * 3 - y1 + y2) * 0.09375;
|
||||
ddfx = tmpx * 2 + dddfx;
|
||||
ddfy = tmpy * 2 + dddfy;
|
||||
dfx = (cx1 - x1) * 0.75 + tmpx + dddfx * 0.16666667;
|
||||
dfy = (cy1 - y1) * 0.75 + tmpy + dddfy * 0.16666667;
|
||||
pathLength += Math.sqrt(dfx * dfx + dfy * dfy);
|
||||
dfx += ddfx;
|
||||
dfy += ddfy;
|
||||
ddfx += dddfx;
|
||||
ddfy += dddfy;
|
||||
pathLength += Math.sqrt(dfx * dfx + dfy * dfy);
|
||||
dfx += ddfx;
|
||||
dfy += ddfy;
|
||||
pathLength += Math.sqrt(dfx * dfx + dfy * dfy);
|
||||
dfx += ddfx + dddfx;
|
||||
dfy += ddfy + dddfy;
|
||||
pathLength += Math.sqrt(dfx * dfx + dfy * dfy);
|
||||
curves[i] = pathLength;
|
||||
x1 = x2;
|
||||
y1 = y2;
|
||||
}
|
||||
if (percentPosition) position *= pathLength;
|
||||
if (percentSpacing) {
|
||||
for (i = 0; i < spacesCount; i++)
|
||||
spaces[i] *= pathLength;
|
||||
}
|
||||
|
||||
var segments:Vector.<Number> = this._segments;
|
||||
var curveLength:Number = 0;
|
||||
var segment:int;
|
||||
for (i = 0, o = 0, curve = 0, segment = 0; i < spacesCount; i++, o += 3) {
|
||||
space = spaces[i];
|
||||
position += space;
|
||||
p = position;
|
||||
|
||||
if (closed) {
|
||||
p %= pathLength;
|
||||
if (p < 0) p += pathLength;
|
||||
curve = 0;
|
||||
} else if (p < 0) {
|
||||
addBeforePosition(p, world, 0, out, o);
|
||||
continue;
|
||||
} else if (p > pathLength) {
|
||||
addAfterPosition(p - pathLength, world, verticesLength - 4, out, o);
|
||||
continue;
|
||||
}
|
||||
|
||||
// Determine curve containing position.
|
||||
for (;; curve++) {
|
||||
length = curves[curve];
|
||||
if (p > length) continue;
|
||||
if (curve == 0)
|
||||
p /= length;
|
||||
else {
|
||||
prev = curves[curve - 1];
|
||||
p = (p - prev) / (length - prev);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// Curve segment lengths.
|
||||
if (curve != prevCurve) {
|
||||
prevCurve = curve;
|
||||
var ii:int = curve * 6;
|
||||
x1 = world[ii];
|
||||
y1 = world[ii + 1];
|
||||
cx1 = world[ii + 2];
|
||||
cy1 = world[ii + 3];
|
||||
cx2 = world[ii + 4];
|
||||
cy2 = world[ii + 5];
|
||||
x2 = world[ii + 6];
|
||||
y2 = world[ii + 7];
|
||||
tmpx = (x1 - cx1 * 2 + cx2) * 0.03;
|
||||
tmpy = (y1 - cy1 * 2 + cy2) * 0.03;
|
||||
dddfx = ((cx1 - cx2) * 3 - x1 + x2) * 0.006;
|
||||
dddfy = ((cy1 - cy2) * 3 - y1 + y2) * 0.006;
|
||||
ddfx = tmpx * 2 + dddfx;
|
||||
ddfy = tmpy * 2 + dddfy;
|
||||
dfx = (cx1 - x1) * 0.3 + tmpx + dddfx * 0.16666667;
|
||||
dfy = (cy1 - y1) * 0.3 + tmpy + dddfy * 0.16666667;
|
||||
curveLength = Math.sqrt(dfx * dfx + dfy * dfy);
|
||||
segments[0] = curveLength;
|
||||
for (ii = 1; ii < 8; ii++) {
|
||||
dfx += ddfx;
|
||||
dfy += ddfy;
|
||||
ddfx += dddfx;
|
||||
ddfy += dddfy;
|
||||
curveLength += Math.sqrt(dfx * dfx + dfy * dfy);
|
||||
segments[ii] = curveLength;
|
||||
}
|
||||
dfx += ddfx;
|
||||
dfy += ddfy;
|
||||
curveLength += Math.sqrt(dfx * dfx + dfy * dfy);
|
||||
segments[8] = curveLength;
|
||||
dfx += ddfx + dddfx;
|
||||
dfy += ddfy + dddfy;
|
||||
curveLength += Math.sqrt(dfx * dfx + dfy * dfy);
|
||||
segments[9] = curveLength;
|
||||
segment = 0;
|
||||
}
|
||||
|
||||
// Weight by segment length.
|
||||
p *= curveLength;
|
||||
for (;; segment++) {
|
||||
length = segments[segment];
|
||||
if (p > length) continue;
|
||||
if (segment == 0)
|
||||
p /= length;
|
||||
else {
|
||||
prev = segments[segment - 1];
|
||||
p = segment + (p - prev) / (length - prev);
|
||||
}
|
||||
break;
|
||||
}
|
||||
addCurvePosition(p * 0.1, x1, y1, cx1, cy1, cx2, cy2, x2, y2, out, o, tangents || (i > 0 && space == 0));
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
private function addBeforePosition (p:Number, temp:Vector.<Number>, i:int, out:Vector.<Number>, o:int) : void {
|
||||
var x1:Number = temp[i], y1:Number = temp[i + 1], dx:Number = temp[i + 2] - x1, dy:Number = temp[i + 3] - y1, r:Number = Math.atan2(dy, dx);
|
||||
out[o] = x1 + p * Math.cos(r);
|
||||
out[o + 1] = y1 + p * Math.sin(r);
|
||||
out[o + 2] = r;
|
||||
}
|
||||
|
||||
private function addAfterPosition (p:Number, temp:Vector.<Number>, i:int, out:Vector.<Number>, o:int) : void {
|
||||
var x1:Number = temp[i + 2], y1:Number = temp[i + 3], dx:Number = x1 - temp[i], dy:Number = y1 - temp[i + 1], r:Number = Math.atan2(dy, dx);
|
||||
out[o] = x1 + p * Math.cos(r);
|
||||
out[o + 1] = y1 + p * Math.sin(r);
|
||||
out[o + 2] = r;
|
||||
}
|
||||
|
||||
private function addCurvePosition (p:Number, x1:Number, y1:Number, cx1:Number, cy1:Number, cx2:Number, cy2:Number, x2:Number, y2:Number,
|
||||
out:Vector.<Number>, o:int, tangents:Boolean) : void {
|
||||
if (p == 0) p = 0.0001;
|
||||
var tt:Number = p * p, ttt:Number = tt * p, u:Number = 1 - p, uu:Number = u * u, uuu:Number = uu * u;
|
||||
var ut:Number = u * p, ut3:Number = ut * 3, uut3:Number = u * ut3, utt3:Number = ut3 * p;
|
||||
var x:Number = x1 * uuu + cx1 * uut3 + cx2 * utt3 + x2 * ttt, y:Number = y1 * uuu + cy1 * uut3 + cy2 * utt3 + y2 * ttt;
|
||||
out[o] = x;
|
||||
out[o + 1] = y;
|
||||
if (tangents) out[o + 2] = Math.atan2(y - (y1 * uu + cy1 * ut * 2 + cy2 * tt), x - (x1 * uu + cx1 * ut * 2 + cx2 * tt));
|
||||
}
|
||||
|
||||
public function get bones () : Vector.<Bone> {
|
||||
return _bones;
|
||||
}
|
||||
|
||||
public function get data () : PathConstraintData {
|
||||
return _data;
|
||||
}
|
||||
|
||||
public function toString () : String {
|
||||
return _data.name;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
62
spine-as3/spine-as3/src/spine/PathConstraintData.as
Normal file
@ -0,0 +1,62 @@
|
||||
/******************************************************************************
|
||||
* Spine Runtimes Software License
|
||||
* Version 2.3
|
||||
*
|
||||
* Copyright (c) 2013-2015, Esoteric Software
|
||||
* All rights reserved.
|
||||
*
|
||||
* You are granted a perpetual, non-exclusive, non-sublicensable and
|
||||
* non-transferable license to use, install, execute and perform the Spine
|
||||
* Runtimes Software (the "Software") and derivative works solely for personal
|
||||
* or internal use. Without the written permission of Esoteric Software (see
|
||||
* Section 2 of the Spine Software License Agreement), you may not (a) modify,
|
||||
* translate, adapt or otherwise create derivative works, improvements of the
|
||||
* Software or develop new applications using the Software or (b) remove,
|
||||
* delete, alter or obscure any trademarks or any copyright, trademark, patent
|
||||
* or other intellectual property or proprietary rights notices on or in the
|
||||
* Software, including any copy thereof. Redistributions in binary or source
|
||||
* form must include this license and terms.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
||||
* EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*****************************************************************************/
|
||||
|
||||
package spine {
|
||||
|
||||
public dynamic class PathConstraintData {
|
||||
internal var _name:String;
|
||||
internal var _bones:Vector.<BoneData> = new Vector.<BoneData>();
|
||||
public var target:SlotData;
|
||||
public var positionMode:PositionMode;
|
||||
public var spacingMode:SpacingMode;
|
||||
public var rotateMode:RotateMode;
|
||||
public var offsetRotation:Number;
|
||||
public var position:Number, spacing:Number, rotateMix:Number, translateMix:Number;
|
||||
|
||||
public function PathConstraintData (name:String) {
|
||||
if (name == null) throw new ArgumentError("name cannot be null.");
|
||||
_name = name;
|
||||
}
|
||||
|
||||
public function get bones () : Vector.<BoneData> {
|
||||
return _bones;
|
||||
}
|
||||
|
||||
public function get name () : String {
|
||||
return _name;
|
||||
}
|
||||
|
||||
public function toString () : String {
|
||||
return name;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -34,6 +34,9 @@ package spine {
|
||||
public class Polygon {
|
||||
public var vertices:Vector.<Number> = new Vector.<Number>();
|
||||
|
||||
public function Polygon () {
|
||||
}
|
||||
|
||||
/** Returns true if the polygon contains the point. */
|
||||
public function containsPoint (x:Number, y:Number) : Boolean {
|
||||
var nn:int = vertices.length;
|
||||
|
||||
@ -29,10 +29,11 @@
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*****************************************************************************/
|
||||
|
||||
package spine.attachments {
|
||||
package spine {
|
||||
|
||||
public interface FfdAttachment {
|
||||
function applyFFD (sourceAttachment:Attachment) : Boolean;
|
||||
public class PositionMode {
|
||||
public static const fixed:PositionMode = new PositionMode();
|
||||
public static const percent:PositionMode = new PositionMode();
|
||||
}
|
||||
|
||||
}
|
||||
40
spine-as3/spine-as3/src/spine/RotateMode.as
Normal file
@ -0,0 +1,40 @@
|
||||
/******************************************************************************
|
||||
* Spine Runtimes Software License
|
||||
* Version 2.3
|
||||
*
|
||||
* Copyright (c) 2013-2015, Esoteric Software
|
||||
* All rights reserved.
|
||||
*
|
||||
* You are granted a perpetual, non-exclusive, non-sublicensable and
|
||||
* non-transferable license to use, install, execute and perform the Spine
|
||||
* Runtimes Software (the "Software") and derivative works solely for personal
|
||||
* or internal use. Without the written permission of Esoteric Software (see
|
||||
* Section 2 of the Spine Software License Agreement), you may not (a) modify,
|
||||
* translate, adapt or otherwise create derivative works, improvements of the
|
||||
* Software or develop new applications using the Software or (b) remove,
|
||||
* delete, alter or obscure any trademarks or any copyright, trademark, patent
|
||||
* or other intellectual property or proprietary rights notices on or in the
|
||||
* Software, including any copy thereof. Redistributions in binary or source
|
||||
* form must include this license and terms.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
||||
* EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*****************************************************************************/
|
||||
|
||||
package spine {
|
||||
|
||||
public class RotateMode {
|
||||
public static const tangent:RotateMode = new RotateMode();
|
||||
public static const chain:RotateMode = new RotateMode();
|
||||
public static const chainScale:RotateMode = new RotateMode();
|
||||
}
|
||||
|
||||
}
|
||||
@ -30,6 +30,8 @@
|
||||
*****************************************************************************/
|
||||
|
||||
package spine {
|
||||
import flash.utils.Dictionary;
|
||||
import spine.attachments.PathAttachment;
|
||||
import spine.attachments.Attachment;
|
||||
|
||||
public class Skeleton {
|
||||
@ -37,8 +39,9 @@ public class Skeleton {
|
||||
public var bones:Vector.<Bone>;
|
||||
public var slots:Vector.<Slot>;
|
||||
public var drawOrder:Vector.<Slot>;
|
||||
public var ikConstraints:Vector.<IkConstraint>;
|
||||
public var ikConstraints:Vector.<IkConstraint>, ikConstraintsSorted:Vector.<IkConstraint>;
|
||||
public var transformConstraints:Vector.<TransformConstraint>;
|
||||
public var pathConstraints:Vector.<PathConstraint>;
|
||||
private var _updateCache:Vector.<Updatable> = new Vector.<Updatable>();
|
||||
private var _skin:Skin;
|
||||
public var r:Number = 1, g:Number = 1, b:Number = 1, a:Number = 1;
|
||||
@ -53,55 +56,181 @@ public class Skeleton {
|
||||
|
||||
bones = new Vector.<Bone>();
|
||||
for each (var boneData:BoneData in data.bones) {
|
||||
var parent:Bone = boneData.parent == null ? null : bones[data.bones.indexOf(boneData.parent)];
|
||||
bones[bones.length] = new Bone(boneData, this, parent);
|
||||
var bone:Bone;
|
||||
if (boneData.parent == null)
|
||||
bone = new Bone(boneData, this, null);
|
||||
else {
|
||||
var parent:Bone = bones[boneData.parent.index];
|
||||
bone = new Bone(boneData, this, parent);
|
||||
parent.children.push(bone);
|
||||
}
|
||||
bones.push(bone);
|
||||
}
|
||||
|
||||
slots = new Vector.<Slot>();
|
||||
drawOrder = new Vector.<Slot>();
|
||||
for each (var slotData:SlotData in data.slots) {
|
||||
var bone:Bone = bones[data.bones.indexOf(slotData.boneData)];
|
||||
bone = bones[slotData.boneData.index];
|
||||
var slot:Slot = new Slot(slotData, bone);
|
||||
slots[slots.length] = slot;
|
||||
slots.push(slot);
|
||||
drawOrder[drawOrder.length] = slot;
|
||||
}
|
||||
|
||||
ikConstraints = new Vector.<IkConstraint>();
|
||||
ikConstraintsSorted = new Vector.<IkConstraint>();
|
||||
for each (var ikConstraintData:IkConstraintData in data.ikConstraints)
|
||||
ikConstraints[ikConstraints.length] = new IkConstraint(ikConstraintData, this);
|
||||
ikConstraints.push(new IkConstraint(ikConstraintData, this));
|
||||
|
||||
transformConstraints = new Vector.<TransformConstraint>();
|
||||
for each (var transformConstraintData:TransformConstraintData in data.transformConstraints)
|
||||
transformConstraints[transformConstraints.length] = new TransformConstraint(transformConstraintData, this);
|
||||
transformConstraints.push(new TransformConstraint(transformConstraintData, this));
|
||||
|
||||
pathConstraints = new Vector.<PathConstraint>();
|
||||
for each (var pathConstraintData:PathConstraintData in data.pathConstraints)
|
||||
pathConstraints.push(new PathConstraint(pathConstraintData, this));
|
||||
|
||||
updateCache();
|
||||
}
|
||||
|
||||
/** Caches information about bones and constraints. Must be called if bones or constraints are added or removed. */
|
||||
/** Caches information about bones and constraints. Must be called if bones, constraints, or weighted path attachments are
|
||||
* added or removed. */
|
||||
public function updateCache () : void {
|
||||
var updateCache:Vector.<Updatable> = _updateCache;
|
||||
var ikConstraints:Vector.<IkConstraint> = this.ikConstraints;
|
||||
var transformConstraints:Vector.<TransformConstraint> = this.transformConstraints;
|
||||
updateCache.length = bones.length + ikConstraints.length;
|
||||
var i:int = 0;
|
||||
for each (var bone:Bone in bones) {
|
||||
updateCache[i++] = bone;
|
||||
for each (var ikConstraint:IkConstraint in ikConstraints) {
|
||||
if (bone == ikConstraint.bones[ikConstraint.bones.length - 1]) {
|
||||
updateCache[i++] = ikConstraint;
|
||||
break;
|
||||
}
|
||||
var updateCache:Vector.<Updatable> = this._updateCache;
|
||||
updateCache.length = 0;
|
||||
|
||||
var bones:Vector.<Bone> = this.bones;
|
||||
for (var i:int = 0, n:int = bones.length; i < n; i++)
|
||||
bones[i]._sorted = false;
|
||||
|
||||
// IK first, lowest hierarchy depth first.
|
||||
var ikConstraints:Vector.<IkConstraint> = this.ikConstraintsSorted;
|
||||
ikConstraints.length = 0;
|
||||
for each (var c:IkConstraint in this.ikConstraints)
|
||||
ikConstraints.push(c);
|
||||
var ikCount:int = ikConstraints.length;
|
||||
var level:int;
|
||||
for (i = 0, n = ikCount; i < n; i++) {
|
||||
var ik:IkConstraint = ikConstraints[i];
|
||||
var bone:Bone = ik.bones[0].parent;
|
||||
for (level = 0; bone != null; level++)
|
||||
bone = bone.parent;
|
||||
ik.level = level;
|
||||
}
|
||||
var ii:int;
|
||||
for (i = 1; i < ikCount; i++) {
|
||||
ik = ikConstraints[i];
|
||||
level = ik.level;
|
||||
for (ii = i - 1; ii >= 0; ii--) {
|
||||
var other:IkConstraint = ikConstraints[ii];
|
||||
if (other.level < level) break;
|
||||
ikConstraints[ii + 1] = other;
|
||||
}
|
||||
ikConstraints[ii + 1] = ik;
|
||||
}
|
||||
for (i = 0, n = ikConstraints.length; i < n; i++) {
|
||||
var ikConstraint:IkConstraint = ikConstraints[i];
|
||||
var target:Bone = ikConstraint.target;
|
||||
sortBone(target);
|
||||
|
||||
var constrained:Vector.<Bone> = ikConstraint.bones;
|
||||
var parent:Bone = constrained[0];
|
||||
sortBone(parent);
|
||||
|
||||
updateCache.push(ikConstraint);
|
||||
|
||||
sortReset(parent.children);
|
||||
constrained[constrained.length - 1]._sorted = true;
|
||||
}
|
||||
|
||||
for each (var transformConstraint:TransformConstraint in transformConstraints) {
|
||||
for (i = updateCache.length - 1; i >= 0; i--) {
|
||||
var updatable:Updatable = updateCache[i];
|
||||
if (updatable == transformConstraint.bone || updatable == transformConstraint.target) {
|
||||
updateCache.splice(i + 1, 0, transformConstraint);
|
||||
break;
|
||||
}
|
||||
}
|
||||
var pathConstraints:Vector.<PathConstraint> = this.pathConstraints;
|
||||
for (i = 0, n = pathConstraints.length; i < n; i++) {
|
||||
var pathConstraint:PathConstraint = pathConstraints[i];
|
||||
|
||||
var slot:Slot = pathConstraint.target;
|
||||
var slotIndex:int = slot.data.index;
|
||||
var slotBone:Bone = slot.bone;
|
||||
if (skin != null) sortPathConstraintAttachment(skin, slotIndex, slotBone);
|
||||
if (_data.defaultSkin != null && _data.defaultSkin != skin)
|
||||
sortPathConstraintAttachment(_data.defaultSkin, slotIndex, slotBone);
|
||||
|
||||
var nn:int;
|
||||
for (ii = 0, nn = _data.skins.length; ii < nn; ii++)
|
||||
sortPathConstraintAttachment(_data.skins[ii], slotIndex, slotBone);
|
||||
|
||||
var attachment:PathAttachment = slot.attachment as PathAttachment;
|
||||
if (attachment != null) sortPathConstraintAttachment2(attachment, slotBone);
|
||||
|
||||
constrained = pathConstraint.bones;
|
||||
var boneCount:int = constrained.length;
|
||||
for (ii = 0; ii < boneCount; ii++)
|
||||
sortBone(constrained[ii]);
|
||||
|
||||
updateCache.push(pathConstraint);
|
||||
|
||||
for (ii = 0; ii < boneCount; ii++)
|
||||
sortReset(constrained[ii].children);
|
||||
for (ii = 0; ii < boneCount; ii++)
|
||||
constrained[ii]._sorted = true;
|
||||
}
|
||||
|
||||
var transformConstraints:Vector.<TransformConstraint> = this.transformConstraints;
|
||||
for (i = 0, n = transformConstraints.length; i < n; i++) {
|
||||
var transformConstraint:TransformConstraint = transformConstraints[i];
|
||||
|
||||
sortBone(transformConstraint.target);
|
||||
|
||||
constrained = transformConstraint.bones;
|
||||
boneCount = constrained.length;
|
||||
for (ii = 0; ii < boneCount; ii++)
|
||||
sortBone(constrained[ii]);
|
||||
|
||||
updateCache.push(transformConstraint);
|
||||
|
||||
for (ii = 0; ii < boneCount; ii++)
|
||||
sortReset(constrained[ii].children);
|
||||
for (ii = 0; ii < boneCount; ii++)
|
||||
constrained[ii]._sorted = true;
|
||||
}
|
||||
|
||||
for (i = 0, n = bones.length; i < n; i++)
|
||||
sortBone(bones[i]);
|
||||
}
|
||||
|
||||
private function sortPathConstraintAttachment (skin:Skin, slotIndex:int, slotBone:Bone) : void {
|
||||
var dict:Dictionary = skin.attachments[slotIndex];
|
||||
if (!dict) return;
|
||||
|
||||
for each (var value:Attachment in dict) {
|
||||
sortPathConstraintAttachment2(value, slotBone);
|
||||
}
|
||||
}
|
||||
|
||||
private function sortPathConstraintAttachment2 (attachment:Attachment, slotBone:Bone) : void {
|
||||
var pathAttachment:PathAttachment = attachment as PathAttachment;
|
||||
if (!pathAttachment) return;
|
||||
var pathBones:Vector.<int> = pathAttachment.bones;
|
||||
if (pathBones == null)
|
||||
sortBone(slotBone);
|
||||
else {
|
||||
var bones:Vector.<Bone> = this.bones;
|
||||
for each (var boneIndex:int in pathBones)
|
||||
sortBone(bones[boneIndex]);
|
||||
}
|
||||
}
|
||||
|
||||
private function sortBone (bone:Bone) : void {
|
||||
if (bone._sorted) return;
|
||||
var parent:Bone = bone.parent;
|
||||
if (parent != null) sortBone(parent);
|
||||
bone._sorted = true;
|
||||
_updateCache.push(bone);
|
||||
}
|
||||
|
||||
private function sortReset (bones:Vector.<Bone>) : void {
|
||||
for (var i:int = 0, n:int = bones.length; i < n; i++) {
|
||||
var bone:Bone = bones[i];
|
||||
if (bone._sorted) sortReset(bone.children);
|
||||
bone._sorted = false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -128,9 +257,17 @@ public class Skeleton {
|
||||
}
|
||||
|
||||
for each (var transformConstraint:TransformConstraint in transformConstraints) {
|
||||
transformConstraint.rotateMix = transformConstraint._data.rotateMix;
|
||||
transformConstraint.translateMix = transformConstraint._data.translateMix;
|
||||
transformConstraint.x = transformConstraint._data.x;
|
||||
transformConstraint.y = transformConstraint._data.y;
|
||||
transformConstraint.scaleMix = transformConstraint._data.scaleMix;
|
||||
transformConstraint.shearMix = transformConstraint._data.shearMix;
|
||||
}
|
||||
|
||||
for each (var pathConstraint:PathConstraint in pathConstraints) {
|
||||
pathConstraint.position = pathConstraint._data.position;
|
||||
pathConstraint.spacing = pathConstraint._data.spacing;
|
||||
pathConstraint.rotateMix = pathConstraint._data.rotateMix;
|
||||
pathConstraint.translateMix = pathConstraint._data.translateMix;
|
||||
}
|
||||
}
|
||||
|
||||
@ -146,6 +283,10 @@ public class Skeleton {
|
||||
return _data;
|
||||
}
|
||||
|
||||
public function get getUpdateCache () : Vector.<Updatable> {
|
||||
return _updateCache;
|
||||
}
|
||||
|
||||
public function get rootBone () : Bone {
|
||||
if (bones.length == 0) return null;
|
||||
return bones[0];
|
||||
@ -283,6 +424,14 @@ public class Skeleton {
|
||||
return null;
|
||||
}
|
||||
|
||||
/** @return May be null. */
|
||||
public function findPathConstraint (constraintName:String) : PathConstraint {
|
||||
if (constraintName == null) throw new ArgumentError("constraintName cannot be null.");
|
||||
for each (var pathConstraint:PathConstraint in pathConstraints)
|
||||
if (pathConstraint._data._name == constraintName) return pathConstraint;
|
||||
return null;
|
||||
}
|
||||
|
||||
public function update (delta:Number) : void {
|
||||
time += delta;
|
||||
}
|
||||
|
||||
@ -39,10 +39,12 @@ public class SkeletonBounds {
|
||||
public var polygons:Vector.<Polygon> = new Vector.<Polygon>();
|
||||
public var minX:Number, minY:Number, maxX:Number, maxY:Number;
|
||||
|
||||
public function SkeletonBounds () {
|
||||
}
|
||||
|
||||
public function update (skeleton:Skeleton, updateAabb:Boolean) : void {
|
||||
var slots:Vector.<Slot> = skeleton.slots;
|
||||
var slotCount:int = slots.length;
|
||||
var x:Number = skeleton.x, y:Number = skeleton.y;
|
||||
|
||||
boundingBoxes.length = 0;
|
||||
for each (var polygon:Polygon in polygons)
|
||||
@ -63,8 +65,8 @@ public class SkeletonBounds {
|
||||
polygon = new Polygon();
|
||||
polygons[polygons.length] = polygon;
|
||||
|
||||
polygon.vertices.length = boundingBox.vertices.length;
|
||||
boundingBox.computeWorldVertices(x, y, slot.bone, polygon.vertices);
|
||||
polygon.vertices.length = boundingBox.worldVerticesLength;
|
||||
boundingBox.computeWorldVertices(slot, polygon.vertices);
|
||||
}
|
||||
|
||||
if (updateAabb) aabbCompute();
|
||||
|
||||
@ -43,9 +43,13 @@ public class SkeletonData {
|
||||
public var animations:Vector.<Animation> = new Vector.<Animation>();
|
||||
public var ikConstraints:Vector.<IkConstraintData> = new Vector.<IkConstraintData>();
|
||||
public var transformConstraints:Vector.<TransformConstraintData> = new Vector.<TransformConstraintData>();
|
||||
public var pathConstraints:Vector.<PathConstraintData> = new Vector.<PathConstraintData>();
|
||||
public var width:Number, height:Number;
|
||||
public var version:String, hash:String;
|
||||
|
||||
public function SkeletonData () {
|
||||
}
|
||||
|
||||
// --- Bones.
|
||||
|
||||
/** @return May be null. */
|
||||
@ -136,6 +140,37 @@ public class SkeletonData {
|
||||
return null;
|
||||
}
|
||||
|
||||
/** @return -1 if the transform constraint was not found. */
|
||||
public function findTransformConstraintIndex (transformConstraintName:String) : int {
|
||||
if (transformConstraintName == null) throw new ArgumentError("transformConstraintName cannot be null.");
|
||||
var transformConstraints:Vector.<TransformConstraintData> = this.transformConstraints;
|
||||
for (var i:int = 0, n:int = transformConstraints.length; i < n; i++)
|
||||
if (transformConstraints[i].name == transformConstraintName) return i;
|
||||
return -1;
|
||||
}
|
||||
|
||||
// --- Path constraints.
|
||||
|
||||
/** @return May be null. */
|
||||
public function findPathConstraint (constraintName:String) : PathConstraintData {
|
||||
if (constraintName == null) throw new ArgumentError("constraintName cannot be null.");
|
||||
var pathConstraints:Vector.<PathConstraintData> = this.pathConstraints;
|
||||
for (var i:int = 0, n:int = pathConstraints.length; i < n; i++) {
|
||||
var constraint:PathConstraintData = pathConstraints[i];
|
||||
if (constraint.name == constraintName) return constraint;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/** @return -1 if the path constraint was not found. */
|
||||
public function findPathConstraintIndex (pathConstraintName:String) : int {
|
||||
if (pathConstraintName == null) throw new ArgumentError("pathConstraintName cannot be null.");
|
||||
var pathConstraints:Vector.<PathConstraintData> = this.pathConstraints;
|
||||
for (var i:int = 0, n:int = pathConstraints.length; i < n; i++)
|
||||
if (pathConstraints[i].name == pathConstraintName) return i;
|
||||
return -1;
|
||||
}
|
||||
|
||||
// ---
|
||||
|
||||
public function toString () : String {
|
||||
|
||||
@ -29,6 +29,13 @@
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*****************************************************************************/
|
||||
package spine {
|
||||
import spine.animation.PathConstraintMixTimeline;
|
||||
import spine.animation.PathConstraintSpacingTimeline;
|
||||
import spine.animation.PathConstraintPositionTimeline;
|
||||
import spine.animation.TransformConstraintTimeline;
|
||||
import spine.animation.ShearTimeline;
|
||||
import spine.attachments.PathAttachment;
|
||||
import spine.attachments.VertexAttachment;
|
||||
import flash.utils.ByteArray;
|
||||
|
||||
import spine.animation.Animation;
|
||||
@ -37,7 +44,7 @@ import spine.animation.ColorTimeline;
|
||||
import spine.animation.CurveTimeline;
|
||||
import spine.animation.DrawOrderTimeline;
|
||||
import spine.animation.EventTimeline;
|
||||
import spine.animation.FfdTimeline;
|
||||
import spine.animation.DeformTimeline;
|
||||
import spine.animation.IkConstraintTimeline;
|
||||
import spine.animation.RotateTimeline;
|
||||
import spine.animation.ScaleTimeline;
|
||||
@ -49,7 +56,6 @@ import spine.attachments.AttachmentType;
|
||||
import spine.attachments.BoundingBoxAttachment;
|
||||
import spine.attachments.MeshAttachment;
|
||||
import spine.attachments.RegionAttachment;
|
||||
import spine.attachments.WeightedMeshAttachment;
|
||||
|
||||
public class SkeletonJson {
|
||||
public var attachmentLoader:AttachmentLoader;
|
||||
@ -95,60 +101,27 @@ public class SkeletonJson {
|
||||
parent = skeletonData.findBone(parentName);
|
||||
if (!parent) throw new Error("Parent bone not found: " + parentName);
|
||||
}
|
||||
boneData = new BoneData(boneMap["name"], parent);
|
||||
boneData = new BoneData(skeletonData.bones.length, boneMap["name"], parent);
|
||||
boneData.length = Number(boneMap["length"] || 0) * scale;
|
||||
boneData.x = Number(boneMap["x"] || 0) * scale;
|
||||
boneData.y = Number(boneMap["y"] || 0) * scale;
|
||||
boneData.rotation = (boneMap["rotation"] || 0);
|
||||
boneData.scaleX = boneMap.hasOwnProperty("scaleX") ? boneMap["scaleX"] : 1;
|
||||
boneData.scaleY = boneMap.hasOwnProperty("scaleY") ? boneMap["scaleY"] : 1;
|
||||
boneData.inheritScale = boneMap.hasOwnProperty("inheritScale") ? boneMap["inheritScale"] : true;
|
||||
boneData.inheritRotation = boneMap.hasOwnProperty("inheritRotation") ? boneMap["inheritRotation"] : true;
|
||||
skeletonData.bones[skeletonData.bones.length] = boneData;
|
||||
}
|
||||
|
||||
// IK constraints.
|
||||
for each (var ikMap:Object in root["ik"]) {
|
||||
var ikConstraintData:IkConstraintData = new IkConstraintData(ikMap["name"]);
|
||||
|
||||
for each (var boneName:String in ikMap["bones"]) {
|
||||
var bone:BoneData = skeletonData.findBone(boneName);
|
||||
if (!bone) throw new Error("IK bone not found: " + boneName);
|
||||
ikConstraintData.bones[ikConstraintData.bones.length] = bone;
|
||||
}
|
||||
|
||||
ikConstraintData.target = skeletonData.findBone(ikMap["target"]);
|
||||
if (!ikConstraintData.target) throw new Error("Target bone not found: " + ikMap["target"]);
|
||||
|
||||
ikConstraintData.bendDirection = (!ikMap.hasOwnProperty("bendPositive") || ikMap["bendPositive"]) ? 1 : -1;
|
||||
ikConstraintData.mix = ikMap.hasOwnProperty("mix") ? ikMap["mix"] : 1;
|
||||
|
||||
skeletonData.ikConstraints[skeletonData.ikConstraints.length] = ikConstraintData;
|
||||
}
|
||||
|
||||
// Transform constraints.
|
||||
for each (var transformMap:Object in root["transform"]) {
|
||||
var transformConstraintData:TransformConstraintData = new TransformConstraintData(transformMap["name"]);
|
||||
|
||||
transformConstraintData.bone = skeletonData.findBone(transformMap["bone"]);
|
||||
if (!transformConstraintData.bone) throw new Error("Bone not found: " + transformMap["bone"]);
|
||||
|
||||
transformConstraintData.target = skeletonData.findBone(transformMap["target"]);
|
||||
if (!transformConstraintData.target) throw new Error("Target bone not found: " + transformMap["target"]);
|
||||
|
||||
transformConstraintData.translateMix = transformMap.hasOwnProperty("translateMix") ? transformMap["translateMix"] : 1;
|
||||
transformConstraintData.x = Number(boneMap["x"] || 0) * scale;
|
||||
transformConstraintData.y = Number(boneMap["y"] || 0) * scale;
|
||||
|
||||
skeletonData.transformConstraints[skeletonData.transformConstraints.length] = transformConstraintData;
|
||||
boneData.shearX = Number(boneMap["shearX"] || 0);
|
||||
boneData.shearY = Number(boneMap["shearY"] || 0);
|
||||
boneData.inheritRotation = boneMap.hasOwnProperty("inheritRotation") ? Boolean(boneMap["inheritRotation"]) : true;
|
||||
boneData.inheritScale = boneMap.hasOwnProperty("inheritScale") ? Boolean(boneMap["inheritScale"]) : true;
|
||||
skeletonData.bones.push(boneData);
|
||||
}
|
||||
|
||||
// Slots.
|
||||
for each (var slotMap:Object in root["slots"]) {
|
||||
boneName = slotMap["bone"];
|
||||
var slotName:String = slotMap["name"];
|
||||
var boneName:String = slotMap["bone"];
|
||||
boneData = skeletonData.findBone(boneName);
|
||||
if (!boneData) throw new Error("Slot bone not found: " + boneName);
|
||||
var slotData:SlotData = new SlotData(slotMap["name"], boneData);
|
||||
var slotData:SlotData = new SlotData(skeletonData.slots.length, slotName, boneData);
|
||||
|
||||
var color:String = slotMap["color"];
|
||||
if (color) {
|
||||
@ -160,8 +133,81 @@ public class SkeletonJson {
|
||||
|
||||
slotData.attachmentName = slotMap["attachment"];
|
||||
slotData.blendMode = BlendMode[slotMap["blend"] || "normal"];
|
||||
skeletonData.slots.push(slotData);
|
||||
}
|
||||
|
||||
skeletonData.slots[skeletonData.slots.length] = slotData;
|
||||
// IK constraints.
|
||||
for each (var constraintMap:Object in root["ik"]) {
|
||||
var ikConstraintData:IkConstraintData = new IkConstraintData(constraintMap["name"]);
|
||||
|
||||
for each (boneName in constraintMap["bones"]) {
|
||||
var bone:BoneData = skeletonData.findBone(boneName);
|
||||
if (!bone) throw new Error("IK constraint bone not found: " + boneName);
|
||||
ikConstraintData.bones.push(bone);
|
||||
}
|
||||
|
||||
ikConstraintData.target = skeletonData.findBone(constraintMap["target"]);
|
||||
if (!ikConstraintData.target) throw new Error("Target bone not found: " + constraintMap["target"]);
|
||||
|
||||
ikConstraintData.bendDirection = (!constraintMap.hasOwnProperty("bendPositive") || constraintMap["bendPositive"]) ? 1 : -1;
|
||||
ikConstraintData.mix = constraintMap.hasOwnProperty("mix") ? constraintMap["mix"] : 1;
|
||||
|
||||
skeletonData.ikConstraints.push(ikConstraintData);
|
||||
}
|
||||
|
||||
// Transform constraints.
|
||||
for each (constraintMap in root["transform"]) {
|
||||
var transformConstraintData:TransformConstraintData = new TransformConstraintData(constraintMap["name"]);
|
||||
|
||||
for each (boneName in constraintMap["bones"]) {
|
||||
bone = skeletonData.findBone(boneName);
|
||||
if (!bone) throw new Error("Transform constraint bone not found: " + boneName);
|
||||
transformConstraintData.bones.push(bone);
|
||||
}
|
||||
|
||||
transformConstraintData.target = skeletonData.findBone(constraintMap["target"]);
|
||||
if (!transformConstraintData.target) throw new Error("Target bone not found: " + constraintMap["target"]);
|
||||
|
||||
transformConstraintData.offsetRotation = Number(constraintMap["rotation"] || 0);
|
||||
transformConstraintData.offsetX = Number(constraintMap["x"] || 0) * scale;
|
||||
transformConstraintData.offsetY = Number(constraintMap["y"] || 0) * scale;
|
||||
transformConstraintData.offsetScaleX = Number(constraintMap["scaleX"] || 0);
|
||||
transformConstraintData.offsetScaleY = Number(constraintMap["scaleY"] || 0);
|
||||
transformConstraintData.offsetShearY = Number(constraintMap["shearY"] || 0);
|
||||
|
||||
transformConstraintData.rotateMix = constraintMap.hasOwnProperty("rotateMix") ? constraintMap["rotateMix"] : 1;
|
||||
transformConstraintData.translateMix = constraintMap.hasOwnProperty("translateMix") ? constraintMap["translateMix"] : 1;
|
||||
transformConstraintData.scaleMix = constraintMap.hasOwnProperty("scaleMix") ? constraintMap["scaleMix"] : 1;
|
||||
transformConstraintData.shearMix = constraintMap.hasOwnProperty("shearMix") ? constraintMap["shearMix"] : 1;
|
||||
|
||||
skeletonData.transformConstraints.push(transformConstraintData);
|
||||
}
|
||||
|
||||
// Path constraints.
|
||||
for each (constraintMap in root["path"]) {
|
||||
var pathConstraintData:PathConstraintData = new PathConstraintData(constraintMap["name"]);
|
||||
|
||||
for each (boneName in constraintMap["bones"]) {
|
||||
bone = skeletonData.findBone(boneName);
|
||||
if (!bone) throw new Error("Path constraint bone not found: " + boneName);
|
||||
pathConstraintData.bones.push(bone);
|
||||
}
|
||||
|
||||
pathConstraintData.target = skeletonData.findSlot(constraintMap["target"]);
|
||||
if (!pathConstraintData.target) throw new Error("Path target slot not found: " + constraintMap["target"]);
|
||||
|
||||
pathConstraintData.positionMode = PositionMode[constraintMap["positionMode"] || "percent"];
|
||||
pathConstraintData.spacingMode = SpacingMode[constraintMap["spacingMode"] || "length"];
|
||||
pathConstraintData.rotateMode = RotateMode[constraintMap["rotateMode"] || "rotateMode"];
|
||||
pathConstraintData.offsetRotation = Number(constraintMap["rotation"] || 0);
|
||||
pathConstraintData.position = Number(constraintMap["position"] || 0);
|
||||
if (pathConstraintData.positionMode == PositionMode.fixed) pathConstraintData.position *= scale;
|
||||
pathConstraintData.spacing = Number(constraintMap["spacing"] || 0);
|
||||
if (pathConstraintData.spacingMode == SpacingMode.length || pathConstraintData.spacingMode == SpacingMode.fixed) pathConstraintData.spacing *= scale;
|
||||
pathConstraintData.rotateMix = constraintMap.hasOwnProperty("rotateMix") ? constraintMap["rotateMix"] : 1;
|
||||
pathConstraintData.translateMix = constraintMap.hasOwnProperty("translateMix") ? constraintMap["translateMix"] : 1;
|
||||
|
||||
skeletonData.pathConstraints.push(pathConstraintData);
|
||||
}
|
||||
|
||||
// Skins.
|
||||
@ -169,11 +215,11 @@ public class SkeletonJson {
|
||||
for (var skinName:String in skins) {
|
||||
var skinMap:Object = skins[skinName];
|
||||
var skin:Skin = new Skin(skinName);
|
||||
for (var slotName:String in skinMap) {
|
||||
for (slotName in skinMap) {
|
||||
var slotIndex:int = skeletonData.findSlotIndex(slotName);
|
||||
var slotEntry:Object = skinMap[slotName];
|
||||
for (var attachmentName:String in slotEntry) {
|
||||
var attachment:Attachment = readAttachment(skin, slotIndex, attachmentName, slotEntry[attachmentName]);
|
||||
var attachment:Attachment = readAttachment(slotEntry[attachmentName], skin, slotIndex, attachmentName);
|
||||
if (attachment != null)
|
||||
skin.addAttachment(slotIndex, attachmentName, attachment);
|
||||
}
|
||||
@ -184,20 +230,14 @@ public class SkeletonJson {
|
||||
}
|
||||
|
||||
// Linked meshes.
|
||||
var linkedMeshes:Vector.<LinkedMesh> = this.linkedMeshes;
|
||||
for each (var linkedMesh:LinkedMesh in linkedMeshes) {
|
||||
var parentSkin:Skin = !linkedMesh.skin ? skeletonData.defaultSkin : skeletonData.findSkin(linkedMesh.skin);
|
||||
if (!parentSkin) throw new Error("Skin not found: " + linkedMesh.skin);
|
||||
var parentMesh:Attachment = parentSkin.getAttachment(linkedMesh.slotIndex, linkedMesh.parent);
|
||||
if (!parentMesh) throw new Error("Parent mesh not found: " + linkedMesh.parent);
|
||||
if (linkedMesh.mesh is MeshAttachment) {
|
||||
var mesh:MeshAttachment = MeshAttachment(linkedMesh.mesh);
|
||||
mesh.parentMesh = MeshAttachment(parentMesh);
|
||||
mesh.updateUVs();
|
||||
} else {
|
||||
var weightedMesh:WeightedMeshAttachment = WeightedMeshAttachment(linkedMesh.mesh);
|
||||
weightedMesh.parentMesh = WeightedMeshAttachment(parentMesh);
|
||||
weightedMesh.updateUVs();
|
||||
}
|
||||
linkedMesh.mesh.parentMesh = MeshAttachment(parentMesh);
|
||||
linkedMesh.mesh.updateUVs();
|
||||
}
|
||||
linkedMeshes.length = 0;
|
||||
|
||||
@ -210,33 +250,31 @@ public class SkeletonJson {
|
||||
eventData.intValue = eventMap["int"] || 0;
|
||||
eventData.floatValue = eventMap["float"] || 0;
|
||||
eventData.stringValue = eventMap["string"] || null;
|
||||
skeletonData.events[skeletonData.events.length] = eventData;
|
||||
skeletonData.events.push(eventData);
|
||||
}
|
||||
}
|
||||
|
||||
// Animations.
|
||||
var animations:Object = root["animations"];
|
||||
for (var animationName:String in animations)
|
||||
readAnimation(animationName, animations[animationName], skeletonData);
|
||||
readAnimation(animations[animationName], animationName, skeletonData);
|
||||
|
||||
return skeletonData;
|
||||
}
|
||||
|
||||
private function readAttachment (skin:Skin, slotIndex:int, name:String, map:Object) : Attachment {
|
||||
private function readAttachment (map:Object, skin:Skin, slotIndex:int, name:String) : Attachment {
|
||||
name = map["name"] || name;
|
||||
|
||||
var typeName:String = map["type"] || "region";
|
||||
if (typeName == "skinnedmesh") typeName = "weightedmesh";
|
||||
var type:AttachmentType = AttachmentType[typeName];
|
||||
var path:String = map["path"] || name;
|
||||
|
||||
var scale:Number = this.scale;
|
||||
var color:String, vertices:Vector.<Number>;
|
||||
var color:String;
|
||||
switch (type) {
|
||||
case AttachmentType.region:
|
||||
var region:RegionAttachment = attachmentLoader.newRegionAttachment(skin, name, path);
|
||||
var region:RegionAttachment = attachmentLoader.newRegionAttachment(skin, name, map["path"] || name);
|
||||
if (!region) return null;
|
||||
region.path = path;
|
||||
region.path = map["path"] || name;
|
||||
region.x = Number(map["x"] || 0) * scale;
|
||||
region.y = Number(map["y"] || 0) * scale;
|
||||
region.scaleX = map.hasOwnProperty("scaleX") ? map["scaleX"] : 1;
|
||||
@ -255,9 +293,9 @@ public class SkeletonJson {
|
||||
return region;
|
||||
case AttachmentType.mesh:
|
||||
case AttachmentType.linkedmesh:
|
||||
var mesh:MeshAttachment = attachmentLoader.newMeshAttachment(skin, name, path);
|
||||
var mesh:MeshAttachment = attachmentLoader.newMeshAttachment(skin, name, map["path"] || name);
|
||||
if (!mesh) return null;
|
||||
mesh.path = path;
|
||||
mesh.path = map["path"] || name;
|
||||
|
||||
color = map["color"];
|
||||
if (color) {
|
||||
@ -270,78 +308,79 @@ public class SkeletonJson {
|
||||
mesh.width = Number(map["width"] || 0) * scale;
|
||||
mesh.height = Number(map["height"] || 0) * scale;
|
||||
|
||||
if (!map["parent"]) {
|
||||
mesh.vertices = getFloatArray(map, "vertices", scale);
|
||||
mesh.triangles = getUintArray(map, "triangles");
|
||||
mesh.regionUVs = getFloatArray(map, "uvs", 1);
|
||||
mesh.updateUVs();
|
||||
|
||||
mesh.hullLength = int(map["hull"] || 0) * 2;
|
||||
if (map["edges"]) mesh.edges = getIntArray(map, "edges");
|
||||
} else {
|
||||
mesh.inheritFFD = map.hasOwnProperty("ffd") ? map["ffd"] : true;
|
||||
linkedMeshes[linkedMeshes.length] = new LinkedMesh(mesh, map["skin"], slotIndex, map["parent"]);
|
||||
if (map["parent"]) {
|
||||
mesh.inheritDeform = map.hasOwnProperty("deform") ? Boolean(map["deform"]) : true;
|
||||
linkedMeshes.push(new LinkedMesh(mesh, map["skin"], slotIndex, map["parent"]));
|
||||
return mesh;
|
||||
}
|
||||
|
||||
var uvs:Vector.<Number> = getFloatArray(map, "uvs", 1);
|
||||
readVertices(map, mesh, uvs.length);
|
||||
mesh.triangles = getUintArray(map, "triangles");
|
||||
mesh.regionUVs = uvs;
|
||||
mesh.updateUVs();
|
||||
|
||||
mesh.hullLength = int(map["hull"] || 0) * 2;
|
||||
if (map["edges"]) mesh.edges = getIntArray(map, "edges");
|
||||
return mesh;
|
||||
case AttachmentType.weightedmesh:
|
||||
case AttachmentType.weightedlinkedmesh:
|
||||
var weightedMesh:WeightedMeshAttachment = attachmentLoader.newWeightedMeshAttachment(skin, name, path);
|
||||
if (!weightedMesh) return null;
|
||||
|
||||
weightedMesh.path = path;
|
||||
|
||||
color = map["color"];
|
||||
if (color) {
|
||||
weightedMesh.r = toColor(color, 0);
|
||||
weightedMesh.g = toColor(color, 1);
|
||||
weightedMesh.b = toColor(color, 2);
|
||||
weightedMesh.a = toColor(color, 3);
|
||||
}
|
||||
|
||||
weightedMesh.width = Number(map["width"] || 0) * scale;
|
||||
weightedMesh.height = Number(map["height"] || 0) * scale;
|
||||
|
||||
if (!map["parent"]) {
|
||||
var uvs:Vector.<Number> = getFloatArray(map, "uvs", 1);
|
||||
vertices = getFloatArray(map, "vertices", 1);
|
||||
var weights:Vector.<Number> = new Vector.<Number>();
|
||||
var bones:Vector.<int> = new Vector.<int>();
|
||||
for (var i:int = 0, n:int = vertices.length; i < n;) {
|
||||
var boneCount:int = int(vertices[i++]);
|
||||
bones[bones.length] = boneCount;
|
||||
for (var nn:int = i + boneCount * 4; i < nn;) {
|
||||
bones[bones.length] = vertices[i];
|
||||
weights[weights.length] = vertices[i + 1] * scale;
|
||||
weights[weights.length] = vertices[i + 2] * scale;
|
||||
weights[weights.length] = vertices[i + 3];
|
||||
i += 4;
|
||||
}
|
||||
}
|
||||
weightedMesh.bones = bones;
|
||||
weightedMesh.weights = weights;
|
||||
weightedMesh.triangles = getUintArray(map, "triangles");
|
||||
weightedMesh.regionUVs = uvs;
|
||||
weightedMesh.updateUVs();
|
||||
|
||||
weightedMesh.hullLength = int(map["hull"] || 0) * 2;
|
||||
if (map["edges"]) weightedMesh.edges = getIntArray(map, "edges");
|
||||
} else {
|
||||
weightedMesh.inheritFFD = map.hasOwnProperty("ffd") ? map["ffd"] : true;
|
||||
linkedMeshes[linkedMeshes.length] = new LinkedMesh(weightedMesh, map["skin"], slotIndex, map["parent"]);
|
||||
}
|
||||
return weightedMesh;
|
||||
case AttachmentType.boundingbox:
|
||||
var box:BoundingBoxAttachment = attachmentLoader.newBoundingBoxAttachment(skin, name);
|
||||
vertices = box.vertices;
|
||||
for each (var point:Number in map["vertices"])
|
||||
vertices[vertices.length] = point * scale;
|
||||
if (!box) return null;
|
||||
readVertices(map, box, int(map["vertexCount"]) << 1);
|
||||
return box;
|
||||
case AttachmentType.path:
|
||||
var path:PathAttachment = attachmentLoader.newPathAttachment(skin, name);
|
||||
if (!path) return null;
|
||||
path.closed = map.hasOwnProperty("closed") ? Boolean(map["closed"]) : false;
|
||||
path.constantSpeed = map.hasOwnProperty("constantSpeed") ? Boolean(map["constantSpeed"]) : true;
|
||||
|
||||
var vertexCount:int = int(map["vertexCount"]);
|
||||
readVertices(map, path, vertexCount << 1);
|
||||
|
||||
var lengths:Vector.<Number> = new Vector.<Number>();
|
||||
for each (var curves:Object in map["lengths"]) {
|
||||
lengths.push(Number(curves) * scale);
|
||||
}
|
||||
path.lengths = lengths;
|
||||
return path;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private function readAnimation (name:String, map:Object, skeletonData:SkeletonData) : void {
|
||||
private function readVertices(map:Object, attachment:VertexAttachment, verticesLength:int) : void {
|
||||
attachment.worldVerticesLength = verticesLength;
|
||||
var vertices:Vector.<Number> = getFloatArray(map, "vertices", 1);
|
||||
if (verticesLength == vertices.length) {
|
||||
if (scale != 1) {
|
||||
for (var i:int = 0, n:int = vertices.length; i < n; i++) {
|
||||
vertices[i] *= scale;
|
||||
}
|
||||
}
|
||||
attachment.vertices = vertices;
|
||||
return;
|
||||
}
|
||||
|
||||
var weights:Vector.<Number> = new Vector.<Number>(verticesLength * 3 * 3);
|
||||
weights.length = 0;
|
||||
var bones:Vector.<int> = new Vector.<int>(verticesLength * 3);
|
||||
bones.length = 0;
|
||||
for (i = 0, n = vertices.length; i < n;) {
|
||||
var boneCount:int = int(vertices[i++]);
|
||||
bones.push(boneCount);
|
||||
for (var nn:int = i + boneCount * 4; i < nn; i+=4) {
|
||||
bones.push(int(vertices[i]));
|
||||
weights.push(vertices[i + 1] * scale);
|
||||
weights.push(vertices[i + 2] * scale);
|
||||
weights.push(vertices[i + 3]);
|
||||
}
|
||||
}
|
||||
attachment.bones = bones;
|
||||
attachment.vertices = weights;
|
||||
}
|
||||
|
||||
private function readAnimation (map:Object, name:String, skeletonData:SkeletonData) : void {
|
||||
var scale:Number = this.scale;
|
||||
var timelines:Vector.<Timeline> = new Vector.<Timeline>();
|
||||
var duration:Number = 0;
|
||||
|
||||
@ -369,11 +408,11 @@ public class SkeletonJson {
|
||||
var b:Number = toColor(color, 2);
|
||||
var a:Number = toColor(color, 3);
|
||||
colorTimeline.setFrame(frameIndex, valueMap["time"], r, g, b, a);
|
||||
readCurve(colorTimeline, frameIndex, valueMap);
|
||||
readCurve(valueMap, colorTimeline, frameIndex);
|
||||
frameIndex++;
|
||||
}
|
||||
timelines[timelines.length] = colorTimeline;
|
||||
duration = Math.max(duration, colorTimeline.frames[colorTimeline.frameCount * 5 - 5]);
|
||||
duration = Math.max(duration, colorTimeline.frames[(colorTimeline.frameCount - 1) * ColorTimeline.ENTRIES]);
|
||||
} else if (timelineName == "attachment") {
|
||||
var attachmentTimeline:AttachmentTimeline = new AttachmentTimeline(values.length);
|
||||
attachmentTimeline.slotIndex = slotIndex;
|
||||
@ -403,32 +442,34 @@ public class SkeletonJson {
|
||||
frameIndex = 0;
|
||||
for each (valueMap in values) {
|
||||
rotateTimeline.setFrame(frameIndex, valueMap["time"], valueMap["angle"]);
|
||||
readCurve(rotateTimeline, frameIndex, valueMap);
|
||||
readCurve(valueMap, rotateTimeline, frameIndex);
|
||||
frameIndex++;
|
||||
}
|
||||
timelines[timelines.length] = rotateTimeline;
|
||||
duration = Math.max(duration, rotateTimeline.frames[rotateTimeline.frameCount * 2 - 2]);
|
||||
} else if (timelineName == "translate" || timelineName == "scale") {
|
||||
var timeline:TranslateTimeline;
|
||||
duration = Math.max(duration, rotateTimeline.frames[(rotateTimeline.frameCount - 1) * RotateTimeline.ENTRIES]);
|
||||
} else if (timelineName == "translate" || timelineName == "scale" || timelineName == "shear") {
|
||||
var translateTimeline:TranslateTimeline;
|
||||
var timelineScale:Number = 1;
|
||||
if (timelineName == "scale")
|
||||
timeline = new ScaleTimeline(values.length);
|
||||
translateTimeline = new ScaleTimeline(values.length);
|
||||
else if (timelineName == "shear")
|
||||
translateTimeline = new ShearTimeline(values.length);
|
||||
else {
|
||||
timeline = new TranslateTimeline(values.length);
|
||||
translateTimeline = new TranslateTimeline(values.length);
|
||||
timelineScale = scale;
|
||||
}
|
||||
timeline.boneIndex = boneIndex;
|
||||
translateTimeline.boneIndex = boneIndex;
|
||||
|
||||
frameIndex = 0;
|
||||
for each (valueMap in values) {
|
||||
var x:Number = Number(valueMap["x"] || 0) * timelineScale;
|
||||
var y:Number = Number(valueMap["y"] || 0) * timelineScale;
|
||||
timeline.setFrame(frameIndex, valueMap["time"], x, y);
|
||||
readCurve(timeline, frameIndex, valueMap);
|
||||
translateTimeline.setFrame(frameIndex, valueMap["time"], x, y);
|
||||
readCurve(valueMap, translateTimeline, frameIndex);
|
||||
frameIndex++;
|
||||
}
|
||||
timelines[timelines.length] = timeline;
|
||||
duration = Math.max(duration, timeline.frames[timeline.frameCount * 3 - 3]);
|
||||
timelines[timelines.length] = translateTimeline;
|
||||
duration = Math.max(duration, translateTimeline.frames[(translateTimeline.frameCount - 1) * TranslateTimeline.ENTRIES]);
|
||||
} else
|
||||
throw new Error("Invalid timeline type for a bone: " + timelineName + " (" + boneName + ")");
|
||||
}
|
||||
@ -445,67 +486,133 @@ public class SkeletonJson {
|
||||
var mix:Number = valueMap.hasOwnProperty("mix") ? valueMap["mix"] : 1;
|
||||
var bendDirection:int = (!valueMap.hasOwnProperty("bendPositive") || valueMap["bendPositive"]) ? 1 : -1;
|
||||
ikTimeline.setFrame(frameIndex, valueMap["time"], mix, bendDirection);
|
||||
readCurve(ikTimeline, frameIndex, valueMap);
|
||||
readCurve(valueMap, ikTimeline, frameIndex);
|
||||
frameIndex++;
|
||||
}
|
||||
timelines[timelines.length] = ikTimeline;
|
||||
duration = Math.max(duration, ikTimeline.frames[ikTimeline.frameCount * 3 - 3]);
|
||||
duration = Math.max(duration, ikTimeline.frames[(ikTimeline.frameCount - 1) * IkConstraintTimeline.ENTRIES]);
|
||||
}
|
||||
|
||||
var ffd:Object = map["ffd"];
|
||||
for (var skinName:String in ffd) {
|
||||
var transformMap:Object = map["transform"];
|
||||
for (var transformName:String in transformMap) {
|
||||
var transformConstraint:TransformConstraintData = skeletonData.findTransformConstraint(transformName);
|
||||
values = transformMap[transformName];
|
||||
var transformTimeline:TransformConstraintTimeline = new TransformConstraintTimeline(values.length);
|
||||
transformTimeline.transformConstraintIndex = skeletonData.transformConstraints.indexOf(transformConstraint);
|
||||
frameIndex = 0;
|
||||
for each (valueMap in values) {
|
||||
var rotateMix:Number = valueMap.hasOwnProperty("rotateMix") ? valueMap["rotateMix"] : 1;
|
||||
var translateMix:Number = valueMap.hasOwnProperty("translateMix") ? valueMap["translateMix"] : 1;
|
||||
var scaleMix:Number = valueMap.hasOwnProperty("scaleMix") ? valueMap["scaleMix"] : 1;
|
||||
var shearMix:Number = valueMap.hasOwnProperty("shearMix") ? valueMap["shearMix"] : 1;
|
||||
transformTimeline.setFrame(frameIndex, valueMap["time"], rotateMix, translateMix, scaleMix, shearMix);
|
||||
readCurve(valueMap, transformTimeline, frameIndex);
|
||||
frameIndex++;
|
||||
}
|
||||
timelines.push(transformTimeline);
|
||||
duration = Math.max(duration, transformTimeline.frames[(transformTimeline.frameCount - 1) * TransformConstraintTimeline.ENTRIES]);
|
||||
}
|
||||
|
||||
// Path constraint timelines.
|
||||
var paths:Object = map["paths"];
|
||||
for (var pathName:String in paths) {
|
||||
var index:int = skeletonData.findPathConstraintIndex(pathName);
|
||||
if (index == -1) throw new Error("Path constraint not found: " + pathName);
|
||||
var data:PathConstraintData = skeletonData.pathConstraints[index];
|
||||
|
||||
var pathMap:Object = paths[pathName];
|
||||
for (timelineName in pathMap) {
|
||||
values = pathMap[timelineName];
|
||||
|
||||
if (timelineName == "position" || timelineName == "spacing") {
|
||||
var pathTimeline:PathConstraintPositionTimeline;
|
||||
timelineScale = 1;
|
||||
if (timelineName == "spacing") {
|
||||
pathTimeline = new PathConstraintSpacingTimeline(values.length);
|
||||
if (data.spacingMode == SpacingMode.length || data.spacingMode == SpacingMode.fixed) timelineScale = scale;
|
||||
} else {
|
||||
pathTimeline = new PathConstraintPositionTimeline(values.length);
|
||||
if (data.positionMode == PositionMode.fixed) timelineScale = scale;
|
||||
}
|
||||
pathTimeline.pathConstraintIndex = index;
|
||||
frameIndex = 0;
|
||||
for each (valueMap in values) {
|
||||
var value:Number = valueMap[timelineName] || 0;
|
||||
pathTimeline.setFrame(frameIndex, valueMap["time"], value * timelineScale);
|
||||
readCurve(valueMap, pathTimeline, frameIndex);
|
||||
frameIndex++;
|
||||
}
|
||||
timelines.push(pathTimeline);
|
||||
duration = Math.max(duration,
|
||||
pathTimeline.frames[(pathTimeline.frameCount - 1) * PathConstraintPositionTimeline.ENTRIES]);
|
||||
} else if (timelineName == "mix") {
|
||||
var pathMixTimeline:PathConstraintMixTimeline = new PathConstraintMixTimeline(values.length);
|
||||
pathMixTimeline.pathConstraintIndex = index;
|
||||
frameIndex = 0;
|
||||
for each (valueMap in values) {
|
||||
rotateMix = valueMap.hasOwnProperty("rotateMix") ? valueMap["rotateMix"] : 1;
|
||||
translateMix = valueMap.hasOwnProperty("translateMix") ? valueMap["translateMix"] : 1;
|
||||
pathMixTimeline.setFrame(frameIndex, valueMap["time"], rotateMix, translateMix);
|
||||
readCurve(valueMap, pathMixTimeline, frameIndex);
|
||||
frameIndex++;
|
||||
}
|
||||
timelines.push(pathMixTimeline);
|
||||
duration = Math.max(duration,
|
||||
pathMixTimeline.frames[(pathMixTimeline.frameCount - 1) * PathConstraintMixTimeline.ENTRIES]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var deformMap:Object = map["deform"];
|
||||
for (var skinName:String in deformMap) {
|
||||
var skin:Skin = skeletonData.findSkin(skinName);
|
||||
slotMap = ffd[skinName];
|
||||
slotMap = deformMap[skinName];
|
||||
for (slotName in slotMap) {
|
||||
slotIndex = skeletonData.findSlotIndex(slotName);
|
||||
var meshMap:Object = slotMap[slotName];
|
||||
for (var meshName:String in meshMap) {
|
||||
values = meshMap[meshName];
|
||||
var ffdTimeline:FfdTimeline = new FfdTimeline(values.length);
|
||||
var attachment:Attachment = skin.getAttachment(slotIndex, meshName);
|
||||
if (!attachment) throw new Error("FFD attachment not found: " + meshName);
|
||||
ffdTimeline.slotIndex = slotIndex;
|
||||
ffdTimeline.attachment = attachment;
|
||||
var timelineMap:Object = slotMap[slotName];
|
||||
for (timelineName in timelineMap) {
|
||||
values = timelineMap[timelineName];
|
||||
|
||||
var vertexCount:int;
|
||||
if (attachment is MeshAttachment)
|
||||
vertexCount = (attachment as MeshAttachment).vertices.length;
|
||||
else
|
||||
vertexCount = (attachment as WeightedMeshAttachment).weights.length / 3 * 2;
|
||||
var attachment:VertexAttachment = skin.getAttachment(slotIndex, timelineName) as VertexAttachment;
|
||||
if (attachment == null) throw new Error("Deform attachment not found: " + timelineName);
|
||||
var weighted:Boolean = attachment.bones != null;
|
||||
var vertices:Vector.<Number> = attachment.vertices;
|
||||
var deformLength:int = weighted ? vertices.length / 3 * 2 : vertices.length;
|
||||
|
||||
var deformTimeline:DeformTimeline = new DeformTimeline(values.length);
|
||||
deformTimeline.slotIndex = slotIndex;
|
||||
deformTimeline.attachment = attachment;
|
||||
|
||||
frameIndex = 0;
|
||||
for each (valueMap in values) {
|
||||
var vertices:Vector.<Number>;
|
||||
if (!valueMap["vertices"]) {
|
||||
if (attachment is MeshAttachment)
|
||||
vertices = (attachment as MeshAttachment).vertices;
|
||||
else
|
||||
vertices = new Vector.<Number>(vertexCount, true);
|
||||
} else {
|
||||
var verticesValue:Array = valueMap["vertices"];
|
||||
vertices = new Vector.<Number>(vertexCount, true);
|
||||
var start:int = valueMap["offset"] || 0;
|
||||
var n:int = verticesValue.length;
|
||||
if (scale == 1) {
|
||||
for (i = 0; i < n; i++)
|
||||
vertices[i + start] = verticesValue[i];
|
||||
} else {
|
||||
for (i = 0; i < n; i++)
|
||||
vertices[i + start] = verticesValue[i] * scale;
|
||||
var deform:Vector.<Number>;
|
||||
var verticesValue:Object = valueMap["vertices"];
|
||||
if (verticesValue == null)
|
||||
deform = weighted ? new Vector.<Number>(deformLength, true) : vertices;
|
||||
else {
|
||||
deform = new Vector.<Number>(deformLength, true);
|
||||
var start:int = Number(valueMap["offset"] || 0);
|
||||
var temp:Vector.<Number> = getFloatArray(valueMap, "vertices", 1);
|
||||
for (i = 0; i < temp.length; i++) {
|
||||
deform[start + i] = temp[i];
|
||||
}
|
||||
if (attachment is MeshAttachment) {
|
||||
var meshVertices:Vector.<Number> = (attachment as MeshAttachment).vertices;
|
||||
for (i = 0; i < vertexCount; i++)
|
||||
vertices[i] += meshVertices[i];
|
||||
if (scale != 1) {
|
||||
var n:int;
|
||||
for (i = start, n = i + temp.length; i < n; i++)
|
||||
deform[i] *= scale;
|
||||
}
|
||||
if (!weighted) {
|
||||
for (i = 0; i < deformLength; i++)
|
||||
deform[i] += vertices[i];
|
||||
}
|
||||
}
|
||||
|
||||
ffdTimeline.setFrame(frameIndex, valueMap["time"], vertices);
|
||||
readCurve(ffdTimeline, frameIndex, valueMap);
|
||||
deformTimeline.setFrame(frameIndex, valueMap["time"], deform);
|
||||
readCurve(valueMap, deformTimeline, frameIndex);
|
||||
frameIndex++;
|
||||
}
|
||||
timelines[timelines.length] = ffdTimeline;
|
||||
duration = Math.max(duration, ffdTimeline.frames[ffdTimeline.frameCount - 1]);
|
||||
timelines[timelines.length] = deformTimeline;
|
||||
duration = Math.max(duration, deformTimeline.frames[deformTimeline.frameCount - 1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -567,8 +674,8 @@ public class SkeletonJson {
|
||||
skeletonData.animations[skeletonData.animations.length] = new Animation(name, timelines, duration);
|
||||
}
|
||||
|
||||
static private function readCurve (timeline:CurveTimeline, frameIndex:int, valueMap:Object) : void {
|
||||
var curve:Object = valueMap["curve"];
|
||||
static private function readCurve (map:Object, timeline:CurveTimeline, frameIndex:int) : void {
|
||||
var curve:Object = map["curve"];
|
||||
if (!curve) return;
|
||||
if (curve == "stepped")
|
||||
timeline.setStepped(frameIndex);
|
||||
@ -614,14 +721,14 @@ public class SkeletonJson {
|
||||
|
||||
}
|
||||
|
||||
import spine.attachments.Attachment;
|
||||
import spine.attachments.MeshAttachment;
|
||||
|
||||
internal class LinkedMesh {
|
||||
internal var parent:String, skin:String;
|
||||
internal var slotIndex:int;
|
||||
internal var mesh:Attachment;
|
||||
internal var mesh:MeshAttachment;
|
||||
|
||||
public function LinkedMesh (mesh:Attachment, skin:String, slotIndex:int, parent:String) {
|
||||
public function LinkedMesh (mesh:MeshAttachment, skin:String, slotIndex:int, parent:String) {
|
||||
this.mesh = mesh;
|
||||
this.skin = skin;
|
||||
this.slotIndex = slotIndex;
|
||||
|
||||
@ -87,7 +87,6 @@ public class Slot {
|
||||
}
|
||||
|
||||
public function setToSetupPose () : void {
|
||||
var slotIndex:int = _bone._skeleton.data.slots.indexOf(data);
|
||||
r = _data.r;
|
||||
g = _data.g;
|
||||
b = _data.b;
|
||||
@ -96,7 +95,7 @@ public class Slot {
|
||||
attachment = null;
|
||||
else {
|
||||
_attachment = null;
|
||||
attachment = _bone._skeleton.getAttachmentForSlotIndex(slotIndex, data.attachmentName);
|
||||
attachment = _bone._skeleton.getAttachmentForSlotIndex(data.index, data.attachmentName);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -32,6 +32,7 @@
|
||||
package spine {
|
||||
|
||||
public class SlotData {
|
||||
internal var _index:int;
|
||||
internal var _name:String;
|
||||
internal var _boneData:BoneData;
|
||||
public var r:Number = 1;
|
||||
@ -41,13 +42,19 @@ public class SlotData {
|
||||
public var attachmentName:String;
|
||||
public var blendMode:BlendMode;
|
||||
|
||||
public function SlotData (name:String, boneData:BoneData) {
|
||||
public function SlotData (index:int, name:String, boneData:BoneData) {
|
||||
if (index < 0) throw new ArgumentError("index must be >= 0.");
|
||||
if (name == null) throw new ArgumentError("name cannot be null.");
|
||||
if (boneData == null) throw new ArgumentError("boneData cannot be null.");
|
||||
_index = index;
|
||||
_name = name;
|
||||
_boneData = boneData;
|
||||
}
|
||||
|
||||
public function get index () : int {
|
||||
return _index;
|
||||
}
|
||||
|
||||
public function get name () : String {
|
||||
return _name;
|
||||
}
|
||||
|
||||
40
spine-as3/spine-as3/src/spine/SpacingMode.as
Normal file
@ -0,0 +1,40 @@
|
||||
/******************************************************************************
|
||||
* Spine Runtimes Software License
|
||||
* Version 2.3
|
||||
*
|
||||
* Copyright (c) 2013-2015, Esoteric Software
|
||||
* All rights reserved.
|
||||
*
|
||||
* You are granted a perpetual, non-exclusive, non-sublicensable and
|
||||
* non-transferable license to use, install, execute and perform the Spine
|
||||
* Runtimes Software (the "Software") and derivative works solely for personal
|
||||
* or internal use. Without the written permission of Esoteric Software (see
|
||||
* Section 2 of the Spine Software License Agreement), you may not (a) modify,
|
||||
* translate, adapt or otherwise create derivative works, improvements of the
|
||||
* Software or develop new applications using the Software or (b) remove,
|
||||
* delete, alter or obscure any trademarks or any copyright, trademark, patent
|
||||
* or other intellectual property or proprietary rights notices on or in the
|
||||
* Software, including any copy thereof. Redistributions in binary or source
|
||||
* form must include this license and terms.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
||||
* EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*****************************************************************************/
|
||||
|
||||
package spine {
|
||||
|
||||
public class SpacingMode {
|
||||
public static const length:SpacingMode = new SpacingMode();
|
||||
public static const fixed:SpacingMode = new SpacingMode();
|
||||
public static const percent:SpacingMode = new SpacingMode();
|
||||
}
|
||||
|
||||
}
|
||||
@ -33,21 +33,25 @@ package spine {
|
||||
|
||||
public class TransformConstraint implements Updatable {
|
||||
internal var _data:TransformConstraintData;
|
||||
public var bone:Bone;
|
||||
internal var _bones:Vector.<Bone>;
|
||||
public var target:Bone;
|
||||
public var rotateMix:Number;
|
||||
public var translateMix:Number;
|
||||
public var x:Number;
|
||||
public var y:Number;
|
||||
public var scaleMix:Number;
|
||||
public var shearMix:Number;
|
||||
internal var _temp:Vector.<Number> = new Vector.<Number>(2);
|
||||
|
||||
public function TransformConstraint (data:TransformConstraintData, skeleton:Skeleton) {
|
||||
if (data == null) throw new ArgumentError("data cannot be null.");
|
||||
if (skeleton == null) throw new ArgumentError("skeleton cannot be null.");
|
||||
_data = data;
|
||||
rotateMix = data.rotateMix;
|
||||
translateMix = data.translateMix;
|
||||
x = data.x;
|
||||
y = data.y;
|
||||
|
||||
bone = skeleton.findBone(data.bone._name);
|
||||
scaleMix = data.scaleMix;
|
||||
shearMix = data.shearMix;
|
||||
_bones = new Vector.<Bone>();
|
||||
for each (var boneData:BoneData in data.bones)
|
||||
_bones.push(skeleton.findBone(boneData.name));
|
||||
target = skeleton.findBone(data.target._name);
|
||||
}
|
||||
|
||||
@ -56,14 +60,60 @@ public class TransformConstraint implements Updatable {
|
||||
}
|
||||
|
||||
public function update () : void {
|
||||
var translateMix:Number = translateMix;
|
||||
if (translateMix > 0) {
|
||||
var local:Vector.<Number> = new Vector.<Number>(2, true);
|
||||
local[0] = x;
|
||||
local[1] = y;
|
||||
target.localToWorld(local);
|
||||
bone._worldX += (local[0] - bone._worldX) * translateMix;
|
||||
bone._worldY += (local[1] - bone._worldY) * translateMix;
|
||||
var rotateMix:Number = this.rotateMix, translateMix:Number = this.translateMix, scaleMix:Number = this.scaleMix, shearMix:Number = this.shearMix;
|
||||
var target:Bone = this.target;
|
||||
var ta:Number = target.a, tb:Number = target.b, tc:Number = target.c, td:Number = target.d;
|
||||
var bones:Vector.<Bone> = this._bones;
|
||||
for (var i:int = 0, n:int = bones.length; i < n; i++) {
|
||||
var bone:Bone = bones[i];
|
||||
|
||||
if (rotateMix > 0) {
|
||||
var a:Number = bone.a, b:Number = bone.b, c:Number = bone.c, d:Number = bone.d;
|
||||
var r:Number = Math.atan2(tc, ta) - Math.atan2(c, a) + data.offsetRotation * MathUtils.degRad;
|
||||
if (r > Math.PI)
|
||||
r -= Math.PI * 2;
|
||||
else if (r < -Math.PI) r += Math.PI * 2;
|
||||
r *= rotateMix;
|
||||
var cos:Number = Math.cos(r), sin:Number = Math.sin(r);
|
||||
bone._a = cos * a - sin * c;
|
||||
bone._b = cos * b - sin * d;
|
||||
bone._c = sin * a + cos * c;
|
||||
bone._d = sin * b + cos * d;
|
||||
}
|
||||
|
||||
if (translateMix > 0) {
|
||||
_temp[0] = data.offsetX;
|
||||
_temp[1] = data.offsetY;
|
||||
target.localToWorld(_temp);
|
||||
bone._worldX += (_temp[0] - bone.worldX) * translateMix;
|
||||
bone._worldY += (_temp[1] - bone.worldY) * translateMix;
|
||||
}
|
||||
|
||||
if (scaleMix > 0) {
|
||||
var bs:Number = Math.sqrt(bone.a * bone.a + bone.c * bone.c);
|
||||
var ts:Number = Math.sqrt(ta * ta + tc * tc);
|
||||
var s:Number = bs > 0.00001 ? (bs + (ts - bs + data.offsetScaleX) * scaleMix) / bs : 0;
|
||||
bone._a *= s;
|
||||
bone._c *= s;
|
||||
bs = Math.sqrt(bone.b * bone.b + bone.d * bone.d);
|
||||
ts = Math.sqrt(tb * tb + td * td);
|
||||
s = bs > 0.00001 ? (bs + (ts - bs + data.offsetScaleY) * scaleMix) / bs : 0;
|
||||
bone._b *= s;
|
||||
bone._d *= s;
|
||||
}
|
||||
|
||||
if (shearMix > 0) {
|
||||
b = bone.b, d = bone.d;
|
||||
var by:Number = Math.atan2(d, b);
|
||||
r = Math.atan2(td, tb) - Math.atan2(tc, ta) - (by - Math.atan2(bone.c, bone.a));
|
||||
if (r > Math.PI)
|
||||
r -= Math.PI * 2;
|
||||
else if (r < -Math.PI) r += Math.PI * 2;
|
||||
r = by + (r + data.offsetShearY * MathUtils.degRad) * shearMix;
|
||||
s = Math.sqrt(b * b + d * d);
|
||||
bone._b = Math.cos(r) * s;
|
||||
bone._d = Math.sin(r) * s;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -71,6 +121,10 @@ public class TransformConstraint implements Updatable {
|
||||
return _data;
|
||||
}
|
||||
|
||||
public function get bones () : Vector.<Bone> {
|
||||
return _bones;
|
||||
}
|
||||
|
||||
public function toString () : String {
|
||||
return _data._name;
|
||||
}
|
||||
|
||||
@ -33,17 +33,28 @@ package spine {
|
||||
|
||||
public class TransformConstraintData {
|
||||
internal var _name:String;
|
||||
public var bone:BoneData;
|
||||
internal var _bones:Vector.<BoneData> = new Vector.<BoneData>();
|
||||
public var target:BoneData;
|
||||
public var rotateMix:Number;
|
||||
public var translateMix:Number;
|
||||
public var x:Number;
|
||||
public var y:Number;
|
||||
public var scaleMix:Number;
|
||||
public var shearMix:Number;
|
||||
public var offsetRotation:Number;
|
||||
public var offsetX:Number;
|
||||
public var offsetY:Number;
|
||||
public var offsetScaleX:Number;
|
||||
public var offsetScaleY:Number;
|
||||
public var offsetShearY:Number;
|
||||
|
||||
public function TransformConstraintData (name:String) {
|
||||
if (name == null) throw new ArgumentError("name cannot be null.");
|
||||
_name = name;
|
||||
}
|
||||
|
||||
public function get bones () : Vector.<BoneData> {;
|
||||
return _bones;
|
||||
}
|
||||
|
||||
public function get name () : String {
|
||||
return _name;
|
||||
}
|
||||
|
||||
@ -55,14 +55,13 @@ public class AttachmentTimeline implements Timeline {
|
||||
|
||||
public function apply (skeleton:Skeleton, lastTime:Number, time:Number, firedEvents:Vector.<Event>, alpha:Number) : void {
|
||||
var frames:Vector.<Number> = this.frames;
|
||||
if (time < frames[0]) {
|
||||
if (lastTime > time) apply(skeleton, lastTime, int.MAX_VALUE, null, 0);
|
||||
return;
|
||||
} else if (lastTime > time) //
|
||||
lastTime = -1;
|
||||
if (time < frames[0]) return; // Time is before first frame.
|
||||
|
||||
var frameIndex:int = time >= frames[frames.length - 1] ? frames.length - 1 : Animation.binarySearch1(frames, time) - 1;
|
||||
if (frames[frameIndex] < lastTime) return;
|
||||
var frameIndex:int;
|
||||
if (time >= frames[frames.length - 1]) // Time is after last frame.
|
||||
frameIndex = frames.length - 1;
|
||||
else
|
||||
frameIndex = Animation.binarySearch(frames, time, 1) - 1;
|
||||
|
||||
var attachmentName:String = attachmentNames[frameIndex];
|
||||
skeleton.slots[slotIndex].attachment = attachmentName == null ? null : skeleton.getAttachmentForSlotIndex(slotIndex, attachmentName);
|
||||
|
||||
@ -35,11 +35,9 @@ import spine.Skeleton;
|
||||
import spine.Slot;
|
||||
|
||||
public class ColorTimeline extends CurveTimeline {
|
||||
static private const PREV_FRAME_TIME:int = -5;
|
||||
static private const FRAME_R:int = 1;
|
||||
static private const FRAME_G:int = 2;
|
||||
static private const FRAME_B:int = 3;
|
||||
static private const FRAME_A:int = 4;
|
||||
static public const ENTRIES:int = 5;
|
||||
static internal const PREV_TIME:int = -5, PREV_R:int = -4, PREV_G:int = -3, PREV_B:int = -2, PREV_A:int = -1;
|
||||
static internal const R:int = 1, G:int = 2, B:int = 3, A:int = 4;
|
||||
|
||||
public var slotIndex:int;
|
||||
public var frames:Vector.<Number>; // time, r, g, b, a, ...
|
||||
@ -51,12 +49,12 @@ public class ColorTimeline extends CurveTimeline {
|
||||
|
||||
/** Sets the time and value of the specified keyframe. */
|
||||
public function setFrame (frameIndex:int, time:Number, r:Number, g:Number, b:Number, a:Number) : void {
|
||||
frameIndex *= 5;
|
||||
frameIndex *= ENTRIES;
|
||||
frames[frameIndex] = time;
|
||||
frames[int(frameIndex + 1)] = r;
|
||||
frames[int(frameIndex + 2)] = g;
|
||||
frames[int(frameIndex + 3)] = b;
|
||||
frames[int(frameIndex + 4)] = a;
|
||||
frames[int(frameIndex + R)] = r;
|
||||
frames[int(frameIndex + G)] = g;
|
||||
frames[int(frameIndex + B)] = b;
|
||||
frames[int(frameIndex + A)] = a;
|
||||
}
|
||||
|
||||
override public function apply (skeleton:Skeleton, lastTime:Number, time:Number, firedEvents:Vector.<Event>, alpha:Number) : void {
|
||||
@ -64,28 +62,28 @@ public class ColorTimeline extends CurveTimeline {
|
||||
return; // Time is before first frame.
|
||||
|
||||
var r:Number, g:Number, b:Number, a:Number;
|
||||
if (time >= frames[int(frames.length - 5)]) {
|
||||
if (time >= frames[int(frames.length - ENTRIES)]) {
|
||||
// Time is after last frame.
|
||||
var i:int = frames.length - 1;
|
||||
r = frames[int(i - 3)];
|
||||
g = frames[int(i - 2)];
|
||||
b = frames[int(i - 1)];
|
||||
a = frames[i];
|
||||
var i:int = frames.length;
|
||||
r = frames[int(i + PREV_R)];
|
||||
g = frames[int(i + PREV_G)];
|
||||
b = frames[int(i + PREV_B)];
|
||||
a = frames[int(i + PREV_A)];
|
||||
} else {
|
||||
// Interpolate between the previous frame and the current frame.
|
||||
var frameIndex:int = Animation.binarySearch(frames, time, 5);
|
||||
var prevFrameR:Number = frames[int(frameIndex - 4)];
|
||||
var prevFrameG:Number = frames[int(frameIndex - 3)];
|
||||
var prevFrameB:Number = frames[int(frameIndex - 2)];
|
||||
var prevFrameA:Number = frames[int(frameIndex - 1)];
|
||||
var frameTime:Number = frames[frameIndex];
|
||||
var percent:Number = 1 - (time - frameTime) / (frames[int(frameIndex + PREV_FRAME_TIME)] - frameTime);
|
||||
percent = getCurvePercent(frameIndex / 5 - 1, percent < 0 ? 0 : (percent > 1 ? 1 : percent));
|
||||
var frame:int = Animation.binarySearch(frames, time, ENTRIES);
|
||||
r = frames[int(frame + PREV_R)];
|
||||
g = frames[int(frame + PREV_G)];
|
||||
b = frames[int(frame + PREV_B)];
|
||||
b = frames[int(frame + PREV_A)];
|
||||
var frameTime:Number = frames[frame];
|
||||
var percent:Number = getCurvePercent(frame / ENTRIES - 1,
|
||||
1 - (time - frameTime) / (frames[frame + PREV_TIME] - frameTime));
|
||||
|
||||
r = prevFrameR + (frames[int(frameIndex + FRAME_R)] - prevFrameR) * percent;
|
||||
g = prevFrameG + (frames[int(frameIndex + FRAME_G)] - prevFrameG) * percent;
|
||||
b = prevFrameB + (frames[int(frameIndex + FRAME_B)] - prevFrameB) * percent;
|
||||
a = prevFrameA + (frames[int(frameIndex + FRAME_A)] - prevFrameA) * percent;
|
||||
r += (frames[frame + R] - r) * percent;
|
||||
g += (frames[frame + G] - g) * percent;
|
||||
b += (frames[frame + B] - b) * percent;
|
||||
a += (frames[frame + A] - a) * percent;
|
||||
}
|
||||
var slot:Slot = skeleton.slots[slotIndex];
|
||||
if (alpha < 1) {
|
||||
|
||||
@ -30,6 +30,7 @@
|
||||
*****************************************************************************/
|
||||
|
||||
package spine.animation {
|
||||
import spine.MathUtils;
|
||||
import spine.Event;
|
||||
import spine.Skeleton;
|
||||
|
||||
@ -38,8 +39,7 @@ public class CurveTimeline implements Timeline {
|
||||
static private const LINEAR:Number = 0;
|
||||
static private const STEPPED:Number = 1;
|
||||
static private const BEZIER:Number = 2;
|
||||
static private const BEZIER_SEGMENTS:int = 10;
|
||||
static private const BEZIER_SIZE:int = BEZIER_SEGMENTS * 2 - 1;
|
||||
static private const BEZIER_SIZE:int = 10 * 2 - 1;
|
||||
|
||||
private var curves:Vector.<Number>; // type, x, y, ...
|
||||
|
||||
@ -66,12 +66,10 @@ public class CurveTimeline implements Timeline {
|
||||
* cx1 and cx2 are from 0 to 1, representing the percent of time between the two keyframes. cy1 and cy2 are the percent of
|
||||
* the difference between the keyframe's values. */
|
||||
public function setCurve (frameIndex:int, cx1:Number, cy1:Number, cx2:Number, cy2:Number) : void {
|
||||
var subdiv1:Number = 1 / BEZIER_SEGMENTS, subdiv2:Number = subdiv1 * subdiv1, subdiv3:Number = subdiv2 * subdiv1;
|
||||
var pre1:Number = 3 * subdiv1, pre2:Number = 3 * subdiv2, pre4:Number = 6 * subdiv2, pre5:Number = 6 * subdiv3;
|
||||
var tmp1x:Number = -cx1 * 2 + cx2, tmp1y:Number = -cy1 * 2 + cy2, tmp2x:Number = (cx1 - cx2) * 3 + 1, tmp2y:Number = (cy1 - cy2) * 3 + 1;
|
||||
var dfx:Number = cx1 * pre1 + tmp1x * pre2 + tmp2x * subdiv3, dfy:Number = cy1 * pre1 + tmp1y * pre2 + tmp2y * subdiv3;
|
||||
var ddfx:Number = tmp1x * pre4 + tmp2x * pre5, ddfy:Number = tmp1y * pre4 + tmp2y * pre5;
|
||||
var dddfx:Number = tmp2x * pre5, dddfy:Number = tmp2y * pre5;
|
||||
var tmpx:Number = (-cx1 * 2 + cx2) * 0.03, tmpy:Number = (-cy1 * 2 + cy2) * 0.03;
|
||||
var dddfx:Number = ((cx1 - cx2) * 3 + 1) * 0.006, dddfy:Number = ((cy1 - cy2) * 3 + 1) * 0.006;
|
||||
var ddfx:Number = tmpx * 2 + dddfx, ddfy:Number = tmpy * 2 + dddfy;
|
||||
var dfx:Number = cx1 * 0.3 + tmpx + dddfx * 0.16666667, dfy:Number = cy1 * 0.3 + tmpy + dddfy * 0.16666667;
|
||||
|
||||
var i:int = frameIndex * BEZIER_SIZE;
|
||||
var curves:Vector.<Number> = this.curves;
|
||||
@ -91,6 +89,7 @@ public class CurveTimeline implements Timeline {
|
||||
}
|
||||
|
||||
public function getCurvePercent (frameIndex:int, percent:Number) : Number {
|
||||
percent = MathUtils.clamp(percent, 0, 1);
|
||||
var curves:Vector.<Number> = this.curves;
|
||||
var i:int = frameIndex * BEZIER_SIZE;
|
||||
var type:Number = curves[i];
|
||||
|
||||
@ -30,19 +30,18 @@
|
||||
*****************************************************************************/
|
||||
|
||||
package spine.animation {
|
||||
import spine.attachments.FfdAttachment;
|
||||
import spine.attachments.VertexAttachment;
|
||||
import spine.Event;
|
||||
import spine.Skeleton;
|
||||
import spine.Slot;
|
||||
import spine.attachments.Attachment;
|
||||
|
||||
public class FfdTimeline extends CurveTimeline {
|
||||
public class DeformTimeline extends CurveTimeline {
|
||||
public var slotIndex:int;
|
||||
public var frames:Vector.<Number>;
|
||||
public var frameVertices:Vector.<Vector.<Number>>;
|
||||
public var attachment:Attachment;
|
||||
public var attachment:VertexAttachment;
|
||||
|
||||
public function FfdTimeline (frameCount:int) {
|
||||
public function DeformTimeline (frameCount:int) {
|
||||
super(frameCount);
|
||||
frames = new Vector.<Number>(frameCount, true);
|
||||
frameVertices = new Vector.<Vector.<Number>>(frameCount, true);
|
||||
@ -56,8 +55,8 @@ public class FfdTimeline extends CurveTimeline {
|
||||
|
||||
override public function apply (skeleton:Skeleton, lastTime:Number, time:Number, firedEvents:Vector.<Event>, alpha:Number) : void {
|
||||
var slot:Slot = skeleton.slots[slotIndex];
|
||||
var slotAttachment:FfdAttachment = slot.attachment as FfdAttachment;
|
||||
if (!slotAttachment || !slotAttachment.applyFFD(attachment)) return;
|
||||
var slotAttachment:VertexAttachment = slot.attachment as VertexAttachment;
|
||||
if (!slotAttachment || !slotAttachment.applyDeform(attachment)) return;
|
||||
|
||||
var frames:Vector.<Number> = this.frames;
|
||||
if (time < frames[0]) return; // Time is before first frame.
|
||||
@ -83,13 +82,11 @@ public class FfdTimeline extends CurveTimeline {
|
||||
}
|
||||
|
||||
// Interpolate between the previous frame and the current frame.
|
||||
var frameIndex:int = Animation.binarySearch1(frames, time);
|
||||
var frameTime:Number = frames[frameIndex];
|
||||
var percent:Number = 1 - (time - frameTime) / (frames[int(frameIndex - 1)] - frameTime);
|
||||
percent = getCurvePercent(frameIndex - 1, percent < 0 ? 0 : (percent > 1 ? 1 : percent));
|
||||
|
||||
var prevVertices:Vector.<Number> = frameVertices[int(frameIndex - 1)];
|
||||
var nextVertices:Vector.<Number> = frameVertices[frameIndex];
|
||||
var frame:int = Animation.binarySearch1(frames, time);
|
||||
var prevVertices:Vector.<Number> = frameVertices[int(frame - 1)];
|
||||
var nextVertices:Vector.<Number> = frameVertices[frame];
|
||||
var frameTime:Number = frames[frame];
|
||||
var percent:Number = getCurvePercent(frame - 1, 1 - (time - frameTime) / (frames[frame - 1] - frameTime));
|
||||
|
||||
var prev:Number;
|
||||
if (alpha < 1) {
|
||||
@ -63,19 +63,19 @@ public class EventTimeline implements Timeline {
|
||||
return;
|
||||
if (time < frames[0]) return; // Time is before first frame.
|
||||
|
||||
var frameIndex:int;
|
||||
var frame:int;
|
||||
if (lastTime < frames[0])
|
||||
frameIndex = 0;
|
||||
frame = 0;
|
||||
else {
|
||||
frameIndex = Animation.binarySearch1(frames, lastTime);
|
||||
var frame:Number = frames[frameIndex];
|
||||
while (frameIndex > 0) { // Fire multiple events with the same frame.
|
||||
if (frames[int(frameIndex - 1)] != frame) break;
|
||||
frameIndex--;
|
||||
frame = Animation.binarySearch1(frames, lastTime);
|
||||
var frameTime:Number = frames[frame];
|
||||
while (frame > 0) { // Fire multiple events with the same frame.
|
||||
if (frames[int(frame - 1)] != frameTime) break;
|
||||
frame--;
|
||||
}
|
||||
}
|
||||
for (; frameIndex < frameCount && time >= frames[frameIndex]; frameIndex++)
|
||||
firedEvents[firedEvents.length] = events[frameIndex];
|
||||
for (; frame < frameCount && time >= frames[frame]; frame++)
|
||||
firedEvents[firedEvents.length] = events[frame];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -35,48 +35,45 @@ import spine.IkConstraint;
|
||||
import spine.Skeleton;
|
||||
|
||||
public class IkConstraintTimeline extends CurveTimeline {
|
||||
static private const PREV_FRAME_TIME:int = -3;
|
||||
static private const PREV_FRAME_MIX:int = -2;
|
||||
static private const PREV_FRAME_BEND_DIRECTION:int = -1;
|
||||
static private const FRAME_MIX:int = 1;
|
||||
static public const ENTRIES:int = 3;
|
||||
static internal const PREV_TIME:int = -3, PREV_MIX:int = -2, PREV_BEND_DIRECTION:int = -1;
|
||||
static internal const MIX:int = 1, BEND_DIRECTION:int = 2;
|
||||
|
||||
public var ikConstraintIndex:int;
|
||||
public var frames:Vector.<Number>; // time, mix, bendDirection, ...
|
||||
|
||||
public function IkConstraintTimeline (frameCount:int) {
|
||||
super(frameCount);
|
||||
frames = new Vector.<Number>(frameCount * 3, true);
|
||||
frames = new Vector.<Number>(frameCount * ENTRIES, true);
|
||||
}
|
||||
|
||||
/** Sets the time, mix and bend direction of the specified keyframe. */
|
||||
public function setFrame (frameIndex:int, time:Number, mix:Number, bendDirection:int) : void {
|
||||
frameIndex *= 3;
|
||||
frameIndex *= ENTRIES;
|
||||
frames[frameIndex] = time;
|
||||
frames[int(frameIndex + 1)] = mix;
|
||||
frames[int(frameIndex + 2)] = bendDirection;
|
||||
frames[int(frameIndex + MIX)] = mix;
|
||||
frames[int(frameIndex + BEND_DIRECTION)] = bendDirection;
|
||||
}
|
||||
|
||||
override public function apply (skeleton:Skeleton, lastTime:Number, time:Number, firedEvents:Vector.<Event>, alpha:Number) : void {
|
||||
if (time < frames[0]) return; // Time is before first frame.
|
||||
|
||||
var ikConstraint:IkConstraint = skeleton.ikConstraints[ikConstraintIndex];
|
||||
var constraint:IkConstraint = skeleton.ikConstraints[ikConstraintIndex];
|
||||
|
||||
if (time >= frames[int(frames.length - 3)]) { // Time is after last frame.
|
||||
ikConstraint.mix += (frames[int(frames.length - 2)] - ikConstraint.mix) * alpha;
|
||||
ikConstraint.bendDirection = int(frames[int(frames.length - 1)]);
|
||||
if (time >= frames[int(frames.length - ENTRIES)]) { // Time is after last frame.
|
||||
constraint.mix += (frames[int(frames.length + PREV_MIX)] - constraint.mix) * alpha;
|
||||
constraint.bendDirection = int(frames[int(frames.length + PREV_BEND_DIRECTION)]);
|
||||
return;
|
||||
}
|
||||
|
||||
// Interpolate between the previous frame and the current frame.
|
||||
var frameIndex:int = Animation.binarySearch(frames, time, 3);
|
||||
var prevFrameMix:Number = frames[int(frameIndex + PREV_FRAME_MIX)];
|
||||
var frameTime:Number = frames[frameIndex];
|
||||
var percent:Number = 1 - (time - frameTime) / (frames[int(frameIndex + PREV_FRAME_TIME)] - frameTime);
|
||||
percent = getCurvePercent(frameIndex / 3 - 1, percent < 0 ? 0 : (percent > 1 ? 1 : percent));
|
||||
var frame:int = Animation.binarySearch(frames, time, ENTRIES);
|
||||
var mix:Number = frames[int(frame + PREV_MIX)];
|
||||
var frameTime:Number = frames[frame];
|
||||
var percent:Number = getCurvePercent(frame / ENTRIES - 1, 1 - (time - frameTime) / (frames[frame + PREV_TIME] - frameTime));
|
||||
|
||||
var mix:Number = prevFrameMix + (frames[int(frameIndex + FRAME_MIX)] - prevFrameMix) * percent;
|
||||
ikConstraint.mix += (mix - ikConstraint.mix) * alpha;
|
||||
ikConstraint.bendDirection = int(frames[int(frameIndex + PREV_FRAME_BEND_DIRECTION)]);
|
||||
constraint.mix += (mix + (frames[frame + MIX] - mix) * percent - constraint.mix) * alpha;
|
||||
constraint.bendDirection = int(frames[frame + PREV_BEND_DIRECTION]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -33,6 +33,9 @@ package spine.animation {
|
||||
public class Listeners {
|
||||
private var _listeners:Vector.<Function> = new Vector.<Function>();
|
||||
|
||||
public function Listeners () {
|
||||
}
|
||||
|
||||
public function get listeners () : Vector.<Function> {
|
||||
return _listeners;
|
||||
}
|
||||
|
||||