- [Core] Added export option to include materials with models in /Materials.
- [GUI] fix issue with `Reset` button causing unintended behaviour. - [Core] fix bug where `Logger` causes performance issues.
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
<add key="filterPrecision" value="0.25" />
|
||||
<add key="exportAllNodes" value="True" />
|
||||
<add key="exportSkins" value="True" />
|
||||
<add key="exportMaterials" value="False" />
|
||||
<add key="exportAnimations" value="True" />
|
||||
<add key="boneSize" value="10" />
|
||||
<add key="fbxVersion" value="3" />
|
||||
@@ -21,7 +22,7 @@
|
||||
<add key="enableFileLogging" value="False" />
|
||||
<add key="minimalAssetMap" value="True" />
|
||||
<add key="allowDuplicates" value="False" />
|
||||
<add key="texs" value='' />
|
||||
<add key="texs" value='{}' />
|
||||
<add key="uvs" value='{"UV0":{"Item1":true,"Item2":0},"UV1":{"Item1":true,"Item2":1},"UV2":{"Item1":false,"Item2":0},"UV3":{"Item1":false,"Item2":0},"UV4":{"Item1":false,"Item2":0},"UV5":{"Item1":false,"Item2":0},"UV6":{"Item1":false,"Item2":0},"UV7":{"Item1":false,"Item2":0}}' />
|
||||
<add key="types" value='{"Animation":{"Item1":true,"Item2":false},"AnimationClip":{"Item1":true,"Item2":true},"Animator":{"Item1":true,"Item2":true},"AnimatorController":{"Item1":true,"Item2":false},"AnimatorOverrideController":{"Item1":true,"Item2":false},"AssetBundle":{"Item1":true,"Item2":false},"AudioClip":{"Item1":true,"Item2":true},"Avatar":{"Item1":true,"Item2":false},"Font":{"Item1":true,"Item2":true},"GameObject":{"Item1":true,"Item2":false},"IndexObject":{"Item1":true,"Item2":false},"Material":{"Item1":true,"Item2":true},"Mesh":{"Item1":true,"Item2":true},"MeshFilter":{"Item1":true,"Item2":false},"MeshRenderer":{"Item1":true,"Item2":false},"MiHoYoBinData":{"Item1":true,"Item2":true},"MonoBehaviour":{"Item1":true,"Item2":true},"MonoScript":{"Item1":true,"Item2":false},"MovieTexture":{"Item1":true,"Item2":true},"PlayerSettings":{"Item1":true,"Item2":false},"RectTransform":{"Item1":true,"Item2":false},"Shader":{"Item1":true,"Item2":true},"SkinnedMeshRenderer":{"Item1":true,"Item2":false},"Sprite":{"Item1":true,"Item2":true},"SpriteAtlas":{"Item1":true,"Item2":false},"TextAsset":{"Item1":true,"Item2":true},"Texture2D":{"Item1":true,"Item2":true},"Transform":{"Item1":true,"Item2":false},"VideoClip":{"Item1":true,"Item2":true},"ResourceManager":{"Item1":true,"Item2":false}}' />
|
||||
</appSettings>
|
||||
|
||||
@@ -365,12 +365,24 @@ namespace AssetStudio.CLI
|
||||
imageFormat = Properties.Settings.Default.convertType,
|
||||
game = Studio.Game,
|
||||
collectAnimations = Properties.Settings.Default.collectAnimations,
|
||||
exportMaterials = Properties.Settings.Default.exportMaterials,
|
||||
materials = new HashSet<Material>(),
|
||||
uvs = JsonConvert.DeserializeObject<Dictionary<string, (bool, int)>>(Properties.Settings.Default.uvs),
|
||||
texs = JsonConvert.DeserializeObject<Dictionary<string, int>>(Properties.Settings.Default.texs),
|
||||
};
|
||||
var convert = animationList != null
|
||||
? new ModelConverter(m_Animator, options, animationList.Select(x => (AnimationClip)x.Asset).ToArray())
|
||||
: new ModelConverter(m_Animator, options);
|
||||
if (options.exportMaterials)
|
||||
{
|
||||
var materialExportPath = Path.Combine(exportFullPath, "Materials");
|
||||
Directory.CreateDirectory(materialExportPath);
|
||||
foreach (var material in options.materials)
|
||||
{
|
||||
var matItem = new AssetItem(material);
|
||||
ExportJSONFile(matItem, materialExportPath);
|
||||
}
|
||||
}
|
||||
ExportFbx(convert, exportFullPath);
|
||||
return true;
|
||||
}
|
||||
@@ -391,6 +403,8 @@ namespace AssetStudio.CLI
|
||||
imageFormat = Properties.Settings.Default.convertType,
|
||||
game = Studio.Game,
|
||||
collectAnimations = Properties.Settings.Default.collectAnimations,
|
||||
exportMaterials = Properties.Settings.Default.exportMaterials,
|
||||
materials = new HashSet<Material>(),
|
||||
uvs = JsonConvert.DeserializeObject<Dictionary<string, (bool, int)>>(Properties.Settings.Default.uvs),
|
||||
texs = JsonConvert.DeserializeObject<Dictionary<string, int>>(Properties.Settings.Default.texs),
|
||||
};
|
||||
@@ -403,6 +417,16 @@ namespace AssetStudio.CLI
|
||||
Logger.Info($"GameObject {gameObject.m_Name} has no mesh, skipping...");
|
||||
return false;
|
||||
}
|
||||
if (options.exportMaterials)
|
||||
{
|
||||
var materialExportPath = Path.Combine(exportPath, "Materials");
|
||||
Directory.CreateDirectory(materialExportPath);
|
||||
foreach (var material in options.materials)
|
||||
{
|
||||
var matItem = new AssetItem(material);
|
||||
ExportJSONFile(matItem, materialExportPath);
|
||||
}
|
||||
}
|
||||
exportPath = exportPath + FixFileName(gameObject.m_Name) + ".fbx";
|
||||
ExportFbx(convert, exportPath);
|
||||
return true;
|
||||
|
||||
@@ -40,7 +40,8 @@ namespace AssetStudio.CLI
|
||||
}
|
||||
|
||||
Studio.Game = game;
|
||||
Logger.Default = new ConsoleLogger() { Flags = o.LoggerFlags.Aggregate((e, x) => e |= x) };
|
||||
Logger.Default = new ConsoleLogger();
|
||||
Logger.Flags = o.LoggerFlags.Aggregate((e, x) => e |= x);
|
||||
Logger.FileLogging = Settings.Default.enableFileLogging;
|
||||
AssetsHelper.Minimal = Settings.Default.minimalAssetMap;
|
||||
AssetsHelper.SetUnityVersion(o.UnityVersion);
|
||||
@@ -67,6 +68,10 @@ namespace AssetStudio.CLI
|
||||
{
|
||||
TypeFlags.SetType(ClassIDType.GameObject, true, false);
|
||||
}
|
||||
if (Settings.Default.exportMaterials)
|
||||
{
|
||||
TypeFlags.SetType(ClassIDType.Material, true, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -43,6 +43,7 @@ namespace AssetStudio.CLI.Properties {
|
||||
public decimal filterPrecision => AppSettings.Get("filterPrecision", (decimal)0.25);
|
||||
public bool exportAllNodes => AppSettings.Get("exportAllNodes", true);
|
||||
public bool exportSkins => AppSettings.Get("exportSkins", true);
|
||||
public bool exportMaterials => AppSettings.Get("exportMaterials", false);
|
||||
public bool collectAnimations => AppSettings.Get("collectAnimations", true);
|
||||
public bool exportAnimations => AppSettings.Get("exportAnimations", true);
|
||||
public decimal boneSize => AppSettings.Get("boneSize", (decimal)10);
|
||||
|
||||
@@ -1,126 +1,3 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<configSections>
|
||||
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
|
||||
<section name="AssetStudio.GUI.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
|
||||
</sectionGroup>
|
||||
</configSections>
|
||||
<userSettings>
|
||||
<AssetStudio.GUI.Properties.Settings>
|
||||
<setting name="displayAll" serializeAs="String">
|
||||
<value>False</value>
|
||||
</setting>
|
||||
<setting name="enablePreview" serializeAs="String">
|
||||
<value>True</value>
|
||||
</setting>
|
||||
<setting name="displayInfo" serializeAs="String">
|
||||
<value>True</value>
|
||||
</setting>
|
||||
<setting name="openAfterExport" serializeAs="String">
|
||||
<value>True</value>
|
||||
</setting>
|
||||
<setting name="assetGroupOption" serializeAs="String">
|
||||
<value>0</value>
|
||||
</setting>
|
||||
<setting name="convertTexture" serializeAs="String">
|
||||
<value>True</value>
|
||||
</setting>
|
||||
<setting name="convertAudio" serializeAs="String">
|
||||
<value>True</value>
|
||||
</setting>
|
||||
<setting name="eulerFilter" serializeAs="String">
|
||||
<value>True</value>
|
||||
</setting>
|
||||
<setting name="filterPrecision" serializeAs="String">
|
||||
<value>0.25</value>
|
||||
</setting>
|
||||
<setting name="exportAllNodes" serializeAs="String">
|
||||
<value>True</value>
|
||||
</setting>
|
||||
<setting name="exportSkins" serializeAs="String">
|
||||
<value>True</value>
|
||||
</setting>
|
||||
<setting name="exportAnimations" serializeAs="String">
|
||||
<value>True</value>
|
||||
</setting>
|
||||
<setting name="boneSize" serializeAs="String">
|
||||
<value>10</value>
|
||||
</setting>
|
||||
<setting name="fbxVersion" serializeAs="String">
|
||||
<value>3</value>
|
||||
</setting>
|
||||
<setting name="fbxFormat" serializeAs="String">
|
||||
<value>0</value>
|
||||
</setting>
|
||||
<setting name="scaleFactor" serializeAs="String">
|
||||
<value>1</value>
|
||||
</setting>
|
||||
<setting name="exportBlendShape" serializeAs="String">
|
||||
<value>True</value>
|
||||
</setting>
|
||||
<setting name="castToBone" serializeAs="String">
|
||||
<value>False</value>
|
||||
</setting>
|
||||
<setting name="restoreExtensionName" serializeAs="String">
|
||||
<value>True</value>
|
||||
</setting>
|
||||
<setting name="key" serializeAs="String">
|
||||
<value>147</value>
|
||||
</setting>
|
||||
<setting name="enableConsole" serializeAs="String">
|
||||
<value>True</value>
|
||||
</setting>
|
||||
<setting name="encrypted" serializeAs="String">
|
||||
<value>True</value>
|
||||
</setting>
|
||||
<setting name="selectedGame" serializeAs="String">
|
||||
<value>0</value>
|
||||
</setting>
|
||||
<setting name="enableResolveDependencies" serializeAs="String">
|
||||
<value>True</value>
|
||||
</setting>
|
||||
<setting name="assetMapType" serializeAs="String">
|
||||
<value>1</value>
|
||||
</setting>
|
||||
<setting name="collectAnimations" serializeAs="String">
|
||||
<value>True</value>
|
||||
</setting>
|
||||
<setting name="skipContainer" serializeAs="String">
|
||||
<value>False</value>
|
||||
</setting>
|
||||
<setting name="minimalAssetMap" serializeAs="String">
|
||||
<value>True</value>
|
||||
</setting>
|
||||
<setting name="modelsOnly" serializeAs="String">
|
||||
<value>False</value>
|
||||
</setting>
|
||||
<setting name="enableModelPreview" serializeAs="String">
|
||||
<value>False</value>
|
||||
</setting>
|
||||
<setting name="selectedUnityCNKey" serializeAs="String">
|
||||
<value>0</value>
|
||||
</setting>
|
||||
<setting name="selectedCABMapName" serializeAs="String">
|
||||
<value />
|
||||
</setting>
|
||||
<setting name="enableFileLogging" serializeAs="String">
|
||||
<value>True</value>
|
||||
</setting>
|
||||
<setting name="uvs" serializeAs="String">
|
||||
<value>{"UV0":{"Item1":true,"Item2":0},"UV1":{"Item1":true,"Item2":1},"UV2":{"Item1":false,"Item2":0},"UV3":{"Item1":false,"Item2":0},"UV4":{"Item1":false,"Item2":0},"UV5":{"Item1":false,"Item2":0},"UV6":{"Item1":false,"Item2":0},"UV7":{"Item1":false,"Item2":0}}</value>
|
||||
</setting>
|
||||
<setting name="allowDuplicates" serializeAs="String">
|
||||
<value>False</value>
|
||||
</setting>
|
||||
<setting name="loggerEventType" serializeAs="String">
|
||||
<value>30</value>
|
||||
</setting>
|
||||
<setting name="types" serializeAs="String">
|
||||
<value>{"Animation":{"Item1":true,"Item2":false},"AnimationClip":{"Item1":true,"Item2":true},"Animator":{"Item1":true,"Item2":true},"AnimatorController":{"Item1":true,"Item2":false},"AnimatorOverrideController":{"Item1":true,"Item2":false},"AssetBundle":{"Item1":true,"Item2":false},"AudioClip":{"Item1":true,"Item2":true},"Avatar":{"Item1":true,"Item2":false},"Font":{"Item1":true,"Item2":true},"GameObject":{"Item1":true,"Item2":false},"IndexObject":{"Item1":true,"Item2":false},"Material":{"Item1":true,"Item2":true},"Mesh":{"Item1":true,"Item2":true},"MeshFilter":{"Item1":true,"Item2":false},"MeshRenderer":{"Item1":true,"Item2":false},"MiHoYoBinData":{"Item1":true,"Item2":true},"MonoBehaviour":{"Item1":true,"Item2":true},"MonoScript":{"Item1":true,"Item2":false},"MovieTexture":{"Item1":true,"Item2":true},"PlayerSettings":{"Item1":true,"Item2":false},"RectTransform":{"Item1":true,"Item2":false},"Shader":{"Item1":true,"Item2":true},"SkinnedMeshRenderer":{"Item1":true,"Item2":false},"Sprite":{"Item1":true,"Item2":true},"SpriteAtlas":{"Item1":true,"Item2":false},"TextAsset":{"Item1":true,"Item2":true},"Texture2D":{"Item1":true,"Item2":true},"Transform":{"Item1":true,"Item2":false},"VideoClip":{"Item1":true,"Item2":true},"ResourceManager":{"Item1":true,"Item2":false}}</value>
|
||||
</setting>
|
||||
<setting name="texs" serializeAs="String">
|
||||
<value />
|
||||
</setting>
|
||||
</AssetStudio.GUI.Properties.Settings>
|
||||
</userSettings>
|
||||
</configuration>
|
||||
14
AssetStudio.GUI/ExportOptions.Designer.cs
generated
14
AssetStudio.GUI/ExportOptions.Designer.cs
generated
@@ -66,6 +66,7 @@ namespace AssetStudio.GUI
|
||||
converttexture = new CheckBox();
|
||||
collectAnimations = new CheckBox();
|
||||
groupBox2 = new GroupBox();
|
||||
exportMaterials = new CheckBox();
|
||||
exportBlendShape = new CheckBox();
|
||||
exportAnimations = new CheckBox();
|
||||
scaleFactor = new NumericUpDown();
|
||||
@@ -471,6 +472,7 @@ namespace AssetStudio.GUI
|
||||
// groupBox2
|
||||
//
|
||||
groupBox2.AutoSize = true;
|
||||
groupBox2.Controls.Add(exportMaterials);
|
||||
groupBox2.Controls.Add(collectAnimations);
|
||||
groupBox2.Controls.Add(exportBlendShape);
|
||||
groupBox2.Controls.Add(exportAnimations);
|
||||
@@ -497,6 +499,17 @@ namespace AssetStudio.GUI
|
||||
groupBox2.TabStop = false;
|
||||
groupBox2.Text = "Fbx";
|
||||
//
|
||||
// exportMaterials
|
||||
//
|
||||
exportMaterials.AutoSize = true;
|
||||
exportMaterials.Location = new System.Drawing.Point(154, 96);
|
||||
exportMaterials.Margin = new Padding(4);
|
||||
exportMaterials.Name = "exportMaterials";
|
||||
exportMaterials.Size = new System.Drawing.Size(111, 19);
|
||||
exportMaterials.TabIndex = 25;
|
||||
exportMaterials.Text = "Export materials";
|
||||
exportMaterials.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// exportBlendShape
|
||||
//
|
||||
exportBlendShape.AutoSize = true;
|
||||
@@ -780,5 +793,6 @@ namespace AssetStudio.GUI
|
||||
private ComboBox texNameComboBox;
|
||||
private Button addTexNameButton;
|
||||
private Button removeTexNameButton;
|
||||
private CheckBox exportMaterials;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Configuration;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
@@ -34,6 +36,7 @@ namespace AssetStudio.GUI
|
||||
filterPrecision.Value = Properties.Settings.Default.filterPrecision;
|
||||
exportAllNodes.Checked = Properties.Settings.Default.exportAllNodes;
|
||||
exportSkins.Checked = Properties.Settings.Default.exportSkins;
|
||||
exportMaterials.Checked = Properties.Settings.Default.exportMaterials;
|
||||
exportAnimations.Checked = Properties.Settings.Default.exportAnimations;
|
||||
exportBlendShape.Checked = Properties.Settings.Default.exportBlendShape;
|
||||
castToBone.Checked = Properties.Settings.Default.castToBone;
|
||||
@@ -84,6 +87,7 @@ namespace AssetStudio.GUI
|
||||
Properties.Settings.Default.filterPrecision = filterPrecision.Value;
|
||||
Properties.Settings.Default.exportAllNodes = exportAllNodes.Checked;
|
||||
Properties.Settings.Default.exportSkins = exportSkins.Checked;
|
||||
Properties.Settings.Default.exportMaterials = exportMaterials.Checked;
|
||||
Properties.Settings.Default.exportAnimations = exportAnimations.Checked;
|
||||
Properties.Settings.Default.exportBlendShape = exportBlendShape.Checked;
|
||||
Properties.Settings.Default.castToBone = castToBone.Checked;
|
||||
@@ -251,7 +255,12 @@ namespace AssetStudio.GUI
|
||||
|
||||
private void Reset_Click(object sender, EventArgs e)
|
||||
{
|
||||
Properties.Settings.Default.Reset();
|
||||
foreach(SettingsProperty settingsProperty in Properties.Settings.Default.Properties)
|
||||
{
|
||||
Properties.Settings.Default[settingsProperty.Name] = TypeDescriptor.GetConverter(settingsProperty.PropertyType).ConvertFrom(settingsProperty.DefaultValue);
|
||||
}
|
||||
Properties.Settings.Default.Save();
|
||||
|
||||
DialogResult = DialogResult.Cancel;
|
||||
Resetted = true;
|
||||
Close();
|
||||
|
||||
@@ -364,12 +364,24 @@ namespace AssetStudio.GUI
|
||||
imageFormat = Properties.Settings.Default.convertType,
|
||||
game = Studio.Game,
|
||||
collectAnimations = Properties.Settings.Default.collectAnimations,
|
||||
exportMaterials = Properties.Settings.Default.exportMaterials,
|
||||
materials = new HashSet<Material>(),
|
||||
uvs = JsonConvert.DeserializeObject<Dictionary<string, (bool, int)>>(Properties.Settings.Default.uvs),
|
||||
texs = JsonConvert.DeserializeObject<Dictionary<string, int>>(Properties.Settings.Default.texs),
|
||||
};
|
||||
var convert = animationList != null
|
||||
? new ModelConverter(m_Animator, options, animationList.Select(x => (AnimationClip)x.Asset).ToArray())
|
||||
: new ModelConverter(m_Animator, options);
|
||||
if (options.exportMaterials)
|
||||
{
|
||||
var materialExportPath = Path.Combine(exportFullPath, "Materials");
|
||||
Directory.CreateDirectory(materialExportPath);
|
||||
foreach (var material in options.materials)
|
||||
{
|
||||
var matItem = new AssetItem(material);
|
||||
ExportJSONFile(matItem, materialExportPath);
|
||||
}
|
||||
}
|
||||
ExportFbx(convert, exportFullPath);
|
||||
return true;
|
||||
}
|
||||
@@ -390,8 +402,10 @@ namespace AssetStudio.GUI
|
||||
imageFormat = Properties.Settings.Default.convertType,
|
||||
game = Studio.Game,
|
||||
collectAnimations = Properties.Settings.Default.collectAnimations,
|
||||
uvs = JsonConvert.DeserializeObject<Dictionary<string, (bool, int)>>(Properties.Settings.Default.uvs),
|
||||
texs = JsonConvert.DeserializeObject<Dictionary<string, int>>(Properties.Settings.Default.texs),
|
||||
exportMaterials = Properties.Settings.Default.exportMaterials,
|
||||
materials = new HashSet<Material>(),
|
||||
uvs = JsonConvert.DeserializeObject<Dictionary<string, (bool, int)>>(Properties.Settings.Default.uvs, new JsonSerializerSettings() { DefaultValueHandling = DefaultValueHandling.Populate }),
|
||||
texs = JsonConvert.DeserializeObject<Dictionary<string, int>>(Properties.Settings.Default.texs, new JsonSerializerSettings() { DefaultValueHandling = DefaultValueHandling.Populate }),
|
||||
};
|
||||
var convert = animationList != null
|
||||
? new ModelConverter(gameObject, options, animationList.Select(x => (AnimationClip)x.Asset).ToArray())
|
||||
@@ -402,6 +416,16 @@ namespace AssetStudio.GUI
|
||||
Logger.Info($"GameObject {gameObject.m_Name} has no mesh, skipping...");
|
||||
return false;
|
||||
}
|
||||
if (options.exportMaterials)
|
||||
{
|
||||
var materialExportPath = Path.Combine(exportPath, "Materials");
|
||||
Directory.CreateDirectory(materialExportPath);
|
||||
foreach (var material in options.materials)
|
||||
{
|
||||
var matItem = new AssetItem(material);
|
||||
ExportJSONFile(matItem, materialExportPath);
|
||||
}
|
||||
}
|
||||
exportPath = exportPath + FixFileName(gameObject.m_Name) + ".fbx";
|
||||
ExportFbx(convert, exportPath);
|
||||
return true;
|
||||
@@ -415,12 +439,24 @@ namespace AssetStudio.GUI
|
||||
imageFormat = Properties.Settings.Default.convertType,
|
||||
game = Studio.Game,
|
||||
collectAnimations = Properties.Settings.Default.collectAnimations,
|
||||
exportMaterials = Properties.Settings.Default.exportMaterials,
|
||||
materials = new HashSet<Material>(),
|
||||
uvs = JsonConvert.DeserializeObject<Dictionary<string, (bool, int)>>(Properties.Settings.Default.uvs),
|
||||
texs = JsonConvert.DeserializeObject<Dictionary<string, int>>(Properties.Settings.Default.texs),
|
||||
};
|
||||
var convert = animationList != null
|
||||
? new ModelConverter(rootName, gameObject, options, animationList.Select(x => (AnimationClip)x.Asset).ToArray())
|
||||
: new ModelConverter(rootName, gameObject, options);
|
||||
if (options.exportMaterials)
|
||||
{
|
||||
var materialExportPath = Path.Combine(exportPath, "Materials");
|
||||
Directory.CreateDirectory(materialExportPath);
|
||||
foreach (var material in options.materials)
|
||||
{
|
||||
var matItem = new AssetItem(material);
|
||||
ExportJSONFile(matItem, materialExportPath);
|
||||
}
|
||||
}
|
||||
ExportFbx(convert, exportPath);
|
||||
}
|
||||
|
||||
|
||||
@@ -136,7 +136,7 @@ namespace AssetStudio.GUI
|
||||
var menuItem = new ToolStripMenuItem(loggerEvent.ToString()) { CheckOnClick = true, Checked = loggerEventType.HasFlag(loggerEvent), Tag = (int)loggerEvent };
|
||||
loggedEventsMenuItem.DropDownItems.Add(menuItem);
|
||||
}
|
||||
Logger.Default.Flags = loggerEventType;
|
||||
Logger.Flags = loggerEventType;
|
||||
Logger.FileLogging = enableFileLogging.Checked;
|
||||
}
|
||||
|
||||
@@ -1312,6 +1312,8 @@ namespace AssetStudio.GUI
|
||||
imageFormat = Properties.Settings.Default.convertType,
|
||||
game = Studio.Game,
|
||||
collectAnimations = Properties.Settings.Default.collectAnimations,
|
||||
exportMaterials = false,
|
||||
materials = new HashSet<Material>(),
|
||||
uvs = JsonConvert.DeserializeObject<Dictionary<string, (bool, int)>>(Properties.Settings.Default.uvs),
|
||||
texs = JsonConvert.DeserializeObject<Dictionary<string, int>>(Properties.Settings.Default.texs),
|
||||
};
|
||||
@@ -1325,6 +1327,8 @@ namespace AssetStudio.GUI
|
||||
imageFormat = Properties.Settings.Default.convertType,
|
||||
game = Studio.Game,
|
||||
collectAnimations = Properties.Settings.Default.collectAnimations,
|
||||
exportMaterials = false,
|
||||
materials = new HashSet<Material>(),
|
||||
uvs = JsonConvert.DeserializeObject<Dictionary<string, (bool, int)>>(Properties.Settings.Default.uvs),
|
||||
texs = JsonConvert.DeserializeObject<Dictionary<string, int>>(Properties.Settings.Default.texs),
|
||||
};
|
||||
@@ -2354,7 +2358,7 @@ namespace AssetStudio.GUI
|
||||
Properties.Settings.Default.loggerEventType = loggedEventsMenuItem.DropDownItems.Cast<ToolStripMenuItem>().Select(x => x.Checked ? (int)x.Tag : 0).Sum();
|
||||
Properties.Settings.Default.Save();
|
||||
|
||||
Logger.Default.Flags = (LoggerEvent)Properties.Settings.Default.loggerEventType;
|
||||
Logger.Flags = (LoggerEvent)Properties.Settings.Default.loggerEventType;
|
||||
}
|
||||
|
||||
private void abortStripMenuItem_Click(object sender, EventArgs e)
|
||||
|
||||
14
AssetStudio.GUI/Properties/Settings.Designer.cs
generated
14
AssetStudio.GUI/Properties/Settings.Designer.cs
generated
@@ -484,7 +484,7 @@ namespace AssetStudio.GUI.Properties {
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("")]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("{}")]
|
||||
public string texs {
|
||||
get {
|
||||
return ((string)(this["texs"]));
|
||||
@@ -493,5 +493,17 @@ namespace AssetStudio.GUI.Properties {
|
||||
this["texs"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("False")]
|
||||
public bool exportMaterials {
|
||||
get {
|
||||
return ((bool)(this["exportMaterials"]));
|
||||
}
|
||||
set {
|
||||
this["exportMaterials"] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -117,7 +117,10 @@
|
||||
<Value Profile="(Default)">{"Animation":{"Item1":true,"Item2":false},"AnimationClip":{"Item1":true,"Item2":true},"Animator":{"Item1":true,"Item2":true},"AnimatorController":{"Item1":true,"Item2":false},"AnimatorOverrideController":{"Item1":true,"Item2":false},"AssetBundle":{"Item1":true,"Item2":false},"AudioClip":{"Item1":true,"Item2":true},"Avatar":{"Item1":true,"Item2":false},"Font":{"Item1":true,"Item2":true},"GameObject":{"Item1":true,"Item2":false},"IndexObject":{"Item1":true,"Item2":false},"Material":{"Item1":true,"Item2":true},"Mesh":{"Item1":true,"Item2":true},"MeshFilter":{"Item1":true,"Item2":false},"MeshRenderer":{"Item1":true,"Item2":false},"MiHoYoBinData":{"Item1":true,"Item2":true},"MonoBehaviour":{"Item1":true,"Item2":true},"MonoScript":{"Item1":true,"Item2":false},"MovieTexture":{"Item1":true,"Item2":true},"PlayerSettings":{"Item1":true,"Item2":false},"RectTransform":{"Item1":true,"Item2":false},"Shader":{"Item1":true,"Item2":true},"SkinnedMeshRenderer":{"Item1":true,"Item2":false},"Sprite":{"Item1":true,"Item2":true},"SpriteAtlas":{"Item1":true,"Item2":false},"TextAsset":{"Item1":true,"Item2":true},"Texture2D":{"Item1":true,"Item2":true},"Transform":{"Item1":true,"Item2":false},"VideoClip":{"Item1":true,"Item2":true},"ResourceManager":{"Item1":true,"Item2":false}}</Value>
|
||||
</Setting>
|
||||
<Setting Name="texs" Type="System.String" Scope="User">
|
||||
<Value Profile="(Default)" />
|
||||
<Value Profile="(Default)">{}</Value>
|
||||
</Setting>
|
||||
<Setting Name="exportMaterials" Type="System.Boolean" Scope="User">
|
||||
<Value Profile="(Default)">False</Value>
|
||||
</Setting>
|
||||
</Settings>
|
||||
</SettingsFile>
|
||||
@@ -649,6 +649,10 @@ namespace AssetStudio
|
||||
ImportedMaterial iMat;
|
||||
if (mat != null)
|
||||
{
|
||||
if (options.exportMaterials)
|
||||
{
|
||||
options.materials.Add(mat);
|
||||
}
|
||||
iMat = ImportedHelpers.FindMaterial(mat.m_Name, MaterialList);
|
||||
if (iMat != null)
|
||||
{
|
||||
@@ -1172,6 +1176,8 @@ namespace AssetStudio
|
||||
public ImageFormat imageFormat;
|
||||
public Game game;
|
||||
public bool collectAnimations;
|
||||
public bool exportMaterials;
|
||||
public HashSet<Material> materials;
|
||||
public Dictionary<string, (bool, int)> uvs;
|
||||
public Dictionary<string, int> texs;
|
||||
}
|
||||
|
||||
@@ -20,27 +20,18 @@ namespace AssetStudio
|
||||
|
||||
public interface ILogger
|
||||
{
|
||||
public bool Silent { get; set; }
|
||||
public LoggerEvent Flags { get; set; }
|
||||
void Log(LoggerEvent loggerEvent, string message);
|
||||
}
|
||||
|
||||
public sealed class DummyLogger : ILogger
|
||||
{
|
||||
public bool Silent { get; set; }
|
||||
public LoggerEvent Flags { get; set; }
|
||||
public void Log(LoggerEvent loggerEvent, string message) { }
|
||||
}
|
||||
|
||||
public sealed class ConsoleLogger : ILogger
|
||||
{
|
||||
public bool Silent { get; set; }
|
||||
public LoggerEvent Flags { get; set; }
|
||||
public void Log(LoggerEvent loggerEvent, string message)
|
||||
{
|
||||
if (!Flags.HasFlag(loggerEvent) || Silent)
|
||||
return;
|
||||
|
||||
Console.WriteLine("[{0}] {1}", loggerEvent, message);
|
||||
}
|
||||
}
|
||||
@@ -51,9 +42,6 @@ namespace AssetStudio
|
||||
private const string PrevLogFileName = "log_prev.txt";
|
||||
private readonly object LockWriter = new object();
|
||||
private StreamWriter Writer;
|
||||
|
||||
public bool Silent { get; set; }
|
||||
public LoggerEvent Flags { get; set; }
|
||||
public FileLogger()
|
||||
{
|
||||
var logPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, LogFileName);
|
||||
@@ -71,9 +59,6 @@ namespace AssetStudio
|
||||
}
|
||||
public void Log(LoggerEvent loggerEvent, string message)
|
||||
{
|
||||
if (!Flags.HasFlag(loggerEvent) || Silent)
|
||||
return;
|
||||
|
||||
lock (LockWriter)
|
||||
{
|
||||
Writer.WriteLine($"[{DateTime.Now}][{loggerEvent}] {message}");
|
||||
|
||||
@@ -13,11 +13,8 @@ namespace AssetStudio
|
||||
public static ILogger Default = new DummyLogger();
|
||||
public static ILogger File;
|
||||
|
||||
public static bool Silent
|
||||
{
|
||||
get => Default.Silent;
|
||||
set => Default.Silent = value;
|
||||
}
|
||||
public static bool Silent { get; set; }
|
||||
public static LoggerEvent Flags { get; set; }
|
||||
|
||||
public static bool FileLogging
|
||||
{
|
||||
@@ -48,6 +45,9 @@ namespace AssetStudio
|
||||
|
||||
public static void Verbose(string message)
|
||||
{
|
||||
if (!Flags.HasFlag(LoggerEvent.Verbose) || Silent)
|
||||
return;
|
||||
|
||||
try
|
||||
{
|
||||
var callerMethod = new StackTrace().GetFrame(1).GetMethod();
|
||||
@@ -63,27 +63,42 @@ namespace AssetStudio
|
||||
}
|
||||
public static void Debug(string message)
|
||||
{
|
||||
if (!Flags.HasFlag(LoggerEvent.Debug) || Silent)
|
||||
return;
|
||||
|
||||
if (FileLogging) File.Log(LoggerEvent.Debug, message);
|
||||
Default.Log(LoggerEvent.Debug, message);
|
||||
}
|
||||
public static void Info(string message)
|
||||
{
|
||||
if (!Flags.HasFlag(LoggerEvent.Info) || Silent)
|
||||
return;
|
||||
|
||||
if (FileLogging) File.Log(LoggerEvent.Info, message);
|
||||
Default.Log(LoggerEvent.Info, message);
|
||||
}
|
||||
public static void Warning(string message)
|
||||
{
|
||||
if (!Flags.HasFlag(LoggerEvent.Warning) || Silent)
|
||||
return;
|
||||
|
||||
if (FileLogging) File.Log(LoggerEvent.Warning, message);
|
||||
Default.Log(LoggerEvent.Warning, message);
|
||||
}
|
||||
public static void Error(string message)
|
||||
{
|
||||
if (!Flags.HasFlag(LoggerEvent.Error) || Silent)
|
||||
return;
|
||||
|
||||
if (FileLogging) File.Log(LoggerEvent.Error, message);
|
||||
Default.Log(LoggerEvent.Error, message);
|
||||
}
|
||||
|
||||
public static void Error(string message, Exception e)
|
||||
{
|
||||
if (!Flags.HasFlag(LoggerEvent.Error) || Silent)
|
||||
return;
|
||||
|
||||
var sb = new StringBuilder();
|
||||
sb.AppendLine(message);
|
||||
sb.AppendLine(e.ToString());
|
||||
|
||||
Reference in New Issue
Block a user