Skip to content

Commit 7a088ff

Browse files
committed
add CreateSimpleSkinFromLegacy
1 parent fede787 commit 7a088ff

File tree

3 files changed

+32
-5
lines changed

3 files changed

+32
-5
lines changed

lol2gltf/Options.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,4 +62,17 @@ public class DumpSimpleSkinInfoOptions
6262
[Option('s', "simple-skin", Default = null, Required = true, HelpText = "Path to the SKN (Simple Skin) file")]
6363
public string SimpleSkinPath { get; set; }
6464
}
65+
66+
[Verb("create-skn-from-legacy", HelpText = "Creates a Simple Skin (SKN) from legacy SCO + WGT file combination")]
67+
public class CreateSimpleSkinFromLegacyOptions
68+
{
69+
[Option("sco", Required = true, HelpText = "Path to the SCO file")]
70+
public string StaticObjectPath { get; set; }
71+
72+
[Option("wgt", Required = true, HelpText = "Path to the WGT file")]
73+
public string WeightFilePath { get; set; }
74+
75+
[Option('o', "output-path", Required = true, HelpText = "Path where to save the created SKN")]
76+
public string SimpleSkinPath { get; set; }
77+
}
6578
}

lol2gltf/Program.cs

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
using Fantome.Libraries.League.Helpers.Structures;
88
using Fantome.Libraries.League.IO.SimpleSkinFile;
99
using Fantome.Libraries.League.IO.SkeletonFile;
10+
using Fantome.Libraries.League.IO.StaticObjectFile;
11+
using Fantome.Libraries.League.IO.WGT;
1012
using ImageMagick;
1113

1214
using LeagueAnimation = Fantome.Libraries.League.IO.AnimationFile.Animation;
@@ -25,7 +27,8 @@ static void Main(string[] args)
2527
(SimpleSkinOptions opts) => ConvertSimpleSkin(opts),
2628
(SkinnedModelOptions opts) => ConvertSkinnedModel(opts),
2729
(DumpSimpleSkinInfoOptions opts) => DumpSimpleSkinInfo(opts),
28-
errors => HandleErrors(errors)
30+
(CreateSimpleSkinFromLegacyOptions opts) => CreateSimpleSkinFromLegacy(opts),
31+
errors => 1
2932
);
3033
}
3134

@@ -91,9 +94,22 @@ private static int ConvertSkinnedModel(SkinnedModelOptions opts)
9194
return 1;
9295
}
9396

94-
private static int HandleErrors(IEnumerable<Error> errors)
97+
private static int CreateSimpleSkinFromLegacy(CreateSimpleSkinFromLegacyOptions opts)
9598
{
96-
// dont handle errors cuz uhhhhhhhh idk
99+
try
100+
{
101+
StaticObject staticObject = StaticObject.ReadSCO(opts.StaticObjectPath);
102+
WGTFile weightFile = new WGTFile(opts.WeightFilePath);
103+
SimpleSkin simpleSkin = new SimpleSkin(staticObject, weightFile);
104+
105+
simpleSkin.Write(opts.SimpleSkinPath);
106+
}
107+
catch(Exception exception)
108+
{
109+
Console.WriteLine("Failed to convert Simple Skin to glTF");
110+
Console.WriteLine(exception);
111+
}
112+
97113
return 1;
98114
}
99115

lol2gltf/lol2gltf.csproj

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
1616
<PublishSingleFile>true</PublishSingleFile>
1717
<SatelliteResourceLanguages> en </SatelliteResourceLanguages>
18-
<OutputPath>bin\Release</OutputPath>
1918
</PropertyGroup>
2019

2120
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleasePortable|x64'">
@@ -26,7 +25,6 @@
2625
<SatelliteResourceLanguages> en </SatelliteResourceLanguages>
2726
<PublishReadyToRun>true</PublishReadyToRun>
2827
<PublishReadyToRunShowWarnings>true</PublishReadyToRunShowWarnings>
29-
<OutputPath>bin\ReleasePortable\</OutputPath>
3028
</PropertyGroup>
3129

3230
<ItemGroup>

0 commit comments

Comments
 (0)