- fixed an issue with vertex colors in Unity 5

- added support for UV channels 3 & 4 in Unity 5
- fixed a problem with the scene hierarchy search box
This commit is contained in:
RaduMCosma 2015-11-03 00:56:03 +02:00
parent a928ffbf92
commit a9c8a4ab79
3 changed files with 248 additions and 142 deletions

View File

@ -116,6 +116,8 @@ namespace Unity_Studio
public float[] m_Colors; public float[] m_Colors;
public float[] m_UV1; public float[] m_UV1;
public float[] m_UV2; public float[] m_UV2;
public float[] m_UV3;
public float[] m_UV4;
public float[] m_Tangents; public float[] m_Tangents;
public class SubMesh public class SubMesh
@ -553,7 +555,7 @@ namespace Unity_Studio
m_Channels[c].dimension = a_Stream.ReadByte(); m_Channels[c].dimension = a_Stream.ReadByte();
//calculate stride for Unity 5 //calculate stride for Unity 5
singleStreamStride += m_Channels[c].dimension * (m_Channels[c].format % 2 == 0 ? 4 : 2);//fingers crossed! singleStreamStride += m_Channels[c].dimension * (4 / (int)Math.Pow(2, m_Channels[c].format));
} }
if (version[0] < 5) if (version[0] < 5)
@ -586,7 +588,7 @@ namespace Unity_Studio
#endregion #endregion
#region compute FvF #region compute FvF
byte valueBufferSize = 0; int valueBufferSize = 0;
byte[] valueBuffer; byte[] valueBuffer;
float[] dstArray; float[] dstArray;
@ -601,11 +603,16 @@ namespace Unity_Studio
{ {
var m_Stream = m_Streams[m_Channel.stream]; var m_Stream = m_Streams[m_Channel.stream];
for (int b = 0; b < 6; b++) for (int b = 0; b < 8; b++)
{ {
if (m_Stream.channelMask.Get(b)) if (m_Stream.channelMask.Get(b))
{ {
switch (m_Channel.format) // in Unity 4.x the colors channel has 1 dimension, as in 1 color with 4 components
if (b == 2 && m_Channel.format == 2) { m_Channel.dimension = 4; }
valueBufferSize = 4 / (int)Math.Pow(2, m_Channel.format);
/*switch (m_Channel.format)
{ {
case 0: //32bit case 0: //32bit
valueBufferSize = 4; valueBufferSize = 4;
@ -615,9 +622,9 @@ namespace Unity_Studio
break; break;
case 2: //8bit case 2: //8bit
valueBufferSize = 1; valueBufferSize = 1;
m_Channel.dimension = 4;//these are actually groups of 4 components m_Channel.dimension = 4;//in older versions this is 1, as in 1 color with 4 components
break; break;
} }*/
valueBuffer = new byte[valueBufferSize]; valueBuffer = new byte[valueBufferSize];
dstArray = new float[m_VertexCount * m_Channel.dimension]; dstArray = new float[m_VertexCount * m_Channel.dimension];
@ -634,22 +641,29 @@ namespace Unity_Studio
switch (b) switch (b)
{ {
case 0://1 case 0:
m_Vertices = dstArray; m_Vertices = dstArray;
break; break;
case 1://2 case 1:
m_Normals = dstArray; m_Normals = dstArray;
break; break;
case 2://4 case 2:
m_Colors = dstArray; m_Colors = dstArray;
break; break;
case 3://8 case 3:
m_UV1 = dstArray; m_UV1 = dstArray;
break; break;
case 4://16 case 4:
m_UV2 = dstArray; m_UV2 = dstArray;
break; break;
case 5://32 case 5:
if (version[0] == 5) { m_UV3 = dstArray; }
else { m_Tangents = dstArray; }
break;
case 6:
m_UV4 = dstArray;
break;
case 7:
m_Tangents = dstArray; m_Tangents = dstArray;
break; break;
} }
@ -799,13 +813,31 @@ namespace Unity_Studio
m_UV1[v] = (float)m_UV_Unpacked[v] / bitmax * m_UV_Packed.m_Range + m_UV_Packed.m_Start; m_UV1[v] = (float)m_UV_Unpacked[v] / bitmax * m_UV_Packed.m_Range + m_UV_Packed.m_Start;
} }
if (m_UV_Packed.m_NumItems == m_VertexCount * 4) if (m_UV_Packed.m_NumItems >= m_VertexCount * 4)
{ {
m_UV2 = new float[m_VertexCount * 2]; m_UV2 = new float[m_VertexCount * 2];
for (uint v = 0; v < m_VertexCount * 2; v++) for (uint v = 0; v < m_VertexCount * 2; v++)
{ {
m_UV2[v] = (float)m_UV_Unpacked[v + m_VertexCount * 2] / bitmax * m_UV_Packed.m_Range + m_UV_Packed.m_Start; m_UV2[v] = (float)m_UV_Unpacked[v + m_VertexCount * 2] / bitmax * m_UV_Packed.m_Range + m_UV_Packed.m_Start;
} }
if (m_UV_Packed.m_NumItems >= m_VertexCount * 6)
{
m_UV3 = new float[m_VertexCount * 2];
for (uint v = 0; v < m_VertexCount * 2; v++)
{
m_UV3[v] = (float)m_UV_Unpacked[v + m_VertexCount * 4] / bitmax * m_UV_Packed.m_Range + m_UV_Packed.m_Start;
}
if (m_UV_Packed.m_NumItems == m_VertexCount * 8)
{
m_UV4 = new float[m_VertexCount * 2];
for (uint v = 0; v < m_VertexCount * 2; v++)
{
m_UV4[v] = (float)m_UV_Unpacked[v + m_VertexCount * 6] / bitmax * m_UV_Packed.m_Range + m_UV_Packed.m_Start;
}
}
}
} }
} }

View File

@ -62,16 +62,14 @@
this.splitContainer1 = new System.Windows.Forms.SplitContainer(); this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.tabControl1 = new System.Windows.Forms.TabControl(); this.tabControl1 = new System.Windows.Forms.TabControl();
this.tabPage1 = new System.Windows.Forms.TabPage(); this.tabPage1 = new System.Windows.Forms.TabPage();
this.sceneTreeView = new Unity_Studio.GOHierarchy();
this.treeSearch = new System.Windows.Forms.TextBox();
this.tabPage2 = new System.Windows.Forms.TabPage(); this.tabPage2 = new System.Windows.Forms.TabPage();
this.assetListView = new System.Windows.Forms.ListView(); this.assetListView = new System.Windows.Forms.ListView();
this.columnHeaderName = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.columnHeaderName = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.columnHeaderType = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.columnHeaderType = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.columnHeaderSize = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.columnHeaderSize = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.listSearch = new System.Windows.Forms.TextBox(); this.listSearch = new System.Windows.Forms.TextBox();
this.tabPage3 = new System.Windows.Forms.TabPage();
this.classesListView = new System.Windows.Forms.ListView();
this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.columnHeader2 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.progressbarPanel = new System.Windows.Forms.Panel(); this.progressbarPanel = new System.Windows.Forms.Panel();
this.progressBar1 = new System.Windows.Forms.ProgressBar(); this.progressBar1 = new System.Windows.Forms.ProgressBar();
this.previewPanel = new System.Windows.Forms.Panel(); this.previewPanel = new System.Windows.Forms.Panel();
@ -92,22 +90,24 @@
this.classTextBox = new System.Windows.Forms.TextBox(); this.classTextBox = new System.Windows.Forms.TextBox();
this.statusStrip1 = new System.Windows.Forms.StatusStrip(); this.statusStrip1 = new System.Windows.Forms.StatusStrip();
this.toolStripStatusLabel1 = new System.Windows.Forms.ToolStripStatusLabel(); this.toolStripStatusLabel1 = new System.Windows.Forms.ToolStripStatusLabel();
this.treeSearch = new System.Windows.Forms.TextBox(); this.tabPage3 = new System.Windows.Forms.TabPage();
this.classesListView = new System.Windows.Forms.ListView();
this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.columnHeader2 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.timer = new System.Windows.Forms.Timer(this.components); this.timer = new System.Windows.Forms.Timer(this.components);
this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog(); this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
this.openFolderDialog1 = new System.Windows.Forms.OpenFileDialog(); this.openFolderDialog1 = new System.Windows.Forms.OpenFileDialog();
this.saveFileDialog1 = new System.Windows.Forms.SaveFileDialog(); this.saveFileDialog1 = new System.Windows.Forms.SaveFileDialog();
this.saveFolderDialog1 = new System.Windows.Forms.SaveFileDialog(); this.saveFolderDialog1 = new System.Windows.Forms.SaveFileDialog();
this.treeTip = new System.Windows.Forms.ToolTip(this.components); this.treeTip = new System.Windows.Forms.ToolTip(this.components);
this.sceneTreeView = new Unity_Studio.GOHierarchy();
this.menuStrip1.SuspendLayout(); this.menuStrip1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout(); this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout(); this.splitContainer1.Panel2.SuspendLayout();
this.splitContainer1.SuspendLayout(); this.splitContainer1.SuspendLayout();
this.tabControl1.SuspendLayout(); this.tabControl1.SuspendLayout();
this.tabPage1.SuspendLayout();
this.tabPage2.SuspendLayout(); this.tabPage2.SuspendLayout();
this.tabPage3.SuspendLayout();
this.progressbarPanel.SuspendLayout(); this.progressbarPanel.SuspendLayout();
this.previewPanel.SuspendLayout(); this.previewPanel.SuspendLayout();
this.FMODpanel.SuspendLayout(); this.FMODpanel.SuspendLayout();
@ -115,6 +115,7 @@
((System.ComponentModel.ISupportInitialize)(this.FMODvolumeBar)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.FMODvolumeBar)).BeginInit();
this.classPreviewPanel.SuspendLayout(); this.classPreviewPanel.SuspendLayout();
this.statusStrip1.SuspendLayout(); this.statusStrip1.SuspendLayout();
this.tabPage3.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
// menuStrip1 // menuStrip1
@ -396,7 +397,6 @@
// //
this.tabControl1.Controls.Add(this.tabPage1); this.tabControl1.Controls.Add(this.tabPage1);
this.tabControl1.Controls.Add(this.tabPage2); this.tabControl1.Controls.Add(this.tabPage2);
//this.tabControl1.Controls.Add(this.tabPage3);
this.tabControl1.Dock = System.Windows.Forms.DockStyle.Fill; this.tabControl1.Dock = System.Windows.Forms.DockStyle.Fill;
this.tabControl1.Location = new System.Drawing.Point(0, 0); this.tabControl1.Location = new System.Drawing.Point(0, 0);
this.tabControl1.Name = "tabControl1"; this.tabControl1.Name = "tabControl1";
@ -418,6 +418,32 @@
this.tabPage1.Text = "Scene Hierarchy"; this.tabPage1.Text = "Scene Hierarchy";
this.tabPage1.UseVisualStyleBackColor = true; this.tabPage1.UseVisualStyleBackColor = true;
// //
// sceneTreeView
//
this.sceneTreeView.CheckBoxes = true;
this.sceneTreeView.Dock = System.Windows.Forms.DockStyle.Fill;
this.sceneTreeView.HideSelection = false;
this.sceneTreeView.Location = new System.Drawing.Point(0, 20);
this.sceneTreeView.Name = "sceneTreeView";
this.sceneTreeView.Size = new System.Drawing.Size(410, 588);
this.sceneTreeView.TabIndex = 1;
this.sceneTreeView.AfterCheck += new System.Windows.Forms.TreeViewEventHandler(this.sceneTreeView_AfterCheck);
//
// treeSearch
//
this.treeSearch.Dock = System.Windows.Forms.DockStyle.Top;
this.treeSearch.ForeColor = System.Drawing.SystemColors.GrayText;
this.treeSearch.Location = new System.Drawing.Point(0, 0);
this.treeSearch.Name = "treeSearch";
this.treeSearch.Size = new System.Drawing.Size(410, 20);
this.treeSearch.TabIndex = 0;
this.treeSearch.Text = " Search ";
this.treeSearch.TextChanged += new System.EventHandler(this.treeSearch_TextChanged);
this.treeSearch.Enter += new System.EventHandler(this.treeSearch_Enter);
this.treeSearch.KeyDown += new System.Windows.Forms.KeyEventHandler(this.treeSearch_KeyDown);
this.treeSearch.Leave += new System.EventHandler(this.treeSearch_Leave);
this.treeSearch.MouseEnter += new System.EventHandler(this.treeSearch_MouseEnter);
//
// tabPage2 // tabPage2
// //
this.tabPage2.Controls.Add(this.assetListView); this.tabPage2.Controls.Add(this.assetListView);
@ -478,43 +504,6 @@
this.listSearch.Enter += new System.EventHandler(this.listSearch_Enter); this.listSearch.Enter += new System.EventHandler(this.listSearch_Enter);
this.listSearch.Leave += new System.EventHandler(this.listSearch_Leave); this.listSearch.Leave += new System.EventHandler(this.listSearch_Leave);
// //
// tabPage3
//
this.tabPage3.Controls.Add(this.classesListView);
this.tabPage3.Location = new System.Drawing.Point(4, 22);
this.tabPage3.Name = "tabPage3";
this.tabPage3.Size = new System.Drawing.Size(410, 608);
this.tabPage3.TabIndex = 2;
this.tabPage3.Text = "Asset Classes";
this.tabPage3.UseVisualStyleBackColor = true;
//
// classesListView
//
this.classesListView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.columnHeader1,
this.columnHeader2});
this.classesListView.Dock = System.Windows.Forms.DockStyle.Fill;
this.classesListView.FullRowSelect = true;
this.classesListView.Location = new System.Drawing.Point(0, 0);
this.classesListView.MultiSelect = false;
this.classesListView.Name = "classesListView";
this.classesListView.Size = new System.Drawing.Size(410, 608);
this.classesListView.TabIndex = 0;
this.classesListView.UseCompatibleStateImageBehavior = false;
this.classesListView.View = System.Windows.Forms.View.Details;
this.classesListView.ItemSelectionChanged += new System.Windows.Forms.ListViewItemSelectionChangedEventHandler(this.classesListView_ItemSelectionChanged);
//
// columnHeader1
//
this.columnHeader1.DisplayIndex = 1;
this.columnHeader1.Text = "Name";
this.columnHeader1.Width = 328;
//
// columnHeader2
//
this.columnHeader2.DisplayIndex = 0;
this.columnHeader2.Text = "ID";
//
// progressbarPanel // progressbarPanel
// //
this.progressbarPanel.Controls.Add(this.progressBar1); this.progressbarPanel.Controls.Add(this.progressBar1);
@ -740,19 +729,42 @@
this.toolStripStatusLabel1.Text = "Ready to go"; this.toolStripStatusLabel1.Text = "Ready to go";
this.toolStripStatusLabel1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; this.toolStripStatusLabel1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
// //
// treeSearch // tabPage3
// //
this.treeSearch.Dock = System.Windows.Forms.DockStyle.Top; this.tabPage3.Controls.Add(this.classesListView);
this.treeSearch.ForeColor = System.Drawing.SystemColors.GrayText; this.tabPage3.Location = new System.Drawing.Point(4, 22);
this.treeSearch.Location = new System.Drawing.Point(0, 0); this.tabPage3.Name = "tabPage3";
this.treeSearch.Name = "treeSearch"; this.tabPage3.Size = new System.Drawing.Size(410, 608);
this.treeSearch.Size = new System.Drawing.Size(410, 20); this.tabPage3.TabIndex = 2;
this.treeSearch.TabIndex = 0; this.tabPage3.Text = "Asset Classes";
this.treeSearch.Text = " Search "; this.tabPage3.UseVisualStyleBackColor = true;
this.treeSearch.Enter += new System.EventHandler(this.treeSearch_Enter); //
this.treeSearch.KeyDown += new System.Windows.Forms.KeyEventHandler(this.treeSearch_KeyDown); // classesListView
this.treeSearch.Leave += new System.EventHandler(this.treeSearch_Leave); //
this.treeSearch.MouseEnter += new System.EventHandler(this.treeSearch_MouseEnter); this.classesListView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.columnHeader1,
this.columnHeader2});
this.classesListView.Dock = System.Windows.Forms.DockStyle.Fill;
this.classesListView.FullRowSelect = true;
this.classesListView.Location = new System.Drawing.Point(0, 0);
this.classesListView.MultiSelect = false;
this.classesListView.Name = "classesListView";
this.classesListView.Size = new System.Drawing.Size(410, 608);
this.classesListView.TabIndex = 0;
this.classesListView.UseCompatibleStateImageBehavior = false;
this.classesListView.View = System.Windows.Forms.View.Details;
this.classesListView.ItemSelectionChanged += new System.Windows.Forms.ListViewItemSelectionChangedEventHandler(this.classesListView_ItemSelectionChanged);
//
// columnHeader1
//
this.columnHeader1.DisplayIndex = 1;
this.columnHeader1.Text = "Name";
this.columnHeader1.Width = 328;
//
// columnHeader2
//
this.columnHeader2.DisplayIndex = 0;
this.columnHeader2.Text = "ID";
// //
// timer // timer
// //
@ -789,18 +801,6 @@
this.saveFolderDialog1.RestoreDirectory = true; this.saveFolderDialog1.RestoreDirectory = true;
this.saveFolderDialog1.Title = "Browse for folder"; this.saveFolderDialog1.Title = "Browse for folder";
// //
// sceneTreeView
//
this.sceneTreeView.CheckBoxes = true;
this.sceneTreeView.Dock = System.Windows.Forms.DockStyle.Fill;
this.sceneTreeView.HideSelection = false;
this.sceneTreeView.LineColor = System.Drawing.Color.Empty;
this.sceneTreeView.Location = new System.Drawing.Point(0, 20);
this.sceneTreeView.Name = "sceneTreeView";
this.sceneTreeView.Size = new System.Drawing.Size(410, 588);
this.sceneTreeView.TabIndex = 1;
this.sceneTreeView.AfterCheck += new System.Windows.Forms.TreeViewEventHandler(this.sceneTreeView_AfterCheck);
//
// UnityStudioForm // UnityStudioForm
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@ -824,9 +824,10 @@
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
this.splitContainer1.ResumeLayout(false); this.splitContainer1.ResumeLayout(false);
this.tabControl1.ResumeLayout(false); this.tabControl1.ResumeLayout(false);
this.tabPage1.ResumeLayout(false);
this.tabPage1.PerformLayout();
this.tabPage2.ResumeLayout(false); this.tabPage2.ResumeLayout(false);
this.tabPage2.PerformLayout(); this.tabPage2.PerformLayout();
this.tabPage3.ResumeLayout(false);
this.progressbarPanel.ResumeLayout(false); this.progressbarPanel.ResumeLayout(false);
this.previewPanel.ResumeLayout(false); this.previewPanel.ResumeLayout(false);
this.previewPanel.PerformLayout(); this.previewPanel.PerformLayout();
@ -838,6 +839,7 @@
this.classPreviewPanel.PerformLayout(); this.classPreviewPanel.PerformLayout();
this.statusStrip1.ResumeLayout(false); this.statusStrip1.ResumeLayout(false);
this.statusStrip1.PerformLayout(); this.statusStrip1.PerformLayout();
this.tabPage3.ResumeLayout(false);
this.ResumeLayout(false); this.ResumeLayout(false);
this.PerformLayout(); this.PerformLayout();

