diff --git a/AssetStudio/AssetStudioForm.Designer.cs b/AssetStudio/AssetStudioForm.Designer.cs index f032198..5c4d575 100644 --- a/AssetStudio/AssetStudioForm.Designer.cs +++ b/AssetStudio/AssetStudioForm.Designer.cs @@ -49,6 +49,9 @@ this.exportallobjectsMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.exportallobjectssplitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.exportselectedobjectsMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); + this.exportSelectedObjectsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.exportSelectedObjectsWithAnimationClipToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.exportToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.exportAllAssetsMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.exportSelectedAssetsMenuItem = new System.Windows.Forms.ToolStripMenuItem(); @@ -105,9 +108,11 @@ this.treeTip = new System.Windows.Forms.ToolTip(this.components); this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components); this.exportSelectedAssetsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.exportAnimatorwithAnimationClipMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.exportObjectswithAnimationClipMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.exportAnimatorwithselectedAnimationClipMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.exportobjectswithselectedAnimationClipMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.showOriginalFileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator(); + this.exportAnimatorWithSelectedAnimationClipToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.menuStrip1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); this.splitContainer1.Panel1.SuspendLayout(); @@ -276,7 +281,10 @@ this.modelToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.exportallobjectsMenuItem, this.exportallobjectssplitToolStripMenuItem, - this.exportselectedobjectsMenuItem}); + this.exportselectedobjectsMenuItem, + this.toolStripSeparator1, + this.exportSelectedObjectsToolStripMenuItem, + this.exportSelectedObjectsWithAnimationClipToolStripMenuItem}); this.modelToolStripMenuItem.Name = "modelToolStripMenuItem"; this.modelToolStripMenuItem.Size = new System.Drawing.Size(58, 21); this.modelToolStripMenuItem.Text = "Model"; @@ -284,53 +292,73 @@ // exportallobjectsMenuItem // this.exportallobjectsMenuItem.Name = "exportallobjectsMenuItem"; - this.exportallobjectsMenuItem.Size = new System.Drawing.Size(213, 22); + this.exportallobjectsMenuItem.Size = new System.Drawing.Size(323, 22); this.exportallobjectsMenuItem.Text = "Export all objects"; this.exportallobjectsMenuItem.Click += new System.EventHandler(this.ExportObjects_Click); // // exportallobjectssplitToolStripMenuItem // this.exportallobjectssplitToolStripMenuItem.Name = "exportallobjectssplitToolStripMenuItem"; - this.exportallobjectssplitToolStripMenuItem.Size = new System.Drawing.Size(213, 22); + this.exportallobjectssplitToolStripMenuItem.Size = new System.Drawing.Size(323, 22); this.exportallobjectssplitToolStripMenuItem.Text = "Export all objects (split)"; this.exportallobjectssplitToolStripMenuItem.Click += new System.EventHandler(this.exportallobjectssplitToolStripMenuItem_Click); // // exportselectedobjectsMenuItem // this.exportselectedobjectsMenuItem.Name = "exportselectedobjectsMenuItem"; - this.exportselectedobjectsMenuItem.Size = new System.Drawing.Size(213, 22); + this.exportselectedobjectsMenuItem.Size = new System.Drawing.Size(323, 22); this.exportselectedobjectsMenuItem.Text = "Export selected objects"; this.exportselectedobjectsMenuItem.Click += new System.EventHandler(this.ExportObjects_Click); // + // toolStripSeparator1 + // + this.toolStripSeparator1.Name = "toolStripSeparator1"; + this.toolStripSeparator1.Size = new System.Drawing.Size(320, 6); + // + // exportSelectedObjectsToolStripMenuItem + // + this.exportSelectedObjectsToolStripMenuItem.Name = "exportSelectedObjectsToolStripMenuItem"; + this.exportSelectedObjectsToolStripMenuItem.Size = new System.Drawing.Size(323, 22); + this.exportSelectedObjectsToolStripMenuItem.Text = "Export selected objects"; + this.exportSelectedObjectsToolStripMenuItem.Click += new System.EventHandler(this.exportSelectedObjectsToolStripMenuItem_Click); + // + // exportSelectedObjectsWithAnimationClipToolStripMenuItem + // + this.exportSelectedObjectsWithAnimationClipToolStripMenuItem.Name = "exportSelectedObjectsWithAnimationClipToolStripMenuItem"; + this.exportSelectedObjectsWithAnimationClipToolStripMenuItem.Size = new System.Drawing.Size(323, 22); + this.exportSelectedObjectsWithAnimationClipToolStripMenuItem.Text = "Export selected objects with AnimationClip"; + this.exportSelectedObjectsWithAnimationClipToolStripMenuItem.Click += new System.EventHandler(this.exportObjectswithAnimationClipMenuItem_Click); + // // exportToolStripMenuItem // this.exportToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.exportAllAssetsMenuItem, this.exportSelectedAssetsMenuItem, - this.exportFilteredAssetsMenuItem}); + this.exportFilteredAssetsMenuItem, + this.toolStripSeparator3, + this.exportAnimatorWithSelectedAnimationClipToolStripMenuItem}); this.exportToolStripMenuItem.Name = "exportToolStripMenuItem"; this.exportToolStripMenuItem.Size = new System.Drawing.Size(58, 21); this.exportToolStripMenuItem.Text = "Export"; - this.exportToolStripMenuItem.Visible = false; // // exportAllAssetsMenuItem // this.exportAllAssetsMenuItem.Name = "exportAllAssetsMenuItem"; - this.exportAllAssetsMenuItem.Size = new System.Drawing.Size(165, 22); + this.exportAllAssetsMenuItem.Size = new System.Drawing.Size(334, 22); this.exportAllAssetsMenuItem.Text = "All assets"; this.exportAllAssetsMenuItem.Click += new System.EventHandler(this.ExportAssets_Click); // // exportSelectedAssetsMenuItem // this.exportSelectedAssetsMenuItem.Name = "exportSelectedAssetsMenuItem"; - this.exportSelectedAssetsMenuItem.Size = new System.Drawing.Size(165, 22); + this.exportSelectedAssetsMenuItem.Size = new System.Drawing.Size(334, 22); this.exportSelectedAssetsMenuItem.Text = "Selected assets"; this.exportSelectedAssetsMenuItem.Click += new System.EventHandler(this.ExportAssets_Click); // // exportFilteredAssetsMenuItem // this.exportFilteredAssetsMenuItem.Name = "exportFilteredAssetsMenuItem"; - this.exportFilteredAssetsMenuItem.Size = new System.Drawing.Size(165, 22); + this.exportFilteredAssetsMenuItem.Size = new System.Drawing.Size(334, 22); this.exportFilteredAssetsMenuItem.Text = "Filtered assets"; this.exportFilteredAssetsMenuItem.Click += new System.EventHandler(this.ExportAssets_Click); // @@ -349,7 +377,7 @@ this.allToolStripMenuItem.CheckOnClick = true; this.allToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked; this.allToolStripMenuItem.Name = "allToolStripMenuItem"; - this.allToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.allToolStripMenuItem.Size = new System.Drawing.Size(90, 22); this.allToolStripMenuItem.Text = "All"; this.allToolStripMenuItem.Click += new System.EventHandler(this.typeToolStripMenuItem_Click); // @@ -607,7 +635,7 @@ // this.FMODcopyright.AutoSize = true; this.FMODcopyright.ForeColor = System.Drawing.SystemColors.ControlLight; - this.FMODcopyright.Location = new System.Drawing.Point(249, 351); + this.FMODcopyright.Location = new System.Drawing.Point(250, 352); this.FMODcopyright.Name = "FMODcopyright"; this.FMODcopyright.Size = new System.Drawing.Size(341, 12); this.FMODcopyright.TabIndex = 9; @@ -852,43 +880,55 @@ this.contextMenuStrip1.ImageScalingSize = new System.Drawing.Size(20, 20); this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.exportSelectedAssetsToolStripMenuItem, - this.exportAnimatorwithAnimationClipMenuItem, - this.exportObjectswithAnimationClipMenuItem, + this.exportAnimatorwithselectedAnimationClipMenuItem, + this.exportobjectswithselectedAnimationClipMenuItem, this.showOriginalFileToolStripMenuItem}); this.contextMenuStrip1.Name = "contextMenuStrip1"; - this.contextMenuStrip1.Size = new System.Drawing.Size(283, 92); + this.contextMenuStrip1.Size = new System.Drawing.Size(335, 92); // // exportSelectedAssetsToolStripMenuItem // this.exportSelectedAssetsToolStripMenuItem.Name = "exportSelectedAssetsToolStripMenuItem"; - this.exportSelectedAssetsToolStripMenuItem.Size = new System.Drawing.Size(282, 22); + this.exportSelectedAssetsToolStripMenuItem.Size = new System.Drawing.Size(334, 22); this.exportSelectedAssetsToolStripMenuItem.Text = "Export selected assets"; this.exportSelectedAssetsToolStripMenuItem.Click += new System.EventHandler(this.exportSelectedAssetsToolStripMenuItem_Click); // - // exportAnimatorwithAnimationClipMenuItem + // exportAnimatorwithselectedAnimationClipMenuItem // - this.exportAnimatorwithAnimationClipMenuItem.Name = "exportAnimatorwithAnimationClipMenuItem"; - this.exportAnimatorwithAnimationClipMenuItem.Size = new System.Drawing.Size(282, 22); - this.exportAnimatorwithAnimationClipMenuItem.Text = "Export Animator with AnimationClip"; - this.exportAnimatorwithAnimationClipMenuItem.Visible = false; - this.exportAnimatorwithAnimationClipMenuItem.Click += new System.EventHandler(this.exportAnimatorwithAnimationClipMenuItem_Click); + this.exportAnimatorwithselectedAnimationClipMenuItem.Name = "exportAnimatorwithselectedAnimationClipMenuItem"; + this.exportAnimatorwithselectedAnimationClipMenuItem.Size = new System.Drawing.Size(334, 22); + this.exportAnimatorwithselectedAnimationClipMenuItem.Text = "Export Animator with selected AnimationClip"; + this.exportAnimatorwithselectedAnimationClipMenuItem.Visible = false; + this.exportAnimatorwithselectedAnimationClipMenuItem.Click += new System.EventHandler(this.exportAnimatorwithAnimationClipMenuItem_Click); // - // exportObjectswithAnimationClipMenuItem + // exportobjectswithselectedAnimationClipMenuItem // - this.exportObjectswithAnimationClipMenuItem.Name = "exportObjectswithAnimationClipMenuItem"; - this.exportObjectswithAnimationClipMenuItem.Size = new System.Drawing.Size(282, 22); - this.exportObjectswithAnimationClipMenuItem.Text = "Export Objects with AnimationClip"; - this.exportObjectswithAnimationClipMenuItem.Visible = false; - this.exportObjectswithAnimationClipMenuItem.Click += new System.EventHandler(this.exportObjectswithAnimationClipMenuItem_Click); + this.exportobjectswithselectedAnimationClipMenuItem.Name = "exportobjectswithselectedAnimationClipMenuItem"; + this.exportobjectswithselectedAnimationClipMenuItem.Size = new System.Drawing.Size(334, 22); + this.exportobjectswithselectedAnimationClipMenuItem.Text = "Export objects with selected AnimationClip"; + this.exportobjectswithselectedAnimationClipMenuItem.Visible = false; + this.exportobjectswithselectedAnimationClipMenuItem.Click += new System.EventHandler(this.exportObjectswithAnimationClipMenuItem_Click); // // showOriginalFileToolStripMenuItem // this.showOriginalFileToolStripMenuItem.Name = "showOriginalFileToolStripMenuItem"; - this.showOriginalFileToolStripMenuItem.Size = new System.Drawing.Size(282, 22); + this.showOriginalFileToolStripMenuItem.Size = new System.Drawing.Size(334, 22); this.showOriginalFileToolStripMenuItem.Text = "Show original file"; this.showOriginalFileToolStripMenuItem.Visible = false; this.showOriginalFileToolStripMenuItem.Click += new System.EventHandler(this.showOriginalFileToolStripMenuItem_Click); // + // toolStripSeparator3 + // + this.toolStripSeparator3.Name = "toolStripSeparator3"; + this.toolStripSeparator3.Size = new System.Drawing.Size(331, 6); + // + // exportAnimatorWithSelectedAnimationClipToolStripMenuItem + // + this.exportAnimatorWithSelectedAnimationClipToolStripMenuItem.Name = "exportAnimatorWithSelectedAnimationClipToolStripMenuItem"; + this.exportAnimatorWithSelectedAnimationClipToolStripMenuItem.Size = new System.Drawing.Size(334, 22); + this.exportAnimatorWithSelectedAnimationClipToolStripMenuItem.Text = "Export Animator with selected AnimationClip"; + this.exportAnimatorWithSelectedAnimationClipToolStripMenuItem.Click += new System.EventHandler(this.exportAnimatorwithAnimationClipMenuItem_Click); + // // AssetStudioForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); @@ -1009,11 +1049,16 @@ private OpenTK.GLControl glControl1; private System.Windows.Forms.ContextMenuStrip contextMenuStrip1; private System.Windows.Forms.ToolStripMenuItem showOriginalFileToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem exportAnimatorwithAnimationClipMenuItem; - private System.Windows.Forms.ToolStripMenuItem exportObjectswithAnimationClipMenuItem; + private System.Windows.Forms.ToolStripMenuItem exportAnimatorwithselectedAnimationClipMenuItem; + private System.Windows.Forms.ToolStripMenuItem exportobjectswithselectedAnimationClipMenuItem; private System.Windows.Forms.ToolStripMenuItem exportSelectedAssetsToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem showTypeToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem allToolStripMenuItem; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator1; + private System.Windows.Forms.ToolStripMenuItem exportSelectedObjectsToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem exportSelectedObjectsWithAnimationClipToolStripMenuItem; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator3; + private System.Windows.Forms.ToolStripMenuItem exportAnimatorWithSelectedAnimationClipToolStripMenuItem; } } diff --git a/AssetStudio/AssetStudioForm.cs b/AssetStudio/AssetStudioForm.cs index e421af0..5acfd66 100644 --- a/AssetStudio/AssetStudioForm.cs +++ b/AssetStudio/AssetStudioForm.cs @@ -72,8 +72,6 @@ namespace AssetStudio private PrivateFontCollection pfc = new PrivateFontCollection(); - private List selectedAssets = new List(); - [DllImport("gdi32.dll")] private static extern IntPtr AddFontMemResourceEx(IntPtr pbFont, uint cbFont, IntPtr pdv, [In] ref uint pcFonts); @@ -511,20 +509,14 @@ namespace AssetStudio { case 0: treeSearch.Select(); - modelToolStripMenuItem.Visible = true; - exportToolStripMenuItem.Visible = false; break; case 1: - modelToolStripMenuItem.Visible = false; - exportToolStripMenuItem.Visible = true; resizeAssetListColumns(); //required because the ListView is not visible on app launch classPreviewPanel.Visible = false; previewPanel.Visible = true; listSearch.Select(); break; case 2: - modelToolStripMenuItem.Visible = false; - exportToolStripMenuItem.Visible = false; previewPanel.Visible = false; classPreviewPanel.Visible = true; break; @@ -1058,12 +1050,12 @@ namespace AssetStudio } case ClassIDReference.Animator: { - StatusStripUpdate("Can be exported as a FBX file."); + StatusStripUpdate("Can be exported to FBX file."); break; } case ClassIDReference.AnimationClip: { - StatusStripUpdate("Select AnimationClip with selecting Animator to export"); + StatusStripUpdate("Can be exported with Animator or objects"); break; } default: @@ -1357,13 +1349,6 @@ namespace AssetStudio if (saveFolderDialog1.ShowDialog(this) == DialogResult.OK) { var savePath = saveFolderDialog1.Folder + "\\"; - - if ((bool)Properties.Settings.Default["showExpOpt"]) - { - var exportOpt = new ExportOptions(); - exportOpt.ShowDialog(); - } - progressBar1.Value = 0; progressBar1.Maximum = sceneTreeView.Nodes.Count; @@ -1387,12 +1372,6 @@ namespace AssetStudio if (saveFileDialog1.ShowDialog() == DialogResult.OK) { - if ((bool)Properties.Settings.Default["showExpOpt"]) - { - var exportOpt = new ExportOptions(); - exportOpt.ShowDialog(); - } - var gameObjects = new List(); foreach (var assetsFile in assetsfileList) { @@ -1755,30 +1734,23 @@ namespace AssetStudio if (e.Button == MouseButtons.Right && assetListView.SelectedIndices.Count > 0) { showOriginalFileToolStripMenuItem.Visible = false; - exportAnimatorwithAnimationClipMenuItem.Visible = false; - exportObjectswithAnimationClipMenuItem.Visible = false; + exportAnimatorwithselectedAnimationClipMenuItem.Visible = false; + exportobjectswithselectedAnimationClipMenuItem.Visible = false; if (assetListView.SelectedIndices.Count == 1) { - selectedAssets.Clear(); - selectedAssets.Add((AssetPreloadData)assetListView.Items[assetListView.SelectedIndices[0]]); showOriginalFileToolStripMenuItem.Visible = true; } if (assetListView.SelectedIndices.Count >= 1) { - selectedAssets.Clear(); - foreach (int index in assetListView.SelectedIndices) - { - selectedAssets.Add((AssetPreloadData)assetListView.Items[index]); - } - + var selectedAssets = GetSelectedAssets(); if (selectedAssets.Any(x => x.Type == ClassIDReference.Animator) && selectedAssets.Any(x => x.Type == ClassIDReference.AnimationClip)) { - exportAnimatorwithAnimationClipMenuItem.Visible = true; + exportAnimatorwithselectedAnimationClipMenuItem.Visible = true; } else if (selectedAssets.All(x => x.Type == ClassIDReference.AnimationClip)) { - exportObjectswithAnimationClipMenuItem.Visible = true; + exportobjectswithselectedAnimationClipMenuItem.Visible = true; } } @@ -1792,13 +1764,13 @@ namespace AssetStudio if (saveFolderDialog1.ShowDialog(this) == DialogResult.OK) { timer.Stop(); - ExportAssets(saveFolderDialog1.Folder, selectedAssets, assetGroupOptions.SelectedIndex, openAfterExport.Checked); + ExportAssets(saveFolderDialog1.Folder, GetSelectedAssets(), assetGroupOptions.SelectedIndex, openAfterExport.Checked); } } private void showOriginalFileToolStripMenuItem_Click(object sender, EventArgs e) { - var selectasset = selectedAssets[0]; + var selectasset = (AssetPreloadData)assetListView.Items[assetListView.SelectedIndices[0]]; var args = $"/select, {selectasset.sourceFile.parentPath ?? selectasset.sourceFile.filePath}"; var pfi = new ProcessStartInfo("explorer.exe", args); Process.Start(pfi); @@ -1808,6 +1780,7 @@ namespace AssetStudio { AssetPreloadData animator = null; List animationList = new List(); + var selectedAssets = GetSelectedAssets(); foreach (var assetPreloadData in selectedAssets) { if (assetPreloadData.Type == ClassIDReference.Animator) @@ -1833,29 +1806,36 @@ namespace AssetStudio } } - private void exportObjectswithAnimationClipMenuItem_Click(object sender, EventArgs e) + private void exportSelectedObjectsToolStripMenuItem_Click(object sender, EventArgs e) { var saveFolderDialog1 = new OpenFolderDialog(); if (saveFolderDialog1.ShowDialog(this) == DialogResult.OK) { var exportPath = saveFolderDialog1.Folder + "\\GameObject\\"; - ThreadPool.QueueUserWorkItem(state => ForeachTreeNodes(sceneTreeView.Nodes, exportPath)); + ThreadPool.QueueUserWorkItem(state => ForeachTreeNodes(sceneTreeView.Nodes, exportPath, o => { ExportObjectsWithAnimationClip(o, exportPath); })); } } - private void ForeachTreeNodes(TreeNodeCollection nodes, string exportPath) + private void exportObjectswithAnimationClipMenuItem_Click(object sender, EventArgs e) { - foreach (TreeNode i in nodes) + var selectedAssets = GetSelectedAssets(); + var saveFolderDialog1 = new OpenFolderDialog(); + if (saveFolderDialog1.ShowDialog(this) == DialogResult.OK) { - if (i.Checked) - { - ExportObjectsWithAnimationClip((GameObject)i, selectedAssets, exportPath); - } - else - { - ForeachTreeNodes(i.Nodes, exportPath); - } + var exportPath = saveFolderDialog1.Folder + "\\GameObject\\"; + ThreadPool.QueueUserWorkItem(state => ForeachTreeNodes(sceneTreeView.Nodes, exportPath, o => { ExportObjectsWithAnimationClip(o, exportPath, selectedAssets); })); } } + + private List GetSelectedAssets() + { + var selectedAssets = new List(); + foreach (int index in assetListView.SelectedIndices) + { + selectedAssets.Add((AssetPreloadData)assetListView.Items[index]); + } + + return selectedAssets; + } } } diff --git a/AssetStudio/ExportOptions.Designer.cs b/AssetStudio/ExportOptions.Designer.cs index 7597da0..e4c03c6 100644 --- a/AssetStudio/ExportOptions.Designer.cs +++ b/AssetStudio/ExportOptions.Designer.cs @@ -28,11 +28,8 @@ /// private void InitializeComponent() { - this.includeBox = new System.Windows.Forms.GroupBox(); + this.FbxBox = new System.Windows.Forms.GroupBox(); this.convertDummies = new System.Windows.Forms.CheckBox(); - this.embedBox = new System.Windows.Forms.CheckBox(); - this.lightsBox = new System.Windows.Forms.CheckBox(); - this.camerasBox = new System.Windows.Forms.CheckBox(); this.exportDeformers = new System.Windows.Forms.CheckBox(); this.geometryBox = new System.Windows.Forms.GroupBox(); this.exportColors = new System.Windows.Forms.CheckBox(); @@ -46,7 +43,6 @@ this.scaleLabel = new System.Windows.Forms.Label(); this.fbxOKbutton = new System.Windows.Forms.Button(); this.fbxCancel = new System.Windows.Forms.Button(); - this.showExpOpt = new System.Windows.Forms.CheckBox(); this.groupBox1 = new System.Windows.Forms.GroupBox(); this.convertAudio = new System.Windows.Forms.CheckBox(); this.panel1 = new System.Windows.Forms.Panel(); @@ -65,7 +61,7 @@ this.allBones = new System.Windows.Forms.CheckBox(); this.allFrames = new System.Windows.Forms.CheckBox(); this.EulerFilter = new System.Windows.Forms.CheckBox(); - this.includeBox.SuspendLayout(); + this.FbxBox.SuspendLayout(); this.geometryBox.SuspendLayout(); this.advancedBox.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.scaleFactor)).BeginInit(); @@ -76,26 +72,24 @@ ((System.ComponentModel.ISupportInitialize)(this.filterPrecision)).BeginInit(); this.SuspendLayout(); // - // includeBox + // FbxBox // - this.includeBox.AutoSize = true; - this.includeBox.Controls.Add(this.convertDummies); - this.includeBox.Controls.Add(this.embedBox); - this.includeBox.Controls.Add(this.lightsBox); - this.includeBox.Controls.Add(this.camerasBox); - this.includeBox.Controls.Add(this.exportDeformers); - this.includeBox.Controls.Add(this.geometryBox); - this.includeBox.Location = new System.Drawing.Point(12, 12); - this.includeBox.Name = "includeBox"; - this.includeBox.Size = new System.Drawing.Size(249, 267); - this.includeBox.TabIndex = 0; - this.includeBox.TabStop = false; - this.includeBox.Text = "Include"; + this.FbxBox.AutoSize = true; + this.FbxBox.Controls.Add(this.convertDummies); + this.FbxBox.Controls.Add(this.exportDeformers); + this.FbxBox.Controls.Add(this.geometryBox); + this.FbxBox.Controls.Add(this.advancedBox); + this.FbxBox.Location = new System.Drawing.Point(12, 12); + this.FbxBox.Name = "FbxBox"; + this.FbxBox.Size = new System.Drawing.Size(247, 317); + this.FbxBox.TabIndex = 0; + this.FbxBox.TabStop = false; + this.FbxBox.Text = "Fbx Ascii"; // // convertDummies // this.convertDummies.AutoSize = true; - this.convertDummies.Location = new System.Drawing.Point(14, 164); + this.convertDummies.Location = new System.Drawing.Point(6, 170); this.convertDummies.Name = "convertDummies"; this.convertDummies.Size = new System.Drawing.Size(228, 16); this.convertDummies.TabIndex = 5; @@ -103,43 +97,10 @@ this.convertDummies.UseVisualStyleBackColor = true; this.convertDummies.CheckedChanged += new System.EventHandler(this.exportOpnions_CheckedChanged); // - // embedBox - // - this.embedBox.AutoSize = true; - this.embedBox.Enabled = false; - this.embedBox.Location = new System.Drawing.Point(14, 230); - this.embedBox.Name = "embedBox"; - this.embedBox.Size = new System.Drawing.Size(90, 16); - this.embedBox.TabIndex = 4; - this.embedBox.Text = "Embed Media"; - this.embedBox.UseVisualStyleBackColor = true; - // - // lightsBox - // - this.lightsBox.AutoSize = true; - this.lightsBox.Enabled = false; - this.lightsBox.Location = new System.Drawing.Point(14, 208); - this.lightsBox.Name = "lightsBox"; - this.lightsBox.Size = new System.Drawing.Size(60, 16); - this.lightsBox.TabIndex = 3; - this.lightsBox.Text = "Lights"; - this.lightsBox.UseVisualStyleBackColor = true; - // - // camerasBox - // - this.camerasBox.AutoSize = true; - this.camerasBox.Enabled = false; - this.camerasBox.Location = new System.Drawing.Point(14, 186); - this.camerasBox.Name = "camerasBox"; - this.camerasBox.Size = new System.Drawing.Size(66, 16); - this.camerasBox.TabIndex = 2; - this.camerasBox.Text = "Cameras"; - this.camerasBox.UseVisualStyleBackColor = true; - // // exportDeformers // this.exportDeformers.AutoSize = true; - this.exportDeformers.Location = new System.Drawing.Point(14, 142); + this.exportDeformers.Location = new System.Drawing.Point(6, 148); this.exportDeformers.Name = "exportDeformers"; this.exportDeformers.Size = new System.Drawing.Size(108, 16); this.exportDeformers.TabIndex = 1; @@ -154,7 +115,7 @@ this.geometryBox.Controls.Add(this.exportUVs); this.geometryBox.Controls.Add(this.exportTangents); this.geometryBox.Controls.Add(this.exportNormals); - this.geometryBox.Location = new System.Drawing.Point(7, 18); + this.geometryBox.Location = new System.Drawing.Point(6, 20); this.geometryBox.Name = "geometryBox"; this.geometryBox.Size = new System.Drawing.Size(235, 122); this.geometryBox.TabIndex = 0; @@ -218,9 +179,9 @@ this.advancedBox.Controls.Add(this.upAxis); this.advancedBox.Controls.Add(this.scaleFactor); this.advancedBox.Controls.Add(this.scaleLabel); - this.advancedBox.Location = new System.Drawing.Point(12, 285); + this.advancedBox.Location = new System.Drawing.Point(6, 192); this.advancedBox.Name = "advancedBox"; - this.advancedBox.Size = new System.Drawing.Size(249, 78); + this.advancedBox.Size = new System.Drawing.Size(235, 78); this.advancedBox.TabIndex = 5; this.advancedBox.TabStop = false; this.advancedBox.Text = "Advanced Options"; @@ -274,7 +235,7 @@ // // fbxOKbutton // - this.fbxOKbutton.Location = new System.Drawing.Point(339, 369); + this.fbxOKbutton.Location = new System.Drawing.Point(325, 335); this.fbxOKbutton.Name = "fbxOKbutton"; this.fbxOKbutton.Size = new System.Drawing.Size(75, 21); this.fbxOKbutton.TabIndex = 6; @@ -285,7 +246,7 @@ // fbxCancel // this.fbxCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; - this.fbxCancel.Location = new System.Drawing.Point(420, 369); + this.fbxCancel.Location = new System.Drawing.Point(406, 335); this.fbxCancel.Name = "fbxCancel"; this.fbxCancel.Size = new System.Drawing.Size(75, 21); this.fbxCancel.TabIndex = 7; @@ -293,16 +254,6 @@ this.fbxCancel.UseVisualStyleBackColor = true; this.fbxCancel.Click += new System.EventHandler(this.fbxCancel_Click); // - // showExpOpt - // - this.showExpOpt.AutoSize = true; - this.showExpOpt.Location = new System.Drawing.Point(12, 372); - this.showExpOpt.Name = "showExpOpt"; - this.showExpOpt.Size = new System.Drawing.Size(222, 16); - this.showExpOpt.TabIndex = 8; - this.showExpOpt.Text = "Show this dialog for every export"; - this.showExpOpt.UseVisualStyleBackColor = true; - // // groupBox1 // this.groupBox1.Controls.Add(this.convertAudio); @@ -310,7 +261,7 @@ this.groupBox1.Controls.Add(this.converttexture); this.groupBox1.Location = new System.Drawing.Point(267, 12); this.groupBox1.Name = "groupBox1"; - this.groupBox1.Size = new System.Drawing.Size(228, 140); + this.groupBox1.Size = new System.Drawing.Size(214, 106); this.groupBox1.TabIndex = 9; this.groupBox1.TabStop = false; this.groupBox1.Text = "Convert"; @@ -322,9 +273,9 @@ this.convertAudio.CheckState = System.Windows.Forms.CheckState.Checked; this.convertAudio.Location = new System.Drawing.Point(6, 78); this.convertAudio.Name = "convertAudio"; - this.convertAudio.Size = new System.Drawing.Size(198, 28); + this.convertAudio.Size = new System.Drawing.Size(198, 16); this.convertAudio.TabIndex = 6; - this.convertAudio.Text = "Convert AudioClip to WAV(PCM)\r\n(If support)"; + this.convertAudio.Text = "Convert AudioClip to WAV(PCM)"; this.convertAudio.UseVisualStyleBackColor = true; // // panel1 @@ -376,9 +327,9 @@ this.converttexture.CheckState = System.Windows.Forms.CheckState.Checked; this.converttexture.Location = new System.Drawing.Point(6, 20); this.converttexture.Name = "converttexture"; - this.converttexture.Size = new System.Drawing.Size(192, 16); + this.converttexture.Size = new System.Drawing.Size(114, 16); this.converttexture.TabIndex = 1; - this.converttexture.Text = "Convert Texture (If support)"; + this.converttexture.Text = "Convert Texture"; this.converttexture.UseVisualStyleBackColor = true; // // groupBox2 @@ -393,12 +344,12 @@ this.groupBox2.Controls.Add(this.allBones); this.groupBox2.Controls.Add(this.allFrames); this.groupBox2.Controls.Add(this.EulerFilter); - this.groupBox2.Location = new System.Drawing.Point(267, 158); + this.groupBox2.Location = new System.Drawing.Point(267, 124); this.groupBox2.Name = "groupBox2"; - this.groupBox2.Size = new System.Drawing.Size(228, 205); + this.groupBox2.Size = new System.Drawing.Size(214, 205); this.groupBox2.TabIndex = 11; this.groupBox2.TabStop = false; - this.groupBox2.Text = "Animator"; + this.groupBox2.Text = "Fbx Binary"; // // compatibility // @@ -518,14 +469,12 @@ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.CancelButton = this.fbxCancel; - this.ClientSize = new System.Drawing.Size(508, 398); + this.ClientSize = new System.Drawing.Size(495, 369); this.Controls.Add(this.groupBox2); this.Controls.Add(this.groupBox1); - this.Controls.Add(this.showExpOpt); this.Controls.Add(this.fbxCancel); this.Controls.Add(this.fbxOKbutton); - this.Controls.Add(this.advancedBox); - this.Controls.Add(this.includeBox); + this.Controls.Add(this.FbxBox); this.MaximizeBox = false; this.MinimizeBox = false; this.Name = "ExportOptions"; @@ -534,8 +483,8 @@ this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "Export options"; this.TopMost = true; - this.includeBox.ResumeLayout(false); - this.includeBox.PerformLayout(); + this.FbxBox.ResumeLayout(false); + this.FbxBox.PerformLayout(); this.geometryBox.ResumeLayout(false); this.geometryBox.PerformLayout(); this.advancedBox.ResumeLayout(false); @@ -556,13 +505,10 @@ #endregion - private System.Windows.Forms.GroupBox includeBox; + private System.Windows.Forms.GroupBox FbxBox; private System.Windows.Forms.GroupBox advancedBox; private System.Windows.Forms.NumericUpDown scaleFactor; private System.Windows.Forms.Label scaleLabel; - private System.Windows.Forms.CheckBox embedBox; - private System.Windows.Forms.CheckBox lightsBox; - private System.Windows.Forms.CheckBox camerasBox; private System.Windows.Forms.CheckBox exportDeformers; private System.Windows.Forms.GroupBox geometryBox; private System.Windows.Forms.CheckBox exportColors; @@ -573,7 +519,6 @@ private System.Windows.Forms.ComboBox upAxis; private System.Windows.Forms.Button fbxOKbutton; private System.Windows.Forms.Button fbxCancel; - private System.Windows.Forms.CheckBox showExpOpt; private System.Windows.Forms.CheckBox convertDummies; private System.Windows.Forms.GroupBox groupBox1; private System.Windows.Forms.CheckBox converttexture; diff --git a/AssetStudio/ExportOptions.cs b/AssetStudio/ExportOptions.cs index 9495678..32306a0 100644 --- a/AssetStudio/ExportOptions.cs +++ b/AssetStudio/ExportOptions.cs @@ -24,7 +24,6 @@ namespace AssetStudio convertDummies.Enabled = (bool)Properties.Settings.Default["exportDeformers"]; scaleFactor.Value = (decimal)Properties.Settings.Default["scaleFactor"]; upAxis.SelectedIndex = (int)Properties.Settings.Default["upAxis"]; - showExpOpt.Checked = (bool)Properties.Settings.Default["showExpOpt"]; converttexture.Checked = (bool)Properties.Settings.Default["convertTexture"]; convertAudio.Checked = (bool)Properties.Settings.Default["convertAudio"]; var str = (string)Properties.Settings.Default["convertType"]; diff --git a/AssetStudio/Properties/Settings.Designer.cs b/AssetStudio/Properties/Settings.Designer.cs index 7131784..aa487de 100644 --- a/AssetStudio/Properties/Settings.Designer.cs +++ b/AssetStudio/Properties/Settings.Designer.cs @@ -155,18 +155,6 @@ namespace AssetStudio.Properties { } } - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("False")] - public bool showExpOpt { - get { - return ((bool)(this["showExpOpt"])); - } - set { - this["showExpOpt"] = value; - } - } - [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("True")] diff --git a/AssetStudio/Properties/Settings.settings b/AssetStudio/Properties/Settings.settings index 6e1715f..7bb2a2b 100644 --- a/AssetStudio/Properties/Settings.settings +++ b/AssetStudio/Properties/Settings.settings @@ -35,9 +35,6 @@ 0 - - False - True diff --git a/AssetStudio/StudioClasses/Exporter.cs b/AssetStudio/StudioClasses/Exporter.cs index 46f97b0..086a16f 100644 --- a/AssetStudio/StudioClasses/Exporter.cs +++ b/AssetStudio/StudioClasses/Exporter.cs @@ -298,7 +298,7 @@ namespace AssetStudio public static bool ExportRawFile(AssetPreloadData asset, string exportPath) { - var exportFullName = exportPath + asset.Text + asset.extension; + var exportFullName = exportPath + asset.Text + ".dat"; if (ExportFileExists(exportFullName)) return false; var bytes = asset.InitReader().ReadBytes(asset.Size); @@ -316,25 +316,17 @@ namespace AssetStudio return false; } - public static bool ExportAnimator(AssetPreloadData animator, string exportPath) + public static bool ExportAnimator(AssetPreloadData animator, string exportPath, List animationList = null) { var m_Animator = new Animator(animator); - var convert = new ModelConverter(m_Animator); + var convert = animationList != null ? new ModelConverter(m_Animator, animationList) : new ModelConverter(m_Animator); exportPath = exportPath + Studio.FixFileName(animator.Text) + ".fbx"; return ModelConverter(convert, exportPath); } - public static bool ExportAnimator(AssetPreloadData animator, List animationList, string exportPath) + public static bool ExportGameObject(GameObject gameObject, string exportPath, List animationList = null) { - var m_Animator = new Animator(animator); - var convert = new ModelConverter(m_Animator, animationList); - exportPath = exportPath + Studio.FixFileName(animator.Text) + ".fbx"; - return ModelConverter(convert, exportPath); - } - - public static bool ExportGameObject(GameObject gameObject, List animationList, string exportPath) - { - var convert = new ModelConverter(gameObject, animationList); + var convert = animationList != null ? new ModelConverter(gameObject, animationList) : new ModelConverter(gameObject); exportPath = exportPath + Studio.FixFileName(gameObject.Text) + ".fbx"; return ModelConverter(convert, exportPath); } diff --git a/AssetStudio/StudioClasses/Studio.cs b/AssetStudio/StudioClasses/Studio.cs index 68cf77b..c257ab1 100644 --- a/AssetStudio/StudioClasses/Studio.cs +++ b/AssetStudio/StudioClasses/Studio.cs @@ -205,9 +205,8 @@ namespace AssetStudio break; } } - if (!exportable && displayAll) + if (displayAll) { - asset.extension = ".dat"; exportable = true; } if (exportable) @@ -556,34 +555,49 @@ namespace AssetStudio { ThreadPool.QueueUserWorkItem(state => { - bool result; + StatusStripUpdate($"Exporting {animator.Text}"); try { - result = ExportAnimator(animator, animationList, exportPath); + ExportAnimator(animator, exportPath, animationList); + StatusStripUpdate($"Finished exporting {animator.Text}"); } catch (Exception ex) { - result = false; MessageBox.Show($"{ex.Message}\r\n{ex.StackTrace}"); + StatusStripUpdate("Error in export"); } - StatusStripUpdate(result ? "Successfully exported" : "Nothing exported."); ProgressBarPerformStep(); }); } - public static void ExportObjectsWithAnimationClip(GameObject gameObject, List animationList, string exportPath) + public static void ExportObjectsWithAnimationClip(GameObject gameObject, string exportPath, List animationList = null) { - bool result; + StatusStripUpdate($"Exporting {gameObject.Text}"); try { - result = ExportGameObject(gameObject, animationList, exportPath); + ExportGameObject(gameObject, exportPath, animationList); + StatusStripUpdate($"Finished exporting {gameObject.Text}"); } catch (Exception ex) { - result = false; MessageBox.Show($"{ex.Message}\r\n{ex.StackTrace}"); + StatusStripUpdate("Error in export"); + } + } + + public static void ForeachTreeNodes(TreeNodeCollection nodes, string exportPath, Action action) + { + foreach (TreeNode i in nodes) + { + if (i.Checked) + { + action((GameObject)i); + } + else + { + ForeachTreeNodes(i.Nodes, exportPath, action); + } } - StatusStripUpdate(result ? "Successfully exported" : "Nothing exported."); } } } diff --git a/AssetStudio/app.config b/AssetStudio/app.config index c4f1921..4c887bc 100644 --- a/AssetStudio/app.config +++ b/AssetStudio/app.config @@ -40,9 +40,6 @@ 0 - - False - True