mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/PCK-Studio.git
synced 2026-07-16 02:10:52 +00:00
Rename class 'Meta' ->'BlockBenchFormatInfo' and update BlockBenchModel.Create function signature
This commit is contained in:
34
PCK-Studio/External/Format/BlockBenchModel.cs
vendored
34
PCK-Studio/External/Format/BlockBenchModel.cs
vendored
@@ -16,16 +16,31 @@ using PckStudio.Internal;
|
||||
|
||||
namespace PckStudio.External.Format
|
||||
{
|
||||
internal class Meta
|
||||
internal static class BlockBenchFormatInfos
|
||||
{
|
||||
internal static readonly string FormatVersion = "4.5";
|
||||
|
||||
internal static BlockBenchFormatInfo Free { get; } = new BlockBenchFormatInfo(FormatVersion, "free", true);
|
||||
internal static BlockBenchFormatInfo BedrockEntity { get; } = new BlockBenchFormatInfo(FormatVersion, "bedrock", true);
|
||||
}
|
||||
|
||||
internal sealed class BlockBenchFormatInfo
|
||||
{
|
||||
[JsonProperty("format_version")]
|
||||
internal string FormatVersion;
|
||||
internal string FormatVersion { get; }
|
||||
|
||||
[JsonProperty("model_format")]
|
||||
internal string ModelFormat;
|
||||
internal string ModelFormat { get; }
|
||||
|
||||
[JsonProperty("box_uv")]
|
||||
internal bool UseBoxUv;
|
||||
internal bool UseBoxUv { get; }
|
||||
|
||||
internal BlockBenchFormatInfo(string formatVersion, string modelFormat, bool useBoxUv)
|
||||
{
|
||||
FormatVersion = formatVersion;
|
||||
ModelFormat = modelFormat;
|
||||
UseBoxUv = useBoxUv;
|
||||
}
|
||||
}
|
||||
|
||||
internal class Element
|
||||
@@ -309,7 +324,7 @@ namespace PckStudio.External.Format
|
||||
internal string Name;
|
||||
|
||||
[JsonProperty("meta")]
|
||||
internal Meta Metadata;
|
||||
internal BlockBenchFormatInfo Format;
|
||||
|
||||
[JsonProperty("model_identifier")]
|
||||
internal string ModelIdentifier { get; set; } = "";
|
||||
@@ -329,7 +344,7 @@ namespace PckStudio.External.Format
|
||||
[JsonProperty("textures")]
|
||||
internal Texture[] Textures;
|
||||
|
||||
internal static BlockBenchModel Create(string name, Size textureResolution, IEnumerable<Texture> textures)
|
||||
internal static BlockBenchModel Create(BlockBenchFormatInfo formatInfo, string name, Size textureResolution, IEnumerable<Texture> textures)
|
||||
{
|
||||
return new BlockBenchModel()
|
||||
{
|
||||
@@ -337,12 +352,7 @@ namespace PckStudio.External.Format
|
||||
Textures = textures.ToArray(),
|
||||
TextureResolution = textureResolution,
|
||||
ModelIdentifier = "",
|
||||
Metadata = new Meta()
|
||||
{
|
||||
FormatVersion = "4.5",
|
||||
ModelFormat = "free",
|
||||
UseBoxUv = true,
|
||||
}
|
||||
Format = formatInfo,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace PckStudio.Internal
|
||||
|
||||
private void ExportBlockBenchModel(string fileName, GameModelInfo modelInfo)
|
||||
{
|
||||
BlockBenchModel blockBenchModel = BlockBenchModel.Create(modelInfo.Model.Name, modelInfo.Model.TextureSize, modelInfo.Textures.Select(nt => (Texture)nt));
|
||||
BlockBenchModel blockBenchModel = BlockBenchModel.Create(BlockBenchFormatInfos.BedrockEntity, modelInfo.Model.Name, modelInfo.Model.TextureSize, modelInfo.Textures.Select(nt => (Texture)nt));
|
||||
|
||||
Dictionary<string, Outline> outliners = new Dictionary<string, Outline>(5);
|
||||
List<Element> elements = new List<Element>(modelInfo.Model.Parts.Count);
|
||||
|
||||
@@ -162,7 +162,7 @@ namespace PckStudio.Internal
|
||||
internal static void ExportBlockBenchModel(string fileName, SkinModelInfo modelInfo)
|
||||
{
|
||||
Image exportTexture = FixTexture(modelInfo);
|
||||
BlockBenchModel blockBenchModel = BlockBenchModel.Create(Path.GetFileNameWithoutExtension(fileName), new Size(64, exportTexture.Width == exportTexture.Height ? 64 : 32), [exportTexture]);
|
||||
BlockBenchModel blockBenchModel = BlockBenchModel.Create(BlockBenchFormatInfos.Free, Path.GetFileNameWithoutExtension(fileName), new Size(64, exportTexture.Width == exportTexture.Height ? 64 : 32), [exportTexture]);
|
||||
|
||||
Dictionary<string, Outline> outliners = new Dictionary<string, Outline>(5);
|
||||
List<Element> elements = new List<Element>(modelInfo.AdditionalBoxes.Count);
|
||||
|
||||
Reference in New Issue
Block a user