Updated Tools accordingly to new pipeline structure.
This commit is contained in:
parent
17e0a2fb21
commit
c4dd6f035d
27
RecrownedGTK.Tools/.vscode/launch.json
vendored
Normal file
27
RecrownedGTK.Tools/.vscode/launch.json
vendored
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
{
|
||||||
|
// Use IntelliSense to find out which attributes exist for C# debugging
|
||||||
|
// Use hover for the description of the existing attributes
|
||||||
|
// For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md
|
||||||
|
"version": "0.2.0",
|
||||||
|
"configurations": [
|
||||||
|
{
|
||||||
|
"name": ".NET Core Launch (console)",
|
||||||
|
"type": "coreclr",
|
||||||
|
"request": "launch",
|
||||||
|
"preLaunchTask": "build",
|
||||||
|
// If you have changed target frameworks, make sure to update the program path.
|
||||||
|
"program": "${workspaceFolder}/bin/Debug/netcoreapp2.1/RecrownedGTK.Tools.dll",
|
||||||
|
"args": [],
|
||||||
|
"cwd": "${workspaceFolder}",
|
||||||
|
// For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console
|
||||||
|
"console": "internalConsole",
|
||||||
|
"stopAtEntry": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": ".NET Core Attach",
|
||||||
|
"type": "coreclr",
|
||||||
|
"request": "attach",
|
||||||
|
"processId": "${command:pickProcess}"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
42
RecrownedGTK.Tools/.vscode/tasks.json
vendored
Normal file
42
RecrownedGTK.Tools/.vscode/tasks.json
vendored
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
{
|
||||||
|
"version": "2.0.0",
|
||||||
|
"tasks": [
|
||||||
|
{
|
||||||
|
"label": "build",
|
||||||
|
"command": "dotnet",
|
||||||
|
"type": "process",
|
||||||
|
"args": [
|
||||||
|
"build",
|
||||||
|
"${workspaceFolder}/RecrownedGTK.Tools.csproj",
|
||||||
|
"/property:GenerateFullPaths=true",
|
||||||
|
"/consoleloggerparameters:NoSummary"
|
||||||
|
],
|
||||||
|
"problemMatcher": "$msCompile"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "publish",
|
||||||
|
"command": "dotnet",
|
||||||
|
"type": "process",
|
||||||
|
"args": [
|
||||||
|
"publish",
|
||||||
|
"${workspaceFolder}/RecrownedGTK.Tools.csproj",
|
||||||
|
"/property:GenerateFullPaths=true",
|
||||||
|
"/consoleloggerparameters:NoSummary"
|
||||||
|
],
|
||||||
|
"problemMatcher": "$msCompile"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "watch",
|
||||||
|
"command": "dotnet",
|
||||||
|
"type": "process",
|
||||||
|
"args": [
|
||||||
|
"watch",
|
||||||
|
"run",
|
||||||
|
"${workspaceFolder}/RecrownedGTK.Tools.csproj",
|
||||||
|
"/property:GenerateFullPaths=true",
|
||||||
|
"/consoleloggerparameters:NoSummary"
|
||||||
|
],
|
||||||
|
"problemMatcher": "$msCompile"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
@ -1,5 +1,5 @@
|
|||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using RecrownedGTK.Data;
|
using RecrownedGTK.Pipeline.Information;
|
||||||
using RecrownedGTK.Tools.CommandProcessor;
|
using RecrownedGTK.Tools.CommandProcessor;
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
@ -45,7 +45,7 @@ namespace RecrownedGTK.Tools.NinePatchTools
|
|||||||
if (IndexOfArgument("-t", arguments) + 1 >= arguments.Length || !int.TryParse(arguments[IndexOfArgument("-t", arguments) + 1], out topBound)) throw new ArgumentException("Missing -u argument bound.");
|
if (IndexOfArgument("-t", arguments) + 1 >= arguments.Length || !int.TryParse(arguments[IndexOfArgument("-t", arguments) + 1], out topBound)) throw new ArgumentException("Missing -u argument bound.");
|
||||||
if (IndexOfArgument("-b", arguments) + 1 >= arguments.Length || !int.TryParse(arguments[IndexOfArgument("-b", arguments) + 1], out bottomBound)) throw new ArgumentException("Missing -d argument bound.");
|
if (IndexOfArgument("-b", arguments) + 1 >= arguments.Length || !int.TryParse(arguments[IndexOfArgument("-b", arguments) + 1], out bottomBound)) throw new ArgumentException("Missing -d argument bound.");
|
||||||
|
|
||||||
NinePatchData npData = new NinePatchData(Path.GetFileName(imagePath), leftBound, rightBound, bottomBound, topBound);
|
NinePatchInfo npData = new NinePatchInfo(Path.GetFileName(imagePath), leftBound, rightBound, bottomBound, topBound);
|
||||||
string serialized = JsonConvert.SerializeObject(npData, Formatting.Indented);
|
string serialized = JsonConvert.SerializeObject(npData, Formatting.Indented);
|
||||||
string modifiedPath = Directory.GetParent(imagePath) + Path.PathSeparator.ToString() + Path.GetFileNameWithoutExtension(imagePath) + "-texture" + Path.GetExtension(imagePath);
|
string modifiedPath = Directory.GetParent(imagePath) + Path.PathSeparator.ToString() + Path.GetFileNameWithoutExtension(imagePath) + "-texture" + Path.GetExtension(imagePath);
|
||||||
File.Move(imagePath, modifiedPath);
|
File.Move(imagePath, modifiedPath);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using RecrownedGTK.Data;
|
using RecrownedGTK.Pipeline.Information;
|
||||||
using SixLabors.ImageSharp;
|
using SixLabors.ImageSharp;
|
||||||
using SixLabors.ImageSharp.PixelFormats;
|
using SixLabors.ImageSharp.PixelFormats;
|
||||||
using SixLabors.ImageSharp.Processing;
|
using SixLabors.ImageSharp.Processing;
|
||||||
@ -23,7 +23,7 @@ namespace RecrownedGTK.Tools.TextureAtlas
|
|||||||
int powLimit;
|
int powLimit;
|
||||||
Node masterNode;
|
Node masterNode;
|
||||||
List<ImageHandler> imageHandlers;
|
List<ImageHandler> imageHandlers;
|
||||||
Dictionary<string, NinePatchData> ninePatchDictionary;
|
Dictionary<string, NinePatchInfo> ninePatchDictionary;
|
||||||
int tpl;
|
int tpl;
|
||||||
int TexturePowerLength { get { return tpl; } set { TextureLength = (int)Math.Pow(2, value); tpl = value; } }
|
int TexturePowerLength { get { return tpl; } set { TextureLength = (int)Math.Pow(2, value); tpl = value; } }
|
||||||
public int TextureLength { get; private set; }
|
public int TextureLength { get; private set; }
|
||||||
@ -65,11 +65,11 @@ namespace RecrownedGTK.Tools.TextureAtlas
|
|||||||
}
|
}
|
||||||
else if (Path.GetExtension(paths[pathID]).ToLower() == ".9p")
|
else if (Path.GetExtension(paths[pathID]).ToLower() == ".9p")
|
||||||
{
|
{
|
||||||
if (ninePatchDictionary == null) ninePatchDictionary = new Dictionary<string, NinePatchData>();
|
if (ninePatchDictionary == null) ninePatchDictionary = new Dictionary<string, NinePatchInfo>();
|
||||||
ConsoleUtilities.WriteWrappedLine("Reading ninepatch data for: " + paths[pathID]);
|
ConsoleUtilities.WriteWrappedLine("Reading ninepatch data for: " + paths[pathID]);
|
||||||
string serialized = File.ReadAllText(paths[pathID]);
|
string serialized = File.ReadAllText(paths[pathID]);
|
||||||
NinePatchData npData = JsonConvert.DeserializeObject<NinePatchData>(serialized);
|
NinePatchInfo npData = JsonConvert.DeserializeObject<NinePatchInfo>(serialized);
|
||||||
ninePatchDictionary.Add(npData.textureName, npData);
|
ninePatchDictionary.Add(npData.name, npData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
imageHandlers.Sort();
|
imageHandlers.Sort();
|
||||||
@ -103,9 +103,9 @@ namespace RecrownedGTK.Tools.TextureAtlas
|
|||||||
}
|
}
|
||||||
if (ninePatchDictionary != null && ninePatchDictionary.ContainsKey(imageHandler.name))
|
if (ninePatchDictionary != null && ninePatchDictionary.ContainsKey(imageHandler.name))
|
||||||
{
|
{
|
||||||
NinePatchData npd = ninePatchDictionary[imageHandler.name];
|
NinePatchInfo npd = ninePatchDictionary[imageHandler.name];
|
||||||
imageHandler.ninePatchData = npd;
|
imageHandler.ninePatchData = npd;
|
||||||
if (npd.textureName.Contains("-texture"))
|
if (npd.name.Contains("-texture"))
|
||||||
{
|
{
|
||||||
imageHandler.name = imageHandler.name.Remove(imageHandler.name.IndexOf("-texture"), 8);
|
imageHandler.name = imageHandler.name.Remove(imageHandler.name.IndexOf("-texture"), 8);
|
||||||
}
|
}
|
||||||
@ -123,7 +123,7 @@ namespace RecrownedGTK.Tools.TextureAtlas
|
|||||||
{
|
{
|
||||||
GraphicsOptions gOptions = new GraphicsOptions();
|
GraphicsOptions gOptions = new GraphicsOptions();
|
||||||
|
|
||||||
TextureAtlasData.AtlasRegionData[] regions = new TextureAtlasData.AtlasRegionData[TexturesFound];
|
TextureMapInfo.MapRegionInfo[] regions = new TextureMapInfo.MapRegionInfo[TexturesFound];
|
||||||
|
|
||||||
using (Image<Rgba32> atlasTexture = new Image<Rgba32>(TextureLength, TextureLength))
|
using (Image<Rgba32> atlasTexture = new Image<Rgba32>(TextureLength, TextureLength))
|
||||||
{
|
{
|
||||||
@ -131,11 +131,11 @@ namespace RecrownedGTK.Tools.TextureAtlas
|
|||||||
|
|
||||||
for (int i = 0; i < imageHandlers.Length; i++)
|
for (int i = 0; i < imageHandlers.Length; i++)
|
||||||
{
|
{
|
||||||
regions[i] = new TextureAtlasData.AtlasRegionData();
|
|
||||||
ImageHandler ih = imageHandlers[i];
|
ImageHandler ih = imageHandlers[i];
|
||||||
|
regions[i] = new TextureMapInfo.MapRegionInfo();
|
||||||
regions[i].SetBounds(ih.x, ih.y, ih.Width, ih.Height);
|
regions[i].SetBounds(ih.x, ih.y, ih.Width, ih.Height);
|
||||||
regions[i].ninePatchData = ih.ninePatchData;
|
regions[i].ninePatchInfo = ih.ninePatchData;
|
||||||
if (regions[i].ninePatchData != null) regions[i].ninePatchData.textureName = null;
|
if (!regions[i].ninePatchInfo.Equals(default(NinePatchInfo))) regions[i].ninePatchInfo.name = null;
|
||||||
regions[i].name = Path.GetFileNameWithoutExtension(ih.name);
|
regions[i].name = Path.GetFileNameWithoutExtension(ih.name);
|
||||||
using (Image<Rgba32> image = Image.Load<Rgba32>(ih.path))
|
using (Image<Rgba32> image = Image.Load<Rgba32>(ih.path))
|
||||||
{
|
{
|
||||||
@ -148,20 +148,20 @@ namespace RecrownedGTK.Tools.TextureAtlas
|
|||||||
atlasTexture.SaveAsPng(stream);
|
atlasTexture.SaveAsPng(stream);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
string serialized = JsonConvert.SerializeObject(new TextureAtlasData(atlasName + "-texture" + ".png", regions), Formatting.Indented);
|
string serialized = JsonConvert.SerializeObject(new TextureMapInfo(atlasName + "-texture" + ".png", regions), Formatting.Indented);
|
||||||
File.WriteAllText(output + "/" + atlasName + ".tatlas", serialized);
|
File.WriteAllText(output + "/" + atlasName + ".tatlas", serialized);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetNinePatch(string fileName, int a, int b, int c, int d)
|
public void SetNinePatch(string fileName, int a, int b, int c, int d)
|
||||||
{
|
{
|
||||||
NinePatchData ninePatchData = new NinePatchData(fileName, a, b, c, d);
|
NinePatchInfo ninePatchData = new NinePatchInfo(fileName, a, b, c, d);
|
||||||
RetrieveImageHandler(fileName).ninePatchData = ninePatchData;
|
RetrieveImageHandler(fileName).ninePatchData = ninePatchData;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RemoveNinePatch(string name)
|
public void RemoveNinePatch(string name)
|
||||||
{
|
{
|
||||||
|
|
||||||
RetrieveImageHandler(name).ninePatchData = null;
|
RetrieveImageHandler(name).ninePatchData = default(NinePatchInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
private ImageHandler RetrieveImageHandler(string name)
|
private ImageHandler RetrieveImageHandler(string name)
|
||||||
@ -265,7 +265,7 @@ namespace RecrownedGTK.Tools.TextureAtlas
|
|||||||
public int Width { get { return image.Width; } }
|
public int Width { get { return image.Width; } }
|
||||||
public int Height { get { return image.Height; } }
|
public int Height { get { return image.Height; } }
|
||||||
public int x, y;
|
public int x, y;
|
||||||
public NinePatchData ninePatchData;
|
public NinePatchInfo ninePatchData;
|
||||||
|
|
||||||
internal ImageHandler(string path)
|
internal ImageHandler(string path)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user