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 RecrownedGTK.Data;
|
||||
using RecrownedGTK.Pipeline.Information;
|
||||
using RecrownedGTK.Tools.CommandProcessor;
|
||||
using System;
|
||||
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("-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 modifiedPath = Directory.GetParent(imagePath) + Path.PathSeparator.ToString() + Path.GetFileNameWithoutExtension(imagePath) + "-texture" + Path.GetExtension(imagePath);
|
||||
File.Move(imagePath, modifiedPath);
|
||||
|
@ -1,5 +1,5 @@
|
||||
using Newtonsoft.Json;
|
||||
using RecrownedGTK.Data;
|
||||
using RecrownedGTK.Pipeline.Information;
|
||||
using SixLabors.ImageSharp;
|
||||
using SixLabors.ImageSharp.PixelFormats;
|
||||
using SixLabors.ImageSharp.Processing;
|
||||
@ -23,7 +23,7 @@ namespace RecrownedGTK.Tools.TextureAtlas
|
||||
int powLimit;
|
||||
Node masterNode;
|
||||
List<ImageHandler> imageHandlers;
|
||||
Dictionary<string, NinePatchData> ninePatchDictionary;
|
||||
Dictionary<string, NinePatchInfo> ninePatchDictionary;
|
||||
int tpl;
|
||||
int TexturePowerLength { get { return tpl; } set { TextureLength = (int)Math.Pow(2, value); tpl = value; } }
|
||||
public int TextureLength { get; private set; }
|
||||
@ -65,11 +65,11 @@ namespace RecrownedGTK.Tools.TextureAtlas
|
||||
}
|
||||
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]);
|
||||
string serialized = File.ReadAllText(paths[pathID]);
|
||||
NinePatchData npData = JsonConvert.DeserializeObject<NinePatchData>(serialized);
|
||||
ninePatchDictionary.Add(npData.textureName, npData);
|
||||
NinePatchInfo npData = JsonConvert.DeserializeObject<NinePatchInfo>(serialized);
|
||||
ninePatchDictionary.Add(npData.name, npData);
|
||||
}
|
||||
}
|
||||
imageHandlers.Sort();
|
||||
@ -103,9 +103,9 @@ namespace RecrownedGTK.Tools.TextureAtlas
|
||||
}
|
||||
if (ninePatchDictionary != null && ninePatchDictionary.ContainsKey(imageHandler.name))
|
||||
{
|
||||
NinePatchData npd = ninePatchDictionary[imageHandler.name];
|
||||
NinePatchInfo npd = ninePatchDictionary[imageHandler.name];
|
||||
imageHandler.ninePatchData = npd;
|
||||
if (npd.textureName.Contains("-texture"))
|
||||
if (npd.name.Contains("-texture"))
|
||||
{
|
||||
imageHandler.name = imageHandler.name.Remove(imageHandler.name.IndexOf("-texture"), 8);
|
||||
}
|
||||
@ -123,7 +123,7 @@ namespace RecrownedGTK.Tools.TextureAtlas
|
||||
{
|
||||
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))
|
||||
{
|
||||
@ -131,11 +131,11 @@ namespace RecrownedGTK.Tools.TextureAtlas
|
||||
|
||||
for (int i = 0; i < imageHandlers.Length; i++)
|
||||
{
|
||||
regions[i] = new TextureAtlasData.AtlasRegionData();
|
||||
ImageHandler ih = imageHandlers[i];
|
||||
regions[i] = new TextureMapInfo.MapRegionInfo();
|
||||
regions[i].SetBounds(ih.x, ih.y, ih.Width, ih.Height);
|
||||
regions[i].ninePatchData = ih.ninePatchData;
|
||||
if (regions[i].ninePatchData != null) regions[i].ninePatchData.textureName = null;
|
||||
regions[i].ninePatchInfo = ih.ninePatchData;
|
||||
if (!regions[i].ninePatchInfo.Equals(default(NinePatchInfo))) regions[i].ninePatchInfo.name = null;
|
||||
regions[i].name = Path.GetFileNameWithoutExtension(ih.name);
|
||||
using (Image<Rgba32> image = Image.Load<Rgba32>(ih.path))
|
||||
{
|
||||
@ -148,20 +148,20 @@ namespace RecrownedGTK.Tools.TextureAtlas
|
||||
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);
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
public void RemoveNinePatch(string name)
|
||||
{
|
||||
|
||||
RetrieveImageHandler(name).ninePatchData = null;
|
||||
RetrieveImageHandler(name).ninePatchData = default(NinePatchInfo);
|
||||
}
|
||||
|
||||
private ImageHandler RetrieveImageHandler(string name)
|
||||
@ -265,7 +265,7 @@ namespace RecrownedGTK.Tools.TextureAtlas
|
||||
public int Width { get { return image.Width; } }
|
||||
public int Height { get { return image.Height; } }
|
||||
public int x, y;
|
||||
public NinePatchData ninePatchData;
|
||||
public NinePatchInfo ninePatchData;
|
||||
|
||||
internal ImageHandler(string path)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user