mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/PCK-Studio.git
synced 2026-06-25 13:05:33 +00:00
Added atlas editor support for moon phases
This commit is contained in:
@@ -94,6 +94,7 @@ namespace PckStudio.Forms.Editor
|
||||
{
|
||||
"terrain" => (Tiles.BlockTileInfos, "blocks"),
|
||||
"items" => (Tiles.ItemTileInfos, "items"),
|
||||
"moon_phases" => (Tiles.MoonPhasesTileInfos, "moon_phases"),
|
||||
_ => (null, null),
|
||||
};
|
||||
originalPictureBox.Image = atlas;
|
||||
@@ -151,17 +152,20 @@ namespace PckStudio.Forms.Editor
|
||||
selectTilePictureBox.BlendColor = GetBlendColor();
|
||||
selectTilePictureBox.UseBlendColor = applyColorMaskToolStripMenuItem.Checked;
|
||||
|
||||
bool hasAnimation =
|
||||
_pckFile.TryGetValue($"res/textures/{_atlasType}/{dataTile.Tile.InternalName}.png", PckFileType.TextureFile, out var animationFile);
|
||||
animationButton.Text = hasAnimation ? "Edit Animation" : "Create Animation";
|
||||
replaceButton.Enabled = !hasAnimation;
|
||||
|
||||
if (playAnimationsToolStripMenuItem.Checked &&
|
||||
hasAnimation &&
|
||||
animationFile.Size > 0)
|
||||
if (animationButton.Enabled = _atlasType == "blocks" || _atlasType == "items")
|
||||
{
|
||||
var animation = AnimationHelper.GetAnimationFromFile(animationFile);
|
||||
selectTilePictureBox.Start(animation);
|
||||
bool hasAnimation =
|
||||
_pckFile.TryGetValue($"res/textures/{_atlasType}/{dataTile.Tile.InternalName}.png", PckFileType.TextureFile, out var animationFile);
|
||||
animationButton.Text = hasAnimation ? "Edit Animation" : "Create Animation";
|
||||
replaceButton.Enabled = !hasAnimation;
|
||||
|
||||
if (playAnimationsToolStripMenuItem.Checked &&
|
||||
hasAnimation &&
|
||||
animationFile.Size > 0)
|
||||
{
|
||||
var animation = AnimationHelper.GetAnimationFromFile(animationFile);
|
||||
selectTilePictureBox.Start(animation);
|
||||
}
|
||||
}
|
||||
|
||||
if (setColorButton.Enabled = clearColorButton.Enabled = dataTile.Tile.HasColourEntry)
|
||||
@@ -504,7 +508,7 @@ namespace PckStudio.Forms.Editor
|
||||
0x211D1D, // Black
|
||||
0x325483 // Brown
|
||||
};
|
||||
|
||||
|
||||
if (colorPick.ShowDialog() != DialogResult.OK) return;
|
||||
|
||||
selectTilePictureBox.BlendColor = colorPick.Color;
|
||||
|
||||
@@ -17,6 +17,8 @@ namespace PckStudio.Internal.Json
|
||||
public List<JsonTileInfo> Blocks { get; set; }
|
||||
[JsonProperty("items")]
|
||||
public List<JsonTileInfo> Items { get; set; }
|
||||
[JsonProperty("moon_phases")]
|
||||
public List<JsonTileInfo> MoonPhases { get; set; }
|
||||
}
|
||||
|
||||
internal static class Tiles
|
||||
@@ -27,6 +29,7 @@ namespace PckStudio.Internal.Json
|
||||
internal static List<JsonTileInfo> ItemTileInfos => JsonTileData.Items;
|
||||
|
||||
internal static List<JsonTileInfo> BlockTileInfos => JsonTileData.Blocks;
|
||||
internal static List<JsonTileInfo> MoonPhasesTileInfos => JsonTileData.MoonPhases;
|
||||
|
||||
private static Image[] _itemImages;
|
||||
public static Image[] ItemImages => _itemImages ??= Resources.items_sheet.SplitHorizontal(16).ToArray();
|
||||
@@ -34,6 +37,9 @@ namespace PckStudio.Internal.Json
|
||||
private static Image[] _blockImages;
|
||||
public static Image[] BlockImages => _blockImages ??= Resources.terrain_sheet.SplitHorizontal(16).ToArray();
|
||||
|
||||
private static Image[] _moonPhasesImages;
|
||||
public static Image[] MoonPhasesImages => _moonPhasesImages ??= Resources.moon_phases_sheet.SplitHorizontal(8).ToArray();
|
||||
|
||||
private static ImageList _itemImageList;
|
||||
public static ImageList ItemImageList
|
||||
{
|
||||
@@ -63,5 +69,20 @@ namespace PckStudio.Internal.Json
|
||||
return _blockImageList;
|
||||
}
|
||||
}
|
||||
|
||||
private static ImageList _moonPhasesImageList;
|
||||
public static ImageList MoonPhasesImageList
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_moonPhasesImageList is null)
|
||||
{
|
||||
_moonPhasesImageList = new ImageList();
|
||||
_moonPhasesImageList.ColorDepth = ColorDepth.Depth32Bit;
|
||||
_moonPhasesImageList.Images.AddRange(MoonPhasesImages);
|
||||
}
|
||||
return _moonPhasesImageList;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -375,11 +375,19 @@ namespace PckStudio
|
||||
return;
|
||||
}
|
||||
|
||||
if (file.Filename == "res/terrain.png" || file.Filename == "res/items.png")
|
||||
bool isTerrainOrItems = file.Filename == "res/terrain.png" || file.Filename == "res/items.png";
|
||||
bool isMoon = file.Filename == "res/terrain/moon_phases.png";
|
||||
|
||||
if (isTerrainOrItems || isMoon)
|
||||
{
|
||||
var img = file.GetTexture();
|
||||
var res = img.Width / 16; // texture count on X axes
|
||||
var size = new Size(res, res);
|
||||
|
||||
var columnCount = 0;
|
||||
if (isTerrainOrItems) columnCount = 16;
|
||||
else if (isMoon) columnCount = 4;
|
||||
|
||||
var resolution = img.Width / columnCount;
|
||||
var size = new Size(resolution, resolution);
|
||||
var viewer = new TextureAtlasEditor(currentPCK, file.Filename, img, size);
|
||||
if (viewer.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
|
||||
@@ -689,6 +689,7 @@
|
||||
<None Include="Resources\icons\ranch.png" />
|
||||
<Content Include="Resources\icons\Replace.png" />
|
||||
<Content Include="Resources\icons\Save.png" />
|
||||
<None Include="Resources\moon_phases.png" />
|
||||
<Content Include="Resources\NoImageFound.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
||||
38
PCK-Studio/Properties/Resources.Designer.cs
generated
38
PCK-Studio/Properties/Resources.Designer.cs
generated
@@ -414,6 +414,16 @@ namespace PckStudio.Properties {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
public static System.Drawing.Bitmap moon_phases_sheet {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("moon_phases_sheet", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Byte[].
|
||||
/// </summary>
|
||||
@@ -617,30 +627,28 @@ namespace PckStudio.Properties {
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to {
|
||||
/// "COMMENT_1": "Tile data research by MattNL",
|
||||
/// "COMMENT_2": "JSON conversion by PhoenixARC",
|
||||
/// "COMMENT_2": "JSON by PhoenixARC, MattNL, and NessieHax (Miku-666)",
|
||||
/// "blocks": [
|
||||
/// {
|
||||
/// "internalName": "grass_top",
|
||||
/// "displayName": "Grass Block (Top)"
|
||||
/// "displayName": "Grass Block (Top)",
|
||||
/// "hasColourEntry": true,
|
||||
/// "colourEntry": {
|
||||
/// "defaultName": "Grass_Common",
|
||||
/// "variants": [
|
||||
/// "Grass_Common",
|
||||
/// "Grass_Mesa",
|
||||
/// "Grass_Swamp1",
|
||||
/// "Grass_Swamp2"
|
||||
/// ]
|
||||
/// }
|
||||
/// },
|
||||
/// {
|
||||
/// "internalName": "stone",
|
||||
/// "displayName": "Stone"
|
||||
/// },
|
||||
/// {
|
||||
/// "internalName": "dirt",
|
||||
/// "displayName": "Dirt"
|
||||
/// },
|
||||
/// {
|
||||
/// "internalName": "grass_side",
|
||||
/// "displayName": "Grass Block (Side)"
|
||||
/// },
|
||||
/// {
|
||||
/// "internalName": "planks_oak",
|
||||
/// "displayName": "Oak Planks"
|
||||
/// },
|
||||
/// {
|
||||
/// "internalName": [rest of string was truncated]";.
|
||||
/// "internalName": [rest of string was truncated]";.
|
||||
/// </summary>
|
||||
public static string tileData {
|
||||
get {
|
||||
|
||||
@@ -328,4 +328,7 @@
|
||||
<data name="ProjectLogo" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\..\ProjectLogo.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="moon_phases_sheet" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\moon_phases.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
</root>
|
||||
BIN
PCK-Studio/Resources/moon_phases.png
Normal file
BIN
PCK-Studio/Resources/moon_phases.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.5 KiB |
@@ -4134,5 +4134,39 @@
|
||||
"internalName": "",
|
||||
"displayName": ""
|
||||
}
|
||||
],
|
||||
"moon_phases": [
|
||||
{
|
||||
"internalName": "moon_phase_0",
|
||||
"displayName": "Full Moon"
|
||||
},
|
||||
{
|
||||
"internalName": "moon_phase_1",
|
||||
"displayName": "Waning Gibbous"
|
||||
},
|
||||
{
|
||||
"internalName": "moon_phase_2",
|
||||
"displayName": "Last Quarter"
|
||||
},
|
||||
{
|
||||
"internalName": "moon_phase_3",
|
||||
"displayName": "Waning Crescent"
|
||||
},
|
||||
{
|
||||
"internalName": "moon_phase_4",
|
||||
"displayName": "New Moon"
|
||||
},
|
||||
{
|
||||
"internalName": "moon_phase_5",
|
||||
"displayName": "Waxing Crescent"
|
||||
},
|
||||
{
|
||||
"internalName": "moon_phase_6",
|
||||
"displayName": "First Quarter"
|
||||
},
|
||||
{
|
||||
"internalName": "moon_phase_7",
|
||||
"displayName": "Waxing Gibbous"
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user