mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/PCK-Studio.git
synced 2026-05-22 06:15:48 +00:00
Move Common functionality to Core project & rendering and Model support as well
This commit is contained in:
@@ -1,54 +1,56 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing.Imaging;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using System.Drawing.Drawing2D;
|
||||
|
||||
using PckStudio.Extensions;
|
||||
using PckStudio.Forms;
|
||||
using PckStudio.Forms.Editor;
|
||||
using PckStudio.Interfaces;
|
||||
using PckStudio.Internal;
|
||||
using PckStudio.Popups;
|
||||
using PckStudio.Properties;
|
||||
using PckStudio.Forms.Additional_Popups.Animation;
|
||||
using PckStudio.Internal.IO._3DST;
|
||||
using PckStudio.Forms.Additional_Popups;
|
||||
using PckStudio.Internal.IO.PckAudio;
|
||||
using PckStudio.Internal.Misc;
|
||||
using MetroFramework.Forms;
|
||||
|
||||
using OMI.Formats.Languages;
|
||||
using OMI.Formats.Pck;
|
||||
using OMI.Workers.Language;
|
||||
using OMI.Workers.Pck;
|
||||
using PckStudio.Internal.Deserializer;
|
||||
using PckStudio.Internal.Serializer;
|
||||
using OMI.Formats.GameRule;
|
||||
using OMI.Workers.GameRule;
|
||||
|
||||
using OMI.Workers;
|
||||
using OMI.Formats.Model;
|
||||
using OMI.Workers.Model;
|
||||
using OMI.Workers;
|
||||
using OMI.Formats.GameRule;
|
||||
using OMI.Workers.GameRule;
|
||||
using OMI.Formats.Material;
|
||||
using OMI.Workers.Material;
|
||||
using OMI.Formats.Behaviour;
|
||||
using OMI.Workers.Behaviour;
|
||||
using PckStudio.Internal.Json;
|
||||
using PckStudio.Internal.FileFormats;
|
||||
using PckStudio.Internal.Skin;
|
||||
using OMI.Formats.Color;
|
||||
using OMI.Workers.Color;
|
||||
using MetroFramework.Forms;
|
||||
|
||||
using PckStudio.Core.Extensions;
|
||||
using PckStudio.Forms.Editor;
|
||||
using PckStudio.Forms.Additional_Popups;
|
||||
using PckStudio.Forms.Additional_Popups.Animation;
|
||||
using PckStudio.Interfaces;
|
||||
using PckStudio.Internal;
|
||||
using PckStudio.Popups;
|
||||
using PckStudio.Properties;
|
||||
|
||||
using PckStudio.Core.Deserializer;
|
||||
using PckStudio.Core.Serializer;
|
||||
using PckStudio.Core.Json;
|
||||
using PckStudio.Core.FileFormats;
|
||||
using PckStudio.Core.Skin;
|
||||
using PckStudio.Rendering;
|
||||
using PckStudio.Core;
|
||||
using PckStudio.ModelSupport;
|
||||
using PckStudio.Json;
|
||||
using PckStudio.Core.IO.PckAudio;
|
||||
using PckStudio.Core.IO._3DST;
|
||||
using PckStudio.Core.Misc;
|
||||
|
||||
namespace PckStudio.Controls
|
||||
{
|
||||
internal partial class PckEditor : EditorControl<PckFile>
|
||||
internal partial class PckEditor : EditorControl<PackInfo>
|
||||
{
|
||||
|
||||
private string _location = string.Empty;
|
||||
@@ -61,22 +63,30 @@ namespace PckStudio.Controls
|
||||
get => __modified;
|
||||
set
|
||||
{
|
||||
if (__modified == value)
|
||||
return;
|
||||
__modified = value;
|
||||
pckFileLabel.Text = !pckFileLabel.Text.StartsWith("*") && __modified ? "*" + pckFileLabel.Text : pckFileLabel.Text.Substring(1);
|
||||
if (__modified != value)
|
||||
{
|
||||
__modified = value;
|
||||
_onModifiedChangeDelegate?.Invoke(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private bool _isTemplateFile = false;
|
||||
private delegate void OnModifiedChangeDelegate(bool state);
|
||||
private OnModifiedChangeDelegate _onModifiedChangeDelegate;
|
||||
|
||||
private int _timesSaved = 0;
|
||||
|
||||
private readonly Dictionary<PckAssetType, Action<PckAsset>> pckAssetTypeHandler;
|
||||
private readonly Dictionary<PckAssetType, Action<PckAsset>> _pckAssetTypeHandler;
|
||||
|
||||
public PckEditor(PckFile pck, ISaveContext<PckFile> saveContext)
|
||||
: base(pck, saveContext)
|
||||
public PckEditor(PackInfo packInfo, ISaveContext<PackInfo> saveContext)
|
||||
: base(packInfo, saveContext)
|
||||
{
|
||||
InitializeComponent();
|
||||
_onModifiedChangeDelegate = OnModify;
|
||||
_originalEndianness = packInfo.Endianness;
|
||||
_currentEndianness = packInfo.Endianness;
|
||||
|
||||
LittleEndianCheckBox.Visible = packInfo.AllowEndianSwap;
|
||||
|
||||
treeViewMain.TreeViewNodeSorter = new PckNodeSorter();
|
||||
|
||||
@@ -111,7 +121,7 @@ namespace PckStudio.Controls
|
||||
imageList.Images.Add(Resources.BEHAVIOURS_ICON); // Icon for Behaviour files (behaviours.bin)
|
||||
imageList.Images.Add(Resources.ENTITY_MATERIALS_ICON); // Icon for Entity Material files (entityMaterials.bin)
|
||||
|
||||
pckAssetTypeHandler = new Dictionary<PckAssetType, Action<PckAsset>>(15)
|
||||
_pckAssetTypeHandler = new Dictionary<PckAssetType, Action<PckAsset>>(15)
|
||||
{
|
||||
[PckAssetType.SkinFile] = HandleSkinFile,
|
||||
[PckAssetType.CapeFile] = null,
|
||||
@@ -154,17 +164,13 @@ namespace PckStudio.Controls
|
||||
|
||||
public override void Close()
|
||||
{
|
||||
if ((_wasModified || _isTemplateFile) &&
|
||||
MessageBox.Show("Save PCK?", _isTemplateFile ? "Unsaved PCK" : "Modified PCK",
|
||||
MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
|
||||
{
|
||||
if (_isTemplateFile || string.IsNullOrEmpty(_location) || !File.Exists(_location))
|
||||
{
|
||||
SaveAs();
|
||||
return;
|
||||
}
|
||||
if (_wasModified && MessageBox.Show("Save PCK?", "Modified PCK", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
|
||||
Save();
|
||||
}
|
||||
}
|
||||
|
||||
private void OnModify(bool state)
|
||||
{
|
||||
pckFileLabel.Text = state && !pckFileLabel.Text.StartsWith("*") ? "*" + pckFileLabel.Text : pckFileLabel.Text.Substring(1);
|
||||
}
|
||||
|
||||
public override void UpdateView()
|
||||
@@ -175,33 +181,39 @@ namespace PckStudio.Controls
|
||||
private void SaveTo(string filepath)
|
||||
{
|
||||
_location = filepath;
|
||||
_isTemplateFile = false;
|
||||
Save();
|
||||
}
|
||||
|
||||
private void HandleInnerPckFile(PckAsset asset)
|
||||
{
|
||||
if (Settings.Default.LoadSubPcks &&
|
||||
(asset.Type == PckAssetType.SkinDataFile || asset.Type == PckAssetType.TexturePackInfoFile) &&
|
||||
asset.Size > 0)
|
||||
{
|
||||
ISaveContext<PckFile> saveContext = new DelegatedSaveContext<PckFile>(false, (pck) =>
|
||||
{
|
||||
asset.SetData(new PckFileWriter(pck, OMI.Endianness.BigEndian));
|
||||
});
|
||||
string identifier = _location + Path.GetFileName(asset.Filename);
|
||||
Program.MainInstance.OpenNewPckTab(Path.GetFileName(asset.Filename), identifier, asset.GetData(new PckFileReader()), saveContext);
|
||||
if (asset.Type != PckAssetType.SkinDataFile && asset.Type != PckAssetType.TexturePackInfoFile || asset.Size <= 0 || !Settings.Default.LoadSubPcks)
|
||||
return;
|
||||
}
|
||||
|
||||
ISaveContext<PackInfo> saveContext = new DelegatedSaveContext<PackInfo>(false, (packInfo) =>
|
||||
{
|
||||
if (packInfo.IsValid)
|
||||
{
|
||||
asset.SetData(new PckFileWriter(packInfo.File, _currentEndianness));
|
||||
_wasModified = true;
|
||||
}
|
||||
});
|
||||
|
||||
string caption = Path.GetFileName(asset.Filename);
|
||||
string identifier = _location + Path.GetFileName(asset.Filename);
|
||||
PckFile pckFile = asset.GetData(new PckFileReader(_originalEndianness));
|
||||
PackInfo packInfo = PackInfo.Create(pckFile, _originalEndianness, false);
|
||||
|
||||
// TODO: may change to use a new tab page that will be closed when the main pck is closed
|
||||
//Program.MainInstance.OpenNewPckTab(caption, identifier, packInfo, saveContext);
|
||||
}
|
||||
|
||||
private void HandleTextureFile(PckAsset asset)
|
||||
{
|
||||
_ = asset.IsMipmappedFile() && EditorValue.TryGetValue(asset.GetNormalPath(), PckAssetType.TextureFile, out asset);
|
||||
_ = asset.IsMipmappedFile() && EditorValue.File.TryGetValue(asset.GetNormalPath(), PckAssetType.TextureFile, out asset);
|
||||
|
||||
if (asset.Size <= 0)
|
||||
{
|
||||
Debug.WriteLine($"'{asset.Filename}' size is 0.", category: nameof(HandleTextureFile));
|
||||
Trace.TraceInformation($"[{nameof(PckEditor)}:{nameof(HandleTextureFile)}] '{asset.Filename}' size is 0.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -238,23 +250,30 @@ namespace PckStudio.Controls
|
||||
modelName = modelNames[itemSelectionPopUp.SelectedIndex];
|
||||
}
|
||||
|
||||
NamedTexture modelTexture = new NamedTexture(Path.GetFileName(texturePath), asset.GetTexture());
|
||||
Image texture = asset.GetTexture();
|
||||
string textureName = Path.GetFileName(texturePath);
|
||||
|
||||
Model model = GetDefaultEntityModel(modelName);
|
||||
if (EditorValue.TryGetAsset("models.bin", PckAssetType.ModelsFile, out PckAsset modelsAsset))
|
||||
NamedTexture modelTexture = new NamedTexture(textureName, texture);
|
||||
|
||||
bool hasCustomModel = false;
|
||||
bool hasDefaultModel = TryGetDefaultEntityModel(modelName, out Model model);
|
||||
if (EditorValue.File.TryGetAsset("models.bin", PckAssetType.ModelsFile, out PckAsset modelsAsset))
|
||||
{
|
||||
ModelContainer models = modelsAsset.GetData(new ModelFileReader());
|
||||
if (models.ContainsModel(modelName))
|
||||
hasCustomModel = models.ContainsModel(modelName);
|
||||
if (hasCustomModel)
|
||||
{
|
||||
Debug.WriteLine($"Custom model for '{modelName}' found.");
|
||||
model = models.GetModelByName(modelName);
|
||||
}
|
||||
}
|
||||
|
||||
if (model is not null)
|
||||
if (!hasDefaultModel && !hasCustomModel)
|
||||
{
|
||||
ShowSimpleModelRender(model, modelTexture);
|
||||
MessageBox.Show(this, $"Not Model found for: {modelName}");
|
||||
return;
|
||||
}
|
||||
|
||||
ShowSimpleModelRender(model, modelTexture);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -293,13 +312,13 @@ namespace PckStudio.Controls
|
||||
case ResourceCategory.AdditionalMapIconsAtlas:
|
||||
Image atlas = asset.GetTexture();
|
||||
ColorContainer colorContainer = default;
|
||||
if (EditorValue.TryGetAsset("colours.col", PckAssetType.ColourTableFile, out PckAsset colAsset))
|
||||
if (EditorValue.File.TryGetAsset("colours.col", PckAssetType.ColourTableFile, out PckAsset colAsset))
|
||||
colorContainer = colAsset.GetData(new COLFileReader());
|
||||
|
||||
ITryGet<string, Animation> tryGetAnimation = TryGet<string, Animation>.FromDelegate((string key, out Animation animation) =>
|
||||
{
|
||||
bool found = EditorValue.TryGetAsset(key + ".png", PckAssetType.TextureFile, out PckAsset foundAsset) ||
|
||||
EditorValue.TryGetAsset(key + ".tga", PckAssetType.TextureFile, out foundAsset);
|
||||
bool found = EditorValue.File.TryGetAsset(key + ".png", PckAssetType.TextureFile, out PckAsset foundAsset) ||
|
||||
EditorValue.File.TryGetAsset(key + ".tga", PckAssetType.TextureFile, out foundAsset);
|
||||
if (found)
|
||||
{
|
||||
animation = foundAsset.GetDeserializedData(AnimationDeserializer.DefaultDeserializer);
|
||||
@@ -312,8 +331,8 @@ namespace PckStudio.Controls
|
||||
ITryGet<string, ISaveContext<Animation>> tryGetAnimationSaveContext = TryGet<string, ISaveContext<Animation>>
|
||||
.FromDelegate((string key, out ISaveContext<Animation> animationSaveContext) =>
|
||||
{
|
||||
bool found = EditorValue.TryGetAsset(key + ".png", PckAssetType.TextureFile, out PckAsset foundAsset) ||
|
||||
EditorValue.TryGetAsset(key + ".tga", PckAssetType.TextureFile, out foundAsset);
|
||||
bool found = EditorValue.File.TryGetAsset(key + ".png", PckAssetType.TextureFile, out PckAsset foundAsset) ||
|
||||
EditorValue.File.TryGetAsset(key + ".tga", PckAssetType.TextureFile, out foundAsset);
|
||||
|
||||
if (found)
|
||||
{
|
||||
@@ -330,7 +349,7 @@ namespace PckStudio.Controls
|
||||
Debug.WriteLine("New animation has 0 frames. Aborting saving.");
|
||||
return;
|
||||
}
|
||||
PckAsset newAnimationAsset = EditorValue.CreateNewAsset(key + ".png", PckAssetType.TextureFile);
|
||||
PckAsset newAnimationAsset = EditorValue.File.CreateNewAsset(key + ".png", PckAssetType.TextureFile);
|
||||
newAnimationAsset.SetSerializedData(animation, AnimationSerializer.DefaultSerializer);
|
||||
BuildMainTreeView();
|
||||
});
|
||||
@@ -354,11 +373,11 @@ namespace PckStudio.Controls
|
||||
|
||||
private void HandleGameRuleFile(PckAsset asset)
|
||||
{
|
||||
const string use_deflate = "PS3";
|
||||
const string use_xmem = "Xbox 360";
|
||||
const string use_zlib = "Other Platforms";
|
||||
const string cDEFLATE = "PS3";
|
||||
const string cXMEM = "Xbox 360";
|
||||
const string cZLIB = "Other Platforms";
|
||||
|
||||
ItemSelectionPopUp dialog = new ItemSelectionPopUp(use_zlib, use_deflate, use_xmem);
|
||||
ItemSelectionPopUp dialog = new ItemSelectionPopUp(cZLIB, cDEFLATE, cXMEM);
|
||||
dialog.LabelText = "Type";
|
||||
dialog.ButtonText = "Ok";
|
||||
if (dialog.ShowDialog() != DialogResult.OK)
|
||||
@@ -366,9 +385,9 @@ namespace PckStudio.Controls
|
||||
|
||||
GameRuleFile.CompressionType compressiontype = dialog.SelectedItem switch
|
||||
{
|
||||
use_deflate => GameRuleFile.CompressionType.Deflate,
|
||||
use_xmem => GameRuleFile.CompressionType.XMem,
|
||||
use_zlib => GameRuleFile.CompressionType.Zlib,
|
||||
cDEFLATE => GameRuleFile.CompressionType.Deflate,
|
||||
cXMEM => GameRuleFile.CompressionType.XMem,
|
||||
cZLIB => GameRuleFile.CompressionType.Zlib,
|
||||
_ => GameRuleFile.CompressionType.Unknown
|
||||
};
|
||||
|
||||
@@ -391,12 +410,11 @@ namespace PckStudio.Controls
|
||||
{
|
||||
try
|
||||
{
|
||||
OMI.Endianness endianness = LittleEndianCheckBox.Checked ? OMI.Endianness.LittleEndian : OMI.Endianness.BigEndian;
|
||||
ISaveContext<PckAudioFile> saveContext = new DelegatedSaveContext<PckAudioFile>(Settings.Default.AutoSaveChanges, (audioFile) =>
|
||||
{
|
||||
asset.SetData(new PckAudioFileWriter(audioFile, endianness));
|
||||
asset.SetData(new PckAudioFileWriter(audioFile, _currentEndianness));
|
||||
});
|
||||
PckAudioFile audioFile = asset.GetData(new PckAudioFileReader(endianness));
|
||||
PckAudioFile audioFile = asset.GetData(new PckAudioFileReader(_originalEndianness));
|
||||
using AudioEditor audioEditor = new AudioEditor(audioFile, saveContext);
|
||||
_wasModified = audioEditor.ShowDialog(this) == DialogResult.OK;
|
||||
}
|
||||
@@ -442,7 +460,7 @@ namespace PckStudio.Controls
|
||||
if (asset.HasProperty("CAPEPATH"))
|
||||
{
|
||||
string capeAssetPath = asset.GetProperty("CAPEPATH");
|
||||
if (EditorValue.TryGetAsset(capeAssetPath, PckAssetType.CapeFile, out PckAsset capeAsset))
|
||||
if (EditorValue.File.TryGetAsset(capeAssetPath, PckAssetType.CapeFile, out PckAsset capeAsset))
|
||||
{
|
||||
skin.CapeTexture = capeAsset.GetTexture();
|
||||
}
|
||||
@@ -455,7 +473,7 @@ namespace PckStudio.Controls
|
||||
asset.SetSkin(customSkin, locFile);
|
||||
});
|
||||
|
||||
using CustomSkinEditor skinEditor = new CustomSkinEditor(skin, saveContext, EditorValue.HasVerionString);
|
||||
using CustomSkinEditor skinEditor = new CustomSkinEditor(skin, saveContext, EditorValue.File.HasVerionString);
|
||||
if (skinEditor.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
entryDataTextBox.Text = entryTypeTextBox.Text = string.Empty;
|
||||
@@ -475,22 +493,22 @@ namespace PckStudio.Controls
|
||||
|
||||
TryGetDelegate<string, Image> tryGetTexture = (string path, out Image img) =>
|
||||
{
|
||||
bool found = EditorValue.TryGetAsset(path + ".png", PckAssetType.TextureFile, out PckAsset asset) ||
|
||||
EditorValue.TryGetAsset(path + ".tga", PckAssetType.TextureFile, out asset);
|
||||
bool found = EditorValue.File.TryGetAsset(path + ".png", PckAssetType.TextureFile, out PckAsset asset) ||
|
||||
EditorValue.File.TryGetAsset(path + ".tga", PckAssetType.TextureFile, out asset);
|
||||
img = found ? asset.GetTexture() : default;
|
||||
return found;
|
||||
};
|
||||
|
||||
TrySetDelegate<string, Image> trySetTexture = (string path, Image img) =>
|
||||
{
|
||||
bool found = EditorValue.TryGetAsset(path + ".png", PckAssetType.TextureFile, out PckAsset foundAsset) ||
|
||||
EditorValue.TryGetAsset(path + ".tga", PckAssetType.TextureFile, out foundAsset);
|
||||
PckAsset asset = foundAsset ?? EditorValue.CreateNewAsset(path + ".png", PckAssetType.TextureFile);
|
||||
bool found = EditorValue.File.TryGetAsset(path + ".png", PckAssetType.TextureFile, out PckAsset foundAsset) ||
|
||||
EditorValue.File.TryGetAsset(path + ".tga", PckAssetType.TextureFile, out foundAsset);
|
||||
PckAsset asset = foundAsset ?? EditorValue.File.CreateNewAsset(path + ".png", PckAssetType.TextureFile);
|
||||
asset.SetTexture(img);
|
||||
return true;
|
||||
};
|
||||
|
||||
bool hasMaterialAsset = EditorValue.TryGetAsset("entityMaterials.bin", PckAssetType.MaterialFile, out PckAsset entityMaterialAsset);
|
||||
bool hasMaterialAsset = EditorValue.File.TryGetAsset("entityMaterials.bin", PckAssetType.MaterialFile, out PckAsset entityMaterialAsset);
|
||||
IReadOnlyDictionary<string, MaterialContainer.Material> entityMaterials =
|
||||
hasMaterialAsset
|
||||
? entityMaterialAsset?.GetData(new MaterialFileReader()).ToDictionary(mat => mat.Name)
|
||||
@@ -534,7 +552,7 @@ namespace PckStudio.Controls
|
||||
|
||||
private void CheckForPasswordAndRemove()
|
||||
{
|
||||
if (EditorValue.TryGetAsset("0", PckAssetType.InfoFile, out PckAsset asset))
|
||||
if (EditorValue.File.TryGetAsset("0", PckAssetType.InfoFile, out PckAsset asset))
|
||||
{
|
||||
asset.RemoveProperties("LOCK");
|
||||
}
|
||||
@@ -597,17 +615,7 @@ namespace PckStudio.Controls
|
||||
previewPictureBox.Image = Resources.NoImageFound;
|
||||
treeMeta.Nodes.Clear();
|
||||
treeViewMain.Nodes.Clear();
|
||||
BuildPckTreeView(treeViewMain.Nodes, EditorValue);
|
||||
|
||||
//if (isTemplateFile && currentPCK.HasAsset("Skins.pck", PckAssetType.SkinDataFile))
|
||||
//{
|
||||
// TreeNode skinsNode = treeViewMain.Nodes.Find("Skins.pck", false).FirstOrDefault();
|
||||
// TreeNode folderNode = CreateNode("Skins");
|
||||
// folderNode.ImageIndex = 0;
|
||||
// folderNode.SelectedImageIndex = 0;
|
||||
// if (!skinsNode.Nodes.ContainsKey("Skins"))
|
||||
// skinsNode.Nodes.Add(folderNode);
|
||||
//}
|
||||
BuildPckTreeView(treeViewMain.Nodes, EditorValue.File);
|
||||
treeViewMain.Sort();
|
||||
|
||||
TreeNode[] selectedNodes = treeViewMain.FindPath(selectedNodeText);
|
||||
@@ -656,8 +664,8 @@ namespace PckStudio.Controls
|
||||
|
||||
private bool TryGetLocFile(out LOCFile locFile)
|
||||
{
|
||||
if (!EditorValue.TryGetAsset("localisation.loc", PckAssetType.LocalisationFile, out PckAsset locAsset) &&
|
||||
!EditorValue.TryGetAsset("languages.loc", PckAssetType.LocalisationFile, out locAsset))
|
||||
if (!EditorValue.File.TryGetAsset("localisation.loc", PckAssetType.LocalisationFile, out PckAsset locAsset) &&
|
||||
!EditorValue.File.TryGetAsset("languages.loc", PckAssetType.LocalisationFile, out locAsset))
|
||||
{
|
||||
locFile = null;
|
||||
return false;
|
||||
@@ -678,8 +686,8 @@ namespace PckStudio.Controls
|
||||
|
||||
private bool TrySetLocFile(in LOCFile locFile)
|
||||
{
|
||||
if (!EditorValue.TryGetAsset("localisation.loc", PckAssetType.LocalisationFile, out PckAsset locAsset) &&
|
||||
!EditorValue.TryGetAsset("languages.loc", PckAssetType.LocalisationFile, out locAsset))
|
||||
if (!EditorValue.File.TryGetAsset("localisation.loc", PckAssetType.LocalisationFile, out PckAsset locAsset) &&
|
||||
!EditorValue.File.TryGetAsset("languages.loc", PckAssetType.LocalisationFile, out locAsset))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -752,12 +760,12 @@ namespace PckStudio.Controls
|
||||
using AddFilePrompt diag = new AddFilePrompt("res/" + Path.GetFileName(ofd.FileName));
|
||||
if (diag.ShowDialog(this) == DialogResult.OK)
|
||||
{
|
||||
if (EditorValue.Contains(diag.Filepath, diag.Filetype))
|
||||
if (EditorValue.File.Contains(diag.Filepath, diag.Filetype))
|
||||
{
|
||||
MessageBox.Show(this, $"'{diag.Filepath}' of type {diag.Filetype} already exists.", "Import failed", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
PckAsset asset = EditorValue.CreateNewAsset(diag.Filepath, diag.Filetype, () => File.ReadAllBytes(ofd.FileName));
|
||||
PckAsset asset = EditorValue.File.CreateNewAsset(diag.Filepath, diag.Filetype, () => File.ReadAllBytes(ofd.FileName));
|
||||
|
||||
BuildMainTreeView();
|
||||
_wasModified = true;
|
||||
@@ -776,12 +784,12 @@ namespace PckStudio.Controls
|
||||
renamePrompt.LabelText = "Path";
|
||||
if (renamePrompt.ShowDialog(this) == DialogResult.OK && !string.IsNullOrEmpty(renamePrompt.NewText))
|
||||
{
|
||||
if (EditorValue.Contains(renamePrompt.NewText, PckAssetType.TextureFile))
|
||||
if (EditorValue.File.Contains(renamePrompt.NewText, PckAssetType.TextureFile))
|
||||
{
|
||||
MessageBox.Show(this, $"'{renamePrompt.NewText}' already exists.", "Import failed", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
PckAsset asset = EditorValue.CreateNewAsset(renamePrompt.NewText, PckAssetType.TextureFile, () => File.ReadAllBytes(fileDialog.FileName));
|
||||
PckAsset asset = EditorValue.File.CreateNewAsset(renamePrompt.NewText, PckAssetType.TextureFile, () => File.ReadAllBytes(fileDialog.FileName));
|
||||
BuildMainTreeView();
|
||||
_wasModified = true;
|
||||
}
|
||||
@@ -800,7 +808,7 @@ namespace PckStudio.Controls
|
||||
{
|
||||
string skinNameImport = Path.GetFileName(contents.FileName);
|
||||
byte[] data = File.ReadAllBytes(contents.FileName);
|
||||
PckAsset mfNew = EditorValue.CreateNewAsset(skinNameImport, PckAssetType.SkinFile);
|
||||
PckAsset mfNew = EditorValue.File.CreateNewAsset(skinNameImport, PckAssetType.SkinFile);
|
||||
mfNew.SetData(data);
|
||||
string propertyFile = Path.GetFileNameWithoutExtension(contents.FileName) + ".txt";
|
||||
if (File.Exists(propertyFile))
|
||||
@@ -986,7 +994,7 @@ namespace PckStudio.Controls
|
||||
Trace.WriteLine($"'{asset.Filename}' has no data attached.", category: nameof(treeViewMain_DoubleClick));
|
||||
return;
|
||||
}
|
||||
pckAssetTypeHandler[asset.Type]?.Invoke(asset);
|
||||
_pckAssetTypeHandler[asset.Type]?.Invoke(asset);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -999,7 +1007,7 @@ namespace PckStudio.Controls
|
||||
if (e.Button != MouseButtons.Left || e.Item is not TreeNode node)
|
||||
return;
|
||||
|
||||
if ((node.TryGetTagData(out PckAsset asset) && EditorValue.Contains(asset.Filename, asset.Type)) || node.Parent is TreeNode)
|
||||
if ((node.TryGetTagData(out PckAsset asset) && EditorValue.File.Contains(asset.Filename, asset.Type)) || node.Parent is TreeNode)
|
||||
{
|
||||
// TODO: add (mouse) scrolling while dragging item(s)
|
||||
treeViewMain.DoDragDrop(node, DragDropEffects.Scroll | DragDropEffects.Move);
|
||||
@@ -1175,14 +1183,14 @@ namespace PckStudio.Controls
|
||||
}
|
||||
}
|
||||
|
||||
if (EditorValue.Contains(filepath, assetType))
|
||||
if (EditorValue.File.Contains(filepath, assetType))
|
||||
{
|
||||
if (askForAssetType)
|
||||
MessageBox.Show(this, $"'{assetPath}' of type {assetType} already exists.\nSkiping file.", "File already exists", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
|
||||
Debug.WriteLine($"'{assetPath}' of type {assetType} already exists.\nSkiping file.");
|
||||
continue;
|
||||
}
|
||||
PckAsset importedAsset = EditorValue.CreateNewAsset(assetPath, assetType, () => File.ReadAllBytes(filepath));
|
||||
PckAsset importedAsset = EditorValue.File.CreateNewAsset(assetPath, assetType, () => File.ReadAllBytes(filepath));
|
||||
string propertyFile = filepath + ".txt";
|
||||
if (File.Exists(propertyFile))
|
||||
{
|
||||
@@ -1223,12 +1231,12 @@ namespace PckStudio.Controls
|
||||
if (addFile.ShowDialog(this) != DialogResult.OK)
|
||||
continue;
|
||||
|
||||
if (EditorValue.Contains(addFile.Filepath, addFile.Filetype))
|
||||
if (EditorValue.File.Contains(addFile.Filepath, addFile.Filetype))
|
||||
{
|
||||
MessageBox.Show(this, $"'{addFile.Filepath}' of type {addFile.Filetype} already exists.", "Import failed", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
continue;
|
||||
}
|
||||
EditorValue.CreateNewAsset(addFile.Filepath, addFile.Filetype, () => File.ReadAllBytes(file));
|
||||
EditorValue.File.CreateNewAsset(addFile.Filepath, addFile.Filetype, () => File.ReadAllBytes(file));
|
||||
addedCount++;
|
||||
|
||||
BuildMainTreeView();
|
||||
@@ -1244,47 +1252,19 @@ namespace PckStudio.Controls
|
||||
{
|
||||
TryGetLocFile(out LOCFile locFile);
|
||||
PckAsset skinAsset = addNewSkinDialog.NewSkin.CreateFile(locFile);
|
||||
EditorValue.AddAsset(skinAsset);
|
||||
// if (currentPCK.HasAsset("Skins.pck", PckAssetType.SkinDataFile)) // Prioritize Skins.pck
|
||||
//{
|
||||
// TreeNode subPCK = treeViewMain.Nodes.Find("Skins.pck", false).FirstOrDefault();
|
||||
// if (subPCK.Nodes.ContainsKey("Skins"))
|
||||
// skinAsset.Filename = skinAsset.Filename.Insert(0, "Skins/");
|
||||
// skinAsset.Filename = skinAsset.Filename.Insert(0, "Skins.pck/");
|
||||
// TreeNode newNode = new TreeNode(Path.GetFileName(skinAsset.Filename));
|
||||
// newNode.Tag = skinAsset;
|
||||
// SetNodeIcon(newNode, PckAssetType.SkinFile);
|
||||
// subPCK.Nodes.Add(newNode);
|
||||
// RebuildSubPCK(newNode.FullPath);
|
||||
//}
|
||||
//else
|
||||
{
|
||||
if (treeViewMain.Nodes.ContainsKey("Skins"))
|
||||
skinAsset.Filename = skinAsset.Filename.Insert(0, "Skins/"); // Then Skins folder
|
||||
EditorValue.AddAsset(skinAsset);
|
||||
}
|
||||
EditorValue.File.AddAsset(skinAsset);
|
||||
|
||||
bool hasSkinsFolder = treeViewMain.Nodes.ContainsKey("Skins");
|
||||
if (hasSkinsFolder)
|
||||
skinAsset.Filename = skinAsset.Filename.Insert(0, "Skins/"); // Then Skins folder
|
||||
EditorValue.File.AddAsset(skinAsset);
|
||||
|
||||
if (addNewSkinDialog.NewSkin.HasCape)
|
||||
{
|
||||
PckAsset capeFile = addNewSkinDialog.NewSkin.CreateCapeFile();
|
||||
//if (currentPCK.HasAsset("Skins.pck", PckAssetType.SkinDataFile)) // Prioritize Skins.pck
|
||||
//{
|
||||
// TreeNode subPCK = treeViewMain.Nodes.Find("Skins.pck", false).FirstOrDefault();
|
||||
// if (subPCK.Nodes.ContainsKey("Skins"))
|
||||
// capeFile.Filename = capeFile.Filename.Insert(0, "Skins/");
|
||||
// capeFile.Filename = capeFile.Filename.Insert(0, "Skins.pck/");
|
||||
// TreeNode newNode = new TreeNode(Path.GetFileName(capeFile.Filename));
|
||||
// newNode.Tag = capeFile;
|
||||
// SetNodeIcon(newNode, PckAssetType.SkinFile);
|
||||
// subPCK.Nodes.Add(newNode);
|
||||
// RebuildSubPCK(newNode.FullPath);
|
||||
//}
|
||||
//else
|
||||
{
|
||||
if (treeViewMain.Nodes.ContainsKey("Skins"))
|
||||
capeFile.Filename = capeFile.Filename.Insert(0, "Skins/"); // Then Skins folder
|
||||
EditorValue.AddAsset(capeFile);
|
||||
}
|
||||
if (hasSkinsFolder)
|
||||
capeFile.Filename = capeFile.Filename.Insert(0, "Skins/"); // Then Skins folder
|
||||
EditorValue.File.AddAsset(capeFile);
|
||||
}
|
||||
|
||||
TrySetLocFile(locFile);
|
||||
@@ -1301,7 +1281,7 @@ namespace PckStudio.Controls
|
||||
|
||||
string animationFilepath = $"{ResourceLocation.GetPathFromCategory(diag.Category)}/{diag.SelectedTile.InternalName}.png";
|
||||
|
||||
if (EditorValue.Contains(animationFilepath, PckAssetType.TextureFile))
|
||||
if (EditorValue.File.Contains(animationFilepath, PckAssetType.TextureFile))
|
||||
{
|
||||
MessageBox.Show(this, $"{diag.SelectedTile.DisplayName} is already present.", "File already present");
|
||||
return;
|
||||
@@ -1317,7 +1297,7 @@ namespace PckStudio.Controls
|
||||
if (animationEditor.ShowDialog() == DialogResult.OK && newAnimation is not null)
|
||||
{
|
||||
_wasModified = true;
|
||||
PckAsset asset = EditorValue.CreateNewAsset(animationFilepath, PckAssetType.TextureFile);
|
||||
PckAsset asset = EditorValue.File.CreateNewAsset(animationFilepath, PckAssetType.TextureFile);
|
||||
asset.SetSerializedData(newAnimation, AnimationSerializer.DefaultSerializer);
|
||||
BuildMainTreeView();
|
||||
ReloadMetaTreeView();
|
||||
@@ -1326,7 +1306,7 @@ namespace PckStudio.Controls
|
||||
|
||||
private void audiopckToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (EditorValue.Contains(PckAssetType.AudioFile))
|
||||
if (EditorValue.File.Contains(PckAssetType.AudioFile))
|
||||
{
|
||||
// the chance of this happening is really really slim but just in case
|
||||
MessageBox.Show(this, "There is already an audio file in this PCK!", "Can't create audio.pck");
|
||||
@@ -1350,7 +1330,7 @@ namespace PckStudio.Controls
|
||||
AudioEditor diag = new AudioEditor(newAudioFile, saveContext);
|
||||
if (diag.ShowDialog(this) == DialogResult.OK)
|
||||
{
|
||||
EditorValue.AddAsset(newAudioAsset);
|
||||
EditorValue.File.AddAsset(newAudioAsset);
|
||||
}
|
||||
diag.Dispose();
|
||||
BuildMainTreeView();
|
||||
@@ -1358,25 +1338,25 @@ namespace PckStudio.Controls
|
||||
|
||||
private void colourscolToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (EditorValue.TryGetAsset("colours.col", PckAssetType.ColourTableFile, out _))
|
||||
if (EditorValue.File.TryGetAsset("colours.col", PckAssetType.ColourTableFile, out _))
|
||||
{
|
||||
MessageBox.Show(this, "A color table file already exists in this PCK and a new one cannot be created.", "Operation aborted");
|
||||
return;
|
||||
}
|
||||
PckAsset newColorAsset = EditorValue.CreateNewAsset("colours.col", PckAssetType.ColourTableFile);
|
||||
PckAsset newColorAsset = EditorValue.File.CreateNewAsset("colours.col", PckAssetType.ColourTableFile);
|
||||
newColorAsset.SetData(Resources.tu69colours);
|
||||
BuildMainTreeView();
|
||||
}
|
||||
|
||||
private void CreateSkinsPCKToolStripMenuItem1_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (EditorValue.TryGetAsset("Skins.pck", PckAssetType.SkinDataFile, out _))
|
||||
if (EditorValue.File.TryGetAsset("Skins.pck", PckAssetType.SkinDataFile, out _))
|
||||
{
|
||||
MessageBox.Show(this, "A Skins.pck file already exists in this PCK and a new one cannot be created.", "Operation aborted");
|
||||
return;
|
||||
}
|
||||
|
||||
EditorValue.CreateNewAsset("Skins.pck", PckAssetType.SkinDataFile, new PckFileWriter(new PckFile(3, true),
|
||||
EditorValue.File.CreateNewAsset("Skins.pck", PckAssetType.SkinDataFile, new PckFileWriter(new PckFile(3, true),
|
||||
LittleEndianCheckBox.Checked ? OMI.Endianness.LittleEndian : OMI.Endianness.BigEndian));
|
||||
|
||||
BuildMainTreeView();
|
||||
@@ -1384,26 +1364,26 @@ namespace PckStudio.Controls
|
||||
|
||||
private void behavioursbinToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (EditorValue.TryGetAsset("behaviours.bin", PckAssetType.BehavioursFile, out _))
|
||||
if (EditorValue.File.TryGetAsset("behaviours.bin", PckAssetType.BehavioursFile, out _))
|
||||
{
|
||||
MessageBox.Show(this, "A behaviours file already exists in this PCK and a new one cannot be created.", "Operation aborted");
|
||||
return;
|
||||
}
|
||||
|
||||
EditorValue.CreateNewAsset("behaviours.bin", PckAssetType.BehavioursFile, new BehavioursWriter(new BehaviourFile()));
|
||||
EditorValue.File.CreateNewAsset("behaviours.bin", PckAssetType.BehavioursFile, new BehavioursWriter(new BehaviourFile()));
|
||||
BuildMainTreeView();
|
||||
}
|
||||
|
||||
private void entityMaterialsbinToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (EditorValue.TryGetAsset("entityMaterials.bin", PckAssetType.MaterialFile, out _))
|
||||
if (EditorValue.File.TryGetAsset("entityMaterials.bin", PckAssetType.MaterialFile, out _))
|
||||
{
|
||||
MessageBox.Show(this, "A behaviours file already exists in this PCK and a new one cannot be created.", "Operation aborted");
|
||||
return;
|
||||
}
|
||||
var materialContainer = new MaterialContainer();
|
||||
materialContainer.InitializeDefault();
|
||||
EditorValue.CreateNewAsset("entityMaterials.bin", PckAssetType.MaterialFile, new MaterialFileWriter(materialContainer));
|
||||
EditorValue.File.CreateNewAsset("entityMaterials.bin", PckAssetType.MaterialFile, new MaterialFileWriter(materialContainer));
|
||||
BuildMainTreeView();
|
||||
}
|
||||
|
||||
@@ -1411,7 +1391,7 @@ namespace PckStudio.Controls
|
||||
private void importExtractedSkinsFolder(object sender, EventArgs e)
|
||||
{
|
||||
OpenFolderDialog contents = new OpenFolderDialog();
|
||||
if (contents.ShowDialog() == true)
|
||||
if (contents.ShowDialog(Handle) == true)
|
||||
{
|
||||
//checks to make sure selected path exist
|
||||
if (!Directory.Exists(contents.ResultPath))
|
||||
@@ -1420,7 +1400,7 @@ namespace PckStudio.Controls
|
||||
return;
|
||||
}
|
||||
// creates variable to indicate wether current pck skin structure is mashup or regular skin
|
||||
bool hasSkinsPck = EditorValue.HasAsset("Skins.pck", PckAssetType.SkinDataFile);
|
||||
bool hasSkinsPck = EditorValue.File.HasAsset("Skins.pck", PckAssetType.SkinDataFile);
|
||||
|
||||
foreach (var fullfilename in Directory.GetFiles(contents.ResultPath, "*.png"))
|
||||
{
|
||||
@@ -1467,7 +1447,7 @@ namespace PckStudio.Controls
|
||||
}
|
||||
if (hasSkinsPck)
|
||||
{
|
||||
PckAsset skinsFileAsset = EditorValue.GetAsset("Skins.pck", PckAssetType.SkinDataFile);
|
||||
PckAsset skinsFileAsset = EditorValue.File.GetAsset("Skins.pck", PckAssetType.SkinDataFile);
|
||||
using (var ms = new MemoryStream(skinsFileAsset.Data))
|
||||
{
|
||||
//var reader = new PckFileReader(LittleEndianCheckBox.Checked ? OMI.Endianness.LittleEndian : OMI.Endianness.BigEndian);
|
||||
@@ -1480,7 +1460,7 @@ namespace PckStudio.Controls
|
||||
}
|
||||
continue;
|
||||
}
|
||||
EditorValue.AddAsset(newFile);
|
||||
EditorValue.File.AddAsset(newFile);
|
||||
}
|
||||
BuildMainTreeView();
|
||||
_wasModified = true;
|
||||
@@ -1529,8 +1509,8 @@ namespace PckStudio.Controls
|
||||
{
|
||||
string mippedPath = $"{textureDirectory}/{textureName}MipMapLevel{i}{textureExtension}";
|
||||
Debug.WriteLine(mippedPath);
|
||||
if (EditorValue.HasAsset(mippedPath, PckAssetType.TextureFile))
|
||||
EditorValue.RemoveAsset(EditorValue.GetAsset(mippedPath, PckAssetType.TextureFile));
|
||||
if (EditorValue.File.HasAsset(mippedPath, PckAssetType.TextureFile))
|
||||
EditorValue.File.RemoveAsset(EditorValue.File.GetAsset(mippedPath, PckAssetType.TextureFile));
|
||||
PckAsset mipMappedAsset = new PckAsset(mippedPath, PckAssetType.TextureFile);
|
||||
|
||||
Image originalTexture = asset.GetTexture();
|
||||
@@ -1549,7 +1529,7 @@ namespace PckStudio.Controls
|
||||
|
||||
mipMappedAsset.SetTexture(mippedTexture);
|
||||
|
||||
EditorValue.InsertAsset(EditorValue.IndexOfAsset(asset) + i - 1, mipMappedAsset);
|
||||
EditorValue.File.InsertAsset(EditorValue.File.IndexOfAsset(asset) + i - 1, mipMappedAsset);
|
||||
}
|
||||
BuildMainTreeView();
|
||||
}
|
||||
@@ -1630,7 +1610,7 @@ namespace PckStudio.Controls
|
||||
|
||||
string selectedFolder = node.FullPath;
|
||||
|
||||
foreach (PckAsset asset in EditorValue.GetAssets().Where(asset => asset.Filename.StartsWith(selectedFolder)))
|
||||
foreach (PckAsset asset in EditorValue.File.GetAssets().Where(asset => asset.Filename.StartsWith(selectedFolder)))
|
||||
{
|
||||
extractFolderFile(outPath, asset);
|
||||
}
|
||||
@@ -1702,7 +1682,7 @@ namespace PckStudio.Controls
|
||||
TreeNodeCollection nodeCollection = node.Parent?.Nodes ?? treeViewMain.Nodes;
|
||||
nodeCollection.Insert(node.Index + 1, newNode);
|
||||
|
||||
EditorValue.InsertAsset(node.Index + 1, newFile);
|
||||
EditorValue.File.InsertAsset(node.Index + 1, newFile);
|
||||
BuildMainTreeView();
|
||||
_wasModified = true;
|
||||
}
|
||||
@@ -1724,7 +1704,7 @@ namespace PckStudio.Controls
|
||||
{
|
||||
if (isFile)
|
||||
{
|
||||
if (EditorValue.Contains(diag.NewText, asset.Type))
|
||||
if (EditorValue.File.Contains(diag.NewText, asset.Type))
|
||||
{
|
||||
MessageBox.Show(this, $"{diag.NewText} already exists", "File already exists");
|
||||
return;
|
||||
@@ -1827,7 +1807,7 @@ namespace PckStudio.Controls
|
||||
|
||||
if (node.TryGetTagData(out PckAsset asset))
|
||||
{
|
||||
if (!BeforeFileRemove(asset) && EditorValue.RemoveAsset(asset))
|
||||
if (!BeforeFileRemove(asset) && EditorValue.File.RemoveAsset(asset))
|
||||
{
|
||||
node.Remove();
|
||||
_wasModified = true;
|
||||
@@ -1837,7 +1817,7 @@ namespace PckStudio.Controls
|
||||
MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
|
||||
{
|
||||
string pckFolderDir = node.FullPath;
|
||||
EditorValue.RemoveAll(file => file.Filename.StartsWith(pckFolderDir) && !BeforeFileRemove(file));
|
||||
EditorValue.File.RemoveAll(file => file.Filename.StartsWith(pckFolderDir) && !BeforeFileRemove(file));
|
||||
node.Remove();
|
||||
_wasModified = true;
|
||||
}
|
||||
@@ -2034,14 +2014,14 @@ namespace PckStudio.Controls
|
||||
}
|
||||
}
|
||||
|
||||
private static Model GetDefaultEntityModel(string modelName)
|
||||
private static bool TryGetDefaultEntityModel(string modelName, out Model model)
|
||||
{
|
||||
if (!GameModelImporter.DefaultModels.TryGetValue(modelName, out DefaultModel defaultModel) || defaultModel is null)
|
||||
{
|
||||
MessageBox.Show("No Default Model found.");
|
||||
return default;
|
||||
model = default;
|
||||
return false;
|
||||
}
|
||||
Model model = new Model(modelName, new Size((int)defaultModel.TextureSize.X, (int)defaultModel.TextureSize.Y));
|
||||
model = new Model(modelName, new Size((int)defaultModel.TextureSize.X, (int)defaultModel.TextureSize.Y));
|
||||
|
||||
foreach (DefaultPart defaultPart in defaultModel.Parts)
|
||||
{
|
||||
@@ -2050,7 +2030,7 @@ namespace PckStudio.Controls
|
||||
model.AddPart(modelPart);
|
||||
}
|
||||
|
||||
return model;
|
||||
return true;
|
||||
}
|
||||
|
||||
private void ShowSimpleModelRender(Model model, NamedTexture modelTexture)
|
||||
|
||||
@@ -117,10 +117,9 @@
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<assembly alias="mscorlib" name="mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="logoPictureBox.GenerateMember" type="System.Boolean, mscorlib">
|
||||
<metadata name="logoPictureBox.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</data>
|
||||
</metadata>
|
||||
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<data name="logoPictureBox.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
@@ -794,6 +793,7 @@
|
||||
<data name="logoPictureBox.SizeMode" type="System.Windows.Forms.PictureBoxSizeMode, System.Windows.Forms">
|
||||
<value>Zoom</value>
|
||||
</data>
|
||||
<assembly alias="mscorlib" name="mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="logoPictureBox.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>14</value>
|
||||
</data>
|
||||
@@ -858,7 +858,7 @@
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>labelImageSize.ZOrder" xml:space="preserve">
|
||||
<value>0</value>
|
||||
<value>5</value>
|
||||
</data>
|
||||
<data name="fileEntryCountLabel.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<value>Top, Right</value>
|
||||
@@ -894,7 +894,7 @@
|
||||
<value>True</value>
|
||||
</data>
|
||||
<data name="metroLabel2.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>204, 147</value>
|
||||
<value>204, 144</value>
|
||||
</data>
|
||||
<data name="metroLabel2.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>0, 0</value>
|
||||
@@ -939,7 +939,7 @@
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="entryTypeTextBox.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>215, 117</value>
|
||||
<value>215, 114</value>
|
||||
</data>
|
||||
<data name="entryTypeTextBox.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>146, 20</value>
|
||||
@@ -984,7 +984,7 @@
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="entryDataTextBox.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>215, 149</value>
|
||||
<value>215, 146</value>
|
||||
</data>
|
||||
<data name="entryDataTextBox.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>146, 20</value>
|
||||
@@ -1008,7 +1008,7 @@
|
||||
<value>Bottom, Right</value>
|
||||
</data>
|
||||
<data name="buttonEdit.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>215, 175</value>
|
||||
<value>215, 172</value>
|
||||
</data>
|
||||
<data name="buttonEdit.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>146, 33</value>
|
||||
@@ -1041,7 +1041,7 @@
|
||||
<value>True</value>
|
||||
</data>
|
||||
<data name="metroLabel1.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>266, 40</value>
|
||||
<value>266, 37</value>
|
||||
</data>
|
||||
<data name="metroLabel1.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>0, 0</value>
|
||||
@@ -1061,9 +1061,9 @@
|
||||
<data name=">>metroLabel1.ZOrder" xml:space="preserve">
|
||||
<value>6</value>
|
||||
</data>
|
||||
<data name="contextMenuMetaTree.TrayLocation" type="System.Drawing.Point, System.Drawing">
|
||||
<metadata name="contextMenuMetaTree.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>301, 19</value>
|
||||
</data>
|
||||
</metadata>
|
||||
<data name="addEntryToolStripMenuItem1.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>160, 22</value>
|
||||
</data>
|
||||
@@ -1198,9 +1198,9 @@
|
||||
<data name=">>PropertiesTabControl.ZOrder" xml:space="preserve">
|
||||
<value>7</value>
|
||||
</data>
|
||||
<data name="label11.Locked" type="System.Boolean, mscorlib">
|
||||
<metadata name="label11.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</data>
|
||||
</metadata>
|
||||
<data name="label11.AutoSize" type="System.Boolean, mscorlib">
|
||||
<value>True</value>
|
||||
</data>
|
||||
@@ -1225,9 +1225,9 @@
|
||||
<data name=">>label11.ZOrder" xml:space="preserve">
|
||||
<value>8</value>
|
||||
</data>
|
||||
<data name="contextMenuPCKEntries.TrayLocation" type="System.Drawing.Point, System.Drawing">
|
||||
<metadata name="contextMenuPCKEntries.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>22, 20</value>
|
||||
</data>
|
||||
</metadata>
|
||||
<data name="folderToolStripMenuItem.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
|
||||
@@ -1630,9 +1630,9 @@
|
||||
<data name="treeViewMain.ImageIndex" type="System.Int32, mscorlib">
|
||||
<value>0</value>
|
||||
</data>
|
||||
<data name="imageList.TrayLocation" type="System.Drawing.Point, System.Drawing">
|
||||
<metadata name="imageList.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>204, 20</value>
|
||||
</data>
|
||||
</metadata>
|
||||
<data name="imageList.ImageSize" type="System.Drawing.Size, System.Drawing">
|
||||
<value>32, 32</value>
|
||||
</data>
|
||||
@@ -1735,11 +1735,11 @@
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>previewPictureBox.ZOrder" xml:space="preserve">
|
||||
<value>0</value>
|
||||
<value>2</value>
|
||||
</data>
|
||||
<data name="$this.Localizable" type="System.Boolean, mscorlib">
|
||||
<metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</data>
|
||||
</metadata>
|
||||
<data name="$this.BackgroundImageLayout" type="System.Windows.Forms.ImageLayout, System.Windows.Forms">
|
||||
<value>None</value>
|
||||
</data>
|
||||
@@ -2092,6 +2092,6 @@
|
||||
<value>PckEditor</value>
|
||||
</data>
|
||||
<data name=">>$this.Type" xml:space="preserve">
|
||||
<value>PckStudio.Internal.EditorControl`1[[OMI.Formats.Pck.PckFile, OMI Filetypes, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]], PCK-Studio, Version=7.0.0.2, Culture=neutral, PublicKeyToken=null</value>
|
||||
<value>PckStudio.Internal.EditorControl`1[[PckStudio.Internal.PackInfo, PCK-Studio, Version=7.0.0.2, Culture=neutral, PublicKeyToken=null]], PCK-Studio, Version=7.0.0.2, Culture=neutral, PublicKeyToken=null</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -1,8 +0,0 @@
|
||||
namespace PckStudio.Extensions
|
||||
{
|
||||
internal enum ImageLayoutDirection
|
||||
{
|
||||
Horizontal,
|
||||
Vertical
|
||||
}
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
namespace PckStudio.Extensions
|
||||
{
|
||||
internal static class NumericsExtensions
|
||||
{
|
||||
internal static OpenTK.Vector3 ToOpenTKVector(this System.Numerics.Vector3 vector3)
|
||||
{
|
||||
return new OpenTK.Vector3(vector3.X, vector3.Y, vector3.Z);
|
||||
}
|
||||
|
||||
internal static OpenTK.Vector2 ToOpenTKVector(this System.Numerics.Vector2 vector2)
|
||||
{
|
||||
return new OpenTK.Vector2(vector2.X, vector2.Y);
|
||||
}
|
||||
|
||||
internal static System.Numerics.Vector3 ToNumericsVector(this OpenTK.Vector3 vector3)
|
||||
{
|
||||
return new System.Numerics.Vector3(vector3.X, vector3.Y, vector3.Z);
|
||||
}
|
||||
|
||||
internal static System.Numerics.Vector2 ToNumericsVector(this OpenTK.Vector2 vector2)
|
||||
{
|
||||
return new System.Numerics.Vector2(vector2.X, vector2.Y);
|
||||
}
|
||||
}
|
||||
}
|
||||
2
PCK-Studio/External/API/Miles/Binka.cs
vendored
2
PCK-Studio/External/API/Miles/Binka.cs
vendored
@@ -2,7 +2,7 @@
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
using PckStudio.Extensions;
|
||||
using PckStudio.Core.Extensions;
|
||||
using PckStudio.Internal;
|
||||
using PckStudio.Internal.App;
|
||||
using SharpMSS;
|
||||
|
||||
@@ -8,14 +8,15 @@ using OMI.Formats.Languages;
|
||||
using OMI.Formats.Pck;
|
||||
using PckStudio.Internal;
|
||||
using PckStudio.Forms.Editor;
|
||||
using PckStudio.Internal.IO._3DST;
|
||||
using PckStudio.Core.IO._3DST;
|
||||
using PckStudio.Properties;
|
||||
using PckStudio.Forms;
|
||||
using PckStudio.Extensions;
|
||||
using PckStudio.Core.Extensions;
|
||||
using System.Linq;
|
||||
using System.Diagnostics;
|
||||
using PckStudio.Internal.Skin;
|
||||
using PckStudio.Core.Skin;
|
||||
using PckStudio.Interfaces;
|
||||
using PckStudio.Core;
|
||||
|
||||
namespace PckStudio.Forms.Additional_Popups
|
||||
{
|
||||
@@ -201,12 +202,12 @@ namespace PckStudio.Forms.Additional_Popups
|
||||
{
|
||||
if (radioButtonManual.Checked)
|
||||
{
|
||||
if (!int.TryParse(textSkinID.Text, out int _skinId))
|
||||
if (!int.TryParse(textSkinID.Text, out int skinId))
|
||||
{
|
||||
MessageBox.Show("The Skin Id must be a unique 8 digit number that is not already in use", "Invalid Skin Id", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
newSkin.Identifier = new SkinIdentifier(_skinId);
|
||||
newSkin.Identifier = new SkinIdentifier(skinId);
|
||||
}
|
||||
newSkin.MetaData = new SkinMetaData(textSkinName.Text, textThemeName.Text);
|
||||
DialogResult = DialogResult.OK;
|
||||
|
||||
@@ -1,14 +1,10 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Windows.Forms;
|
||||
using MetroFramework.Controls;
|
||||
using System.Xml.Linq;
|
||||
using MetroFramework.Forms;
|
||||
using PckStudio.Extensions;
|
||||
using PckStudio.Internal;
|
||||
using PckStudio.Internal.App;
|
||||
using PckStudio.Internal.Json;
|
||||
using PckStudio.Core;
|
||||
using PckStudio.Core.Json;
|
||||
using PckStudio.Json;
|
||||
using PckStudio.Core.Extensions;
|
||||
|
||||
namespace PckStudio.Forms.Additional_Popups.Animation
|
||||
{
|
||||
@@ -32,10 +28,8 @@ namespace PckStudio.Forms.Additional_Popups.Animation
|
||||
|
||||
private void InitializeTreeviews()
|
||||
{
|
||||
Profiler.Start();
|
||||
GetTileDataToView(ResourceCategory.BlockAnimation);
|
||||
GetTileDataToView(ResourceCategory.ItemAnimation);
|
||||
Profiler.Stop();
|
||||
}
|
||||
|
||||
public DialogResult ShowDialog(IWin32Window owner)
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Windows.Forms;
|
||||
using PckStudio.Forms.Additional_Popups.Animation;
|
||||
using PckStudio.Internal.Json;
|
||||
using PckStudio.Core.Json;
|
||||
using PckStudio.Json;
|
||||
|
||||
|
||||
namespace PckStudio.Forms.Additional_Popups.EntityForms
|
||||
|
||||
@@ -5,6 +5,7 @@ using System.Diagnostics;
|
||||
using System.Windows.Forms;
|
||||
using MetroFramework.Controls;
|
||||
using MetroFramework.Forms;
|
||||
using PckStudio.Core.App;
|
||||
using PckStudio.Internal.App;
|
||||
using PckStudio.Properties;
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ using System.Collections.Generic;
|
||||
using PckStudio.Internal;
|
||||
using PckStudio.Forms.Additional_Popups;
|
||||
using PckStudio.Properties;
|
||||
using PckStudio.Internal.Skin;
|
||||
using PckStudio.Core.Skin;
|
||||
|
||||
namespace PckStudio.Forms.Editor
|
||||
{
|
||||
|
||||
@@ -319,7 +319,7 @@
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.animationPictureBox.BlendColor = System.Drawing.Color.White;
|
||||
this.animationPictureBox.BlendMode = PckStudio.Extensions.BlendMode.Multiply;
|
||||
this.animationPictureBox.BlendMode = PckStudio.Core.Extensions.BlendMode.Multiply;
|
||||
this.animationPictureBox.Image = null;
|
||||
this.animationPictureBox.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.NearestNeighbor;
|
||||
this.animationPictureBox.Location = new System.Drawing.Point(157, 88);
|
||||
|
||||
@@ -29,11 +29,12 @@ using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
using PckStudio.Forms.Additional_Popups.Animation;
|
||||
using PckStudio.Extensions;
|
||||
using PckStudio.Core.Extensions;
|
||||
using PckStudio.Properties;
|
||||
using PckStudio.Internal;
|
||||
using PckStudio.Internal.Deserializer;
|
||||
using PckStudio.Internal.Serializer;
|
||||
using PckStudio.Core.Deserializer;
|
||||
using PckStudio.Core.Serializer;
|
||||
using PckStudio.Core;
|
||||
using PckStudio.Interfaces;
|
||||
|
||||
namespace PckStudio.Forms.Editor
|
||||
|
||||
@@ -7,21 +7,15 @@ using System.Windows.Forms;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Diagnostics;
|
||||
|
||||
using MetroFramework.Forms;
|
||||
using NAudio.Wave;
|
||||
|
||||
using OMI.Formats.Pck;
|
||||
|
||||
using PckStudio.Internal.IO.PckAudio;
|
||||
using PckStudio.Forms.Additional_Popups;
|
||||
using PckStudio.Properties;
|
||||
using PckStudio.External.API.Miles;
|
||||
using PckStudio.Internal.FileFormats;
|
||||
using PckStudio.Extensions;
|
||||
using PckStudio.Core.Extensions;
|
||||
using PckStudio.Internal.App;
|
||||
using PckStudio.Internal;
|
||||
using PckStudio.Interfaces;
|
||||
using PckStudio.Core.FileFormats;
|
||||
|
||||
// Audio Editor by MattNL and Miku-666
|
||||
|
||||
@@ -113,9 +107,9 @@ namespace PckStudio.Forms.Editor
|
||||
|
||||
if (!parent.CreateDataFolder())
|
||||
return;
|
||||
string FileName = Path.Combine(parent.GetDataPath(), entry.Text + ".binka");
|
||||
string fileName = Path.Combine(parent.GetDataPath(), entry.Text + ".binka");
|
||||
|
||||
if (File.Exists(FileName))
|
||||
if (File.Exists(fileName))
|
||||
MessageBox.Show(this, $"\"{entry.Text}.binka\" exists in the \"Data\" folder", "File found");
|
||||
else
|
||||
MessageBox.Show(this, $"\"{entry.Text}.binka\" does not exist in the \"Data\" folder. The game will crash when attempting to load this track.", "File missing");
|
||||
@@ -384,8 +378,8 @@ namespace PckStudio.Forms.Editor
|
||||
|
||||
foreach(var song in category.SongNames)
|
||||
{
|
||||
string FileName = Path.Combine(parent.GetDataPath(), song + ".binka");
|
||||
if (!File.Exists(FileName))
|
||||
string fileName = Path.Combine(parent.GetDataPath(), song + ".binka");
|
||||
if (!File.Exists(fileName))
|
||||
{
|
||||
songs_missing = true;
|
||||
MessageBox.Show(this, "\"" + song + ".binka\" does not exist in the \"Data\" folder. The game will crash when attempting to load this track.", "File missing");
|
||||
|
||||
@@ -5,9 +5,10 @@ using System.Collections.Generic;
|
||||
using OMI.Formats.Behaviour;
|
||||
using PckStudio.Internal;
|
||||
using PckStudio.Internal.App;
|
||||
using PckStudio.Internal.Json;
|
||||
using PckStudio.Interfaces;
|
||||
using PckStudio.Forms.Additional_Popups.EntityForms;
|
||||
using PckStudio.Json;
|
||||
using PckStudio.Core.Json;
|
||||
|
||||
namespace PckStudio.Forms.Editor
|
||||
{
|
||||
@@ -36,24 +37,24 @@ namespace PckStudio.Forms.Editor
|
||||
treeView1.Nodes.Clear();
|
||||
foreach (BehaviourFile.RiderPositionOverride entry in EditorValue.entries)
|
||||
{
|
||||
TreeNode EntryNode = new TreeNode(entry.name);
|
||||
TreeNode entryNode = new TreeNode(entry.name);
|
||||
|
||||
EntityInfo behaviour = BehaviourData.Find(b => b.InternalName == entry.name);
|
||||
EntryNode.Text = behaviour.DisplayName;
|
||||
EntryNode.ImageIndex = BehaviourData.IndexOf(behaviour);
|
||||
EntryNode.SelectedImageIndex = EntryNode.ImageIndex;
|
||||
EntryNode.Tag = entry;
|
||||
entryNode.Text = behaviour.DisplayName;
|
||||
entryNode.ImageIndex = BehaviourData.IndexOf(behaviour);
|
||||
entryNode.SelectedImageIndex = entryNode.ImageIndex;
|
||||
entryNode.Tag = entry;
|
||||
|
||||
foreach (BehaviourFile.RiderPositionOverride.PositionOverride posOverride in entry.overrides)
|
||||
{
|
||||
TreeNode OverrideNode = new TreeNode("Position Override");
|
||||
OverrideNode.Tag = posOverride;
|
||||
EntryNode.Nodes.Add(OverrideNode);
|
||||
OverrideNode.ImageIndex = 103;
|
||||
OverrideNode.SelectedImageIndex = OverrideNode.ImageIndex;
|
||||
TreeNode overrideNode = new TreeNode("Position Override");
|
||||
overrideNode.Tag = posOverride;
|
||||
entryNode.Nodes.Add(overrideNode);
|
||||
overrideNode.ImageIndex = 103;
|
||||
overrideNode.SelectedImageIndex = overrideNode.ImageIndex;
|
||||
}
|
||||
|
||||
treeView1.Nodes.Add(EntryNode);
|
||||
treeView1.Nodes.Add(entryNode);
|
||||
}
|
||||
treeView1.EndUpdate();
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using PckStudio.Internal.Skin;
|
||||
using PckStudio.Core.Skin;
|
||||
using PckStudio.Properties;
|
||||
|
||||
namespace PckStudio.Forms.Editor
|
||||
|
||||
@@ -8,7 +8,7 @@ using MetroFramework.Forms;
|
||||
using OMI.Formats.Color;
|
||||
using OMI.Formats.Pck;
|
||||
using OMI.Workers.Color;
|
||||
using PckStudio.Extensions;
|
||||
using PckStudio.Core.Extensions;
|
||||
using PckStudio.Properties;
|
||||
using PckStudio.Internal;
|
||||
using PckStudio.Interfaces;
|
||||
@@ -120,7 +120,7 @@ namespace PckStudio.Forms.Editor
|
||||
|
||||
ColorContainer temp = targetVersion ? _defaultColourfile : EditorValue;
|
||||
|
||||
List<string> CurrentEntries = new List<string>();
|
||||
List<string> currentEntries = new List<string>();
|
||||
|
||||
colorCache.Clear();
|
||||
fogCache.Clear();
|
||||
@@ -134,7 +134,7 @@ namespace PckStudio.Forms.Editor
|
||||
{
|
||||
if (_defaultColourfile.Colors.Find(c => c.Name == col.Name) == null)
|
||||
continue;
|
||||
CurrentEntries.Add(col.Name);
|
||||
currentEntries.Add(col.Name);
|
||||
AddEntry(colorTreeView, colorCache, col.Name, col);
|
||||
}
|
||||
}
|
||||
@@ -142,12 +142,12 @@ namespace PckStudio.Forms.Editor
|
||||
foreach (ColorContainer.Color col in temp.Colors)
|
||||
{
|
||||
ColorContainer.Color entry = EditorValue.Colors.Find(color => color.Name == col.Name);
|
||||
if (CurrentEntries.Contains(col.Name))
|
||||
if (currentEntries.Contains(col.Name))
|
||||
continue;
|
||||
ColorContainer.Color color = entry ?? col;
|
||||
AddEntry(colorTreeView, colorCache, color.Name, color);
|
||||
}
|
||||
CurrentEntries.Clear();
|
||||
currentEntries.Clear();
|
||||
|
||||
// fixes the duplicate entry bug
|
||||
if (targetVersion)
|
||||
@@ -167,7 +167,7 @@ namespace PckStudio.Forms.Editor
|
||||
foreach (ColorContainer.WaterColor col in temp.WaterColors)
|
||||
{
|
||||
ColorContainer.WaterColor entry = EditorValue.WaterColors.Find(color => color.Name == col.Name);
|
||||
if (CurrentEntries.Contains(col.Name))
|
||||
if (currentEntries.Contains(col.Name))
|
||||
continue;
|
||||
ColorContainer.WaterColor color = entry ?? col;
|
||||
AddEntry(waterTreeView, waterCache, color.Name, color);
|
||||
@@ -493,14 +493,14 @@ namespace PckStudio.Forms.Editor
|
||||
}
|
||||
else
|
||||
{
|
||||
ColorContainer.WaterColor WaterEntry = _defaultColourfile.WaterColors.Find(color => color.Name == node.Text);
|
||||
ColorContainer.WaterColor waterEntry = _defaultColourfile.WaterColors.Find(color => color.Name == node.Text);
|
||||
|
||||
if (WaterEntry == null)
|
||||
if (waterEntry == null)
|
||||
return;
|
||||
|
||||
color =
|
||||
tab == waterTab ? WaterEntry.SurfaceColor :
|
||||
tab == underwaterTab ? WaterEntry.UnderwaterColor : WaterEntry.FogColor;
|
||||
tab == waterTab ? waterEntry.SurfaceColor :
|
||||
tab == underwaterTab ? waterEntry.UnderwaterColor : waterEntry.FogColor;
|
||||
|
||||
if (tab == waterTab)
|
||||
{
|
||||
@@ -531,52 +531,52 @@ namespace PckStudio.Forms.Editor
|
||||
fogTreeView.Nodes.Clear();
|
||||
if (!string.IsNullOrEmpty(metroTextBox1.Text))
|
||||
{
|
||||
foreach (TreeNode _node in colorCache)
|
||||
foreach (TreeNode node in colorCache)
|
||||
{
|
||||
if (_node.Text.ToLower().Contains(metroTextBox1.Text.ToLower()))
|
||||
if (node.Text.ToLower().Contains(metroTextBox1.Text.ToLower()))
|
||||
{
|
||||
colorTreeView.Nodes.Add((TreeNode)_node.Clone());
|
||||
colorTreeView.Nodes.Add((TreeNode)node.Clone());
|
||||
}
|
||||
}
|
||||
foreach (TreeNode _node in waterCache)
|
||||
foreach (TreeNode node in waterCache)
|
||||
{
|
||||
if (_node.Text.ToLower().Contains(metroTextBox1.Text.ToLower()))
|
||||
if (node.Text.ToLower().Contains(metroTextBox1.Text.ToLower()))
|
||||
{
|
||||
waterTreeView.Nodes.Add((TreeNode)_node.Clone());
|
||||
waterTreeView.Nodes.Add((TreeNode)node.Clone());
|
||||
}
|
||||
}
|
||||
foreach (TreeNode _node in underwaterCache)
|
||||
foreach (TreeNode node in underwaterCache)
|
||||
{
|
||||
if (_node.Text.ToLower().Contains(metroTextBox1.Text.ToLower()))
|
||||
if (node.Text.ToLower().Contains(metroTextBox1.Text.ToLower()))
|
||||
{
|
||||
underwaterTreeView.Nodes.Add((TreeNode)_node.Clone());
|
||||
underwaterTreeView.Nodes.Add((TreeNode)node.Clone());
|
||||
}
|
||||
}
|
||||
foreach (TreeNode _node in fogCache)
|
||||
foreach (TreeNode node in fogCache)
|
||||
{
|
||||
if (_node.Text.ToLower().Contains(metroTextBox1.Text.ToLower()))
|
||||
if (node.Text.ToLower().Contains(metroTextBox1.Text.ToLower()))
|
||||
{
|
||||
fogTreeView.Nodes.Add((TreeNode)_node.Clone());
|
||||
fogTreeView.Nodes.Add((TreeNode)node.Clone());
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (TreeNode _node in colorCache)
|
||||
foreach (TreeNode node in colorCache)
|
||||
{
|
||||
colorTreeView.Nodes.Add((TreeNode)_node.Clone());
|
||||
colorTreeView.Nodes.Add((TreeNode)node.Clone());
|
||||
}
|
||||
foreach (TreeNode _node in waterCache)
|
||||
foreach (TreeNode node in waterCache)
|
||||
{
|
||||
waterTreeView.Nodes.Add((TreeNode)_node.Clone());
|
||||
waterTreeView.Nodes.Add((TreeNode)node.Clone());
|
||||
}
|
||||
foreach (TreeNode _node in underwaterCache)
|
||||
foreach (TreeNode node in underwaterCache)
|
||||
{
|
||||
underwaterTreeView.Nodes.Add((TreeNode)_node.Clone());
|
||||
underwaterTreeView.Nodes.Add((TreeNode)node.Clone());
|
||||
}
|
||||
foreach (TreeNode _node in fogCache)
|
||||
foreach (TreeNode node in fogCache)
|
||||
{
|
||||
fogTreeView.Nodes.Add((TreeNode)_node.Clone());
|
||||
fogTreeView.Nodes.Add((TreeNode)node.Clone());
|
||||
}
|
||||
}
|
||||
//enables redrawing tree after all objects have been added
|
||||
|
||||
@@ -8,13 +8,16 @@ using System.Drawing.Drawing2D;
|
||||
using MetroFramework.Forms;
|
||||
|
||||
using PckStudio.Internal;
|
||||
using PckStudio.Extensions;
|
||||
using PckStudio.Internal.Skin;
|
||||
using PckStuido.ModelSupport.Extension;
|
||||
using PckStudio.Core.Skin;
|
||||
using PckStudio.Forms.Additional_Popups;
|
||||
using PckStudio.Properties;
|
||||
using System.Collections.Generic;
|
||||
using PckStudio.Internal.App;
|
||||
using PckStudio.Interfaces;
|
||||
using System.Text;
|
||||
using PckStudio.Core.Extensions;
|
||||
using PckStudio.ModelSupport;
|
||||
|
||||
namespace PckStudio.Forms.Editor
|
||||
{
|
||||
@@ -28,7 +31,7 @@ namespace PckStudio.Forms.Editor
|
||||
private BindingSource _skinPartListBindingSource;
|
||||
private BindingSource _skinOffsetListBindingSource;
|
||||
|
||||
private SettingsManager _settingsManager;
|
||||
private Core.App.SettingsManager _settingsManager;
|
||||
|
||||
private static GraphicsConfig _graphicsConfig = new GraphicsConfig()
|
||||
{
|
||||
@@ -36,6 +39,9 @@ namespace PckStudio.Forms.Editor
|
||||
PixelOffsetMode = PixelOffsetMode.HighQuality,
|
||||
};
|
||||
|
||||
private CustomSkinEditor() : this(null, null)
|
||||
{ }
|
||||
|
||||
public CustomSkinEditor(Skin skin, ISaveContext<Skin> saveContext, bool inflateOverlayParts = false, bool allowInflate = false)
|
||||
: base(skin, saveContext)
|
||||
{
|
||||
@@ -51,7 +57,7 @@ namespace PckStudio.Forms.Editor
|
||||
|
||||
private void InitializeRenderSettings()
|
||||
{
|
||||
_settingsManager = SettingsManager.CreateSettings();
|
||||
_settingsManager = Core.App.SettingsManager.CreateSettings();
|
||||
_settingsManager.AddSetting("shouldAnimate" , true , "Animate skin" , state => renderer3D1.Animate = state);
|
||||
_settingsManager.AddSetting("lockMouse" , true , "Lock mouse when paning/rotating", state => renderer3D1.LockMousePosition = state);
|
||||
_settingsManager.AddSetting("showGuidelines" , false, "Show guidelines" , state => renderer3D1.ShowGuideLines = state);
|
||||
@@ -289,11 +295,26 @@ namespace PckStudio.Forms.Editor
|
||||
{
|
||||
int scale = 1;
|
||||
renderer3D1.SelectedIndices = skinPartListBox.SelectedIndices.Cast<int>().ToArray();
|
||||
StringBuilder uv_sb = new StringBuilder();
|
||||
StringBuilder size_sb = new StringBuilder();
|
||||
StringBuilder pos_sb = new StringBuilder();
|
||||
foreach (SkinBOX b in skinPartListBox.SelectedItems.Cast<SkinBOX>())
|
||||
{
|
||||
uv_sb.Append(b.UV);
|
||||
uv_sb.Append(", ");
|
||||
size_sb.Append(b.Size);
|
||||
size_sb.Append(", ");
|
||||
pos_sb.Append(b.Pos);
|
||||
pos_sb.Append(", ");
|
||||
}
|
||||
|
||||
uvLabel.Text = $"UV: {uv_sb}";
|
||||
sizeLabel.Text = $"Size: {size_sb}";
|
||||
positionLabel.Text = $"Position: {pos_sb}";
|
||||
|
||||
// TODO: highlight all selected boxes
|
||||
if (skinPartListBox.SelectedItem is SkinBOX box)
|
||||
{
|
||||
uvLabel.Text = $"UV: {box.UV}";
|
||||
sizeLabel.Text = $"Size: {box.Size}";
|
||||
positionLabel.Text = $"Position: {box.Pos}";
|
||||
|
||||
Image uvArea = EditorValue.Texture.GetArea(Rectangle.Truncate(new RectangleF(box.UV.X, box.UV.Y, box.Size.X * 2 + box.Size.Z * 2, box.Size.Z + box.Size.Y)));
|
||||
|
||||
@@ -432,16 +453,20 @@ namespace PckStudio.Forms.Editor
|
||||
settingsForm.ShowDialog();
|
||||
}
|
||||
|
||||
private string SanitizeModelFilename(in string modelFilename)
|
||||
{
|
||||
return string.IsNullOrWhiteSpace(modelFilename) ? "template" : modelFilename.TrimEnd(new char[] { '\n', '\r' }).Replace(' ', '_');
|
||||
}
|
||||
|
||||
private void exportTemplateButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
Image templateTexture = Resources.classic_template;
|
||||
string templateFilename = "template";
|
||||
SkinAnimMask templateAnimMask = SkinAnimMask.RESOLUTION_64x64;
|
||||
|
||||
SaveFileDialog saveFileDialog = new SaveFileDialog();
|
||||
saveFileDialog.Title = "Save Template Model";
|
||||
saveFileDialog.Filter = SkinModelImporter.Default.SupportedModelFileFormatsFilter;
|
||||
saveFileDialog.FileName = templateFilename.TrimEnd(new char[] { '\n', '\r' }).Replace(' ', '_');
|
||||
saveFileDialog.FileName = SanitizeModelFilename(EditorValue.MetaData.Name);
|
||||
if (saveFileDialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
SkinModelInfo modelInfo = new SkinModelInfo(templateTexture, templateAnimMask, new SkinModel());
|
||||
|
||||
@@ -20,9 +20,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
using PckStudio.Forms.Additional_Popups.Grf;
|
||||
using PckStudio.Internal.Misc;
|
||||
using OMI.Formats.GameRule;
|
||||
using PckStudio.Properties;
|
||||
using PckStudio.ToolboxItems;
|
||||
using PckStudio.Internal;
|
||||
using PckStudio.Interfaces;
|
||||
|
||||
@@ -5,10 +5,8 @@ using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
using System.Windows.Forms;
|
||||
using PckStudio.Internal;
|
||||
using PckStudio.Internal.Misc;
|
||||
using PckStudio.Forms.Additional_Popups.Loc;
|
||||
using OMI.Formats.Languages;
|
||||
using PckStudio.Properties;
|
||||
using PckStudio.Interfaces;
|
||||
|
||||
namespace PckStudio.Forms.Editor
|
||||
|
||||
@@ -4,10 +4,11 @@ using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
using OMI.Formats.Material;
|
||||
using PckStudio.Internal;
|
||||
using PckStudio.Extensions;
|
||||
using PckStudio.Internal.Json;
|
||||
using PckStudio.Core.Extensions;
|
||||
using PckStudio.Core.Json;
|
||||
using PckStudio.Internal.App;
|
||||
using PckStudio.Interfaces;
|
||||
using PckStudio.Json;
|
||||
|
||||
namespace PckStudio.Forms.Editor
|
||||
{
|
||||
|
||||
@@ -12,10 +12,11 @@ using MetroFramework.Forms;
|
||||
|
||||
using PckStudio.Internal;
|
||||
using PckStudio.Interfaces;
|
||||
using PckStudio.Internal.Json;
|
||||
using PckStudio.Internal.App;
|
||||
using PckStudio.Extensions;
|
||||
using OMI.Formats.Material;
|
||||
using PckStudio.ModelSupport;
|
||||
using PckStudio.Core.Json;
|
||||
using PckStudio.Core.Extensions;
|
||||
using PckStudio.Internal.App;
|
||||
|
||||
namespace PckStudio.Forms.Editor
|
||||
{
|
||||
|
||||
@@ -188,7 +188,7 @@
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.selectTilePictureBox.BackColor = System.Drawing.Color.Transparent;
|
||||
this.selectTilePictureBox.BlendColor = System.Drawing.Color.White;
|
||||
this.selectTilePictureBox.BlendMode = PckStudio.Extensions.BlendMode.Multiply;
|
||||
this.selectTilePictureBox.BlendMode = PckStudio.Core.Extensions.BlendMode.Multiply;
|
||||
this.tableLayoutPanel1.SetColumnSpan(this.selectTilePictureBox, 2);
|
||||
this.selectTilePictureBox.Image = null;
|
||||
this.selectTilePictureBox.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.NearestNeighbor;
|
||||
|
||||
@@ -24,12 +24,13 @@ using System.Drawing.Imaging;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using OMI.Formats.Color;
|
||||
|
||||
using PckStudio.Extensions;
|
||||
using PckStudio.Core;
|
||||
using PckStudio.Core.Extensions;
|
||||
using PckStudio.Interfaces;
|
||||
using PckStudio.Internal;
|
||||
using PckStudio.Internal.Json;
|
||||
using OMI.Formats.Color;
|
||||
using PckStudio.Core.Json;
|
||||
using PckStudio.Json;
|
||||
|
||||
namespace PckStudio.Forms.Editor
|
||||
{
|
||||
|
||||
@@ -16,14 +16,14 @@
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
**/
|
||||
using System;
|
||||
using System.Xml;
|
||||
using System.IO;
|
||||
using System.Xml;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
using PckStudio.Extensions;
|
||||
using PckStudio.Internal.Misc;
|
||||
using System.Diagnostics;
|
||||
using System.Windows.Forms;
|
||||
using PckStudio.Core.Misc;
|
||||
using PckStudio.Properties;
|
||||
using PckStudio.Core.Extensions;
|
||||
|
||||
namespace PckStudio.Forms.Features
|
||||
{
|
||||
|
||||
@@ -2,13 +2,11 @@
|
||||
using OMI;
|
||||
using OMI.Formats.Pck;
|
||||
using OMI.Workers.Pck;
|
||||
using PckStudio.Extensions;
|
||||
using PckStudio.Core.Extensions;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
/* Copyright (c) 2023-present miku-666
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
* arising from the use of this software.
|
||||
*
|
||||
* Permission is granted to anyone to use this software for any purpose,
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
*
|
||||
* 1.The origin of this software must not be misrepresented; you must not
|
||||
* claim that you wrote the original software. If you use this software
|
||||
* in a product, an acknowledgment in the product documentation would be
|
||||
* appreciated but is not required.
|
||||
* 2. Altered source versions must be plainly marked as such, and must not be
|
||||
* misrepresented as being the original software.
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
**/
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace PckStudio.Internal.App
|
||||
{
|
||||
internal static class Profiler
|
||||
{
|
||||
private static Stopwatch _stopwatch = new Stopwatch();
|
||||
|
||||
[Conditional("DEBUG")]
|
||||
internal static void Start([CallerMemberName] string caller = default!, [CallerFilePath] string source = default!, [CallerLineNumber] int line = default!)
|
||||
{
|
||||
Debug.WriteLine($"Stopwatch starts", category: nameof(Profiler));
|
||||
Debug.WriteLine($"{source}@{caller}:{line}", category: nameof(Profiler));
|
||||
_stopwatch.Restart();
|
||||
}
|
||||
|
||||
[Conditional("DEBUG")]
|
||||
internal static void Stop([CallerMemberName] string caller = default!, [CallerFilePath] string source = default!, [CallerLineNumber] int line = default!)
|
||||
{
|
||||
_stopwatch.Stop();
|
||||
Debug.WriteLine($"{caller} took {_stopwatch.ElapsedMilliseconds}ms", category: nameof(Profiler));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -3,12 +3,13 @@ using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using PckStudio.Properties;
|
||||
using PckStudio.Extensions;
|
||||
using PckStudio.Core.Extensions;
|
||||
using System.Globalization;
|
||||
using PckStudio.Internal.Json;
|
||||
using PckStudio.Internal.Misc;
|
||||
using PckStudio.Core.Json;
|
||||
using PckStudio.Core.Misc;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using PckStudio.Json;
|
||||
|
||||
namespace PckStudio.Internal.App
|
||||
{
|
||||
@@ -25,30 +26,26 @@ namespace PckStudio.Internal.App
|
||||
|
||||
internal static void Initialize()
|
||||
{
|
||||
Profiler.Start();
|
||||
{
|
||||
_entityImages ??= Resources.entities_atlas.SplitHorizontal(32).ToArray();
|
||||
DataCacher ??= new FileCacher(Program.AppDataCache);
|
||||
_ = Tiles.JsonBlockData;
|
||||
_ = Tiles.JsonItemData;
|
||||
_ = Tiles.JsonParticleData;
|
||||
_ = Tiles.JsonMoonPhaseData;
|
||||
_ = Tiles.JsonExplosionData;
|
||||
_ = Tiles.JsonMapIconData;
|
||||
_ = Tiles.JsonExperienceOrbData;
|
||||
_ = Tiles.JsonPaintingData;
|
||||
_ = Tiles.BlockImageList;
|
||||
_ = Tiles.ItemImageList;
|
||||
_ = Tiles.ParticleImageList;
|
||||
_ = Tiles.ExplosionImageList;
|
||||
_ = Tiles.MapIconImageList;
|
||||
_ = Tiles.ExperienceOrbImageList;
|
||||
_ = Tiles.MoonPhaseImageList;
|
||||
_ = Tiles.PaintingImageList;
|
||||
CultureInfo.CurrentCulture = CultureInfo.InvariantCulture;
|
||||
Task.Run(GetContributors);
|
||||
}
|
||||
Profiler.Stop();
|
||||
_entityImages ??= Resources.entities_atlas.SplitHorizontal(32).ToArray();
|
||||
DataCacher ??= new FileCacher(Program.AppDataCache);
|
||||
_ = Tiles.JsonBlockData;
|
||||
_ = Tiles.JsonItemData;
|
||||
_ = Tiles.JsonParticleData;
|
||||
_ = Tiles.JsonMoonPhaseData;
|
||||
_ = Tiles.JsonExplosionData;
|
||||
_ = Tiles.JsonMapIconData;
|
||||
_ = Tiles.JsonExperienceOrbData;
|
||||
_ = Tiles.JsonPaintingData;
|
||||
_ = Tiles.BlockImageList;
|
||||
_ = Tiles.ItemImageList;
|
||||
_ = Tiles.ParticleImageList;
|
||||
_ = Tiles.ExplosionImageList;
|
||||
_ = Tiles.MapIconImageList;
|
||||
_ = Tiles.ExperienceOrbImageList;
|
||||
_ = Tiles.MoonPhaseImageList;
|
||||
_ = Tiles.PaintingImageList;
|
||||
CultureInfo.CurrentCulture = CultureInfo.InvariantCulture;
|
||||
Task.Run(GetContributors);
|
||||
}
|
||||
|
||||
internal static void GetContributors()
|
||||
@@ -4,12 +4,11 @@ using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using Newtonsoft.Json;
|
||||
using PckStudio.Extensions;
|
||||
using PckStudio.Properties;
|
||||
using PckStudio.Core.Json;
|
||||
|
||||
namespace PckStudio.Internal.Json
|
||||
namespace PckStudio.Json
|
||||
{
|
||||
internal class JsonEntities
|
||||
{
|
||||
@@ -4,7 +4,7 @@ using System.Diagnostics;
|
||||
using System.Windows.Forms;
|
||||
|
||||
using OMI.Formats.Pck;
|
||||
using PckStudio.Extensions;
|
||||
using PckStudio.Core.Extensions;
|
||||
|
||||
namespace PckStudio.Internal
|
||||
{
|
||||
|
||||
@@ -2,11 +2,10 @@
|
||||
using System.Diagnostics;
|
||||
using DiscordRPC;
|
||||
using PckStudio.Internal;
|
||||
using PckStudio.Properties;
|
||||
using DiscordRPC.Logging;
|
||||
using PckStudio.Internal.App;
|
||||
using PckStudio.Properties;
|
||||
|
||||
namespace PckStudio.Internal.Misc
|
||||
namespace PckStudio.Internal
|
||||
{
|
||||
// https://github.com/BullyWiiPlaza/Minecraft-Wii-U-Mod-Injector/blob/main/Minecraft%20Wii%20U%20Mod%20Injector/Helpers/DiscordRpc.cs
|
||||
static class RPC
|
||||
14
PCK-Studio/Internal/SettingsManager.cs
Normal file
14
PCK-Studio/Internal/SettingsManager.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using PckStudio.Properties;
|
||||
|
||||
namespace PckStudio.Internal
|
||||
{
|
||||
internal static class SettingsManager
|
||||
{
|
||||
internal static Core.App.SettingsManager Default { get; } = new Core.App.SettingsManager(Settings.Default, isReadOnly: true);
|
||||
}
|
||||
}
|
||||
@@ -2,14 +2,13 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using Newtonsoft.Json;
|
||||
using PckStudio.Extensions;
|
||||
using PckStudio.Core.Extensions;
|
||||
using PckStudio.Core.Json;
|
||||
using PckStudio.Properties;
|
||||
|
||||
namespace PckStudio.Internal.Json
|
||||
namespace PckStudio.Json
|
||||
{
|
||||
internal class JsonTiles
|
||||
{
|
||||
@@ -80,11 +79,11 @@ namespace PckStudio.Internal.Json
|
||||
|
||||
private static ImageList GetImageList(Image[] images)
|
||||
{
|
||||
ImageList _imageList = new ImageList();
|
||||
_imageList.ColorDepth = ColorDepth.Depth32Bit;
|
||||
_imageList.Images.AddRange(images);
|
||||
ImageList imageList = new ImageList();
|
||||
imageList.ColorDepth = ColorDepth.Depth32Bit;
|
||||
imageList.Images.AddRange(images);
|
||||
|
||||
return _imageList;
|
||||
return imageList;
|
||||
}
|
||||
|
||||
private static ImageList _blockImageList = GetImageList(BlockImages);
|
||||
@@ -14,15 +14,17 @@ using OMI.Workers.Language;
|
||||
using PckStudio.Properties;
|
||||
using PckStudio.Forms;
|
||||
using PckStudio.Forms.Additional_Popups;
|
||||
using PckStudio.Internal.Misc;
|
||||
using PckStudio.Core.Misc;
|
||||
using PckStudio.Forms.Features;
|
||||
using PckStudio.Extensions;
|
||||
using PckStudio.Core.Extensions;
|
||||
using PckStudio.Popups;
|
||||
using PckStudio.External.API.Miles;
|
||||
using PckStudio.Internal.App;
|
||||
using PckStudio.Interfaces;
|
||||
using PckStudio.Controls;
|
||||
using PckStudio.Internal;
|
||||
using PckStudio.Core;
|
||||
using PckStudio.Core.App;
|
||||
|
||||
namespace PckStudio
|
||||
{
|
||||
@@ -35,7 +37,7 @@ namespace PckStudio
|
||||
// 16777215 being the uint24 max value
|
||||
private const int MAX_PACK_ID = 16777215;
|
||||
|
||||
public MainForm()
|
||||
public MainForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
@@ -61,49 +63,30 @@ namespace PckStudio
|
||||
AddEditorPage(filepath);
|
||||
}
|
||||
|
||||
internal void OpenNewPckTab(string caption, string identifier, PckFile pckFile, ISaveContext<PckFile> saveContext)
|
||||
internal void OpenNewPckTab(string caption, string identifier, PackInfo packInfo, ISaveContext<PackInfo> saveContext)
|
||||
{
|
||||
if (openTabPages.ContainsKey(identifier))
|
||||
{
|
||||
tabControl.SelectTab(openTabPages[identifier]);
|
||||
return;
|
||||
}
|
||||
var editor = new PckEditor(pckFile, saveContext);
|
||||
var editor = new PckEditor(packInfo, saveContext);
|
||||
AddPage(caption, identifier, editor);
|
||||
}
|
||||
|
||||
private void AddEditorPage(string caption, string identifier, PckFile pck, OMI.Endianness endianness = OMI.Endianness.BigEndian, ISaveContext<PckFile> saveContext = null)
|
||||
private void AddEditorPage(string caption, string identifier, PackInfo packInfo, ISaveContext<PackInfo> saveContext = null)
|
||||
{
|
||||
saveContext ??= GetSaveContext("./new.pck", "PCK (Minecraft Console Package)", endianness);
|
||||
var editor = new PckEditor(pck, saveContext);
|
||||
AddPage(caption, identifier, editor);
|
||||
saveContext ??= GetDefaultSaveContext("./new.pck", "PCK (Minecraft Console Package)");
|
||||
var editor = new PckEditor(packInfo, saveContext);
|
||||
AddPage(caption, identifier, editor);
|
||||
}
|
||||
|
||||
|
||||
private PckFile ReadPck(string filePath, OMI.Endianness endianness)
|
||||
{
|
||||
var pckReader = new PckFileReader(endianness);
|
||||
return pckReader.FromFile(filePath);
|
||||
}
|
||||
|
||||
private class PackInfo
|
||||
{
|
||||
public static readonly PackInfo Empty = new PackInfo(default, default, default);
|
||||
public bool IsValid { get; }
|
||||
public PckFile File { get; }
|
||||
public OMI.Endianness Endianness { get; }
|
||||
|
||||
public bool AllowEndianSwap { get; }
|
||||
|
||||
public PackInfo(PckFile file, OMI.Endianness endianness, bool allowEndianSwap)
|
||||
{
|
||||
File = file;
|
||||
Endianness = endianness;
|
||||
AllowEndianSwap = allowEndianSwap;
|
||||
IsValid = file is not null && Enum.IsDefined(typeof(OMI.Endianness), endianness);
|
||||
}
|
||||
}
|
||||
|
||||
private bool TryOpenPck(string filepath, out PackInfo packInfo)
|
||||
{
|
||||
if (!File.Exists(filepath) || !filepath.EndsWith(".pck"))
|
||||
@@ -113,8 +96,9 @@ namespace PckStudio
|
||||
}
|
||||
try
|
||||
{
|
||||
PckFile pckFile = ReadPck(filepath, OMI.Endianness.BigEndian);
|
||||
packInfo = new PackInfo(pckFile, OMI.Endianness.BigEndian, true);
|
||||
OMI.Endianness endianness = OMI.Endianness.BigEndian;
|
||||
PckFile pckFile = ReadPck(filepath, endianness);
|
||||
packInfo = PackInfo.Create(pckFile, endianness, true);
|
||||
return packInfo.IsValid;
|
||||
}
|
||||
catch (OverflowException)
|
||||
@@ -122,8 +106,9 @@ namespace PckStudio
|
||||
try
|
||||
{
|
||||
// if failed, attempt again in the reverse. THEN throw an error if failed
|
||||
PckFile pckFile = ReadPck(filepath, OMI.Endianness.LittleEndian);
|
||||
packInfo = new PackInfo(pckFile, OMI.Endianness.LittleEndian, true);
|
||||
OMI.Endianness endianness = OMI.Endianness.LittleEndian;
|
||||
PckFile pckFile = ReadPck(filepath, endianness);
|
||||
packInfo = PackInfo.Create(pckFile, endianness, true);
|
||||
return packInfo.IsValid;
|
||||
}
|
||||
catch (OverflowException ex)
|
||||
@@ -145,6 +130,12 @@ namespace PckStudio
|
||||
|
||||
private void AddEditorPage(string filepath)
|
||||
{
|
||||
if (!File.Exists(filepath) && !filepath.EndsWith(".pck"))
|
||||
{
|
||||
Trace.TraceError($"[{nameof(AddEditorPage)}] Invalid filepath({filepath})");
|
||||
return;
|
||||
}
|
||||
|
||||
if (openTabPages.ContainsKey(filepath))
|
||||
{
|
||||
tabControl.SelectTab(openTabPages[filepath]);
|
||||
@@ -154,34 +145,36 @@ namespace PckStudio
|
||||
|
||||
if (TryOpenPck(filepath, out PackInfo packInfo))
|
||||
{
|
||||
ISaveContext<PckFile> saveContext = GetSaveContext(filepath, "PCK (Minecraft Console Package)", packInfo.Endianness);
|
||||
var editor = new PckEditor(packInfo.File, saveContext);
|
||||
ISaveContext<PackInfo> saveContext = GetDefaultSaveContext(filepath, "PCK (Minecraft Console Package)");
|
||||
var editor = new PckEditor(packInfo, saveContext);
|
||||
TabPage page = AddPage(Path.GetFileName(filepath), filepath, editor);
|
||||
return;
|
||||
}
|
||||
MessageBox.Show(string.Format("Failed to load {0}", Path.GetFileName(filepath)), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
|
||||
private ISaveContext<PckFile> GetSaveContext(string filepath, string description, OMI.Endianness endianness)
|
||||
private static ISaveContext<PackInfo> GetDefaultSaveContext(string filepath, string description)
|
||||
{
|
||||
return new DelegatedFileSaveContext<PckFile>(filepath, false, new FileDialogFilter(description, "*"+Path.GetExtension(filepath)),(pck, stream) => new PckFileWriter(pck, endianness).WriteToStream(stream));
|
||||
return new DelegatedFileSaveContext<PackInfo>(filepath, false, new FileDialogFilter(description, "*"+Path.GetExtension(filepath)),(packInfo, stream) => new PckFileWriter(packInfo.File, packInfo.Endianness).WriteToStream(stream));
|
||||
}
|
||||
|
||||
private TabPage AddPage(string caption, string identifier, Control control)
|
||||
{
|
||||
identifier ??= caption;
|
||||
if (openTabPages.ContainsKey(identifier))
|
||||
return openTabPages[identifier];
|
||||
control.Dock = DockStyle.Fill;
|
||||
var page = new TabPage(caption);
|
||||
page.Name = identifier;
|
||||
page.Controls.Add(control);
|
||||
tabControl.TabPages.Add(page);
|
||||
tabControl.SelectTab(page);
|
||||
if (!openTabPages.ContainsKey(identifier))
|
||||
openTabPages.Add(identifier, page);
|
||||
return page;
|
||||
}
|
||||
|
||||
private bool TryGetEditor(TabPage page, out IEditor<PckFile> editor)
|
||||
private bool TryGetEditor(TabPage page, out IEditor<PackInfo> editor)
|
||||
{
|
||||
if (page.Controls[0] is IEditor<PckFile> outEditor)
|
||||
if (page.Controls[0] is IEditor<PackInfo> outEditor)
|
||||
{
|
||||
editor = outEditor;
|
||||
return true;
|
||||
@@ -190,18 +183,10 @@ namespace PckStudio
|
||||
return false;
|
||||
}
|
||||
|
||||
private bool TryGetCurrentEditor(out IEditor<PckFile> editor) => TryGetEditor(tabControl.SelectedTab, out editor);
|
||||
private bool TryGetCurrentEditor(out IEditor<PackInfo> editor) => TryGetEditor(tabControl.SelectedTab, out editor);
|
||||
|
||||
private void MainForm_Load(object sender, EventArgs e)
|
||||
{
|
||||
//SettingsManager.Default.RegisterPropertyChangedCallback(nameof(Settings.Default.LoadSubPcks), () =>
|
||||
//{
|
||||
// if (TryGetCurrentEditor(out IEditor<PckFile> editor))
|
||||
// {
|
||||
// editor.UpdateView();
|
||||
// }
|
||||
// });
|
||||
|
||||
LoadRecentFileList();
|
||||
}
|
||||
|
||||
@@ -222,7 +207,7 @@ namespace PckStudio
|
||||
|
||||
private void CloseTab(TabControl.TabPageCollection collection, TabPage page)
|
||||
{
|
||||
if (TryGetEditor(page, out IEditor<PckFile> editor))
|
||||
if (TryGetEditor(page, out IEditor<PackInfo> editor))
|
||||
{
|
||||
editor.Close();
|
||||
RemoveOpenFile(page);
|
||||
@@ -237,10 +222,9 @@ namespace PckStudio
|
||||
|
||||
private void RemoveOpenFile(TabPage page)
|
||||
{
|
||||
KeyValuePair<string, TabPage> kv = openTabPages.FirstOrDefault((kv) => kv.Value == page);
|
||||
if (kv.Key != default)
|
||||
if (openTabPages.ContainsKey(page.Name))
|
||||
{
|
||||
openTabPages.Remove(kv.Key);
|
||||
openTabPages.Remove(page.Name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -264,7 +248,7 @@ namespace PckStudio
|
||||
{
|
||||
Settings.Default.RecentFiles.Clear();
|
||||
LoadRecentFileList();
|
||||
}
|
||||
}
|
||||
recentlyOpenToolStripMenuItem.DropDownItems.Add(new ToolStripSeparator());
|
||||
recentlyOpenToolStripMenuItem.DropDownItems.Add("Clear", null, clearRecentFileList);
|
||||
}
|
||||
@@ -325,7 +309,7 @@ namespace PckStudio
|
||||
|
||||
private void tabControl_PageClosing(object sender, PageClosingEventArgs e)
|
||||
{
|
||||
if (TryGetEditor(e.Page, out IEditor<PckFile> editor))
|
||||
if (TryGetEditor(e.Page, out IEditor<PackInfo> editor))
|
||||
{
|
||||
editor.Close();
|
||||
RemoveOpenFile();
|
||||
@@ -345,7 +329,7 @@ namespace PckStudio
|
||||
}
|
||||
}
|
||||
|
||||
private PckFile InitializePack(int packId, int packVersion, string packName, bool createSkinsPCK)
|
||||
private static PckFile InitializePack(int packId, int packVersion, string packName, bool createSkinsPCK)
|
||||
{
|
||||
var pack = new PckFile(3);
|
||||
|
||||
@@ -362,12 +346,14 @@ namespace PckStudio
|
||||
return pack;
|
||||
}
|
||||
|
||||
private PckFile InitializeTexturePack(int packId, int packVersion, string packName, string res, bool createSkinsPCK)
|
||||
private static PckFile InitializeTexturePack(int packId, int packVersion, string packName, string res, bool createSkinsPCK)
|
||||
{
|
||||
PckFile pack = InitializePack(packId, packVersion, packName, createSkinsPCK);
|
||||
|
||||
PckFile infoPCK = new PckFile(3);
|
||||
|
||||
pack.GetAsset("localisation.loc", PckAssetType.LocalisationFile).Filename = "languages.loc";
|
||||
|
||||
PckAsset iconAsset = infoPCK.CreateNewAsset("icon.png", PckAssetType.TextureFile);
|
||||
iconAsset.SetTexture(Resources.TexturePackIcon);
|
||||
|
||||
@@ -383,7 +369,7 @@ namespace PckStudio
|
||||
return pack;
|
||||
}
|
||||
|
||||
private PckFile InitializeMashUpPack(int packId, int packVersion, string packName, string res)
|
||||
private static PckFile InitializeMashUpPack(int packId, int packVersion, string packName, string res)
|
||||
{
|
||||
PckFile pack = InitializeTexturePack(packId, packVersion, packName, res, true);
|
||||
PckAsset gameRuleAsset = pack.CreateNewAsset("GameRules.grf", PckAssetType.GameRulesFile);
|
||||
@@ -415,7 +401,8 @@ namespace PckStudio
|
||||
if (namePrompt.ShowDialog(this) == DialogResult.OK)
|
||||
{
|
||||
PckFile skinPck = InitializePack(new Random().Next(8000, MAX_PACK_ID), 0, namePrompt.NewText, true);
|
||||
AddEditorPage("Unsaved skin pack", "Unsaved skin pack", skinPck);
|
||||
PackInfo packInfo = PackInfo.Create(skinPck, OMI.Endianness.BigEndian, true);
|
||||
AddEditorPage("Unsaved skin pack", "Unsaved skin pack", packInfo);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -425,7 +412,8 @@ namespace PckStudio
|
||||
if (packPrompt.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
PckFile texturePackPck = InitializeTexturePack(new Random().Next(8000, MAX_PACK_ID), 0, packPrompt.PackName, packPrompt.PackRes, packPrompt.CreateSkinsPck);
|
||||
AddEditorPage("Unsaved texture pack", "Unsaved texture pack", texturePackPck);
|
||||
PackInfo packInfo = PackInfo.Create(texturePackPck, OMI.Endianness.BigEndian, true);
|
||||
AddEditorPage("Unsaved texture pack", "Unsaved texture pack", packInfo);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -435,17 +423,17 @@ namespace PckStudio
|
||||
if (packPrompt.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
PckFile mashUpPck = InitializeMashUpPack(new Random().Next(8000, MAX_PACK_ID), 0, packPrompt.PackName, packPrompt.PackRes);
|
||||
AddEditorPage("Unsaved mash-up pack", "Unsaved mash-up pack", mashUpPck);
|
||||
PackInfo packInfo = PackInfo.Create(mashUpPck, OMI.Endianness.BigEndian, true);
|
||||
AddEditorPage("Unsaved mash-up pack", "Unsaved mash-up pack", packInfo);
|
||||
}
|
||||
}
|
||||
|
||||
private void quickChangeToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (TryGetCurrentEditor(out IEditor<PckFile> editor))
|
||||
if (TryGetCurrentEditor(out IEditor<PackInfo> editor))
|
||||
{
|
||||
using AdvancedOptions advanced = new AdvancedOptions(editor.EditorValue);
|
||||
// TODO:
|
||||
//advanced.IsLittleEndian = LittleEndianCheckBox.Checked;
|
||||
using AdvancedOptions advanced = new AdvancedOptions(editor.EditorValue.File);
|
||||
advanced.IsLittleEndian = editor.EditorValue.Endianness == OMI.Endianness.LittleEndian;
|
||||
if (advanced.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
editor.UpdateView();
|
||||
@@ -490,62 +478,31 @@ namespace PckStudio
|
||||
return true;
|
||||
}
|
||||
|
||||
private void howToMakeABasicSkinPackToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
Process.Start("https://www.youtube.com/watch?v=A43aHRHkKxk");
|
||||
}
|
||||
private void howToMakeABasicSkinPackToolStripMenuItem_Click(object sender, EventArgs e) => Process.Start("https://www.youtube.com/watch?v=A43aHRHkKxk");
|
||||
|
||||
private void howToMakeACustomSkinModelToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
Process.Start("https://www.youtube.com/watch?v=pEC_ug55lag");
|
||||
}
|
||||
private void howToMakeACustomSkinModelToolStripMenuItem_Click(object sender, EventArgs e) => Process.Start("https://www.youtube.com/watch?v=pEC_ug55lag");
|
||||
|
||||
private void howToMakeCustomSkinModelsbedrockToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
Process.Start("https://www.youtube.com/watch?v=6z8NTogw5x4");
|
||||
}
|
||||
private void howToMakeCustomSkinModelsbedrockToolStripMenuItem_Click(object sender, EventArgs e) => Process.Start("https://www.youtube.com/watch?v=6z8NTogw5x4");
|
||||
|
||||
private void howToMakeCustomMusicToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
Process.Start("https://www.youtube.com/watch?v=v6EYr4zc7rI");
|
||||
}
|
||||
private void howToMakeCustomMusicToolStripMenuItem_Click(object sender, EventArgs e) => Process.Start("https://www.youtube.com/watch?v=v6EYr4zc7rI");
|
||||
|
||||
private void howToInstallPcksDirectlyToWiiUToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
Process.Start("https://www.youtube.com/watch?v=hRQagnEplec");
|
||||
}
|
||||
private void howToInstallPcksDirectlyToWiiUToolStripMenuItem_Click(object sender, EventArgs e) => Process.Start("https://www.youtube.com/watch?v=hRQagnEplec");
|
||||
|
||||
private void pckCenterReleaseToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
Process.Start("https://www.youtube.com/watch?v=E_6bXSh6yqw");
|
||||
}
|
||||
private void pckCenterReleaseToolStripMenuItem_Click(object sender, EventArgs e) => Process.Start("https://www.youtube.com/watch?v=E_6bXSh6yqw");
|
||||
|
||||
private void howPCKsWorkToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
Process.Start("https://www.youtube.com/watch?v=hTlImrRrCKQ");
|
||||
}
|
||||
private void howPCKsWorkToolStripMenuItem_Click(object sender, EventArgs e) => Process.Start("https://www.youtube.com/watch?v=hTlImrRrCKQ");
|
||||
|
||||
private void toPhoenixARCDeveloperToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
Process.Start("https://cash.app/$PhoenixARC");
|
||||
}
|
||||
private void toPhoenixARCDeveloperToolStripMenuItem_Click(object sender, EventArgs e) => Process.Start("https://cash.app/$PhoenixARC");
|
||||
|
||||
private void toNobledezJackToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
Process.Start("https://www.paypal.me/realnobledez");
|
||||
}
|
||||
private void toNobledezJackToolStripMenuItem_Click(object sender, EventArgs e) => Process.Start("https://www.paypal.me/realnobledez");
|
||||
|
||||
private void forMattNLContributorToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
Process.Start("https://ko-fi.com/mattnl");
|
||||
}
|
||||
private void forMattNLContributorToolStripMenuItem_Click(object sender, EventArgs e) => Process.Start("https://ko-fi.com/mattnl");
|
||||
|
||||
private void joinDevelopmentDiscordToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
Process.Start("https://discord.gg/aJtZNFVQTv");
|
||||
}
|
||||
private void joinDevelopmentDiscordToolStripMenuItem_Click(object sender, EventArgs e) => Process.Start("https://discord.gg/aJtZNFVQTv");
|
||||
|
||||
private void OpenPck_MouseEnter(object sender, EventArgs e)
|
||||
private void trelloBoardToolStripMenuItem_Click(object sender, EventArgs e) => Process.Start("https://trello.com/b/0XLNOEbe/pck-studio");
|
||||
|
||||
private void OpenPck_MouseEnter(object sender, EventArgs e)
|
||||
{
|
||||
pckOpen.Image = Resources.pckOpen;
|
||||
}
|
||||
@@ -582,7 +539,7 @@ namespace PckStudio
|
||||
|
||||
private void saveToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (TryGetCurrentEditor(out IEditor<PckFile> editor))
|
||||
if (TryGetCurrentEditor(out IEditor<PackInfo> editor))
|
||||
{
|
||||
editor.Save();
|
||||
}
|
||||
@@ -590,17 +547,12 @@ namespace PckStudio
|
||||
|
||||
private void saveAsToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (TryGetCurrentEditor(out IEditor<PckFile> editor))
|
||||
if (TryGetCurrentEditor(out IEditor<PackInfo> editor))
|
||||
{
|
||||
editor.SaveAs();
|
||||
}
|
||||
}
|
||||
|
||||
private void trelloBoardToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
Process.Start("https://trello.com/b/0XLNOEbe/pck-studio");
|
||||
}
|
||||
|
||||
private void wavBinkaToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
using OpenFileDialog fileDialog = new OpenFileDialog
|
||||
@@ -646,9 +598,9 @@ namespace PckStudio
|
||||
|
||||
private void fullBoxSupportToolStripMenuItem_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (TryGetCurrentEditor(out IEditor<PckFile> editor))
|
||||
if (TryGetCurrentEditor(out IEditor<PackInfo> editor))
|
||||
{
|
||||
editor.EditorValue.SetVersion(fullBoxSupportToolStripMenuItem.Checked);
|
||||
editor.EditorValue.File.SetVersion(fullBoxSupportToolStripMenuItem.Checked);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -139,6 +139,12 @@
|
||||
<Compile Include="Controls\CustomTabControl.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Controls\EditorControl.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Controls\EditorForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Controls\PageClosingEventArgs.cs" />
|
||||
<Compile Include="Controls\PckEditor.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
@@ -146,12 +152,6 @@
|
||||
<Compile Include="Controls\PckEditor.Designer.cs">
|
||||
<DependentUpon>PckEditor.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Extensions\BoundingBoxExtensions.cs" />
|
||||
<Compile Include="Extensions\MaterialContainerExtensions.cs" />
|
||||
<Compile Include="Extensions\MaterialExtensions.cs" />
|
||||
<Compile Include="Extensions\ModelBoxExtension.cs" />
|
||||
<Compile Include="Extensions\PictureBoxExtensions.cs" />
|
||||
<Compile Include="Extensions\TreeViewExtensions.cs" />
|
||||
<Compile Include="Forms\Additional-Popups\FilterPrompt.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
@@ -164,112 +164,40 @@
|
||||
<Compile Include="Forms\ContributorsForm.Designer.cs">
|
||||
<DependentUpon>ContributorsForm.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Extensions\OpenTKExtensions.cs" />
|
||||
<Compile Include="Internal\DelegatedSaveContext.cs" />
|
||||
<Compile Include="Interfaces\IEditor.cs" />
|
||||
<Compile Include="Interfaces\ISaveContext.cs" />
|
||||
<Compile Include="Interfaces\ITryGetSet.cs" />
|
||||
<Compile Include="Forms\Editor\ModelEditor.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Forms\Editor\ModelEditor.Designer.cs">
|
||||
<DependentUpon>ModelEditor.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Interfaces\IModelImportProvider.cs" />
|
||||
<Compile Include="Internal\App\Updater.cs" />
|
||||
<Compile Include="Internal\EditorControl.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Internal\EditorForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Internal\DelegatedFileSaveContext.cs" />
|
||||
<Compile Include="Internal\GameModelInfo.cs" />
|
||||
<Compile Include="Internal\IO\PSM\PSMFileReader.cs" />
|
||||
<Compile Include="Internal\IO\PSM\PSMFileWriter.cs" />
|
||||
<Compile Include="Internal\GameConstants.cs" />
|
||||
<Compile Include="Internal\IO\TGA\TGADeserializer.cs" />
|
||||
<Compile Include="Internal\IO\TGA\TGASerializer.cs" />
|
||||
<Compile Include="Extensions\LocFileExtensions.cs" />
|
||||
<Compile Include="Extensions\PckAssetExtensions.cs" />
|
||||
<Compile Include="Extensions\CursorExtensions.cs" />
|
||||
<Compile Include="Extensions\SkinBOXExtensions.cs" />
|
||||
<Compile Include="Extensions\SkinExtensions.cs" />
|
||||
<Compile Include="Extensions\System.Numerics.cs" />
|
||||
<Compile Include="Extensions\TreeNodeExtensions.cs" />
|
||||
<Compile Include="External\Format\BedrockLegacyModel.cs" />
|
||||
<Compile Include="External\Format\BedrockModel.cs" />
|
||||
<Compile Include="Internal\FileDialogFilter.cs" />
|
||||
<Compile Include="Internal\Deserializer\ImageDeserializer.cs" />
|
||||
<Compile Include="Internal\Json\JsonDefaultModel.cs" />
|
||||
<Compile Include="Internal\Misc\RichPresenceClient.cs" />
|
||||
<Compile Include="Internal\GameModelImporter.cs" />
|
||||
<Compile Include="Internal\ModelImporter.cs" />
|
||||
<Compile Include="Internal\SkinModelImporter.cs" />
|
||||
<Compile Include="Internal\Json\JsonModelMetaData.cs" />
|
||||
<Compile Include="Internal\NamedTexture.cs" />
|
||||
<Compile Include="Internal\Json\UpdateInformation.cs" />
|
||||
<Compile Include="Internal\Serializer\AnimationSerializer.cs" />
|
||||
<Compile Include="Internal\Deserializer\AnimationDeserializer.cs" />
|
||||
<Compile Include="Interfaces\IPckAssetDeserializer.cs" />
|
||||
<Compile Include="Interfaces\IPckAssetSerializer.cs" />
|
||||
<Compile Include="Internal\Json\Entities.cs" />
|
||||
<Compile Include="Internal\Json\EntityInfo.cs" />
|
||||
<Compile Include="Internal\ResourceCategory.cs" />
|
||||
<Compile Include="Internal\App\CommitInfo.cs" />
|
||||
<Compile Include="External\Format\BlockBenchModel.cs" />
|
||||
<Compile Include="Internal\Skin\Skin.cs" />
|
||||
<Compile Include="Internal\Skin\SkinIdentifier.cs" />
|
||||
<Compile Include="Internal\Skin\SkinMetaData.cs" />
|
||||
<Compile Include="Internal\Skin\SkinModel.cs" />
|
||||
<Compile Include="Internal\Skin\SkinModelInfo.cs" />
|
||||
<Compile Include="Internal\Skin\SkinPartOffset.cs" />
|
||||
<Compile Include="Internal\ResourceLocation.cs" />
|
||||
<Compile Include="Internal\Serializer\ImageSerializer.cs" />
|
||||
<Compile Include="Internal\Skin\SkinAnimFlag.cs" />
|
||||
<Compile Include="Internal\Skin\SkinAnimMask.cs" />
|
||||
<Compile Include="Internal\ApplicationBuildInfo.cs" />
|
||||
<Compile Include="Internal\ApplicationScope.cs" />
|
||||
<Compile Include="Internal\CommitInfo.cs" />
|
||||
<Compile Include="Internal\Entities.cs" />
|
||||
<Compile Include="Internal\RichPresenceClient.cs" />
|
||||
<Compile Include="Internal\PckNodeSorter.cs" />
|
||||
<Compile Include="Internal\SettingsManager.cs" />
|
||||
<Compile Include="Internal\Tiles.cs" />
|
||||
<Compile Include="Properties\Resources.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Rendering\BoundingBox.cs" />
|
||||
<Compile Include="Rendering\Camera\Camera.cs" />
|
||||
<Compile Include="Rendering\Camera\PerspectiveCamera.cs" />
|
||||
<Compile Include="Rendering\Cube.cs" />
|
||||
<Compile Include="Rendering\CubeMesh.cs" />
|
||||
<Compile Include="Rendering\CubeMeshCollection.cs" />
|
||||
<Compile Include="Rendering\FrameBuffer.cs" />
|
||||
<Compile Include="Rendering\IndexBuffer.cs" />
|
||||
<Compile Include="Rendering\DrawContext.cs" />
|
||||
<Compile Include="Rendering\ColorVertex.cs" />
|
||||
<Compile Include="Rendering\ModelRenderer.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Rendering\ModelRenderer.Designer.cs">
|
||||
<DependentUpon>ModelRenderer.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Rendering\Renderer.cs" />
|
||||
<Compile Include="Rendering\GenericMesh.cs" />
|
||||
<Compile Include="Rendering\Shader\ShaderLibrary.cs" />
|
||||
<Compile Include="Rendering\Shader\ShaderProgram.cs" />
|
||||
<Compile Include="Rendering\Shader\ShaderObject.cs" />
|
||||
<Compile Include="Rendering\Shader\ShaderSource.cs" />
|
||||
<Compile Include="Rendering\SceneViewport.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Rendering\SkinRenderer.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Rendering\SkinRenderer.Designer.cs">
|
||||
<DependentUpon>SkinRenderer.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Rendering\Spherical.cs" />
|
||||
<Compile Include="Rendering\TextureChangingEventArgs.cs" />
|
||||
<Compile Include="Rendering\TextureVertex.cs" />
|
||||
<Compile Include="Rendering\Texture\CubeTexture.cs" />
|
||||
<Compile Include="Rendering\Texture\Texture.cs" />
|
||||
<Compile Include="Rendering\Texture\Texture2D.cs" />
|
||||
<Compile Include="Rendering\VertexArray.cs" />
|
||||
<Compile Include="Rendering\VertexBuffer.cs" />
|
||||
<Compile Include="Rendering\VertexBufferLayout.cs" />
|
||||
<Compile Include="ToolboxItems\BlendPictureBox.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
@@ -282,18 +210,10 @@
|
||||
<Compile Include="ToolboxItems\InterpolationPictureBox.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Rendering\SceneViewport.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="ToolboxItems\ToolStripRadioButtonMenuItem.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="External\API\Miles\BinkaConverter.cs" />
|
||||
<Compile Include="Extensions\AnimationExtensions.cs" />
|
||||
<Compile Include="Extensions\ImageLayoutDirection.cs" />
|
||||
<Compile Include="Extensions\ImageSection.cs" />
|
||||
<Compile Include="Extensions\ListExtensions.cs" />
|
||||
<Compile Include="Extensions\MathExtensions.cs" />
|
||||
<Compile Include="Forms\Additional-Popups\NumericPrompt.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
@@ -306,49 +226,19 @@
|
||||
<Compile Include="Forms\AppSettingsForm.Designer.cs">
|
||||
<DependentUpon>AppSettingsForm.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Internal\App\ApplicationBuildInfo.cs" />
|
||||
<Compile Include="Forms\Editor\TextureAtlasEditor.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Forms\Editor\TextureAtlasEditor.Designer.cs">
|
||||
<DependentUpon>TextureAtlasEditor.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Extensions\BlendMode.cs" />
|
||||
<Compile Include="Extensions\ColorExtensions.cs" />
|
||||
<Compile Include="Extensions\EnumerableExtensions.cs" />
|
||||
<Compile Include="Extensions\GraphicsExtensions.cs" />
|
||||
<Compile Include="Internal\FileFormats\PSMFile.cs" />
|
||||
<Compile Include="Internal\FileFormats\PckAudioFile.cs" />
|
||||
<Compile Include="External\API\Miles\Binka.cs" />
|
||||
<Compile Include="Internal\IO\3DST\3DSTextureReader.cs" />
|
||||
<Compile Include="Internal\IO\3DST\3DSTextureWriter.cs" />
|
||||
<Compile Include="Internal\IO\PckAudio\PckAudioFileReader.cs" />
|
||||
<Compile Include="Internal\IO\PckAudio\PckAudioFileWriter.cs" />
|
||||
<Compile Include="Internal\Misc\FileCacher.cs" />
|
||||
<Compile Include="Internal\Misc\OpenFolderDialog.cs" />
|
||||
<Compile Include="Internal\App\ApplicationScope.cs" />
|
||||
<Compile Include="Internal\Json\ColorEntry.cs" />
|
||||
<Compile Include="Internal\Json\TileInfo.cs" />
|
||||
<Compile Include="Internal\Json\Tiles.cs" />
|
||||
<Compile Include="Internal\App\Profiler.cs" />
|
||||
<Compile Include="Internal\App\SettingsManager.cs" />
|
||||
<Compile Include="Internal\Skin\SkinBOX.cs" />
|
||||
<Compile Include="Extensions\ImageExtensions.cs" />
|
||||
<Compile Include="Internal\Skin\SkinANIM.cs" />
|
||||
<Compile Include="Forms\Features\CemuPanel.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Forms\Features\CemuPanel.Designer.cs">
|
||||
<DependentUpon>CemuPanel.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Internal\IO\TGA\TGAFileData.cs" />
|
||||
<Compile Include="Internal\IO\TGA\TGADataTypeCode.cs" />
|
||||
<Compile Include="Internal\IO\TGA\TGAException.cs" />
|
||||
<Compile Include="Internal\IO\TGA\TGAExtentionData.cs" />
|
||||
<Compile Include="Internal\IO\TGA\TGAFooter.cs" />
|
||||
<Compile Include="Internal\IO\TGA\TGAHeader.cs" />
|
||||
<Compile Include="Internal\IO\TGA\TGAReader.cs" />
|
||||
<Compile Include="Internal\IO\TGA\TGAWriter.cs" />
|
||||
<Compile Include="Forms\Additional-Popups\EntityForms\AddEntry.cs" />
|
||||
<Compile Include="Forms\Additional-Popups\Loc\AddLanguage.cs">
|
||||
<SubType>Form</SubType>
|
||||
@@ -380,7 +270,6 @@
|
||||
<Compile Include="Forms\Additional-Popups\MultiTextPrompt.Designer.cs">
|
||||
<DependentUpon>MultiTextPrompt.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Internal\Animation.cs" />
|
||||
<Compile Include="ToolboxItems\AnimationPictureBox.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
@@ -505,10 +394,8 @@
|
||||
<Compile Include="Forms\Editor\AudioEditor.Designer.cs">
|
||||
<DependentUpon>AudioEditor.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Internal\PckNodeSorter.cs" />
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Internal\IO\3DST\TextureCodec.cs" />
|
||||
<EmbeddedResource Include="Controls\PckEditor.resx">
|
||||
<DependentUpon>PckEditor.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
@@ -771,17 +658,11 @@
|
||||
<PackageReference Include="AnimatedGif">
|
||||
<Version>1.0.5</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Autoupdater.NET.Official">
|
||||
<Version>1.9.2</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Costura.Fody">
|
||||
<Version>5.8.0-alpha0098</Version>
|
||||
<IncludeAssets>compile; runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="DiscordRichPresence">
|
||||
<Version>1.2.1.24</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="MetroFramework">
|
||||
<Version>1.2.0.3</Version>
|
||||
</PackageReference>
|
||||
@@ -803,12 +684,6 @@
|
||||
<PackageReference Include="Newtonsoft.Json">
|
||||
<Version>13.0.3</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="OpenTK">
|
||||
<Version>3.3.3</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="OpenTK.GLControl">
|
||||
<Version>3.3.3</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Octokit">
|
||||
<Version>13.0.1</Version>
|
||||
</PackageReference>
|
||||
@@ -826,6 +701,18 @@
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\PckStudio.Core\PckStudio.Core.csproj">
|
||||
<Project>{345eabed-f0d1-4d04-b409-babdef747352}</Project>
|
||||
<Name>PckStudio.Core</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\PckStudio.Rendering\PckStudio.Rendering.csproj">
|
||||
<Project>{b1e19d0f-6dd5-4d91-9b45-9818759ca8ef}</Project>
|
||||
<Name>PckStudio.Rendering</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\PckStuido.ModelSupport\PckStuido.ModelSupport.csproj">
|
||||
<Project>{43bcacd7-5405-4499-9b45-e1435ac03c26}</Project>
|
||||
<Name>PckStuido.ModelSupport</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Vendor\OMI-Lib\OMI Filetypes Library\OMI Filetype Library.csproj">
|
||||
<Project>{693AEBC1-293D-4DF0-BCAE-26A1099FE7BB}</Project>
|
||||
<Name>OMI Filetype Library</Name>
|
||||
|
||||
@@ -2,10 +2,11 @@
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Windows.Forms;
|
||||
using PckStudio.Internal.Misc;
|
||||
using PckStudio.Internal.App;
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
using PckStudio.Internal;
|
||||
using PckStudio.Core.App;
|
||||
using PckStudio.Properties;
|
||||
|
||||
|
||||
namespace PckStudio
|
||||
@@ -28,7 +29,7 @@ namespace PckStudio
|
||||
[STAThread]
|
||||
static void Main(string[] args)
|
||||
{
|
||||
Updater.Initialize(RawProjectUrl);
|
||||
Updater.Initialize(RawProjectUrl, Settings.Default.AutoUpdate);
|
||||
|
||||
ApplicationScope.Initialize();
|
||||
Trace.TraceInformation("Startup");
|
||||
|
||||
57
PCK-Studio/Properties/Resources.Designer.cs
generated
57
PCK-Studio/Properties/Resources.Designer.cs
generated
@@ -316,29 +316,6 @@ namespace PckStudio.Properties {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to {
|
||||
/// "bat": {
|
||||
/// "textureSize": { "X": 64, "Y": 64 },
|
||||
/// "parts": [
|
||||
/// {
|
||||
/// "name": "head",
|
||||
/// "boxes": [
|
||||
/// { "pos": { "X": -3, "Y": -3, "Z": -3 }, "size": { "X": 6, "Y": 6, "Z": 6 }, "uv": { "X": 0, "Y": 0 } }
|
||||
/// ]
|
||||
/// },
|
||||
/// {
|
||||
/// "name": "body",
|
||||
/// "boxes": [
|
||||
/// { "pos": { "X": -3, "Y": 4, "Z": -3 }, "size": { "X": 6, "Y": 12, "Z": 6 }, "uv": { "X": 0, "Y": 16 } },
|
||||
/// { "pos": { "X": -5, "Y": 16, "Z": 0 }, "size": { "X": 10, "Y": 6, "Z": [rest of string was truncated]";.
|
||||
/// </summary>
|
||||
public static string defaultModels {
|
||||
get {
|
||||
return ResourceManager.GetString("defaultModels", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
@@ -837,40 +814,6 @@ namespace PckStudio.Properties {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to {
|
||||
/// "bat": {
|
||||
/// "textureLocations": [
|
||||
/// "res/mob/bat"
|
||||
/// ],
|
||||
/// "materialName": "bat",
|
||||
/// "parts": [
|
||||
/// {
|
||||
/// "name": "head",
|
||||
/// "children": [
|
||||
/// { "name": "rightEar" },
|
||||
/// { "name": "leftEar" }
|
||||
/// ]
|
||||
/// },
|
||||
/// {
|
||||
/// "name": "body",
|
||||
/// "children": [
|
||||
/// {
|
||||
/// "name": "rightWing",
|
||||
/// "children": [
|
||||
/// { "name": "rightWingTip" }
|
||||
/// ]
|
||||
/// },
|
||||
/// {
|
||||
/// "name": "leftWing",
|
||||
/// [rest of string was truncated]";.
|
||||
/// </summary>
|
||||
public static string modelMetaData {
|
||||
get {
|
||||
return ResourceManager.GetString("modelMetaData", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
|
||||
@@ -286,9 +286,6 @@
|
||||
<data name="GRF_ICON" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\iconImageList\GRF ICON.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="defaultModels" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\model\defaultModels.json;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value>
|
||||
</data>
|
||||
<data name="experience_orbs_atlas" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\atlases\experience_orbs.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
@@ -334,9 +331,6 @@
|
||||
<data name="INFO_ICON" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\iconImageList\INFO ICON.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="modelMetaData" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\model\modelMetaData.json;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;iso-8859-1</value>
|
||||
</data>
|
||||
<data name="file_paste" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\icons\file_paste.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
|
||||
@@ -1,84 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using PckStudio.Extensions;
|
||||
|
||||
namespace PckStudio.Rendering
|
||||
{
|
||||
internal struct BoundingBox
|
||||
{
|
||||
public static BoundingBox Empty = new BoundingBox(OpenTK.Vector3.Zero, OpenTK.Vector3.Zero);
|
||||
|
||||
public readonly OpenTK.Vector3 Start;
|
||||
public readonly OpenTK.Vector3 End;
|
||||
public readonly OpenTK.Vector3 Center;
|
||||
public readonly OpenTK.Vector3 Volume;
|
||||
|
||||
public BoundingBox(OpenTK.Vector3 start, OpenTK.Vector3 end)
|
||||
{
|
||||
Start = start;
|
||||
End = end;
|
||||
OpenTK.Vector3 size = End - Start;
|
||||
Volume = OpenTKExtensions.Abs(size);
|
||||
Center = start + Volume / 2;
|
||||
}
|
||||
|
||||
public BoundingBox(System.Numerics.Vector3 start, System.Numerics.Vector3 end)
|
||||
: this(start.ToOpenTKVector(), end.ToOpenTKVector())
|
||||
{
|
||||
}
|
||||
|
||||
public OpenTK.Matrix4 GetTransform()
|
||||
{
|
||||
return OpenTK.Matrix4.CreateScale(Volume) * OpenTK.Matrix4.CreateTranslation(Start);
|
||||
}
|
||||
|
||||
private static readonly ColorVertex[] _vertices = [
|
||||
new ColorVertex(new OpenTK.Vector3(0f, 1f, 1f)),
|
||||
new ColorVertex(new OpenTK.Vector3(1f, 1f, 1f)),
|
||||
new ColorVertex(new OpenTK.Vector3(1f, 0f, 1f)),
|
||||
new ColorVertex(new OpenTK.Vector3(0f, 0f, 1f)),
|
||||
new ColorVertex(new OpenTK.Vector3(0f, 1f, 0f)),
|
||||
new ColorVertex(new OpenTK.Vector3(1f, 1f, 0f)),
|
||||
new ColorVertex(new OpenTK.Vector3(1f, 0f, 0f)),
|
||||
new ColorVertex(new OpenTK.Vector3(0f, 0f, 0f)),
|
||||
];
|
||||
|
||||
private static readonly int[] _indecies = [
|
||||
0, 1,
|
||||
1, 2,
|
||||
2, 3,
|
||||
3, 0,
|
||||
|
||||
4, 5,
|
||||
5, 6,
|
||||
6, 7,
|
||||
7, 4,
|
||||
|
||||
0, 4,
|
||||
1, 5,
|
||||
2, 6,
|
||||
3, 7
|
||||
];
|
||||
|
||||
public static ColorVertex[] GetVertices()
|
||||
{
|
||||
return _vertices;
|
||||
//OpenTK.Vector3 s = Start; // 0, 0, 0
|
||||
//OpenTK.Vector3 e = End; // 1, 1, 1
|
||||
//return [
|
||||
// new ColorVertex(new OpenTK.Vector3(s.X, e.Y, e.Z)),
|
||||
// new ColorVertex(new OpenTK.Vector3(e.X, e.Y, e.Z)),
|
||||
// new ColorVertex(new OpenTK.Vector3(e.X, s.Y, e.Z)),
|
||||
// new ColorVertex(new OpenTK.Vector3(s.X, s.Y, e.Z)),
|
||||
// new ColorVertex(new OpenTK.Vector3(s.X, e.Y, s.Z)),
|
||||
// new ColorVertex(new OpenTK.Vector3(e.X, e.Y, s.Z)),
|
||||
// new ColorVertex(new OpenTK.Vector3(e.X, s.Y, s.Z)),
|
||||
// new ColorVertex(new OpenTK.Vector3(s.X, s.Y, s.Z)),
|
||||
//];
|
||||
}
|
||||
|
||||
public static int[] GetIndecies() => _indecies;
|
||||
}
|
||||
}
|
||||
@@ -11,13 +11,14 @@ using OMI.Formats.Material;
|
||||
using OMI.Formats.Model;
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics.OpenGL;
|
||||
using PckStudio.Extensions;
|
||||
using PckStudio.Core.Extensions;
|
||||
using PckStudio.Interfaces;
|
||||
using PckStudio.Internal;
|
||||
using PckStudio.Internal.Json;
|
||||
using PckStudio.Core.Json;
|
||||
using PckStudio.Properties;
|
||||
using PckStudio.Rendering.Shader;
|
||||
using PckStudio.Rendering.Texture;
|
||||
using PckStudio.Core;
|
||||
using PckStudio.ModelSupport;
|
||||
|
||||
namespace PckStudio.Rendering
|
||||
{
|
||||
|
||||
@@ -36,8 +36,9 @@ using System.Windows.Forms;
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
using OpenTK.Graphics.OpenGL;
|
||||
using PckStudio.Extensions;
|
||||
using PckStudio.Core.Extensions;
|
||||
using PckStudio.Properties;
|
||||
using PckStudio.Rendering;
|
||||
using PckStudio.Rendering.Camera;
|
||||
using PckStudio.Rendering.Shader;
|
||||
|
||||
@@ -173,8 +174,8 @@ namespace PckStudio.Rendering
|
||||
layout.Add(ShaderDataType.Float3);
|
||||
layout.Add(ShaderDataType.Float4);
|
||||
int id = vao.AddNewBuffer(layout);
|
||||
vao.GetBuffer(id).SetData(BoundingBox.GetVertices());
|
||||
var ibo = IndexBuffer.Create(BoundingBox.GetIndecies());
|
||||
vao.GetBuffer(id).SetData(Addon.BoundingBox.GetVertices());
|
||||
var ibo = IndexBuffer.Create(Addon.BoundingBox.GetIndecies());
|
||||
_boundingBoxDrawContext = new DrawContext(vao, ibo, PrimitiveType.Lines);
|
||||
|
||||
_meshTypeVertexArray = new Dictionary<Type, VertexArray>();
|
||||
@@ -267,7 +268,7 @@ namespace PckStudio.Rendering
|
||||
Renderer.Draw(shader, drawContext);
|
||||
}
|
||||
|
||||
protected void DrawBoundingBox(Matrix4 transform, BoundingBox boundingBox, Color color)
|
||||
protected void DrawBoundingBox(Matrix4 transform, Core.BoundingBox boundingBox, Color color)
|
||||
{
|
||||
ShaderProgram colorShader = _shaderLibrary.GetShader("Internal_colorShader");
|
||||
colorShader.Bind();
|
||||
|
||||
@@ -20,7 +20,7 @@ using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using OpenTK;
|
||||
using PckStudio.Internal;
|
||||
using PckStudio.Extensions;
|
||||
using PckStudio.Core.Extensions;
|
||||
using OpenTK.Graphics.OpenGL;
|
||||
using System.Windows.Forms;
|
||||
using System.ComponentModel;
|
||||
@@ -30,10 +30,12 @@ using System.Collections.ObjectModel;
|
||||
using System.Collections.Specialized;
|
||||
using System.Drawing.Imaging;
|
||||
using System.IO;
|
||||
using PckStudio.Rendering.Extension;
|
||||
using PckStudio.Rendering.Texture;
|
||||
using PckStudio.Rendering.Shader;
|
||||
using System.Linq;
|
||||
using PckStudio.Internal.Skin;
|
||||
using PckStudio.Core.Skin;
|
||||
using PckStudio.Core;
|
||||
|
||||
namespace PckStudio.Rendering
|
||||
{
|
||||
@@ -499,8 +501,8 @@ namespace PckStudio.Rendering
|
||||
void AddOutline(BoundingBox boundingBox, ref List<ColorVertex> vertices, ref List<int> indices)
|
||||
{
|
||||
int offset = vertices.Count;
|
||||
vertices.AddRange(BoundingBox.GetVertices().Select(vert => new ColorVertex(Vector3.TransformPosition(vert.Position, boundingBox.GetTransform()), vert.Color)));
|
||||
indices.AddRange(BoundingBox.GetIndecies().Select(i => i + offset));
|
||||
vertices.AddRange(Addon.BoundingBox.GetVertices().Select(vert => new ColorVertex(Vector3.TransformPosition(vert.Position, boundingBox.GetTransform()), vert.Color)));
|
||||
indices.AddRange(Addon.BoundingBox.GetIndecies().Select(i => i + offset));
|
||||
}
|
||||
|
||||
List<ColorVertex> vertices = new List<ColorVertex>(8 * 6);
|
||||
|
||||
@@ -16,14 +16,10 @@
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
**/
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Windows.Forms;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
using PckStudio.Extensions;
|
||||
using PckStudio.Internal;
|
||||
using PckStudio.Core.Extensions;
|
||||
using System.Drawing;
|
||||
using AnimatedGif;
|
||||
using System.Drawing.Imaging;
|
||||
|
||||
namespace PckStudio.ToolboxItems
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using PckStudio.Extensions;
|
||||
using PckStudio.Core.Extensions;
|
||||
|
||||
namespace PckStudio.ToolboxItems
|
||||
{
|
||||
|
||||
@@ -11,6 +11,12 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OMI Filetype Library", "Ven
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SharpMss32", "Vendor\SharpMss32\SharpMss32\SharpMss32.csproj", "{E8D0B671-3AB1-48B6-A767-58DF67BD5D11}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PckStudio.Rendering", "PckStudio.Rendering\PckStudio.Rendering.csproj", "{B1E19D0F-6DD5-4D91-9B45-9818759CA8EF}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PckStudio.Core", "PckStudio.Core\PckStudio.Core.csproj", "{345EABED-F0D1-4D04-B409-BABDEF747352}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PckStuido.ModelSupport", "PckStuido.ModelSupport\PckStuido.ModelSupport.csproj", "{43BCACD7-5405-4499-9B45-E1435AC03C26}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Beta|Any CPU = Beta|Any CPU
|
||||
@@ -78,6 +84,60 @@ Global
|
||||
{E8D0B671-3AB1-48B6-A767-58DF67BD5D11}.Release|x64.Build.0 = Release|Any CPU
|
||||
{E8D0B671-3AB1-48B6-A767-58DF67BD5D11}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{E8D0B671-3AB1-48B6-A767-58DF67BD5D11}.Release|x86.Build.0 = Release|Any CPU
|
||||
{B1E19D0F-6DD5-4D91-9B45-9818759CA8EF}.Beta|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{B1E19D0F-6DD5-4D91-9B45-9818759CA8EF}.Beta|Any CPU.Build.0 = Debug|Any CPU
|
||||
{B1E19D0F-6DD5-4D91-9B45-9818759CA8EF}.Beta|x64.ActiveCfg = Debug|Any CPU
|
||||
{B1E19D0F-6DD5-4D91-9B45-9818759CA8EF}.Beta|x64.Build.0 = Debug|Any CPU
|
||||
{B1E19D0F-6DD5-4D91-9B45-9818759CA8EF}.Beta|x86.ActiveCfg = Debug|Any CPU
|
||||
{B1E19D0F-6DD5-4D91-9B45-9818759CA8EF}.Beta|x86.Build.0 = Debug|Any CPU
|
||||
{B1E19D0F-6DD5-4D91-9B45-9818759CA8EF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{B1E19D0F-6DD5-4D91-9B45-9818759CA8EF}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{B1E19D0F-6DD5-4D91-9B45-9818759CA8EF}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{B1E19D0F-6DD5-4D91-9B45-9818759CA8EF}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{B1E19D0F-6DD5-4D91-9B45-9818759CA8EF}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{B1E19D0F-6DD5-4D91-9B45-9818759CA8EF}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{B1E19D0F-6DD5-4D91-9B45-9818759CA8EF}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{B1E19D0F-6DD5-4D91-9B45-9818759CA8EF}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{B1E19D0F-6DD5-4D91-9B45-9818759CA8EF}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{B1E19D0F-6DD5-4D91-9B45-9818759CA8EF}.Release|x64.Build.0 = Release|Any CPU
|
||||
{B1E19D0F-6DD5-4D91-9B45-9818759CA8EF}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{B1E19D0F-6DD5-4D91-9B45-9818759CA8EF}.Release|x86.Build.0 = Release|Any CPU
|
||||
{345EABED-F0D1-4D04-B409-BABDEF747352}.Beta|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{345EABED-F0D1-4D04-B409-BABDEF747352}.Beta|Any CPU.Build.0 = Debug|Any CPU
|
||||
{345EABED-F0D1-4D04-B409-BABDEF747352}.Beta|x64.ActiveCfg = Debug|Any CPU
|
||||
{345EABED-F0D1-4D04-B409-BABDEF747352}.Beta|x64.Build.0 = Debug|Any CPU
|
||||
{345EABED-F0D1-4D04-B409-BABDEF747352}.Beta|x86.ActiveCfg = Debug|Any CPU
|
||||
{345EABED-F0D1-4D04-B409-BABDEF747352}.Beta|x86.Build.0 = Debug|Any CPU
|
||||
{345EABED-F0D1-4D04-B409-BABDEF747352}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{345EABED-F0D1-4D04-B409-BABDEF747352}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{345EABED-F0D1-4D04-B409-BABDEF747352}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{345EABED-F0D1-4D04-B409-BABDEF747352}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{345EABED-F0D1-4D04-B409-BABDEF747352}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{345EABED-F0D1-4D04-B409-BABDEF747352}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{345EABED-F0D1-4D04-B409-BABDEF747352}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{345EABED-F0D1-4D04-B409-BABDEF747352}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{345EABED-F0D1-4D04-B409-BABDEF747352}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{345EABED-F0D1-4D04-B409-BABDEF747352}.Release|x64.Build.0 = Release|Any CPU
|
||||
{345EABED-F0D1-4D04-B409-BABDEF747352}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{345EABED-F0D1-4D04-B409-BABDEF747352}.Release|x86.Build.0 = Release|Any CPU
|
||||
{43BCACD7-5405-4499-9B45-E1435AC03C26}.Beta|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{43BCACD7-5405-4499-9B45-E1435AC03C26}.Beta|Any CPU.Build.0 = Debug|Any CPU
|
||||
{43BCACD7-5405-4499-9B45-E1435AC03C26}.Beta|x64.ActiveCfg = Debug|Any CPU
|
||||
{43BCACD7-5405-4499-9B45-E1435AC03C26}.Beta|x64.Build.0 = Debug|Any CPU
|
||||
{43BCACD7-5405-4499-9B45-E1435AC03C26}.Beta|x86.ActiveCfg = Debug|Any CPU
|
||||
{43BCACD7-5405-4499-9B45-E1435AC03C26}.Beta|x86.Build.0 = Debug|Any CPU
|
||||
{43BCACD7-5405-4499-9B45-E1435AC03C26}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{43BCACD7-5405-4499-9B45-E1435AC03C26}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{43BCACD7-5405-4499-9B45-E1435AC03C26}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{43BCACD7-5405-4499-9B45-E1435AC03C26}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{43BCACD7-5405-4499-9B45-E1435AC03C26}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{43BCACD7-5405-4499-9B45-E1435AC03C26}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{43BCACD7-5405-4499-9B45-E1435AC03C26}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{43BCACD7-5405-4499-9B45-E1435AC03C26}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{43BCACD7-5405-4499-9B45-E1435AC03C26}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{43BCACD7-5405-4499-9B45-E1435AC03C26}.Release|x64.Build.0 = Release|Any CPU
|
||||
{43BCACD7-5405-4499-9B45-E1435AC03C26}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{43BCACD7-5405-4499-9B45-E1435AC03C26}.Release|x86.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
||||
@@ -18,13 +18,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using PckStudio.Extensions;
|
||||
using PckStudio.Core.Extensions;
|
||||
using System.Text;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace PckStudio.Internal
|
||||
namespace PckStudio.Core
|
||||
{
|
||||
public sealed class Animation
|
||||
{
|
||||
@@ -167,7 +166,7 @@ namespace PckStudio.Internal
|
||||
SetFrame(frameIndex, new Frame(_textures[textureIndex], frameTime));
|
||||
}
|
||||
|
||||
internal void SetFrameTicks(int ticks)
|
||||
public void SetFrameTicks(int ticks)
|
||||
{
|
||||
lock(_syncLock)
|
||||
{
|
||||
@@ -178,7 +177,7 @@ namespace PckStudio.Internal
|
||||
}
|
||||
}
|
||||
|
||||
internal void SwapFrames(int sourceIndex, int destinationIndex)
|
||||
public void SwapFrames(int sourceIndex, int destinationIndex)
|
||||
{
|
||||
lock(_syncLock)
|
||||
{
|
||||
@@ -186,7 +185,7 @@ namespace PckStudio.Internal
|
||||
}
|
||||
}
|
||||
|
||||
internal static Animation CreateEmpty()
|
||||
public static Animation CreateEmpty()
|
||||
{
|
||||
return new Animation(Array.Empty<Image>());
|
||||
}
|
||||
@@ -19,17 +19,14 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Configuration;
|
||||
using PckStudio.Properties;
|
||||
|
||||
namespace PckStudio.Internal.App
|
||||
namespace PckStudio.Core.App
|
||||
{
|
||||
internal sealed class SettingsManager
|
||||
public sealed class SettingsManager
|
||||
{
|
||||
public static SettingsManager Default { get; } = new SettingsManager(Settings.Default, isReadOnly: true);
|
||||
|
||||
public bool IsReadOnly => _isReadOnly;
|
||||
|
||||
internal const string KeyToStringContextKeyConst = "keyToString";
|
||||
public const string KeyToStringContextKeyConst = "keyToString";
|
||||
|
||||
private Dictionary<string, Action<object>> _registery = new Dictionary<string, Action<object>>();
|
||||
|
||||
@@ -40,7 +37,7 @@ namespace PckStudio.Internal.App
|
||||
private class InternalSettings : ApplicationSettingsBase
|
||||
{ }
|
||||
|
||||
internal SettingsManager(ApplicationSettingsBase settings, bool isReadOnly = false)
|
||||
public SettingsManager(ApplicationSettingsBase settings, bool isReadOnly = false)
|
||||
{
|
||||
_settings = settings;
|
||||
_isReadOnly = isReadOnly;
|
||||
@@ -48,14 +45,14 @@ namespace PckStudio.Internal.App
|
||||
settings.SettingChanging += SettingChangingHandler;
|
||||
}
|
||||
|
||||
internal ApplicationSettingsBase GetSettings() => _settings;
|
||||
public ApplicationSettingsBase GetSettings() => _settings;
|
||||
|
||||
internal static SettingsManager CreateSettings()
|
||||
public static SettingsManager CreateSettings()
|
||||
{
|
||||
return new SettingsManager(new InternalSettings());
|
||||
}
|
||||
|
||||
internal bool RegisterPropertyChangedCallback<TSettingsType>(string propertyName, Action<TSettingsType> callback)
|
||||
public bool RegisterPropertyChangedCallback<TSettingsType>(string propertyName, Action<TSettingsType> callback)
|
||||
{
|
||||
Type propertyType = _settings[propertyName].GetType();
|
||||
if (!propertyType.Equals(typeof(TSettingsType)))
|
||||
@@ -65,7 +62,7 @@ namespace PckStudio.Internal.App
|
||||
return RegisterPropertyChangedCallback(propertyName, delegate (object obj) { callback((TSettingsType)obj); });
|
||||
}
|
||||
|
||||
internal bool RegisterPropertyChangedCallback(string propertyName, Action callback)
|
||||
public bool RegisterPropertyChangedCallback(string propertyName, Action callback)
|
||||
{
|
||||
return RegisterPropertyChangedCallback(propertyName, delegate (object _) { callback(); });
|
||||
}
|
||||
@@ -95,7 +92,7 @@ namespace PckStudio.Internal.App
|
||||
}
|
||||
}
|
||||
|
||||
internal bool AddSetting<T>(string name, T initialValue, string description, Action<T> callback)
|
||||
public bool AddSetting<T>(string name, T initialValue, string description, Action<T> callback)
|
||||
{
|
||||
if (_isReadOnly)
|
||||
throw new SettingsPropertyIsReadOnlyException("Can't add setting. Underlying SettingsBase is readonly.");
|
||||
@@ -3,18 +3,19 @@ using System.IO;
|
||||
using System.Windows.Forms;
|
||||
using AutoUpdaterDotNET;
|
||||
using Newtonsoft.Json;
|
||||
using PckStudio.Internal.Json;
|
||||
using PckStudio.Properties;
|
||||
using PckStudio.Core.Json;
|
||||
|
||||
namespace PckStudio.Internal.App
|
||||
namespace PckStudio.Core.App
|
||||
{
|
||||
internal static class Updater
|
||||
public static class Updater
|
||||
{
|
||||
private static Uri _appCast;
|
||||
private static bool _autoUpdate;
|
||||
|
||||
internal static void Initialize(Uri appCast)
|
||||
public static void Initialize(Uri appCast, bool autoUpdate = false)
|
||||
{
|
||||
_appCast = appCast;
|
||||
_autoUpdate = autoUpdate;
|
||||
//AutoUpdater.ClearAppDirectory = true;
|
||||
#if DEBUG
|
||||
AutoUpdater.ReportErrors = true;
|
||||
@@ -26,17 +27,17 @@ namespace PckStudio.Internal.App
|
||||
string jsonPath = Path.Combine(Environment.CurrentDirectory, "updates.json");
|
||||
AutoUpdater.PersistenceProvider = new JsonFilePersistenceProvider(jsonPath);
|
||||
AutoUpdater.ParseUpdateInfoEvent += AutoUpdaterOnParseUpdateInfoEvent;
|
||||
AutoUpdater.Icon = Resources.ProjectLogo.ToBitmap();
|
||||
//AutoUpdater.Icon = Resources.ProjectLogo.ToBitmap();
|
||||
|
||||
if (Settings.Default.AutoUpdate)
|
||||
if (_autoUpdate)
|
||||
{
|
||||
UpdateToLatest();
|
||||
}
|
||||
}
|
||||
|
||||
internal static void SetOwner(Form owner) => AutoUpdater.SetOwner(owner);
|
||||
public static void SetOwner(Form owner) => AutoUpdater.SetOwner(owner);
|
||||
|
||||
internal static void UpdateToLatest()
|
||||
public static void UpdateToLatest()
|
||||
{
|
||||
#if NDEBUG
|
||||
string url = $"{_appCast}/main/Version.json";
|
||||
37
PckStudio.Core/BoundingBox.cs
Normal file
37
PckStudio.Core/BoundingBox.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using PckStudio.Core.Extensions;
|
||||
|
||||
namespace PckStudio.Core
|
||||
{
|
||||
public struct BoundingBox
|
||||
{
|
||||
public static BoundingBox Empty = new BoundingBox(OpenTK.Vector3.Zero, OpenTK.Vector3.Zero);
|
||||
|
||||
public readonly OpenTK.Vector3 Start;
|
||||
public readonly OpenTK.Vector3 End;
|
||||
public readonly OpenTK.Vector3 Center;
|
||||
public readonly OpenTK.Vector3 Volume;
|
||||
|
||||
public BoundingBox(OpenTK.Vector3 start, OpenTK.Vector3 end)
|
||||
{
|
||||
Start = start;
|
||||
End = end;
|
||||
OpenTK.Vector3 size = End - Start;
|
||||
Volume = OpenTKExtensions.Abs(size);
|
||||
Center = start + Volume / 2;
|
||||
}
|
||||
|
||||
public BoundingBox(System.Numerics.Vector3 start, System.Numerics.Vector3 end)
|
||||
: this(start.ToOpenTKVector(), end.ToOpenTKVector())
|
||||
{
|
||||
}
|
||||
|
||||
public OpenTK.Matrix4 GetTransform()
|
||||
{
|
||||
return OpenTK.Matrix4.CreateScale(Volume) * OpenTK.Matrix4.CreateTranslation(Start);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,10 +7,11 @@ using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using PckStudio.Interfaces;
|
||||
using PckStudio.Core;
|
||||
|
||||
namespace PckStudio.Internal
|
||||
namespace PckStudio.Core
|
||||
{
|
||||
internal sealed class DelegatedFileSaveContext<T> : ISaveContext<T>
|
||||
public sealed class DelegatedFileSaveContext<T> : ISaveContext<T>
|
||||
{
|
||||
public delegate void SerializeDataToStreamDelegate(T value, Stream stream);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using PckStudio.Interfaces;
|
||||
|
||||
namespace PckStudio.Internal
|
||||
namespace PckStudio.Core
|
||||
{
|
||||
public class DelegatedSaveContext<T> : ISaveContext<T>
|
||||
{
|
||||
@@ -7,12 +7,13 @@ using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using OMI.Formats.Pck;
|
||||
using PckStudio.Extensions;
|
||||
using PckStudio.Core;
|
||||
using PckStudio.Core.Extensions;
|
||||
using PckStudio.Interfaces;
|
||||
|
||||
namespace PckStudio.Internal.Deserializer
|
||||
namespace PckStudio.Core.Deserializer
|
||||
{
|
||||
internal sealed class AnimationDeserializer : IPckAssetDeserializer<Animation>
|
||||
public sealed class AnimationDeserializer : IPckAssetDeserializer<Animation>
|
||||
{
|
||||
public static readonly AnimationDeserializer DefaultDeserializer = new AnimationDeserializer();
|
||||
|
||||
@@ -1,17 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Imaging;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using OMI.Formats.Pck;
|
||||
using PckStudio.Interfaces;
|
||||
using PckStudio.Internal.IO.TGA;
|
||||
using PckStudio.Core.IO.TGA;
|
||||
|
||||
namespace PckStudio.Internal.Deserializer
|
||||
namespace PckStudio.Core.Deserializer
|
||||
{
|
||||
internal sealed class ImageDeserializer : IPckAssetDeserializer<Image>
|
||||
{
|
||||
@@ -1,12 +1,11 @@
|
||||
using System.Drawing;
|
||||
using AnimatedGif;
|
||||
using PckStudio.Internal;
|
||||
|
||||
namespace PckStudio.Extensions
|
||||
namespace PckStudio.Core.Extensions
|
||||
{
|
||||
internal static class AnimationExtensions
|
||||
public static class AnimationExtensions
|
||||
{
|
||||
internal static Image CreateAnimationImage(this Animation animation)
|
||||
public static Image CreateAnimationImage(this Animation animation)
|
||||
{
|
||||
if (animation.FrameCount == 0)
|
||||
{
|
||||
@@ -1,6 +1,6 @@
|
||||
namespace PckStudio.Extensions
|
||||
namespace PckStudio.Core.Extensions
|
||||
{
|
||||
internal enum BlendMode
|
||||
public enum BlendMode
|
||||
{
|
||||
Add,
|
||||
Subtract,
|
||||
@@ -3,11 +3,10 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using PckStudio.Rendering;
|
||||
|
||||
namespace PckStudio.Extensions
|
||||
namespace PckStudio.Core.Extensions
|
||||
{
|
||||
internal static class BoundingBoxExtensions
|
||||
public static class BoundingBoxExtensions
|
||||
{
|
||||
public static BoundingBox GetEnclosingBoundingBox(this IEnumerable<BoundingBox> boundingBoxes)
|
||||
{
|
||||
@@ -1,41 +1,41 @@
|
||||
using System.Drawing;
|
||||
using System.Numerics;
|
||||
|
||||
namespace PckStudio.Extensions
|
||||
namespace PckStudio.Core.Extensions
|
||||
{
|
||||
internal static class ColorExtensions
|
||||
public static class ColorExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Normalizes the Color between 0.0 - 1.0
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
internal static Vector4 Normalize(this Color color)
|
||||
public static Vector4 Normalize(this Color color)
|
||||
{
|
||||
return new Vector4(color.R / 255f, color.G / 255f, color.B / 255f, color.A / 255f);
|
||||
}
|
||||
|
||||
internal static Color Inversed(this Color color)
|
||||
public static Color Inversed(this Color color)
|
||||
{
|
||||
return Color.FromArgb(color.A, 255 - color.R, 255 - color.G, 255 - color.B);
|
||||
}
|
||||
|
||||
internal static Color GreyScaled(this Color color)
|
||||
public static Color GreyScaled(this Color color)
|
||||
{
|
||||
int greyScaleValue = (color.R + color.G + color.B) / 3;
|
||||
return Color.FromArgb(color.A, greyScaleValue, greyScaleValue, greyScaleValue);
|
||||
}
|
||||
|
||||
internal static int ToBGR(this Color color)
|
||||
public static int ToBGR(this Color color)
|
||||
{
|
||||
return color.B << 16 | color.G << 8 | color.R;
|
||||
}
|
||||
|
||||
internal static byte BlendValues(byte source, byte overlay, BlendMode blendType)
|
||||
public static byte BlendValues(byte source, byte overlay, BlendMode blendType)
|
||||
{
|
||||
return (byte)MathExtensions.Clamp(BlendValues(source / 255f, overlay / 255f, blendType) * 255, 0, 255);
|
||||
}
|
||||
|
||||
internal static float BlendValues(float source, float overlay, BlendMode blendType)
|
||||
public static float BlendValues(float source, float overlay, BlendMode blendType)
|
||||
{
|
||||
source = MathExtensions.Clamp(source, 0.0f, 1.0f);
|
||||
overlay = MathExtensions.Clamp(overlay, 0.0f, 1.0f);
|
||||
@@ -54,13 +54,13 @@ namespace PckStudio.Extensions
|
||||
return MathExtensions.Clamp(resultValue, 0.0f, 1.0f);
|
||||
}
|
||||
|
||||
internal static byte Mix(double ratio, byte val1, byte val2)
|
||||
public static byte Mix(double ratio, byte val1, byte val2)
|
||||
{
|
||||
ratio = MathExtensions.Clamp(ratio, 0.0, 1.0);
|
||||
return (byte)(ratio * val1 + (1.0 - ratio) * val2);
|
||||
}
|
||||
|
||||
internal static Color Mix(this Color c1, Color c2, double ratio)
|
||||
public static Color Mix(this Color c1, Color c2, double ratio)
|
||||
{
|
||||
ratio = MathExtensions.Clamp(ratio, 0.0, 1.0);
|
||||
return Color.FromArgb(c1.A,
|
||||
@@ -6,9 +6,9 @@ using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace PckStudio.Extensions
|
||||
namespace PckStudio.Core.Extensions
|
||||
{
|
||||
internal static class CursorExtensions
|
||||
public static class CursorExtensions
|
||||
{
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
@@ -1,9 +1,9 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace PckStudio.Extensions
|
||||
namespace PckStudio.Core.Extensions
|
||||
{
|
||||
internal static class EnumerableExtensions
|
||||
public static class EnumerableExtensions
|
||||
{
|
||||
public static IEnumerable<(int index, T value)>enumerate<T>(this IEnumerable<T> array)
|
||||
{
|
||||
@@ -1,9 +1,9 @@
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
|
||||
namespace PckStudio.Extensions
|
||||
namespace PckStudio.Core.Extensions
|
||||
{
|
||||
internal struct GraphicsConfig
|
||||
public struct GraphicsConfig
|
||||
{
|
||||
public GraphicsConfig()
|
||||
{
|
||||
@@ -21,7 +21,7 @@ namespace PckStudio.Extensions
|
||||
public PixelOffsetMode PixelOffsetMode { get; set; }
|
||||
}
|
||||
|
||||
internal static class GraphicsExtensions
|
||||
public static class GraphicsExtensions
|
||||
{
|
||||
public static void ApplyConfig(this Graphics graphics, GraphicsConfig config)
|
||||
{
|
||||
@@ -32,7 +32,7 @@ namespace PckStudio.Extensions
|
||||
graphics.PixelOffsetMode = config.PixelOffsetMode;
|
||||
}
|
||||
|
||||
internal static Graphics Fill(this Graphics graphics, Rectangle area, Color color)
|
||||
public static Graphics Fill(this Graphics graphics, Rectangle area, Color color)
|
||||
{
|
||||
Region clip = graphics.Clip;
|
||||
graphics.SetClip(area, CombineMode.Replace);
|
||||
@@ -25,20 +25,19 @@ using System.Runtime.InteropServices;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Threading.Tasks;
|
||||
using PckStudio.Internal.App;
|
||||
|
||||
namespace PckStudio.Extensions
|
||||
namespace PckStudio.Core.Extensions
|
||||
{
|
||||
internal static class ImageExtensions
|
||||
public static class ImageExtensions
|
||||
{
|
||||
internal static Image ReleaseFromFile(this Image image)
|
||||
public static Image ReleaseFromFile(this Image image)
|
||||
{
|
||||
Image img = new Bitmap(image);
|
||||
image.Dispose();
|
||||
return img;
|
||||
}
|
||||
|
||||
internal static Image GetArea(this Image source, Rectangle area)
|
||||
public static Image GetArea(this Image source, Rectangle area)
|
||||
{
|
||||
Image tileImage = new Bitmap(area.Width, area.Height);
|
||||
using (Graphics gfx = Graphics.FromImage(tileImage))
|
||||
@@ -57,17 +56,17 @@ namespace PckStudio.Extensions
|
||||
/// <param name="source">this image</param>
|
||||
/// <param name="scalar">Indecates width and height of image sub section</param>
|
||||
/// <returns><see cref="IEnumerable{Image}"/> of type <see cref="Image"/></returns>
|
||||
internal static IEnumerable<Image> SplitHorizontal(this Image source, int scalar)
|
||||
public static IEnumerable<Image> SplitHorizontal(this Image source, int scalar)
|
||||
{
|
||||
return source.Split(scalar, ImageLayoutDirection.Horizontal);
|
||||
}
|
||||
|
||||
internal static IEnumerable<Image> Split(this Image source, int scalar, ImageLayoutDirection layoutDirection)
|
||||
public static IEnumerable<Image> Split(this Image source, int scalar, ImageLayoutDirection layoutDirection)
|
||||
{
|
||||
return Split(source, new Size(scalar, scalar), layoutDirection);
|
||||
}
|
||||
|
||||
internal static IEnumerable<Image> Split(this Image source, Size size, ImageLayoutDirection imageLayout)
|
||||
public static IEnumerable<Image> Split(this Image source, Size size, ImageLayoutDirection imageLayout)
|
||||
{
|
||||
int rowCount = source.Width / size.Width;
|
||||
int columnCount = source.Height / size.Height;
|
||||
@@ -83,7 +82,7 @@ namespace PckStudio.Extensions
|
||||
yield break;
|
||||
}
|
||||
|
||||
internal static IEnumerable<Image> Split(this Image source, ImageLayoutDirection layoutDirection)
|
||||
public static IEnumerable<Image> Split(this Image source, ImageLayoutDirection layoutDirection)
|
||||
{
|
||||
for (int i = 0; i < source.Height / source.Width; i++)
|
||||
{
|
||||
@@ -93,7 +92,7 @@ namespace PckStudio.Extensions
|
||||
yield break;
|
||||
}
|
||||
|
||||
internal static Image Combine(this IEnumerable<Image> sources, ImageLayoutDirection layoutDirection)
|
||||
public static Image Combine(this IEnumerable<Image> sources, ImageLayoutDirection layoutDirection)
|
||||
{
|
||||
Size imageSize = CalculateImageSize(sources, layoutDirection);
|
||||
var image = new Bitmap(imageSize.Width, imageSize.Height);
|
||||
@@ -130,12 +129,12 @@ namespace PckStudio.Extensions
|
||||
return size;
|
||||
}
|
||||
|
||||
internal static Image Resize(this Image image, Size size, GraphicsConfig graphicsConfig)
|
||||
public static Image Resize(this Image image, Size size, GraphicsConfig graphicsConfig)
|
||||
{
|
||||
return image.Resize(size.Width, size.Height, graphicsConfig);
|
||||
}
|
||||
|
||||
internal static Image Resize(this Image image, int width, int height, GraphicsConfig graphicsConfig)
|
||||
public static Image Resize(this Image image, int width, int height, GraphicsConfig graphicsConfig)
|
||||
{
|
||||
var destRect = new Rectangle(0, 0, width, height);
|
||||
var destImage = new Bitmap(width, height);
|
||||
@@ -154,7 +153,7 @@ namespace PckStudio.Extensions
|
||||
return destImage;
|
||||
}
|
||||
|
||||
internal static Image Blend(this Image image, Color overlayColor, BlendMode mode)
|
||||
public static Image Blend(this Image image, Color overlayColor, BlendMode mode)
|
||||
{
|
||||
if (image is not Bitmap baseImage)
|
||||
return image;
|
||||
@@ -166,7 +165,6 @@ namespace PckStudio.Extensions
|
||||
BitmapData resultImageData = bitmapResult.LockBits(new Rectangle(Point.Empty, bitmapResult.Size),
|
||||
ImageLockMode.WriteOnly, PixelFormat.Format32bppArgb);
|
||||
|
||||
Profiler.Start();
|
||||
Parallel.For(0, baseImageData.Stride * baseImageData.Height / 4, (i) =>
|
||||
{
|
||||
int k = i * 4;
|
||||
@@ -186,14 +184,13 @@ namespace PckStudio.Extensions
|
||||
Unsafe.Write((resultImageData.Scan0 + k).ToPointer(), blendedValue);
|
||||
}
|
||||
});
|
||||
Profiler.Stop();
|
||||
|
||||
bitmapResult.UnlockBits(resultImageData);
|
||||
baseImage.UnlockBits(baseImageData);
|
||||
return bitmapResult;
|
||||
}
|
||||
|
||||
internal static Image Blend(this Image image, Image overlay, BlendMode mode)
|
||||
public static Image Blend(this Image image, Image overlay, BlendMode mode)
|
||||
{
|
||||
if (image is not Bitmap baseImage || overlay is not Bitmap overlayImage ||
|
||||
image.Width != overlay.Width || image.Height != overlay.Height)
|
||||
@@ -230,7 +227,7 @@ namespace PckStudio.Extensions
|
||||
return bitmapResult;
|
||||
}
|
||||
|
||||
internal static Image Interpolate(this Image image1, Image image2, double delta)
|
||||
public static Image Interpolate(this Image image1, Image image2, double delta)
|
||||
{
|
||||
delta = MathExtensions.Clamp(delta, 0.0, 1.0);
|
||||
if (image1 is not Bitmap baseImage || image2 is not Bitmap overlayImage ||
|
||||
8
PckStudio.Core/Extensions/ImageLayoutDirection.cs
Normal file
8
PckStudio.Core/Extensions/ImageLayoutDirection.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
namespace PckStudio.Core
|
||||
{
|
||||
public enum ImageLayoutDirection
|
||||
{
|
||||
Horizontal,
|
||||
Vertical
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
using System.Drawing;
|
||||
|
||||
namespace PckStudio.Extensions
|
||||
namespace PckStudio.Core.Extensions
|
||||
{
|
||||
internal struct ImageSection
|
||||
{
|
||||
@@ -1,8 +1,8 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace PckStudio.Extensions
|
||||
namespace PckStudio.Core.Extensions
|
||||
{
|
||||
internal static class ListExtensions
|
||||
public static class ListExtensions
|
||||
{
|
||||
public static IList<T> Swap<T>(this IList<T> list, int index1, int index2)
|
||||
{
|
||||
@@ -1,8 +1,8 @@
|
||||
using OMI.Formats.Languages;
|
||||
|
||||
namespace PckStudio.Extensions
|
||||
namespace PckStudio.Core.Extensions
|
||||
{
|
||||
internal static class LocFileExtensions
|
||||
public static class LocFileExtensions
|
||||
{
|
||||
|
||||
public static void InitializeDefault(this LOCFile locFile, string packName) => locFile.Initialize("en-EN", ("IDS_DISPLAY_NAME", packName));
|
||||
@@ -1,8 +1,8 @@
|
||||
using OMI.Formats.Material;
|
||||
|
||||
namespace PckStudio.Extensions
|
||||
namespace PckStudio.Core.Extensions
|
||||
{
|
||||
internal static class MaterialContainerExtensions
|
||||
public static class MaterialContainerExtensions
|
||||
{
|
||||
private static readonly MaterialContainer.Material[] defaultMaterials = [
|
||||
new MaterialContainer.Material("bat", "entity_alphatest"),
|
||||
@@ -5,9 +5,9 @@ using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using OMI.Formats.Material;
|
||||
|
||||
namespace PckStudio.Extensions
|
||||
namespace PckStudio.Core.Extensions
|
||||
{
|
||||
internal static class MaterialExtensions
|
||||
public static class MaterialExtensions
|
||||
{
|
||||
public static bool HasInvalidEntries(this MaterialContainer materials)
|
||||
{
|
||||
@@ -1,10 +1,10 @@
|
||||
using System;
|
||||
|
||||
namespace PckStudio.Extensions
|
||||
namespace PckStudio.Core.Extensions
|
||||
{
|
||||
internal class MathExtensions
|
||||
public class MathExtensions
|
||||
{
|
||||
internal static T Clamp<T>(T value, T min, T max) where T : IComparable<T>
|
||||
public static T Clamp<T>(T value, T min, T max) where T : IComparable<T>
|
||||
{
|
||||
if (value.CompareTo(min) < 0)
|
||||
return min;
|
||||
@@ -1,20 +1,11 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using ICSharpCode.SharpZipLib.Zip.Compression;
|
||||
using System.Windows.Media;
|
||||
using System.Windows;
|
||||
using OMI.Formats.Model;
|
||||
using PckStudio.Rendering;
|
||||
using System.Numerics;
|
||||
|
||||
namespace PckStudio.Extensions
|
||||
namespace PckStudio.Core.Extensions
|
||||
{
|
||||
static class ModelBoxExtension
|
||||
public static class ModelBoxExtension
|
||||
{
|
||||
|
||||
public static BoundingBox GetBoundingBox(this ModelBox modelBox)
|
||||
{
|
||||
Vector3 halfSize = modelBox.Size / 2f;
|
||||
@@ -5,11 +5,11 @@ using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using OpenTK;
|
||||
|
||||
namespace PckStudio.Extensions
|
||||
namespace PckStudio.Core.Extensions
|
||||
{
|
||||
internal static class OpenTKExtensions
|
||||
public static class OpenTKExtensions
|
||||
{
|
||||
internal static Matrix4 Pivoted(this Matrix4 rotation, Vector3 pivot)
|
||||
public static Matrix4 Pivoted(this Matrix4 rotation, Vector3 pivot)
|
||||
{
|
||||
var model = Matrix4.CreateTranslation(pivot);
|
||||
model *= rotation;
|
||||
@@ -11,17 +11,17 @@ using OMI.Formats.Pck;
|
||||
using OMI.Workers;
|
||||
|
||||
using PckStudio.Interfaces;
|
||||
using PckStudio.Internal.Deserializer;
|
||||
using PckStudio.Internal.Serializer;
|
||||
using PckStudio.Internal.Skin;
|
||||
using PckStudio.Core.Deserializer;
|
||||
using PckStudio.Core.Serializer;
|
||||
using PckStudio.Core.Skin;
|
||||
|
||||
namespace PckStudio.Extensions
|
||||
namespace PckStudio.Core.Extensions
|
||||
{
|
||||
internal static class PckAssetExtensions
|
||||
public static class PckAssetExtensions
|
||||
{
|
||||
private const string MipMap = "MipMapLevel";
|
||||
|
||||
internal static PckAsset CreateNewAssetIf(this PckFile pck, bool condition, string filename, PckAssetType filetype, IDataFormatWriter writer)
|
||||
public static PckAsset CreateNewAssetIf(this PckFile pck, bool condition, string filename, PckAssetType filetype, IDataFormatWriter writer)
|
||||
{
|
||||
if (condition)
|
||||
{
|
||||
@@ -30,14 +30,14 @@ namespace PckStudio.Extensions
|
||||
return default;
|
||||
}
|
||||
|
||||
internal static PckAsset CreateNewAsset(this PckFile pck, string filename, PckAssetType filetype, IDataFormatWriter writer)
|
||||
public static PckAsset CreateNewAsset(this PckFile pck, string filename, PckAssetType filetype, IDataFormatWriter writer)
|
||||
{
|
||||
PckAsset asset = pck.CreateNewAsset(filename, filetype);
|
||||
asset.SetData(writer);
|
||||
return asset;
|
||||
}
|
||||
|
||||
internal static Image GetTexture(this PckAsset asset)
|
||||
public static Image GetTexture(this PckAsset asset)
|
||||
{
|
||||
if (asset.Type != PckAssetType.SkinFile &&
|
||||
asset.Type != PckAssetType.CapeFile &&
|
||||
@@ -54,7 +54,7 @@ namespace PckStudio.Extensions
|
||||
/// <param name="asset"></param>
|
||||
/// <returns>Non-zero base number on success, otherwise 0</returns>
|
||||
/// <exception cref="InvalidOperationException"></exception>
|
||||
internal static int GetSkinId(this PckAsset asset)
|
||||
public static int GetSkinId(this PckAsset asset)
|
||||
{
|
||||
if (asset.Type != PckAssetType.SkinFile)
|
||||
throw new InvalidOperationException("Asset is not a skin.");
|
||||
@@ -76,7 +76,7 @@ namespace PckStudio.Extensions
|
||||
return skinId;
|
||||
}
|
||||
|
||||
internal static Skin GetSkin(this PckAsset asset)
|
||||
public static Skin.Skin GetSkin(this PckAsset asset)
|
||||
{
|
||||
if (asset.Type != PckAssetType.SkinFile)
|
||||
throw new InvalidOperationException("Asset is not a skin.");
|
||||
@@ -88,10 +88,10 @@ namespace PckStudio.Extensions
|
||||
SkinANIM anim = asset.GetProperty("ANIM", SkinANIM.FromString);
|
||||
IEnumerable<SkinBOX> boxes = asset.GetMultipleProperties("BOX").Select(kv => SkinBOX.FromString(kv.Value));
|
||||
IEnumerable<SkinPartOffset> offsets = asset.GetMultipleProperties("OFFSET").Select(kv => SkinPartOffset.FromString(kv.Value));
|
||||
return new Skin(name, skinId, texture, anim, boxes, offsets);
|
||||
return new Skin.Skin(name, skinId, texture, anim, boxes, offsets);
|
||||
}
|
||||
|
||||
internal static void SetSkin(this PckAsset asset, Skin skin, LOCFile localizationFile)
|
||||
public static void SetSkin(this PckAsset asset, Skin.Skin skin, LOCFile localizationFile)
|
||||
{
|
||||
if (asset.Type != PckAssetType.SkinFile)
|
||||
throw new InvalidOperationException("Asset is not a skin file");
|
||||
@@ -146,23 +146,23 @@ namespace PckStudio.Extensions
|
||||
}
|
||||
}
|
||||
|
||||
internal static T GetDeserializedData<T>(this PckAsset asset, IPckAssetDeserializer<T> deserializer)
|
||||
public static T GetDeserializedData<T>(this PckAsset asset, IPckAssetDeserializer<T> deserializer)
|
||||
{
|
||||
return deserializer.Deserialize(asset);
|
||||
}
|
||||
|
||||
internal static T GetData<T>(this PckAsset asset, IDataFormatReader<T> formatReader) where T : class
|
||||
public static T GetData<T>(this PckAsset asset, IDataFormatReader<T> formatReader) where T : class
|
||||
{
|
||||
using var ms = new MemoryStream(asset.Data);
|
||||
return formatReader.FromStream(ms);
|
||||
}
|
||||
|
||||
internal static void SetSerializedData<T>(this PckAsset asset, T obj, IPckAssetSerializer<T> serializer)
|
||||
public static void SetSerializedData<T>(this PckAsset asset, T obj, IPckAssetSerializer<T> serializer)
|
||||
{
|
||||
serializer.Serialize(obj, ref asset);
|
||||
}
|
||||
|
||||
internal static void SetData(this PckAsset asset, IDataFormatWriter formatWriter)
|
||||
public static void SetData(this PckAsset asset, IDataFormatWriter formatWriter)
|
||||
{
|
||||
using (var stream = new MemoryStream())
|
||||
{
|
||||
@@ -171,7 +171,7 @@ namespace PckStudio.Extensions
|
||||
}
|
||||
}
|
||||
|
||||
internal static void SetTexture(this PckAsset asset, Image image)
|
||||
public static void SetTexture(this PckAsset asset, Image image)
|
||||
{
|
||||
if (asset.Type != PckAssetType.SkinFile &&
|
||||
asset.Type != PckAssetType.CapeFile &&
|
||||
@@ -182,7 +182,7 @@ namespace PckStudio.Extensions
|
||||
asset.SetSerializedData(image, ImageSerializer.DefaultSerializer);
|
||||
}
|
||||
|
||||
internal static bool IsMipmappedFile(this PckAsset asset)
|
||||
public static bool IsMipmappedFile(this PckAsset asset)
|
||||
{
|
||||
// We only want to test the file name itself. ex: "terrainMipMapLevel2"
|
||||
string name = Path.GetFileNameWithoutExtension(asset.Filename);
|
||||
@@ -197,7 +197,7 @@ namespace PckStudio.Extensions
|
||||
return true;
|
||||
}
|
||||
|
||||
internal static string GetNormalPath(this PckAsset asset)
|
||||
public static string GetNormalPath(this PckAsset asset)
|
||||
{
|
||||
if (!asset.IsMipmappedFile())
|
||||
return asset.Filename;
|
||||
@@ -205,7 +205,7 @@ namespace PckStudio.Extensions
|
||||
return asset.Filename.Remove(asset.Filename.Length - (MipMap.Length + 1) - ext.Length) + ext;
|
||||
}
|
||||
|
||||
internal static void DeserializeProperties(this PckAsset asset, IEnumerable<string> serializedData)
|
||||
public static void DeserializeProperties(this PckAsset asset, IEnumerable<string> serializedData)
|
||||
{
|
||||
IEnumerable<KeyValuePair<string, string>> lines = serializedData
|
||||
.Select(line => line.Split([' '], 2))
|
||||
@@ -217,7 +217,7 @@ namespace PckStudio.Extensions
|
||||
}
|
||||
}
|
||||
|
||||
internal static IEnumerable<string> SerializeProperties(this PckAsset asset, string seperater = ":")
|
||||
public static IEnumerable<string> SerializeProperties(this PckAsset asset, string seperater = ":")
|
||||
{
|
||||
IReadOnlyList<KeyValuePair<string, string>> properties = asset.GetProperties();
|
||||
return properties.Select(property => property.Key + seperater + property.Value);
|
||||
@@ -2,9 +2,9 @@
|
||||
using System.Reflection;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace PckStudio.Extensions
|
||||
namespace PckStudio.Core.Extensions
|
||||
{
|
||||
internal static class PictureBoxExtensions
|
||||
public static class PictureBoxExtensions
|
||||
{
|
||||
public static bool IsAnimating(this PictureBox pictureBox)
|
||||
{
|
||||
@@ -6,13 +6,11 @@ using System.Linq;
|
||||
using System.Numerics;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using PckStudio.Internal;
|
||||
using PckStudio.Internal.Skin;
|
||||
using PckStudio.Rendering;
|
||||
using PckStudio.Core.Skin;
|
||||
|
||||
namespace PckStudio.Extensions
|
||||
namespace PckStudio.Core.Extensions
|
||||
{
|
||||
internal static class SkinBOXExtensions
|
||||
public static class SkinBOXExtensions
|
||||
{
|
||||
public static GraphicsPath GetUVGraphicsPath(this SkinBOX skinBOX, Vector2 tillingFactor)
|
||||
{
|
||||
@@ -79,10 +77,5 @@ namespace PckStudio.Extensions
|
||||
int index = Array.IndexOf(SkinBOX.OverlayTypes, type);
|
||||
return SkinBOX.BaseTypes.IndexInRange(index) ? SkinBOX.BaseTypes[index] : "";
|
||||
}
|
||||
|
||||
internal static Cube ToCube(this SkinBOX skinBOX) => skinBOX.ToCube(0f);
|
||||
|
||||
internal static Cube ToCube(this SkinBOX skinBOX, float inflate, bool flipZMapping = false)
|
||||
=> new Cube(skinBOX.Pos.ToOpenTKVector(), skinBOX.Size.ToOpenTKVector(), skinBOX.UV.ToOpenTKVector(), skinBOX.Scale + inflate, skinBOX.Mirror, flipZMapping);
|
||||
}
|
||||
}
|
||||
@@ -6,14 +6,13 @@ using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using OMI.Formats.Languages;
|
||||
using OMI.Formats.Pck;
|
||||
using PckStudio.Internal;
|
||||
using PckStudio.Internal.Skin;
|
||||
using PckStudio.Core.Skin;
|
||||
|
||||
namespace PckStudio.Extensions
|
||||
namespace PckStudio.Core.Extensions
|
||||
{
|
||||
internal static class SkinExtensions
|
||||
public static class SkinExtensions
|
||||
{
|
||||
public static PckAsset CreateFile(this Skin skin, LOCFile localizationFile)
|
||||
public static PckAsset CreateFile(this Skin.Skin skin, LOCFile localizationFile)
|
||||
{
|
||||
string skinId = skin.Identifier.ToString("d08");
|
||||
PckAsset skinFile = new PckAsset($"dlcskin{skinId}.png", PckAssetType.SkinFile);
|
||||
@@ -59,7 +58,7 @@ namespace PckStudio.Extensions
|
||||
return skinFile;
|
||||
}
|
||||
|
||||
public static PckAsset CreateCapeFile(this Skin skin)
|
||||
public static PckAsset CreateCapeFile(this Skin.Skin skin)
|
||||
{
|
||||
if (!skin.HasCape)
|
||||
throw new InvalidOperationException("Skin does not contain a cape.");
|
||||
29
PckStudio.Core/Extensions/System.Numerics.cs
Normal file
29
PckStudio.Core/Extensions/System.Numerics.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
namespace PckStudio.Core.Extensions
|
||||
{
|
||||
public static class NumericsExtensions
|
||||
{
|
||||
//internal static Cube ToCube(this SkinBOX skinBOX) => skinBOX.ToCube(0f);
|
||||
|
||||
//internal static Cube ToCube(this SkinBOX skinBOX, float inflate, bool flipZMapping = false)
|
||||
// => new Cube(skinBOX.Pos.ToOpenTKVector(), skinBOX.Size.ToOpenTKVector(), skinBOX.UV.ToOpenTKVector(), skinBOX.Scale + inflate, skinBOX.Mirror, flipZMapping);
|
||||
public static OpenTK.Vector3 ToOpenTKVector(this System.Numerics.Vector3 vector3)
|
||||
{
|
||||
return new OpenTK.Vector3(vector3.X, vector3.Y, vector3.Z);
|
||||
}
|
||||
|
||||
public static OpenTK.Vector2 ToOpenTKVector(this System.Numerics.Vector2 vector2)
|
||||
{
|
||||
return new OpenTK.Vector2(vector2.X, vector2.Y);
|
||||
}
|
||||
|
||||
public static System.Numerics.Vector3 ToNumericsVector(this OpenTK.Vector3 vector3)
|
||||
{
|
||||
return new System.Numerics.Vector3(vector3.X, vector3.Y, vector3.Z);
|
||||
}
|
||||
|
||||
public static System.Numerics.Vector2 ToNumericsVector(this OpenTK.Vector2 vector2)
|
||||
{
|
||||
return new System.Numerics.Vector2(vector2.X, vector2.Y);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,16 +1,16 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace PckStudio.Extensions
|
||||
namespace PckStudio.Core.Extensions
|
||||
{
|
||||
internal static class TreeNodeExtensions
|
||||
public static class TreeNodeExtensions
|
||||
{
|
||||
internal static bool IsTagOfType<T>(this TreeNode node) where T : class
|
||||
public static bool IsTagOfType<T>(this TreeNode node) where T : class
|
||||
{
|
||||
return node?.Tag is T;
|
||||
}
|
||||
|
||||
internal static bool TryGetTagData<TOut>(this TreeNode node, out TOut tagData) where TOut : class
|
||||
public static bool TryGetTagData<TOut>(this TreeNode node, out TOut tagData) where TOut : class
|
||||
{
|
||||
if (node?.Tag is TOut data)
|
||||
{
|
||||
@@ -21,7 +21,7 @@ namespace PckStudio.Extensions
|
||||
return false;
|
||||
}
|
||||
|
||||
internal static bool Contains(this TreeNode thisNode, TreeNode childNode)
|
||||
public static bool Contains(this TreeNode thisNode, TreeNode childNode)
|
||||
{
|
||||
if (childNode.Parent == null)
|
||||
return false;
|
||||
@@ -32,7 +32,7 @@ namespace PckStudio.Extensions
|
||||
return thisNode.Contains(childNode.Parent);
|
||||
}
|
||||
|
||||
internal static List<TreeNode> GetChildNodes(this TreeNode thisNode)
|
||||
public static List<TreeNode> GetChildNodes(this TreeNode thisNode)
|
||||
{
|
||||
List<TreeNode> nodes = new List<TreeNode>(thisNode.Nodes.Count);
|
||||
foreach (TreeNode node in thisNode.Nodes)
|
||||
@@ -2,9 +2,9 @@
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace PckStudio.Extensions
|
||||
namespace PckStudio.Core.Extensions
|
||||
{
|
||||
internal static class TreeViewExtensions
|
||||
public static class TreeViewExtensions
|
||||
{
|
||||
public static TreeNode[] FindPath(this TreeView treeView, string path)
|
||||
{
|
||||
@@ -1,8 +1,8 @@
|
||||
using System.IO;
|
||||
|
||||
namespace PckStudio.Internal
|
||||
namespace PckStudio.Core
|
||||
{
|
||||
internal readonly struct FileDialogFilter
|
||||
public readonly struct FileDialogFilter
|
||||
{
|
||||
public readonly string Description;
|
||||
public readonly string Pattern;
|
||||
@@ -3,7 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using OMI.Formats.Languages;
|
||||
|
||||
namespace PckStudio.Internal.FileFormats
|
||||
namespace PckStudio.Core.FileFormats
|
||||
{
|
||||
public class PckAudioFile
|
||||
{
|
||||
@@ -5,31 +5,31 @@ using System.Linq;
|
||||
using System.Numerics;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using PckStudio.Extensions;
|
||||
using PckStudio.Internal.Skin;
|
||||
using PckStudio.Core.Extensions;
|
||||
using PckStudio.Core.Skin;
|
||||
|
||||
namespace PckStudio.Internal
|
||||
namespace PckStudio.Core
|
||||
{
|
||||
internal static class GameConstants
|
||||
public static class GameConstants
|
||||
{
|
||||
|
||||
internal static readonly Vector3 SkinHeadTranslation = Vector3.Zero;
|
||||
internal static readonly Vector3 SkinHeadPivot = Vector3.Zero;
|
||||
|
||||
internal static readonly Vector3 SkinBodyTranslation = Vector3.Zero;
|
||||
internal static readonly Vector3 SkinBodyPivot = Vector3.Zero;
|
||||
|
||||
internal static readonly Vector3 SkinRightArmTranslation = new(-5f, 2f, 0f);
|
||||
internal static readonly Vector3 SkinRightArmPivot = new(-6f, 2f, 0f);
|
||||
public static readonly Vector3 SkinHeadTranslation = Vector3.Zero;
|
||||
public static readonly Vector3 SkinHeadPivot = Vector3.Zero;
|
||||
|
||||
public static readonly Vector3 SkinBodyTranslation = Vector3.Zero;
|
||||
public static readonly Vector3 SkinBodyPivot = Vector3.Zero;
|
||||
|
||||
public static readonly Vector3 SkinRightArmTranslation = new(-5f, 2f, 0f);
|
||||
public static readonly Vector3 SkinRightArmPivot = new(-6f, 2f, 0f);
|
||||
|
||||
internal static readonly Vector3 SkinLeftArmTranslation = new(5f, 2f, 0f);
|
||||
internal static readonly Vector3 SkinLeftArmPivot = new(6f, 2f, 0f);
|
||||
public static readonly Vector3 SkinLeftArmTranslation = new(5f, 2f, 0f);
|
||||
public static readonly Vector3 SkinLeftArmPivot = new(6f, 2f, 0f);
|
||||
|
||||
internal static readonly Vector3 SkinRightLegTranslation = new(-2f, 12f, 0f);
|
||||
internal static readonly Vector3 SkinRightLegPivot = new(-2f, 12f, 0f);
|
||||
public static readonly Vector3 SkinRightLegTranslation = new(-2f, 12f, 0f);
|
||||
public static readonly Vector3 SkinRightLegPivot = new(-2f, 12f, 0f);
|
||||
|
||||
internal static readonly Vector3 SkinLeftLegTranslation = new(2f, 12f, 0f);
|
||||
internal static readonly Vector3 SkinLeftLegPivot = new(2f, 12f, 0f);
|
||||
public static readonly Vector3 SkinLeftLegTranslation = new(2f, 12f, 0f);
|
||||
public static readonly Vector3 SkinLeftLegPivot = new(2f, 12f, 0f);
|
||||
|
||||
private static Dictionary<string, PositioningInfo> _posisioningInfos = new Dictionary<string, PositioningInfo>()
|
||||
{
|
||||
@@ -40,18 +40,18 @@ namespace PckStudio.Internal
|
||||
["LEG0"] = new PositioningInfo(SkinRightLegTranslation, SkinRightLegPivot),
|
||||
["LEG1"] = new PositioningInfo(SkinLeftLegTranslation, SkinLeftLegPivot),
|
||||
};
|
||||
internal record struct PositioningInfo(Vector3 Translation, Vector3 Pivot);
|
||||
public record struct PositioningInfo(Vector3 Translation, Vector3 Pivot);
|
||||
|
||||
internal static PositioningInfo GetPositioningInfo(string partName)
|
||||
public static PositioningInfo GetPositioningInfo(string partName)
|
||||
{
|
||||
if (SkinBOX.IsOverlayPart(partName))
|
||||
partName = SkinBOXExtensions.GetBaseType(partName);
|
||||
return _posisioningInfos.ContainsKey(partName) ? _posisioningInfos[partName] : default;
|
||||
}
|
||||
|
||||
internal static Vector3 GetSkinPartPivot(string partName) => GetPositioningInfo(partName).Pivot;
|
||||
public static Vector3 GetSkinPartPivot(string partName) => GetPositioningInfo(partName).Pivot;
|
||||
|
||||
internal static Vector3 GetSkinPartTranslation(string partName) => GetPositioningInfo(partName).Translation;
|
||||
public static Vector3 GetSkinPartTranslation(string partName) => GetPositioningInfo(partName).Translation;
|
||||
|
||||
public const int GameTickInMilliseconds = 50;
|
||||
|
||||
@@ -8,9 +8,9 @@ using System.Threading.Tasks;
|
||||
using OMI.Workers;
|
||||
using OMI;
|
||||
|
||||
namespace PckStudio.Internal.IO._3DST
|
||||
namespace PckStudio.Core.IO._3DST
|
||||
{
|
||||
internal class _3DSTextureReader : IDataFormatReader<Image>, IDataFormatReader
|
||||
public class _3DSTextureReader : IDataFormatReader<Image>, IDataFormatReader
|
||||
{
|
||||
public Image FromFile(string filename)
|
||||
{
|
||||
@@ -5,9 +5,9 @@ using System.Text;
|
||||
using OMI;
|
||||
using OMI.Workers;
|
||||
|
||||
namespace PckStudio.Internal.IO._3DST
|
||||
namespace PckStudio.Core.IO._3DST
|
||||
{
|
||||
internal class _3DSTextureWriter : IDataFormatWriter
|
||||
public class _3DSTextureWriter : IDataFormatWriter
|
||||
{
|
||||
private Image _image;
|
||||
private _3DSTextureFormat _format;
|
||||
@@ -3,7 +3,7 @@ using System.Drawing;
|
||||
using System.Drawing.Imaging;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace PckStudio.Internal.IO._3DST
|
||||
namespace PckStudio.Core.IO._3DST
|
||||
{
|
||||
/// <summary>
|
||||
/// Format of the texture used on the PICA200.
|
||||
@@ -1,13 +1,13 @@
|
||||
using OMI;
|
||||
using OMI.Workers;
|
||||
using PckStudio.Internal.FileFormats;
|
||||
using PckStudio.Core.FileFormats;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace PckStudio.Internal.IO.PckAudio
|
||||
namespace PckStudio.Core.IO.PckAudio
|
||||
{
|
||||
|
||||
public class InvalidAudioPckException : Exception
|
||||
@@ -16,7 +16,7 @@ namespace PckStudio.Internal.IO.PckAudio
|
||||
{ }
|
||||
}
|
||||
|
||||
internal class PckAudioFileReader : IDataFormatReader<PckAudioFile>, IDataFormatReader
|
||||
public class PckAudioFileReader : IDataFormatReader<PckAudioFile>, IDataFormatReader
|
||||
{
|
||||
private PckAudioFile _file;
|
||||
private Endianness _endianness;
|
||||
@@ -1,13 +1,13 @@
|
||||
using OMI;
|
||||
using OMI.Workers;
|
||||
using PckStudio.Internal.FileFormats;
|
||||
using PckStudio.Core.FileFormats;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
|
||||
namespace PckStudio.Internal.IO.PckAudio
|
||||
namespace PckStudio.Core.IO.PckAudio
|
||||
{
|
||||
internal class PckAudioFileWriter : IDataFormatWriter
|
||||
public class PckAudioFileWriter : IDataFormatWriter
|
||||
{
|
||||
|
||||
private PckAudioFile _file;
|
||||
@@ -16,7 +16,7 @@
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
**/
|
||||
|
||||
namespace PckStudio.Internal.IO.TGA
|
||||
namespace PckStudio.Core.IO.TGA
|
||||
{
|
||||
internal enum TGADataTypeCode : byte
|
||||
{
|
||||
@@ -18,7 +18,7 @@
|
||||
using System.IO;
|
||||
using System.Drawing;
|
||||
|
||||
namespace PckStudio.Internal.IO.TGA
|
||||
namespace PckStudio.Core.IO.TGA
|
||||
{
|
||||
internal static class TGADeserializer
|
||||
{
|
||||
@@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace PckStudio.Internal.IO.TGA
|
||||
namespace PckStudio.Core.IO.TGA
|
||||
{
|
||||
[Serializable]
|
||||
internal class TGAException : Exception
|
||||
@@ -18,7 +18,7 @@
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace PckStudio.Internal.IO.TGA
|
||||
namespace PckStudio.Core.IO.TGA
|
||||
{
|
||||
internal struct TGAExtentionData
|
||||
{
|
||||
@@ -18,7 +18,7 @@
|
||||
using System.IO;
|
||||
using System.Drawing;
|
||||
|
||||
namespace PckStudio.Internal.IO.TGA
|
||||
namespace PckStudio.Core.IO.TGA
|
||||
{
|
||||
internal class TGAFileData
|
||||
{
|
||||
@@ -16,7 +16,7 @@
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
**/
|
||||
|
||||
namespace PckStudio.Internal.IO.TGA
|
||||
namespace PckStudio.Core.IO.TGA
|
||||
{
|
||||
internal struct TGAFooter
|
||||
{
|
||||
@@ -16,7 +16,7 @@
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
**/
|
||||
|
||||
namespace PckStudio.Internal.IO.TGA
|
||||
namespace PckStudio.Core.IO.TGA
|
||||
{
|
||||
/// <summary>
|
||||
/// Resources:
|
||||
@@ -22,11 +22,10 @@ using System.Drawing;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing.Imaging;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Collections.Generic;
|
||||
using OMI.Workers;
|
||||
using OMI;
|
||||
|
||||
namespace PckStudio.Internal.IO.TGA
|
||||
namespace PckStudio.Core.IO.TGA
|
||||
{
|
||||
internal class TGAReader : IDataFormatReader<TGAFileData>, IDataFormatReader
|
||||
{
|
||||
@@ -18,7 +18,7 @@
|
||||
using System.IO;
|
||||
using System.Drawing;
|
||||
|
||||
namespace PckStudio.Internal.IO.TGA
|
||||
namespace PckStudio.Core.IO.TGA
|
||||
{
|
||||
internal static class TGASerializer
|
||||
{
|
||||
@@ -18,15 +18,12 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Drawing;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing.Imaging;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using OMI;
|
||||
using System.Windows.Forms;
|
||||
using DiscordRPC;
|
||||
|
||||
namespace PckStudio.Internal.IO.TGA
|
||||
namespace PckStudio.Core.IO.TGA
|
||||
{
|
||||
internal class TGAWriter
|
||||
{
|
||||
@@ -7,7 +7,7 @@ using OMI.Formats.Pck;
|
||||
|
||||
namespace PckStudio.Interfaces
|
||||
{
|
||||
internal interface IEditor<T> where T : class
|
||||
public interface IEditor<T> where T : class
|
||||
{
|
||||
T EditorValue { get; }
|
||||
|
||||
@@ -1,15 +1,10 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using PckStudio.Internal.Skin;
|
||||
using PckStudio.Internal;
|
||||
using PckStudio.Core;
|
||||
|
||||
namespace PckStudio.Interfaces
|
||||
{
|
||||
internal interface IModelImportProvider<T> where T : class
|
||||
public interface IModelImportProvider<T> where T : class
|
||||
{
|
||||
public string Name { get; }
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user