Skip to content

Commit

Permalink
add some features
Browse files Browse the repository at this point in the history
- Export tex2D/sprites with PathID as a filename
- Dump selected assets from the context menu strip
- Drag&Drop support by Jayatubi
- Sort by PathID by Tahvohck
  • Loading branch information
aelurum committed Jul 26, 2020
1 parent 4a81c46 commit c5f7ef6
Show file tree
Hide file tree
Showing 18 changed files with 292 additions and 192 deletions.
2 changes: 1 addition & 1 deletion AssetStudio/AssetStudio.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<DebugType>none</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
Expand Down
4 changes: 2 additions & 2 deletions AssetStudio/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyVersion("0.14.38.3")]
[assembly: AssemblyFileVersion("0.14.38.3")]
10 changes: 5 additions & 5 deletions AssetStudioFBX/AssetStudioFBX.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -24,34 +24,34 @@
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<Keyword>ManagedCProj</Keyword>
<RootNamespace>AssetStudioFBX</RootNamespace>
<WindowsTargetPlatformVersion>10.0.18362.0</WindowsTargetPlatformVersion>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<PlatformToolset>v142</PlatformToolset>
<CLRSupport>true</CLRSupport>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<PlatformToolset>v142</PlatformToolset>
<CLRSupport>true</CLRSupport>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<PlatformToolset>v142</PlatformToolset>
<CLRSupport>true</CLRSupport>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<PlatformToolset>v142</PlatformToolset>
<CLRSupport>true</CLRSupport>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
Expand Down
5 changes: 3 additions & 2 deletions AssetStudioGUI/AssetStudioGUI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
Expand All @@ -28,7 +29,7 @@
<OutputPath>bin\x64\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<DebugType>none</DebugType>
<PlatformTarget>x64</PlatformTarget>
<LangVersion>7.3</LangVersion>
<ErrorReport>prompt</ErrorReport>
Expand All @@ -50,7 +51,7 @@
<OutputPath>bin\x86\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<DebugType>none</DebugType>
<PlatformTarget>x86</PlatformTarget>
<LangVersion>7.3</LangVersion>
<ErrorReport>prompt</ErrorReport>
Expand Down
196 changes: 103 additions & 93 deletions AssetStudioGUI/AssetStudioGUIForm.Designer.cs

Large diffs are not rendered by default.

47 changes: 45 additions & 2 deletions AssetStudioGUI/AssetStudioGUIForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,35 @@ public AssetStudioGUIForm()
Logger.Default = new GUILogger(StatusStripUpdate);
Progress.Default = new GUIProgress(SetProgressBarValue);
Studio.StatusStripUpdate = StatusStripUpdate;

this.AllowDrop = true;
this.DragEnter += AssetStudioGUIForm_DragEnter;
this.DragDrop += AssetStudioGUIForm_DragDrop;
}

private void AssetStudioGUIForm_DragEnter(object sender, DragEventArgs e)
{
if (e.Data.GetDataPresent(DataFormats.FileDrop)) e.Effect = DragDropEffects.Move;
}

private async void AssetStudioGUIForm_DragDrop(object sender, DragEventArgs e)
{
string[] paths = (string[])e.Data.GetData(DataFormats.FileDrop);
if (paths.Length > 0)
{
ResetForm();

if (paths.Length == 1 && Directory.Exists(paths[0]))
{
await Task.Run(() => assetsManager.LoadFolder(paths[0]));
}
else
{
await Task.Run(() => assetsManager.LoadFiles(paths));
}

BuildAssetStructures();
}
}

private async void loadFile_Click(object sender, EventArgs e)
Expand Down Expand Up @@ -442,7 +471,7 @@ private void treeSearch_Enter(object sender, EventArgs e)

private void treeSearch_Leave(object sender, EventArgs e)
{
if (treeSearch.Text == "")
if (string.IsNullOrEmpty(treeSearch.Text))
{
treeSearch.Text = " Search ";
treeSearch.ForeColor = SystemColors.GrayText;
Expand Down Expand Up @@ -512,7 +541,7 @@ private void listSearch_Enter(object sender, EventArgs e)

private void listSearch_Leave(object sender, EventArgs e)
{
if (listSearch.Text == "")
if (string.IsNullOrEmpty(listSearch.Text))
{
enableFiltering = false;
listSearch.Text = " Filter ";
Expand Down Expand Up @@ -564,6 +593,15 @@ private void assetListView_ColumnClick(object sender, ColumnClickEventArgs e)
return reverseSort ? bsf.CompareTo(asf) : asf.CompareTo(bsf);
});
}
else if (sortColumn == 3) // PathID
{
visibleAssets.Sort((x, y) =>
{
long pathID_X = x.m_PathID;
long pathID_Y = y.m_PathID;
return reverseSort ? pathID_Y.CompareTo(pathID_X) : pathID_X.CompareTo(pathID_Y);
});
}
else
{
visibleAssets.Sort((a, b) =>
Expand Down Expand Up @@ -1214,6 +1252,11 @@ private void exportSelectedAssetsToolStripMenuItem_Click(object sender, EventArg
ExportAssets(2, ExportType.Convert);
}

private void dumpSelectedAssetsToolStripMenuItem_Click(object sender, EventArgs e)
{
ExportAssets(2, ExportType.Dump);
}

private void showOriginalFileToolStripMenuItem_Click(object sender, EventArgs e)
{
var selectasset = (AssetItem)assetListView.Items[assetListView.SelectedIndices[0]];
Expand Down
6 changes: 3 additions & 3 deletions AssetStudioGUI/AssetStudioGUIForm.resx
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,9 @@
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>312, 17</value>
</metadata>
<metadata name="statusStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>432, 17</value>
</metadata>
<data name="fontPreviewBox.Text" xml:space="preserve">
<value>abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWYZ
1234567890.:,;'\"(!?)+-*/=
Expand All @@ -138,9 +141,6 @@ The quick brown fox jumps over the lazy dog. 1234567890

The quick brown fox jumps over the lazy dog. 1234567890</value>
</data>
<metadata name="statusStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>432, 17</value>
</metadata>
<metadata name="timer.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>553, 17</value>
</metadata>
Expand Down
2 changes: 1 addition & 1 deletion AssetStudioGUI/Components/TreeViewExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public static void HideCheckBox(this TreeNode node)
hItem = node.Handle,
mask = TVIF_STATE,
stateMask = TVIS_STATEIMAGEMASK,
state = 0
state = node.StateImageIndex //freeze bugfix (no)
};
SendMessage(node.TreeView.Handle, TVM_SETITEM, IntPtr.Zero, ref tvi);
}
Expand Down
Loading

0 comments on commit c5f7ef6

Please sign in to comment.