- [Core] fix bug with export part for Materials.
This commit is contained in:
@@ -375,7 +375,7 @@ namespace AssetStudio.CLI
|
|||||||
: new ModelConverter(m_Animator, options);
|
: new ModelConverter(m_Animator, options);
|
||||||
if (options.exportMaterials)
|
if (options.exportMaterials)
|
||||||
{
|
{
|
||||||
var materialExportPath = Path.Combine(exportFullPath, "Materials");
|
var materialExportPath = Path.Combine(Path.GetDirectoryName(exportFullPath), "Materials");
|
||||||
Directory.CreateDirectory(materialExportPath);
|
Directory.CreateDirectory(materialExportPath);
|
||||||
foreach (var material in options.materials)
|
foreach (var material in options.materials)
|
||||||
{
|
{
|
||||||
@@ -393,7 +393,7 @@ namespace AssetStudio.CLI
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
var m_GameObject = (GameObject)item.Asset;
|
var m_GameObject = (GameObject)item.Asset;
|
||||||
return ExportGameObject(m_GameObject, exportPath, animationList);
|
return ExportGameObject(m_GameObject, exportFullPath, animationList);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool ExportGameObject(GameObject gameObject, string exportPath, List<AssetItem> animationList = null)
|
public static bool ExportGameObject(GameObject gameObject, string exportPath, List<AssetItem> animationList = null)
|
||||||
|
|||||||
@@ -374,7 +374,7 @@ namespace AssetStudio.GUI
|
|||||||
: new ModelConverter(m_Animator, options);
|
: new ModelConverter(m_Animator, options);
|
||||||
if (options.exportMaterials)
|
if (options.exportMaterials)
|
||||||
{
|
{
|
||||||
var materialExportPath = Path.Combine(exportFullPath, "Materials");
|
var materialExportPath = Path.Combine(Path.GetDirectoryName(exportFullPath), "Materials");
|
||||||
Directory.CreateDirectory(materialExportPath);
|
Directory.CreateDirectory(materialExportPath);
|
||||||
foreach (var material in options.materials)
|
foreach (var material in options.materials)
|
||||||
{
|
{
|
||||||
@@ -404,8 +404,8 @@ namespace AssetStudio.GUI
|
|||||||
collectAnimations = Properties.Settings.Default.collectAnimations,
|
collectAnimations = Properties.Settings.Default.collectAnimations,
|
||||||
exportMaterials = Properties.Settings.Default.exportMaterials,
|
exportMaterials = Properties.Settings.Default.exportMaterials,
|
||||||
materials = new HashSet<Material>(),
|
materials = new HashSet<Material>(),
|
||||||
uvs = JsonConvert.DeserializeObject<Dictionary<string, (bool, int)>>(Properties.Settings.Default.uvs, new JsonSerializerSettings() { DefaultValueHandling = DefaultValueHandling.Populate }),
|
uvs = JsonConvert.DeserializeObject<Dictionary<string, (bool, int)>>(Properties.Settings.Default.uvs),
|
||||||
texs = JsonConvert.DeserializeObject<Dictionary<string, int>>(Properties.Settings.Default.texs, new JsonSerializerSettings() { DefaultValueHandling = DefaultValueHandling.Populate }),
|
texs = JsonConvert.DeserializeObject<Dictionary<string, int>>(Properties.Settings.Default.texs),
|
||||||
};
|
};
|
||||||
var convert = animationList != null
|
var convert = animationList != null
|
||||||
? new ModelConverter(gameObject, options, animationList.Select(x => (AnimationClip)x.Asset).ToArray())
|
? new ModelConverter(gameObject, options, animationList.Select(x => (AnimationClip)x.Asset).ToArray())
|
||||||
@@ -449,7 +449,7 @@ namespace AssetStudio.GUI
|
|||||||
: new ModelConverter(rootName, gameObject, options);
|
: new ModelConverter(rootName, gameObject, options);
|
||||||
if (options.exportMaterials)
|
if (options.exportMaterials)
|
||||||
{
|
{
|
||||||
var materialExportPath = Path.Combine(exportPath, "Materials");
|
var materialExportPath = Path.Combine(Path.GetDirectoryName(exportPath), "Materials");
|
||||||
Directory.CreateDirectory(materialExportPath);
|
Directory.CreateDirectory(materialExportPath);
|
||||||
foreach (var material in options.materials)
|
foreach (var material in options.materials)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1698,6 +1698,11 @@ namespace AssetStudio.GUI
|
|||||||
saveDirectoryBackup = saveFolderDialog.Folder;
|
saveDirectoryBackup = saveFolderDialog.Folder;
|
||||||
var exportPath = Path.Combine(saveFolderDialog.Folder, "GameObject") + Path.DirectorySeparatorChar;
|
var exportPath = Path.Combine(saveFolderDialog.Folder, "GameObject") + Path.DirectorySeparatorChar;
|
||||||
var roots = sceneTreeView.Nodes.Cast<TreeNode>().Where(x => x.Level == 0 && x.Checked).ToList();
|
var roots = sceneTreeView.Nodes.Cast<TreeNode>().Where(x => x.Level == 0 && x.Checked).ToList();
|
||||||
|
if (roots.Count == 0)
|
||||||
|
{
|
||||||
|
Logger.Info("No root nodes found selected.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
List<AssetItem> animationList = null;
|
List<AssetItem> animationList = null;
|
||||||
if (animation)
|
if (animation)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user