diff --git a/Unity Studio/EndianStream.cs b/Unity Studio/EndianStream.cs index 4279784..8227573 100644 --- a/Unity Studio/EndianStream.cs +++ b/Unity Studio/EndianStream.cs @@ -163,21 +163,24 @@ namespace Unity_Studio public string ReadAlignedString(int length) { - - byte[] stringData = new byte[length]; - base.Read(stringData, 0, length); - var result = System.Text.Encoding.UTF8.GetString(stringData); //must verify strange characters in PS3 - - /*string result = ""; - char c; - for (int i = 0; i < length; i++) + if (length > 0 && length < (base.BaseStream.Length - base.BaseStream.Position))//crude failsafe { - c = (char)base.ReadByte(); - result += c.ToString(); - }*/ + byte[] stringData = new byte[length]; + base.Read(stringData, 0, length); + var result = System.Text.Encoding.UTF8.GetString(stringData); //must verify strange characters in PS3 - AlignStream(4); - return result; + /*string result = ""; + char c; + for (int i = 0; i < length; i++) + { + c = (char)base.ReadByte(); + result += c.ToString(); + }*/ + + AlignStream(4); + return result; + } + else { return ""; } } public string ReadStringToNull() diff --git a/Unity Studio/Mesh.cs b/Unity Studio/Mesh.cs index 4623fb2..8d43a65 100644 --- a/Unity Studio/Mesh.cs +++ b/Unity Studio/Mesh.cs @@ -81,11 +81,11 @@ So Unity adds a -90 degree rotation, similar to the FBX PreRotation, to bring th Except it does it as a regular rotation, and combines it with any other rotations in the Transform asset. Converting from Unity back to FBX, the same vertex conversion cannot be applied because we have to take into account the rotation. -Option 0: convert vertices and transformations as -X,Y,Z and set FBX option to Y-up without PreRotation! +Option 0: export vertices and transformations as -X,Y,Z and set FBX option to Y-up without PreRotation! the result will be Max Z = FBX Y, Max -Y = FBX Z, Max X = FBX X => final order -X -Z Y -Option 1: convert vertices and transformations as -X,-Z,Y and set FBX options as "Z-up". +Option 1: export vertices and transformations as -X,-Z,Y and set FBX options as "Z-up". The -90 rotation exported from Unity will bring the model in correct orientation. -Option 2: convert vertices and transformations as -X,-Y,-Z, add -90 PreRotation to every Mesh Node and set FBX options as "Y-up". +Option 2: export vertices and transformations as -X,-Y,-Z, add -90 PreRotation to every Mesh Node and set FBX options as "Y-up". The -90 rotation from Unity plus the -90 PreRotation will bring the model in correct orientation. Remember though that the PreRotation is baked into the Geometry. diff --git a/Unity Studio/PlayerSettings.cs b/Unity Studio/PlayerSettings.cs index 2995cf2..86c24d8 100644 --- a/Unity Studio/PlayerSettings.cs +++ b/Unity Studio/PlayerSettings.cs @@ -39,7 +39,7 @@ namespace Unity_Studio else if (sourceFile.version[0] == 3 && sourceFile.version[1] <= 4) { } else { int accelerometerFrequency = a_Stream.ReadInt32(); }//3.5.0 and up } - + //fail in Unity 5 beta companyName = a_Stream.ReadAlignedString(a_Stream.ReadInt32()); productName = a_Stream.ReadAlignedString(a_Stream.ReadInt32()); } diff --git a/Unity Studio/UnityStudioForm.Designer.cs b/Unity Studio/UnityStudioForm.Designer.cs index 77a8db1..01b52e2 100644 --- a/Unity Studio/UnityStudioForm.Designer.cs +++ b/Unity Studio/UnityStudioForm.Designer.cs @@ -100,6 +100,7 @@ this.saveFileDialog1 = new System.Windows.Forms.SaveFileDialog(); this.saveFolderDialog1 = new System.Windows.Forms.SaveFileDialog(); this.treeTip = new System.Windows.Forms.ToolTip(this.components); + this.FMODcopyright = new System.Windows.Forms.Label(); this.menuStrip1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); this.splitContainer1.Panel1.SuspendLayout(); @@ -552,6 +553,7 @@ // this.FMODpanel.Anchor = System.Windows.Forms.AnchorStyles.None; this.FMODpanel.BackColor = System.Drawing.SystemColors.ControlDark; + this.FMODpanel.Controls.Add(this.FMODcopyright); this.FMODpanel.Controls.Add(this.FMODinfoLabel); this.FMODpanel.Controls.Add(this.FMODtimerLabel); this.FMODpanel.Controls.Add(this.FMODstatusLabel); @@ -801,6 +803,16 @@ this.saveFolderDialog1.RestoreDirectory = true; this.saveFolderDialog1.Title = "Browse for folder"; // + // FMODcopyright + // + this.FMODcopyright.AutoSize = true; + this.FMODcopyright.ForeColor = System.Drawing.SystemColors.ControlLight; + this.FMODcopyright.Location = new System.Drawing.Point(117, 187); + this.FMODcopyright.Name = "FMODcopyright"; + this.FMODcopyright.Size = new System.Drawing.Size(283, 13); + this.FMODcopyright.TabIndex = 9; + this.FMODcopyright.Text = "Audio Engine supplied by FMOD by Firelight Technologies."; + // // UnityStudioForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -917,6 +929,7 @@ private System.Windows.Forms.TextBox classTextBox; private System.Windows.Forms.ToolStripSeparator toolStripSeparator2; private System.Windows.Forms.ToolStripMenuItem exportClassStructuresMenuItem; + private System.Windows.Forms.Label FMODcopyright; } } diff --git a/Unity Studio/UnityStudioForm.cs b/Unity Studio/UnityStudioForm.cs index ebb6161..71004de 100644 --- a/Unity Studio/UnityStudioForm.cs +++ b/Unity Studio/UnityStudioForm.cs @@ -609,7 +609,6 @@ namespace Unity_Studio #region first loop - read asset data & create list if (!dontLoadAssetsMenuItem.Checked) { - StatusStripUpdate("Building asset list..."); assetListView.BeginUpdate(); progressBar1.Value = 0; progressBar1.Maximum = totalAssetCount; @@ -618,6 +617,8 @@ namespace Unity_Studio foreach (var assetsFile in assetsfileList) { + StatusStripUpdate("Building asset list from " + Path.GetFileName(assetsFile.filePath)); + var a_Stream = assetsFile.a_Stream; var fileGen = assetsFile.fileGen; //var m_version = assetsFile.m_version; @@ -764,13 +765,13 @@ namespace Unity_Studio #region second loop - build tree structure if (!dontBuildHierarchyMenuItem.Checked) { - StatusStripUpdate("Building tree structure..."); sceneTreeView.BeginUpdate(); progressBar1.Value = 0; progressBar1.Maximum = totalTreeNodes; foreach (var assetsFile in assetsfileList) { + StatusStripUpdate("Building tree structure from " + Path.GetFileName(assetsFile.filePath)); GameObject fileNode = new GameObject(null); fileNode.Text = Path.GetFileName(assetsFile.filePath); @@ -1049,6 +1050,7 @@ namespace Unity_Studio fontPreviewBox.Visible = false; FMODpanel.Visible = false; lastLoadedAsset = null; + StatusStripUpdate(""); FMOD.RESULT result; if (sound != null) @@ -1147,6 +1149,7 @@ namespace Unity_Studio previewPanel.BackgroundImage = imageTexture; previewPanel.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom; } + else { StatusStripUpdate("Unsupported image for preview. Try to export."); } break; } #endregion @@ -1202,7 +1205,7 @@ namespace Unity_Studio ERRCHECK(result); FMODinfoLabel.Text = FMODfrequency.ToString() + " Hz"; } - else { StatusStripUpdate("Unsuported format"); } + else { StatusStripUpdate("Unsuported audio format"); } break; } #endregion @@ -1225,7 +1228,7 @@ namespace Unity_Studio { unityFont m_Font = new unityFont(asset); - if (m_Font.extension != ".otf" && m_Font.m_FontData.Length > 0) + if (m_Font.extension != ".otf" && m_Font.m_FontData != null) { IntPtr data = Marshal.AllocCoTaskMem(m_Font.m_FontData.Length); Marshal.Copy(m_Font.m_FontData, 0, data, m_Font.m_FontData.Length); @@ -1266,6 +1269,7 @@ namespace Unity_Studio fontPreviewBox.SelectionFont = new Font(pfc.Families[0], 72, FontStyle.Regular); fontPreviewBox.Visible = true; } + else { StatusStripUpdate("Unsupported font for preview. Try to export."); } break; } @@ -2921,25 +2925,28 @@ namespace Unity_Studio { unityFont m_Font = new unityFont(asset); - string fontPath = exportPath + "\\" + asset.Text; - if (uniqueNames.Checked) { fontPath += " #" + asset.uniqueID; } - fontPath += m_Font.extension; - - if (File.Exists(fontPath)) + if (m_Font.m_FontData != null) { - StatusStripUpdate("Font file " + Path.GetFileName(fontPath) + " already exists"); - } - else - { - StatusStripUpdate("Exporting Font: " + Path.GetFileName(fontPath)); + string fontPath = exportPath + "\\" + asset.Text; + if (uniqueNames.Checked) { fontPath += " #" + asset.uniqueID; } + fontPath += m_Font.extension; - using (BinaryWriter writer = new BinaryWriter(File.Open(fontPath, FileMode.Create))) + if (File.Exists(fontPath)) { - writer.Write(m_Font.m_FontData); - writer.Close(); + StatusStripUpdate("Font file " + Path.GetFileName(fontPath) + " already exists"); } + else + { + StatusStripUpdate("Exporting Font: " + Path.GetFileName(fontPath)); - exportCount += 1; + using (BinaryWriter writer = new BinaryWriter(File.Open(fontPath, FileMode.Create))) + { + writer.Write(m_Font.m_FontData); + writer.Close(); + } + + exportCount += 1; + } } break; }