View File

@ -53,9 +53,9 @@ namespace Unity_Studio
private bool isTypeSorted = false; private bool isTypeSorted = false;
private bool isSizeSorted = false; private bool isSizeSorted = false;
//return-to indices for tree search //tree search
private int lastAFile = 0; private int nextGObject = 0;
private int lastGObject = 0; List<GameObject> treeSrcResults = new List<GameObject>();
//counters for progress bar //counters for progress bar
private int totalAssetCount = 0; private int totalAssetCount = 0;
@ -878,19 +878,6 @@ namespace Unity_Studio
} }
} }
private void recurseTreeCheck(TreeNodeCollection start)
{
foreach (GameObject GObject in start)
{
if (GObject.Text.Like(treeSearch.Text))
{
GObject.Checked = !GObject.Checked;
if (GObject.Checked) { GObject.EnsureVisible(); }
}
else { recurseTreeCheck(GObject.Nodes); }
}
}
private void treeSearch_MouseEnter(object sender, EventArgs e) private void treeSearch_MouseEnter(object sender, EventArgs e)
{ {
treeTip.Show("Search with * ? widcards. Enter to scroll through results, Ctrl+Enter to select all results.", treeSearch, 5000); treeTip.Show("Search with * ? widcards. Enter to scroll through results, Ctrl+Enter to select all results.", treeSearch, 5000);
@ -914,59 +901,57 @@ namespace Unity_Studio
} }
} }
private void recurseTreeCheck(TreeNodeCollection start)
{
foreach (GameObject GObject in start)
{
if (GObject.Text.Like(treeSearch.Text))
{
GObject.Checked = !GObject.Checked;
if (GObject.Checked) { GObject.EnsureVisible(); }
}
else { recurseTreeCheck(GObject.Nodes); }
}
}
private void treeSearch_TextChanged(object sender, EventArgs e)
{
treeSrcResults.Clear();
nextGObject = 0;
}
private void treeSearch_KeyDown(object sender, KeyEventArgs e) private void treeSearch_KeyDown(object sender, KeyEventArgs e)
{ {
if (e.KeyCode == Keys.Enter) if (e.KeyCode == Keys.Enter)
{ {
if (e.Control) //toggle all matching nodes //skip children? if (treeSrcResults.Count == 0)
{
foreach (var aFile in assetsfileList)
{
foreach (var GObject in aFile.GameObjectList.Values)
{
if (GObject.Text.Like(treeSearch.Text)) { treeSrcResults.Add(GObject); }
}
}
}
if (e.Control) //toggle all matching nodes
{ {
sceneTreeView.BeginUpdate(); sceneTreeView.BeginUpdate();
//loop assetsFileList? //loop TreeView recursively to avoid children already checked by parent
/*foreach (var AFile in assetsfileList)
{
foreach (var GObject in AFile.GameObjectList)
{
if (GObject.Text.Like(treeSearch.Text))
{
GObject.Checked = true;
GObject.EnsureVisible();
}
}
}*/
//loop TreeView to avoid checking children already checked by parent
recurseTreeCheck(sceneTreeView.Nodes); recurseTreeCheck(sceneTreeView.Nodes);
sceneTreeView.EndUpdate(); sceneTreeView.EndUpdate();
} }
else //make visible one by one else //make visible one by one
{ {
bool foundNode = false; if (treeSrcResults.Count > 0)
while (!foundNode && lastAFile < assetsfileList.Count)
{ {
var AFile = assetsfileList[lastAFile]; if (nextGObject > treeSrcResults.Count) { nextGObject = 0; }
treeSrcResults[nextGObject].EnsureVisible();
while (!foundNode && lastGObject < AFile.GameObjectList.Count) sceneTreeView.SelectedNode = treeSrcResults[nextGObject];
{ nextGObject++;
var GObject = AFile.GameObjectList[lastGObject];
if (GObject.Text.Like(treeSearch.Text))
{
foundNode = true;
GObject.EnsureVisible();
sceneTreeView.SelectedNode = GObject;
lastGObject++;
return;
}
lastGObject++;
}
lastAFile++;
lastGObject = 0;
} }
lastAFile = 0;
} }
} }
} }
@ -2171,7 +2156,7 @@ namespace Unity_Studio
} }
#endregion #endregion
#region UV #region UV1
//does FBX support UVW coordinates? //does FBX support UVW coordinates?
if ((bool)Properties.Settings.Default["exportUVs"] && m_Mesh.m_UV1 != null && m_Mesh.m_UV1.Length > 0) if ((bool)Properties.Settings.Default["exportUVs"] && m_Mesh.m_UV1 != null && m_Mesh.m_UV1.Length > 0)
{ {
@ -2203,7 +2188,8 @@ namespace Unity_Studio
ob.Append("\n\t\t\t}\n\t\t}"); ob.Append("\n\t\t\t}\n\t\t}");
} }
#endregion
#region UV2
if ((bool)Properties.Settings.Default["exportUVs"] && m_Mesh.m_UV2 != null && m_Mesh.m_UV2.Length > 0) if ((bool)Properties.Settings.Default["exportUVs"] && m_Mesh.m_UV2 != null && m_Mesh.m_UV2.Length > 0)
{ {
ob.Append("\n\t\tLayerElementUV: 1 {"); ob.Append("\n\t\tLayerElementUV: 1 {");
@ -2235,6 +2221,70 @@ namespace Unity_Studio
ob.Append("\n\t\t\t}\n\t\t}"); ob.Append("\n\t\t\t}\n\t\t}");
} }
#endregion #endregion
#region UV3
if ((bool)Properties.Settings.Default["exportUVs"] && m_Mesh.m_UV3 != null && m_Mesh.m_UV3.Length > 0)
{
ob.Append("\n\t\tLayerElementUV: 2 {");
ob.Append("\n\t\t\tVersion: 101");
ob.Append("\n\t\t\tName: \"UVChannel_3\"");
ob.Append("\n\t\t\tMappingInformationType: \"ByVertice\"");
ob.Append("\n\t\t\tReferenceInformationType: \"Direct\"");
ob.AppendFormat("\n\t\t\tUV: *{0} {{\n\t\t\ta: ", m_Mesh.m_UV3.Length);
for (int l = 0; l < f2Lines; l++)
{
for (int v = 0; v < 60; v++)
{
ob.AppendFormat("{0},{1},", m_Mesh.m_UV3[l * 120 + v * 2], 1 - m_Mesh.m_UV3[l * 120 + v * 2 + 1]);
}
ob.Append("\n");
}
if (remf2Verts != 0)
{
for (int v = 0; v < remf2Verts; v++)
{
ob.AppendFormat("{0},{1},", m_Mesh.m_UV3[f2Lines * 120 + v * 2], 1 - m_Mesh.m_UV3[f2Lines * 120 + v * 2 + 1]);
}
}
else { ob.Length--; }//remove last newline
ob.Length--;//remove last comma
ob.Append("\n\t\t\t}\n\t\t}");
}
#endregion
#region UV4
if ((bool)Properties.Settings.Default["exportUVs"] && m_Mesh.m_UV4 != null && m_Mesh.m_UV4.Length > 0)
{
ob.Append("\n\t\tLayerElementUV: 3 {");
ob.Append("\n\t\t\tVersion: 101");
ob.Append("\n\t\t\tName: \"UVChannel_4\"");
ob.Append("\n\t\t\tMappingInformationType: \"ByVertice\"");
ob.Append("\n\t\t\tReferenceInformationType: \"Direct\"");
ob.AppendFormat("\n\t\t\tUV: *{0} {{\n\t\t\ta: ", m_Mesh.m_UV4.Length);
for (int l = 0; l < f2Lines; l++)
{
for (int v = 0; v < 60; v++)
{
ob.AppendFormat("{0},{1},", m_Mesh.m_UV4[l * 120 + v * 2], 1 - m_Mesh.m_UV4[l * 120 + v * 2 + 1]);
}
ob.Append("\n");
}
if (remf2Verts != 0)
{
for (int v = 0; v < remf2Verts; v++)
{
ob.AppendFormat("{0},{1},", m_Mesh.m_UV4[f2Lines * 120 + v * 2], 1 - m_Mesh.m_UV4[f2Lines * 120 + v * 2 + 1]);
}
}
else { ob.Length--; }//remove last newline
ob.Length--;//remove last comma
ob.Append("\n\t\t\t}\n\t\t}");
}
#endregion
#region Material #region Material
ob.Append("\n\t\tLayerElementMaterial: 0 {"); ob.Append("\n\t\tLayerElementMaterial: 0 {");
@ -2323,6 +2373,28 @@ namespace Unity_Studio
ob.Append("\n\t\t\t}"); ob.Append("\n\t\t\t}");
ob.Append("\n\t\t}"); //Layer 1 end ob.Append("\n\t\t}"); //Layer 1 end
} }
if ((bool)Properties.Settings.Default["exportUVs"] && m_Mesh.m_UV3 != null && m_Mesh.m_UV3.Length > 0)
{
ob.Append("\n\t\tLayer: 2 {");
ob.Append("\n\t\t\tVersion: 100");
ob.Append("\n\t\t\tLayerElement: {");
ob.Append("\n\t\t\t\tType: \"LayerElementUV\"");
ob.Append("\n\t\t\t\tTypedIndex: 2");
ob.Append("\n\t\t\t}");
ob.Append("\n\t\t}"); //Layer 2 end
}
if ((bool)Properties.Settings.Default["exportUVs"] && m_Mesh.m_UV4 != null && m_Mesh.m_UV4.Length > 0)
{
ob.Append("\n\t\tLayer: 3 {");
ob.Append("\n\t\t\tVersion: 100");
ob.Append("\n\t\t\tLayerElement: {");
ob.Append("\n\t\t\t\tType: \"LayerElementUV\"");
ob.Append("\n\t\t\t\tTypedIndex: 3");
ob.Append("\n\t\t\t}");
ob.Append("\n\t\t}"); //Layer 3 end
}
#endregion #endregion
ob.Append("\n\t}"); //Geometry end ob.Append("\n\t}"); //Geometry end
@ -2986,7 +3058,7 @@ namespace Unity_Studio
lastSelectedItem = null; lastSelectedItem = null;
lastLoadedAsset = null; lastLoadedAsset = null;
//FMODinit(); FMODinit();
} }