Skip to content

Commit

Permalink
Improved spine atlas file path resolution.
Browse files Browse the repository at this point in the history
Added default spine skeleton asset.
  • Loading branch information
bryanedds committed Dec 22, 2024
1 parent 7470740 commit a498e25
Show file tree
Hide file tree
Showing 5 changed files with 282 additions and 1 deletion.
259 changes: 259 additions & 0 deletions Nu/Nu.Gaia/Assets/Default/SpineSkeleton-pro.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,259 @@
{
"skeleton": {
"hash": "fKr+fe4rKEk",
"spine": "4.2.22",
"x": -152.5,
"y": -151,
"width": 305,
"height": 302,
"images": "./images/",
"audio": ""
},
"bones": [
{ "name": "root" },
{ "name": "coin-front", "parent": "root" },
{ "name": "clipping", "parent": "coin-front" },
{ "name": "coin-sides", "parent": "root" },
{ "name": "coin-side-round", "parent": "coin-sides" },
{ "name": "coin-side-straight", "parent": "coin-sides" },
{ "name": "shine", "parent": "root", "x": 243.14 }
],
"slots": [
{ "name": "coin-side", "bone": "coin-side-straight", "color": "ffdb2fff", "attachment": "coin-side-straight" },
{ "name": "coin-side-round", "bone": "coin-side-round", "color": "ffdb2fff", "attachment": "coin-side-round" },
{ "name": "coin-front-texture", "bone": "coin-front", "color": "868686ff", "attachment": "coin-front-logo" },
{ "name": "coin-front-shine", "bone": "coin-front", "color": "888888ff", "dark": "000000", "attachment": "coin-front-shine-logo", "blend": "additive" },
{ "name": "clipping", "bone": "clipping", "attachment": "clipping" },
{ "name": "shine", "bone": "shine", "color": "ffffff60", "attachment": "shine", "blend": "additive" }
],
"skins": [
{
"name": "default",
"attachments": {
"clipping": {
"clipping": {
"type": "clipping",
"end": "clipping",
"vertexCount": 39,
"vertices": [ 0.1, 140.26, -26.4, 138.14, -50.51, 131.25, -75.42, 119.06, -98.21, 101.04, -115.44, 82.22, -127.63, 62.08, -136.11, 39.03, -140.08, 19.68, -141.41, -0.19, -140.08, -22.98, -134.78, -45.5, -125.24, -66.44, -113.32, -84.19, -98.21, -101.95, -80.46, -116.52, -61.38, -127.39, -38.92, -134.81, -18.22, -139.27, -0.14, -140.58, 24.23, -138.48, 45.45, -132.46, 67.98, -122.5, 86.58, -110.19, 102.56, -95.25, 115.4, -78.75, 125.36, -61.72, 134, -42.33, 138.46, -22.15, 139.24, -0.15, 138.46, 20.29, 133.48, 39.94, 127.19, 58.54, 117.5, 76.1, 104.4, 92.86, 88.42, 108.32, 69.03, 121.42, 50.43, 130.85, 26.32, 137.4 ],
"color": "ce3a3aff"
}
},
"coin-front-shine": {
"coin-front-shine-logo": { "width": 282, "height": 282 },
"coin-front-shine-spineboy": { "width": 282, "height": 282 }
},
"coin-front-texture": {
"coin-front-logo": { "width": 305, "height": 302 },
"coin-front-spineboy": { "width": 305, "height": 302 }
},
"coin-side": {
"coin-side-straight": { "x": 0.5, "width": 17, "height": 282 }
},
"coin-side-round": {
"coin-side-round": { "x": -69.43, "width": 144, "height": 282 }
},
"shine": {
"shine": { "y": 0.5, "scaleX": 1.6004, "scaleY": 1.6004, "width": 72, "height": 245 }
}
}
}
],
"animations": {
"idle": {
"slots": {
"coin-front-shine": {
"rgba2": [
{ "light": "7d7d7dff", "dark": "000000" },
{ "time": 0.2667, "light": "000000ff", "dark": "7e7e7e" },
{ "time": 0.664, "light": "000000ff", "dark": "000000" },
{ "time": 1.0333, "light": "7f7f7fff", "dark": "000000" },
{ "time": 1.3333, "light": "404040ff", "dark": "000000" },
{ "time": 1.6, "light": "000000ff", "dark": "7e7e7e" },
{ "time": 2.0022, "light": "000000ff", "dark": "000000" },
{ "time": 2.4, "light": "7f7f7fff", "dark": "000000" },
{ "time": 2.6667, "light": "7d7d7dff", "dark": "000000" }
],
"attachment": [
{ "time": 0.6667, "name": "coin-front-shine-spineboy" },
{ "time": 2, "name": "coin-front-shine-logo" }
]
},
"coin-front-texture": {
"rgba": [
{ "color": "858585ff" },
{ "time": 0.4, "color": "ffffffff" },
{
"time": 0.6696,
"color": "858585ff",
"curve": [ 0.725, 0.59, 0.892, 1, 0.725, 0.59, 0.892, 1, 0.725, 0.59, 0.892, 1, 0.725, 1, 0.892, 1 ]
},
{ "time": 0.9667, "color": "ffffffff" },
{ "time": 1.3318, "color": "858585ff", "curve": "stepped" },
{ "time": 1.3333, "color": "858585ff" },
{ "time": 1.7333, "color": "ffffffff" },
{ "time": 1.9982, "color": "858585ff", "curve": "stepped" },
{ "time": 2.0022, "color": "858585ff" },
{ "time": 2.3, "color": "ffffffff" },
{ "time": 2.6667, "color": "858585ff" }
],
"attachment": [
{ "time": 0.6667, "name": "coin-front-spineboy" },
{ "time": 2, "name": "coin-front-logo" }
]
}
},
"bones": {
"coin-front": {
"translate": [
{},
{ "time": 0.664, "x": 8.3, "curve": "stepped" },
{
"time": 0.6696,
"x": -8.3,
"curve": [ 0.794, -7.08, 1.167, 0, 0.794, 0, 1.167, 0 ]
},
{ "time": 1.3333 },
{ "time": 1.9982, "x": 8.3, "curve": "stepped" },
{ "time": 2.0022, "x": -8.3 },
{ "time": 2.6667 }
],
"scale": [
{
"curve": [ 0.164, 1, 0.484, 0.091, 0.164, 1, 0.484, 1 ]
},
{ "time": 0.664, "x": 0, "curve": "stepped" },
{
"time": 0.6696,
"x": 0.003,
"curve": [ 0.786, 0.153, 1.167, 1, 0.786, 1, 1.167, 1 ]
},
{
"time": 1.3333,
"curve": [ 1.442, 0.992, 1.858, 0.098, 1.442, 1, 1.858, 1 ]
},
{ "time": 1.9982, "x": 0.003, "curve": "stepped" },
{
"time": 2.0022,
"x": 0.003,
"curve": [ 2.123, 0.151, 2.501, 1, 2.123, 1, 2.501, 1 ]
},
{ "time": 2.6667 }
]
},
"coin-side-round": {
"translate": [
{},
{ "time": 0.664, "x": -6.75, "curve": "stepped" },
{
"time": 0.6696,
"x": 7.03,
"curve": [ 0.794, 5.99, 1.167, 0, 0.794, 0, 1.167, 0 ]
},
{ "time": 1.3333 },
{ "time": 1.9982, "x": -6.75, "curve": "stepped" },
{ "time": 2.0022, "x": 7.03 },
{ "time": 2.6667 }
],
"scale": [
{
"curve": [ 0.085, 1, 0.207, 0.789, 0.085, 1, 0.207, 1 ]
},
{
"time": 0.3333,
"x": 0.555,
"curve": [ 0.449, 0.347, 0.567, 0.122, 0.449, 1, 0.567, 1 ]
},
{ "time": 0.664, "x": 0.014, "curve": "stepped" },
{
"time": 0.6696,
"x": -0.028,
"curve": [ 0.723, -0.126, 0.865, -0.367, 0.723, 1, 0.865, 1 ]
},
{
"time": 1,
"x": -0.609,
"curve": [ 1.053, -0.778, 1.29, -0.997, 1.053, 1, 1.29, 1 ]
},
{ "time": 1.3318, "x": -1, "curve": "stepped" },
{
"time": 1.3333,
"curve": [ 1.384, 0.997, 1.439, 0.94, 1.384, 1, 1.439, 1 ]
},
{
"time": 1.5,
"x": 0.852,
"curve": [ 1.564, 0.748, 1.703, 0.509, 1.564, 1, 1.703, 1 ]
},
{
"time": 1.8,
"x": 0.315,
"curve": [ 1.873, 0.13, 1.987, 0.015, 1.873, 1, 1.987, 1 ]
},
{ "time": 1.9982, "x": 0.014, "curve": "stepped" },
{
"time": 2.0022,
"x": -0.028,
"curve": [ 2.039, -0.072, 2.123, -0.239, 2.039, 1, 2.123, 1 ]
},
{
"time": 2.2018,
"x": -0.365,
"curve": [ 2.269, -0.513, 2.337, -0.635, 2.269, 1, 2.337, 1 ]
},
{
"time": 2.4,
"x": -0.731,
"curve": [ 2.503, -0.871, 2.596, -0.961, 2.503, 1, 2.596, 1 ]
},
{
"time": 2.6592,
"x": -1,
"curve": [ 2.661, -1, 2.665, 1, 2.661, 1, 2.665, 1 ]
},
{ "time": 2.6667 }
]
},
"shine": {
"translate": [
{
"curve": [ 0.167, 0, 0.5, -473.39, 0.167, 0, 0.5, 0 ]
},
{
"time": 0.6667,
"x": -473.39,
"curve": [ 0.833, -473.39, 1.167, -33.16, 0.833, 0, 1.167, 0 ]
},
{
"time": 1.3333,
"x": -33.16,
"curve": [ 1.5, -33.16, 1.833, -473.39, 1.5, 0, 1.833, 0 ]
},
{
"time": 2,
"x": -473.39,
"curve": [ 2.167, -473.39, 2.5, 0, 2.167, 0, 2.5, 0 ]
},
{ "time": 2.6667 }
]
}
},
"drawOrder": [
{
"time": 0.6667,
"offsets": [
{ "slot": "coin-side", "offset": 2 }
]
},
{ "time": 0.6696 },
{
"time": 1.9982,
"offsets": [
{ "slot": "coin-side", "offset": 2 }
]
},
{ "time": 2.0022 }
]
}
}
}
18 changes: 18 additions & 0 deletions Nu/Nu.Gaia/Assets/Default/SpineSkeleton.atlas
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
SpineSkeleton.png
size: 1024, 1024
filter: Linear, Linear
coin-front-logo
bounds: 2, 609, 305, 302
coin-front-shine-logo
bounds: 309, 629, 282, 282
coin-front-shine-spineboy
bounds: 2, 21, 282, 282
coin-front-spineboy
bounds: 2, 305, 305, 302
coin-side-round
bounds: 309, 345, 144, 282
coin-side-straight
bounds: 2, 2, 17, 282
rotate: 90
shine
bounds: 593, 666, 72, 245
Binary file added Nu/Nu.Gaia/Assets/Default/SpineSkeleton.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion Nu/Nu/Core/Assets.fs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ module Assets =
let [<Literal>] PaddleName = "Paddle"
let [<Literal>] StaticSpriteName = "StaticSprite"
let [<Literal>] AnimatedSpriteName = "AnimatedSprite"
let [<Literal>] SpineSkeletonName = "SpineSkeleton"
let [<Literal>] SpineSkeletonName = "SpineSkeleton-pro"
let [<Literal>] NuSlideName = "NuSlide"
let [<Literal>] Character2dIdleName = "Character2dIdle"
let [<Literal>] Character2dJumpName = "Character2dJump"
Expand Down
4 changes: 4 additions & 0 deletions Nu/Nu/Metadata/Metadata.fs
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,10 @@ module Metadata =
let assetTag = AssetTag.make<Image> Assets.Default.PackageName Assets.Default.ImageName
(32, 32, assetTag :> obj) // TODO: P1: turn the resolution into constants?
let spineAtlasFilePath = PathF.Combine (directoryPath, fileName + ".atlas")
let spineAtlasFilePath = if not (File.Exists spineAtlasFilePath) then spineAtlasFilePath.Replace (fileName, fileName.Replace ("-ess", "")) else spineAtlasFilePath
let spineAtlasFilePath = if not (File.Exists spineAtlasFilePath) then spineAtlasFilePath.Replace (fileName, fileName.Replace ("-pro", "")) else spineAtlasFilePath
let spineAtlasFilePath = if not (File.Exists spineAtlasFilePath) then spineAtlasFilePath.Replace (fileName, fileName.Replace ("-ent", "")) else spineAtlasFilePath
let spineAtlasFilePath = if not (File.Exists spineAtlasFilePath) then spineAtlasFilePath.Replace (fileName, fileName.Replace ("-edu", "")) else spineAtlasFilePath
let spineTextureRetriever = Spine.TextureRetriever getTexture
try let spineAtlas = Spine.Atlas (spineAtlasFilePath, spineTextureRetriever)
if fileExtension = ".skel" then
Expand Down

0 comments on commit a498e25

Please sign in to comment.