From 08bf84146bf2b818ae93377777ad701a6cef42d8 Mon Sep 17 00:00:00 2001 From: Perfare Date: Mon, 16 Jan 2017 01:26:39 +0800 Subject: [PATCH] - support export m4a AudioClip - fixed some bug --- Unity Studio/AssetsFile.cs | 2 + Unity Studio/ExportOptions.Designer.cs | 139 ++++++++++++-------- Unity Studio/Unity Classes/AudioClip.cs | 6 +- Unity Studio/Unity Classes/GameObject.cs | 1 - Unity Studio/Unity Classes/MonoBehaviour.cs | 6 + 5 files changed, 98 insertions(+), 56 deletions(-) diff --git a/Unity Studio/AssetsFile.cs b/Unity Studio/AssetsFile.cs index 6c90578..67a57d2 100644 --- a/Unity Studio/AssetsFile.cs +++ b/Unity Studio/AssetsFile.cs @@ -335,10 +335,12 @@ namespace Unity_Studio baseStrings[800] = "SInt16"; baseStrings[814] = "int64"; baseStrings[840] = "string"; + baseStrings[847] = "TextAsset"; baseStrings[874] = "Texture2D"; baseStrings[884] = "Transform"; baseStrings[894] = "TypelessData"; baseStrings[907] = "UInt16"; + baseStrings[921] = "UInt64"; baseStrings[928] = "UInt8"; baseStrings[934] = "UInt"; baseStrings[981] = "vector"; diff --git a/Unity Studio/ExportOptions.Designer.cs b/Unity Studio/ExportOptions.Designer.cs index f5b9674..19657bd 100644 --- a/Unity Studio/ExportOptions.Designer.cs +++ b/Unity Studio/ExportOptions.Designer.cs @@ -72,9 +72,11 @@ 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.Location = new System.Drawing.Point(16, 15); + this.includeBox.Margin = new System.Windows.Forms.Padding(4); this.includeBox.Name = "includeBox"; - this.includeBox.Size = new System.Drawing.Size(249, 266); + this.includeBox.Padding = new System.Windows.Forms.Padding(4); + this.includeBox.Size = new System.Drawing.Size(332, 334); this.includeBox.TabIndex = 0; this.includeBox.TabStop = false; this.includeBox.Text = "Include"; @@ -82,9 +84,10 @@ // convertDummies // this.convertDummies.AutoSize = true; - this.convertDummies.Location = new System.Drawing.Point(14, 164); + this.convertDummies.Location = new System.Drawing.Point(19, 205); + this.convertDummies.Margin = new System.Windows.Forms.Padding(4); this.convertDummies.Name = "convertDummies"; - this.convertDummies.Size = new System.Drawing.Size(228, 16); + this.convertDummies.Size = new System.Drawing.Size(302, 20); this.convertDummies.TabIndex = 5; this.convertDummies.Text = "Convert Deforming Dummies to Bones"; this.convertDummies.UseVisualStyleBackColor = true; @@ -94,9 +97,10 @@ // this.embedBox.AutoSize = true; this.embedBox.Enabled = false; - this.embedBox.Location = new System.Drawing.Point(14, 230); + this.embedBox.Location = new System.Drawing.Point(19, 288); + this.embedBox.Margin = new System.Windows.Forms.Padding(4); this.embedBox.Name = "embedBox"; - this.embedBox.Size = new System.Drawing.Size(90, 16); + this.embedBox.Size = new System.Drawing.Size(118, 20); this.embedBox.TabIndex = 4; this.embedBox.Text = "Embed Media"; this.embedBox.UseVisualStyleBackColor = true; @@ -105,9 +109,10 @@ // this.lightsBox.AutoSize = true; this.lightsBox.Enabled = false; - this.lightsBox.Location = new System.Drawing.Point(14, 208); + this.lightsBox.Location = new System.Drawing.Point(19, 260); + this.lightsBox.Margin = new System.Windows.Forms.Padding(4); this.lightsBox.Name = "lightsBox"; - this.lightsBox.Size = new System.Drawing.Size(60, 16); + this.lightsBox.Size = new System.Drawing.Size(78, 20); this.lightsBox.TabIndex = 3; this.lightsBox.Text = "Lights"; this.lightsBox.UseVisualStyleBackColor = true; @@ -116,9 +121,10 @@ // this.camerasBox.AutoSize = true; this.camerasBox.Enabled = false; - this.camerasBox.Location = new System.Drawing.Point(14, 186); + this.camerasBox.Location = new System.Drawing.Point(19, 232); + this.camerasBox.Margin = new System.Windows.Forms.Padding(4); this.camerasBox.Name = "camerasBox"; - this.camerasBox.Size = new System.Drawing.Size(66, 16); + this.camerasBox.Size = new System.Drawing.Size(86, 20); this.camerasBox.TabIndex = 2; this.camerasBox.Text = "Cameras"; this.camerasBox.UseVisualStyleBackColor = true; @@ -126,9 +132,10 @@ // exportDeformers // this.exportDeformers.AutoSize = true; - this.exportDeformers.Location = new System.Drawing.Point(14, 142); + this.exportDeformers.Location = new System.Drawing.Point(19, 178); + this.exportDeformers.Margin = new System.Windows.Forms.Padding(4); this.exportDeformers.Name = "exportDeformers"; - this.exportDeformers.Size = new System.Drawing.Size(108, 16); + this.exportDeformers.Size = new System.Drawing.Size(142, 20); this.exportDeformers.TabIndex = 1; this.exportDeformers.Text = "Skin Deformers"; this.exportDeformers.UseVisualStyleBackColor = true; @@ -141,9 +148,11 @@ 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(9, 22); + this.geometryBox.Margin = new System.Windows.Forms.Padding(4); this.geometryBox.Name = "geometryBox"; - this.geometryBox.Size = new System.Drawing.Size(235, 121); + this.geometryBox.Padding = new System.Windows.Forms.Padding(4); + this.geometryBox.Size = new System.Drawing.Size(313, 161); this.geometryBox.TabIndex = 0; this.geometryBox.TabStop = false; this.geometryBox.Text = "Geometry"; @@ -153,9 +162,10 @@ this.exportColors.AutoSize = true; this.exportColors.Checked = true; this.exportColors.CheckState = System.Windows.Forms.CheckState.Checked; - this.exportColors.Location = new System.Drawing.Point(7, 85); + this.exportColors.Location = new System.Drawing.Point(9, 106); + this.exportColors.Margin = new System.Windows.Forms.Padding(4); this.exportColors.Name = "exportColors"; - this.exportColors.Size = new System.Drawing.Size(102, 16); + this.exportColors.Size = new System.Drawing.Size(134, 20); this.exportColors.TabIndex = 3; this.exportColors.Text = "Vertex Colors"; this.exportColors.UseVisualStyleBackColor = true; @@ -166,9 +176,10 @@ this.exportUVs.AutoSize = true; this.exportUVs.Checked = true; this.exportUVs.CheckState = System.Windows.Forms.CheckState.Checked; - this.exportUVs.Location = new System.Drawing.Point(7, 63); + this.exportUVs.Location = new System.Drawing.Point(9, 79); + this.exportUVs.Margin = new System.Windows.Forms.Padding(4); this.exportUVs.Name = "exportUVs"; - this.exportUVs.Size = new System.Drawing.Size(108, 16); + this.exportUVs.Size = new System.Drawing.Size(142, 20); this.exportUVs.TabIndex = 2; this.exportUVs.Text = "UV Coordinates"; this.exportUVs.UseVisualStyleBackColor = true; @@ -177,9 +188,10 @@ // exportTangents // this.exportTangents.AutoSize = true; - this.exportTangents.Location = new System.Drawing.Point(7, 41); + this.exportTangents.Location = new System.Drawing.Point(9, 51); + this.exportTangents.Margin = new System.Windows.Forms.Padding(4); this.exportTangents.Name = "exportTangents"; - this.exportTangents.Size = new System.Drawing.Size(72, 16); + this.exportTangents.Size = new System.Drawing.Size(94, 20); this.exportTangents.TabIndex = 1; this.exportTangents.Text = "Tangents"; this.exportTangents.UseVisualStyleBackColor = true; @@ -190,9 +202,10 @@ this.exportNormals.AutoSize = true; this.exportNormals.Checked = true; this.exportNormals.CheckState = System.Windows.Forms.CheckState.Checked; - this.exportNormals.Location = new System.Drawing.Point(7, 18); + this.exportNormals.Location = new System.Drawing.Point(9, 22); + this.exportNormals.Margin = new System.Windows.Forms.Padding(4); this.exportNormals.Name = "exportNormals"; - this.exportNormals.Size = new System.Drawing.Size(66, 16); + this.exportNormals.Size = new System.Drawing.Size(86, 20); this.exportNormals.TabIndex = 0; this.exportNormals.Text = "Normals"; this.exportNormals.UseVisualStyleBackColor = true; @@ -205,9 +218,11 @@ 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, 284); + this.advancedBox.Location = new System.Drawing.Point(16, 355); + this.advancedBox.Margin = new System.Windows.Forms.Padding(4); this.advancedBox.Name = "advancedBox"; - this.advancedBox.Size = new System.Drawing.Size(249, 77); + this.advancedBox.Padding = new System.Windows.Forms.Padding(4); + this.advancedBox.Size = new System.Drawing.Size(332, 96); this.advancedBox.TabIndex = 5; this.advancedBox.TabStop = false; this.advancedBox.Text = "Advanced Options"; @@ -215,9 +230,10 @@ // axisLabel // this.axisLabel.AutoSize = true; - this.axisLabel.Location = new System.Drawing.Point(6, 40); + this.axisLabel.Location = new System.Drawing.Point(8, 50); + this.axisLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.axisLabel.Name = "axisLabel"; - this.axisLabel.Size = new System.Drawing.Size(53, 12); + this.axisLabel.Size = new System.Drawing.Size(72, 16); this.axisLabel.TabIndex = 3; this.axisLabel.Text = "Up Axis:"; // @@ -226,10 +242,11 @@ this.upAxis.FormattingEnabled = true; this.upAxis.Items.AddRange(new object[] { "Y-up"}); - this.upAxis.Location = new System.Drawing.Point(58, 37); + this.upAxis.Location = new System.Drawing.Point(88, 47); + this.upAxis.Margin = new System.Windows.Forms.Padding(4); this.upAxis.MaxDropDownItems = 2; this.upAxis.Name = "upAxis"; - this.upAxis.Size = new System.Drawing.Size(70, 20); + this.upAxis.Size = new System.Drawing.Size(92, 23); this.upAxis.TabIndex = 2; // // scaleFactor @@ -240,9 +257,10 @@ 0, 0, 131072}); - this.scaleFactor.Location = new System.Drawing.Point(82, 13); + this.scaleFactor.Location = new System.Drawing.Point(128, 17); + this.scaleFactor.Margin = new System.Windows.Forms.Padding(4); this.scaleFactor.Name = "scaleFactor"; - this.scaleFactor.Size = new System.Drawing.Size(46, 21); + this.scaleFactor.Size = new System.Drawing.Size(61, 25); this.scaleFactor.TabIndex = 1; this.scaleFactor.Value = new decimal(new int[] { 254, @@ -253,17 +271,19 @@ // scaleLabel // this.scaleLabel.AutoSize = true; - this.scaleLabel.Location = new System.Drawing.Point(6, 15); + this.scaleLabel.Location = new System.Drawing.Point(8, 19); + this.scaleLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.scaleLabel.Name = "scaleLabel"; - this.scaleLabel.Size = new System.Drawing.Size(83, 12); + this.scaleLabel.Size = new System.Drawing.Size(112, 16); this.scaleLabel.TabIndex = 0; this.scaleLabel.Text = "Scale Factor:"; // // fbxOKbutton // - this.fbxOKbutton.Location = new System.Drawing.Point(332, 364); + this.fbxOKbutton.Location = new System.Drawing.Point(443, 455); + this.fbxOKbutton.Margin = new System.Windows.Forms.Padding(4); this.fbxOKbutton.Name = "fbxOKbutton"; - this.fbxOKbutton.Size = new System.Drawing.Size(75, 21); + this.fbxOKbutton.Size = new System.Drawing.Size(100, 26); this.fbxOKbutton.TabIndex = 6; this.fbxOKbutton.Text = "OK"; this.fbxOKbutton.UseVisualStyleBackColor = true; @@ -272,9 +292,10 @@ // fbxCancel // this.fbxCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; - this.fbxCancel.Location = new System.Drawing.Point(420, 364); + this.fbxCancel.Location = new System.Drawing.Point(560, 455); + this.fbxCancel.Margin = new System.Windows.Forms.Padding(4); this.fbxCancel.Name = "fbxCancel"; - this.fbxCancel.Size = new System.Drawing.Size(75, 21); + this.fbxCancel.Size = new System.Drawing.Size(100, 26); this.fbxCancel.TabIndex = 7; this.fbxCancel.Text = "Cancel"; this.fbxCancel.UseVisualStyleBackColor = true; @@ -288,9 +309,10 @@ // showExpOpt // this.showExpOpt.AutoSize = true; - this.showExpOpt.Location = new System.Drawing.Point(12, 367); + this.showExpOpt.Location = new System.Drawing.Point(16, 459); + this.showExpOpt.Margin = new System.Windows.Forms.Padding(4); this.showExpOpt.Name = "showExpOpt"; - this.showExpOpt.Size = new System.Drawing.Size(222, 16); + this.showExpOpt.Size = new System.Drawing.Size(294, 20); this.showExpOpt.TabIndex = 8; this.showExpOpt.Text = "Show this dialog for every export"; this.showExpOpt.UseVisualStyleBackColor = true; @@ -300,9 +322,11 @@ this.groupBox1.Controls.Add(this.convertfsb); this.groupBox1.Controls.Add(this.panel1); this.groupBox1.Controls.Add(this.converttexture); - this.groupBox1.Location = new System.Drawing.Point(267, 12); + this.groupBox1.Location = new System.Drawing.Point(356, 15); + this.groupBox1.Margin = new System.Windows.Forms.Padding(4); this.groupBox1.Name = "groupBox1"; - this.groupBox1.Size = new System.Drawing.Size(228, 349); + this.groupBox1.Padding = new System.Windows.Forms.Padding(4); + this.groupBox1.Size = new System.Drawing.Size(304, 436); this.groupBox1.TabIndex = 9; this.groupBox1.TabStop = false; this.groupBox1.Text = "Convert"; @@ -312,9 +336,10 @@ this.convertfsb.AutoSize = true; this.convertfsb.Checked = true; this.convertfsb.CheckState = System.Windows.Forms.CheckState.Checked; - this.convertfsb.Location = new System.Drawing.Point(8, 81); + this.convertfsb.Location = new System.Drawing.Point(11, 101); + this.convertfsb.Margin = new System.Windows.Forms.Padding(4); this.convertfsb.Name = "convertfsb"; - this.convertfsb.Size = new System.Drawing.Size(132, 16); + this.convertfsb.Size = new System.Drawing.Size(174, 20); this.convertfsb.TabIndex = 6; this.convertfsb.Text = "Convert FSB to WAV"; this.convertfsb.UseVisualStyleBackColor = true; @@ -324,17 +349,19 @@ this.panel1.Controls.Add(this.tojpg); this.panel1.Controls.Add(this.topng); this.panel1.Controls.Add(this.tobmp); - this.panel1.Location = new System.Drawing.Point(30, 42); + this.panel1.Location = new System.Drawing.Point(40, 52); + this.panel1.Margin = new System.Windows.Forms.Padding(4); this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(146, 30); + this.panel1.Size = new System.Drawing.Size(195, 38); this.panel1.TabIndex = 5; // // tojpg // this.tojpg.AutoSize = true; - this.tojpg.Location = new System.Drawing.Point(97, 6); + this.tojpg.Location = new System.Drawing.Point(129, 8); + this.tojpg.Margin = new System.Windows.Forms.Padding(4); this.tojpg.Name = "tojpg"; - this.tojpg.Size = new System.Drawing.Size(47, 16); + this.tojpg.Size = new System.Drawing.Size(61, 20); this.tojpg.TabIndex = 4; this.tojpg.Text = "JPEG"; this.tojpg.UseVisualStyleBackColor = true; @@ -343,9 +370,10 @@ // this.topng.AutoSize = true; this.topng.Checked = true; - this.topng.Location = new System.Drawing.Point(50, 6); + this.topng.Location = new System.Drawing.Point(67, 8); + this.topng.Margin = new System.Windows.Forms.Padding(4); this.topng.Name = "topng"; - this.topng.Size = new System.Drawing.Size(41, 16); + this.topng.Size = new System.Drawing.Size(53, 20); this.topng.TabIndex = 3; this.topng.TabStop = true; this.topng.Text = "PNG"; @@ -354,9 +382,10 @@ // tobmp // this.tobmp.AutoSize = true; - this.tobmp.Location = new System.Drawing.Point(3, 6); + this.tobmp.Location = new System.Drawing.Point(4, 8); + this.tobmp.Margin = new System.Windows.Forms.Padding(4); this.tobmp.Name = "tobmp"; - this.tobmp.Size = new System.Drawing.Size(41, 16); + this.tobmp.Size = new System.Drawing.Size(53, 20); this.tobmp.TabIndex = 2; this.tobmp.Text = "BMP"; this.tobmp.UseVisualStyleBackColor = true; @@ -366,9 +395,10 @@ this.converttexture.AutoSize = true; this.converttexture.Checked = true; this.converttexture.CheckState = System.Windows.Forms.CheckState.Checked; - this.converttexture.Location = new System.Drawing.Point(8, 20); + this.converttexture.Location = new System.Drawing.Point(11, 25); + this.converttexture.Margin = new System.Windows.Forms.Padding(4); this.converttexture.Name = "converttexture"; - this.converttexture.Size = new System.Drawing.Size(192, 16); + this.converttexture.Size = new System.Drawing.Size(254, 20); this.converttexture.TabIndex = 1; this.converttexture.Text = "Convert Texture (If support)"; this.converttexture.UseVisualStyleBackColor = true; @@ -376,10 +406,10 @@ // ExportOptions // this.AcceptButton = this.fbxOKbutton; - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); + this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.CancelButton = this.fbxCancel; - this.ClientSize = new System.Drawing.Size(513, 392); + this.ClientSize = new System.Drawing.Size(684, 490); this.Controls.Add(this.groupBox1); this.Controls.Add(this.showExpOpt); this.Controls.Add(this.fbxCancel); @@ -387,6 +417,7 @@ this.Controls.Add(this.advancedBox); this.Controls.Add(this.includeBox); this.HelpButton = true; + this.Margin = new System.Windows.Forms.Padding(4); this.MaximizeBox = false; this.MinimizeBox = false; this.Name = "ExportOptions"; diff --git a/Unity Studio/Unity Classes/AudioClip.cs b/Unity Studio/Unity Classes/AudioClip.cs index 0fc701d..4f2bff2 100644 --- a/Unity Studio/Unity Classes/AudioClip.cs +++ b/Unity Studio/Unity Classes/AudioClip.cs @@ -164,9 +164,13 @@ namespace Unity_Studio preloadData.extension = ".fsb"; preloadData.InfoText += "MP3";//not sure break; + case 7: + preloadData.extension = ".m4a"; + preloadData.InfoText += "M4a"; + break; } - if (preloadData.extension == "") + if (preloadData.extension == null) { preloadData.extension = ".AudioClip"; preloadData.InfoText += "Unknown"; diff --git a/Unity Studio/Unity Classes/GameObject.cs b/Unity Studio/Unity Classes/GameObject.cs index c9cab78..1c2d311 100644 --- a/Unity Studio/Unity Classes/GameObject.cs +++ b/Unity Studio/Unity Classes/GameObject.cs @@ -56,7 +56,6 @@ namespace Unity_Studio m_SkinnedMeshRenderer = sourceFile.ReadPPtr(); break; default: - a_Stream.Position -= 4; PPtr m_Component = sourceFile.ReadPPtr(); break; } diff --git a/Unity Studio/Unity Classes/MonoBehaviour.cs b/Unity Studio/Unity Classes/MonoBehaviour.cs index aa2373b..188e246 100644 --- a/Unity Studio/Unity Classes/MonoBehaviour.cs +++ b/Unity Studio/Unity Classes/MonoBehaviour.cs @@ -87,6 +87,12 @@ namespace Unity_Studio sb.AppendFormat("{0}{1} {2} = {3}\r\n", (new string('\t', level)), varTypeStr, varNameStr, value); a_Stream.AlignStream(4); } + else if (varTypeStr == "UInt64") + { + var value = a_Stream.ReadUInt64(); + sb.AppendFormat("{0}{1} {2} = {3}\r\n", (new string('\t', level)), varTypeStr, varNameStr, value); + a_Stream.AlignStream(4); + } else if (varTypeStr == "UInt16") { var value = a_Stream.ReadUInt16();