mirror of
https://github.com/aelurum/AssetStudio.git
synced 2025-05-25 05:40:21 -04:00
minor fixes and improvements
This commit is contained in:
parent
23ac590648
commit
98c4d0c3ab
@ -142,7 +142,7 @@ namespace AssetStudioGUI
|
|||||||
private async void loadFile_Click(object sender, EventArgs e)
|
private async void loadFile_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
openFileDialog1.InitialDirectory = openDirectoryBackup;
|
openFileDialog1.InitialDirectory = openDirectoryBackup;
|
||||||
if (openFileDialog1.ShowDialog() == DialogResult.OK)
|
if (openFileDialog1.ShowDialog(this) == DialogResult.OK)
|
||||||
{
|
{
|
||||||
ResetForm();
|
ResetForm();
|
||||||
openDirectoryBackup = Path.GetDirectoryName(openFileDialog1.FileNames[0]);
|
openDirectoryBackup = Path.GetDirectoryName(openFileDialog1.FileNames[0]);
|
||||||
@ -168,7 +168,7 @@ namespace AssetStudioGUI
|
|||||||
|
|
||||||
private async void extractFileToolStripMenuItem_Click(object sender, EventArgs e)
|
private async void extractFileToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (openFileDialog1.ShowDialog() == DialogResult.OK)
|
if (openFileDialog1.ShowDialog(this) == DialogResult.OK)
|
||||||
{
|
{
|
||||||
var saveFolderDialog = new OpenFolderDialog();
|
var saveFolderDialog = new OpenFolderDialog();
|
||||||
saveFolderDialog.Title = "Select the save folder";
|
saveFolderDialog.Title = "Select the save folder";
|
||||||
@ -223,10 +223,6 @@ namespace AssetStudioGUI
|
|||||||
|
|
||||||
sceneTreeView.BeginUpdate();
|
sceneTreeView.BeginUpdate();
|
||||||
sceneTreeView.Nodes.AddRange(treeNodeCollection.ToArray());
|
sceneTreeView.Nodes.AddRange(treeNodeCollection.ToArray());
|
||||||
foreach (var node in treeNodeCollection)
|
|
||||||
{
|
|
||||||
node.HideCheckBox();
|
|
||||||
}
|
|
||||||
sceneTreeView.EndUpdate();
|
sceneTreeView.EndUpdate();
|
||||||
treeNodeCollection.Clear();
|
treeNodeCollection.Clear();
|
||||||
|
|
||||||
@ -462,7 +458,7 @@ namespace AssetStudioGUI
|
|||||||
private void showExpOpt_Click(object sender, EventArgs e)
|
private void showExpOpt_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var exportOpt = new ExportOptions();
|
var exportOpt = new ExportOptions();
|
||||||
exportOpt.ShowDialog();
|
exportOpt.ShowDialog(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void assetListView_RetrieveVirtualItem(object sender, RetrieveVirtualItemEventArgs e)
|
private void assetListView_RetrieveVirtualItem(object sender, RetrieveVirtualItemEventArgs e)
|
||||||
@ -1404,25 +1400,32 @@ namespace AssetStudioGUI
|
|||||||
{
|
{
|
||||||
var gameObjects = new List<GameObject>();
|
var gameObjects = new List<GameObject>();
|
||||||
GetSelectedParentNode(sceneTreeView.Nodes, gameObjects);
|
GetSelectedParentNode(sceneTreeView.Nodes, gameObjects);
|
||||||
var saveFileDialog = new SaveFileDialog();
|
if (gameObjects.Count > 0)
|
||||||
saveFileDialog.FileName = gameObjects[0].m_Name + " (merge).fbx";
|
|
||||||
saveFileDialog.AddExtension = false;
|
|
||||||
saveFileDialog.Filter = "Fbx file (*.fbx)|*.fbx";
|
|
||||||
saveFileDialog.InitialDirectory = saveDirectoryBackup;
|
|
||||||
if (saveFileDialog.ShowDialog() == DialogResult.OK)
|
|
||||||
{
|
{
|
||||||
saveDirectoryBackup = Path.GetDirectoryName(saveFileDialog.FileName);
|
var saveFileDialog = new SaveFileDialog();
|
||||||
var exportPath = saveFileDialog.FileName;
|
saveFileDialog.FileName = gameObjects[0].m_Name + " (merge).fbx";
|
||||||
List<AssetItem> animationList = null;
|
saveFileDialog.AddExtension = false;
|
||||||
if (animation)
|
saveFileDialog.Filter = "Fbx file (*.fbx)|*.fbx";
|
||||||
|
saveFileDialog.InitialDirectory = saveDirectoryBackup;
|
||||||
|
if (saveFileDialog.ShowDialog(this) == DialogResult.OK)
|
||||||
{
|
{
|
||||||
animationList = GetSelectedAssets().Where(x => x.Type == ClassIDType.AnimationClip).ToList();
|
saveDirectoryBackup = Path.GetDirectoryName(saveFileDialog.FileName);
|
||||||
if (animationList.Count == 0)
|
var exportPath = saveFileDialog.FileName;
|
||||||
|
List<AssetItem> animationList = null;
|
||||||
|
if (animation)
|
||||||
{
|
{
|
||||||
animationList = null;
|
animationList = GetSelectedAssets().Where(x => x.Type == ClassIDType.AnimationClip).ToList();
|
||||||
|
if (animationList.Count == 0)
|
||||||
|
{
|
||||||
|
animationList = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
ExportObjectsMergeWithAnimationClip(exportPath, gameObjects, animationList);
|
||||||
}
|
}
|
||||||
ExportObjectsMergeWithAnimationClip(exportPath, gameObjects, animationList);
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
StatusStripUpdate("No Object selected for export.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,11 +7,6 @@ namespace AssetStudioGUI
|
|||||||
{
|
{
|
||||||
public GameObject gameObject;
|
public GameObject gameObject;
|
||||||
|
|
||||||
public GameObjectTreeNode(string name)
|
|
||||||
{
|
|
||||||
Text = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public GameObjectTreeNode(GameObject gameObject)
|
public GameObjectTreeNode(GameObject gameObject)
|
||||||
{
|
{
|
||||||
this.gameObject = gameObject;
|
this.gameObject = gameObject;
|
||||||
|
@ -14,12 +14,12 @@ namespace AssetStudioGUI
|
|||||||
|
|
||||||
internal DialogResult ShowDialog(IWin32Window owner = null)
|
internal DialogResult ShowDialog(IWin32Window owner = null)
|
||||||
{
|
{
|
||||||
#if NETFRAMEWORK
|
//#if NETFRAMEWORK
|
||||||
if (Environment.OSVersion.Version.Major >= 6)
|
if (Environment.OSVersion.Version.Major >= 6)
|
||||||
{
|
{
|
||||||
return ShowVistaDialog(owner);
|
return ShowVistaDialog(owner);
|
||||||
}
|
}
|
||||||
#endif
|
//#endif
|
||||||
return ShowFolderBrowserDialog(owner);
|
return ShowFolderBrowserDialog(owner);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,48 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
using System.Windows.Forms;
|
|
||||||
|
|
||||||
namespace AssetStudioGUI
|
|
||||||
{
|
|
||||||
internal static class TreeViewExtensions
|
|
||||||
{
|
|
||||||
private const int TVIF_STATE = 0x8;
|
|
||||||
private const int TVIS_STATEIMAGEMASK = 0xF000;
|
|
||||||
private const int TV_FIRST = 0x1100;
|
|
||||||
private const int TVM_SETITEM = TV_FIRST + 63;
|
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential, Pack = 8, CharSet = CharSet.Auto)]
|
|
||||||
private struct TVITEM
|
|
||||||
{
|
|
||||||
public int mask;
|
|
||||||
public IntPtr hItem;
|
|
||||||
public int state;
|
|
||||||
public int stateMask;
|
|
||||||
[MarshalAs(UnmanagedType.LPTStr)]
|
|
||||||
public string lpszText;
|
|
||||||
public int cchTextMax;
|
|
||||||
public int iImage;
|
|
||||||
public int iSelectedImage;
|
|
||||||
public int cChildren;
|
|
||||||
public IntPtr lParam;
|
|
||||||
}
|
|
||||||
|
|
||||||
[DllImport("user32.dll", CharSet = CharSet.Auto)]
|
|
||||||
private static extern IntPtr SendMessage(IntPtr hWnd, int Msg, IntPtr wParam, ref TVITEM lParam);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Hides the checkbox for the specified node on a TreeView control.
|
|
||||||
/// </summary>
|
|
||||||
public static void HideCheckBox(this TreeNode node)
|
|
||||||
{
|
|
||||||
var tvi = new TVITEM
|
|
||||||
{
|
|
||||||
hItem = node.Handle,
|
|
||||||
mask = TVIF_STATE,
|
|
||||||
stateMask = TVIS_STATEIMAGEMASK,
|
|
||||||
state = TVIS_STATEIMAGEMASK
|
|
||||||
};
|
|
||||||
SendMessage(node.TreeView.Handle, TVM_SETITEM, IntPtr.Zero, ref tvi);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -265,7 +265,7 @@ namespace AssetStudioGUI
|
|||||||
Progress.Reset();
|
Progress.Reset();
|
||||||
foreach (var assetsFile in assetsManager.assetsFileList)
|
foreach (var assetsFile in assetsManager.assetsFileList)
|
||||||
{
|
{
|
||||||
var fileNode = new GameObjectTreeNode(assetsFile.fileName); //RootNode
|
var fileNode = new TreeNode(assetsFile.fileName); //RootNode
|
||||||
|
|
||||||
foreach (var obj in assetsFile.Objects)
|
foreach (var obj in assetsFile.Objects)
|
||||||
{
|
{
|
||||||
@ -307,11 +307,12 @@ namespace AssetStudioGUI
|
|||||||
{
|
{
|
||||||
if (m_Father.m_GameObject.TryGet(out var parentGameObject))
|
if (m_Father.m_GameObject.TryGet(out var parentGameObject))
|
||||||
{
|
{
|
||||||
if (!treeNodeDictionary.TryGetValue(parentGameObject, out parentNode))
|
if (!treeNodeDictionary.TryGetValue(parentGameObject, out var parentGameObjectNode))
|
||||||
{
|
{
|
||||||
parentNode = new GameObjectTreeNode(parentGameObject);
|
parentGameObjectNode = new GameObjectTreeNode(parentGameObject);
|
||||||
treeNodeDictionary.Add(parentGameObject, parentNode);
|
treeNodeDictionary.Add(parentGameObject, parentGameObjectNode);
|
||||||
}
|
}
|
||||||
|
parentNode = parentGameObjectNode;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -514,7 +515,7 @@ namespace AssetStudioGUI
|
|||||||
var count = nodes.Cast<TreeNode>().Sum(x => x.Nodes.Count);
|
var count = nodes.Cast<TreeNode>().Sum(x => x.Nodes.Count);
|
||||||
int k = 0;
|
int k = 0;
|
||||||
Progress.Reset();
|
Progress.Reset();
|
||||||
foreach (GameObjectTreeNode node in nodes)
|
foreach (TreeNode node in nodes)
|
||||||
{
|
{
|
||||||
//遍历一级子节点
|
//遍历一级子节点
|
||||||
foreach (GameObjectTreeNode j in node.Nodes)
|
foreach (GameObjectTreeNode j in node.Nodes)
|
||||||
@ -635,7 +636,7 @@ namespace AssetStudioGUI
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
StatusStripUpdate("No Object can be exported.");
|
StatusStripUpdate("No Object selected for export.");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -667,11 +668,11 @@ namespace AssetStudioGUI
|
|||||||
|
|
||||||
public static void GetSelectedParentNode(TreeNodeCollection nodes, List<GameObject> gameObjects)
|
public static void GetSelectedParentNode(TreeNodeCollection nodes, List<GameObject> gameObjects)
|
||||||
{
|
{
|
||||||
foreach (GameObjectTreeNode i in nodes)
|
foreach (TreeNode i in nodes)
|
||||||
{
|
{
|
||||||
if (i.Checked)
|
if (i is GameObjectTreeNode gameObjectTreeNode && i.Checked)
|
||||||
{
|
{
|
||||||
gameObjects.Add(i.gameObject);
|
gameObjects.Add(gameObjectTreeNode.gameObject);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -82,7 +82,7 @@ namespace AssetStudio
|
|||||||
var polygons = triangles.Select(x => new Polygon(new LinearLineSegment(x.Select(y => new PointF(y.X, y.Y)).ToArray()))).ToArray();
|
var polygons = triangles.Select(x => new Polygon(new LinearLineSegment(x.Select(y => new PointF(y.X, y.Y)).ToArray()))).ToArray();
|
||||||
IPathCollection path = new PathCollection(polygons);
|
IPathCollection path = new PathCollection(polygons);
|
||||||
var matrix = Matrix3x2.CreateScale(m_Sprite.m_PixelsToUnits);
|
var matrix = Matrix3x2.CreateScale(m_Sprite.m_PixelsToUnits);
|
||||||
matrix *= Matrix3x2.CreateTranslation(m_Sprite.m_Rect.width * m_Sprite.m_Pivot.X - textureRectOffset.X, m_Sprite.m_Rect.height * m_Sprite.m_Pivot.Y - textureRectOffset.Y);
|
matrix *= Matrix3x2.CreateTranslation(textureRect.width * m_Sprite.m_Pivot.X - textureRectOffset.X, textureRect.height * m_Sprite.m_Pivot.Y - textureRectOffset.Y);
|
||||||
path = path.Transform(matrix);
|
path = path.Transform(matrix);
|
||||||
var graphicsOptions = new GraphicsOptions
|
var graphicsOptions = new GraphicsOptions
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user