private void InitSubfileLists() { remSubfilesList.Items.Clear(); reaSubfilesList.Items.Clear(); imageSubfilesList.Items.Clear(); soundSubfilesList.Items.Clear(); otherSubfilesList.Items.Clear(); adjustSubfileListsEnabled(false); List <ListViewItem> remFiles = new List <ListViewItem>(Editor.Parser.Subfiles.Count); List <ListViewItem> reaFiles = new List <ListViewItem>(Editor.Parser.Subfiles.Count); List <ListViewItem> imageFiles = new List <ListViewItem>(Editor.Parser.Subfiles.Count); List <ListViewItem> soundFiles = new List <ListViewItem>(Editor.Parser.Subfiles.Count); List <ListViewItem> otherFiles = new List <ListViewItem>(Editor.Parser.Subfiles.Count); for (int i = 0; i < Editor.Parser.Subfiles.Count; i++) { IWriteFile subfile = Editor.Parser.Subfiles[i]; ListViewItem item = new ListViewItem(subfile.Name); item.Tag = subfile; string ext = Path.GetExtension(subfile.Name).ToUpper(); if (ext.Equals(".REM")) { remFiles.Add(item); } else if (ext.Equals(".REA")) { reaFiles.Add(item); } else if (Utility.ImageSupported(ext)) { imageFiles.Add(item); } else if (ext.Equals(".WAV") || ext.Equals(".OGG")) { soundFiles.Add(item); } else { otherFiles.Add(item); } } remSubfilesList.Items.AddRange(remFiles.ToArray()); reaSubfilesList.Items.AddRange(reaFiles.ToArray()); OptionalTab(imageSubfilesList, imageFiles, tabPageImageSubfiles, 2); OptionalTab(soundSubfilesList, soundFiles, tabPageSoundSubfiles, 3); otherSubfilesList.Items.AddRange(otherFiles.ToArray()); adjustSubfileLists(); adjustSubfileListsEnabled(true); if (soundSubfilesList.Items.Count > 0 && soundLib == null) { soundLib = new Utility.SoundLib(); } }
private void InitSubfileLists(bool opening) { adjustSubfileListsEnabled(false); int[] selectedXX = new int[xxSubfilesList.SelectedIndices.Count]; xxSubfilesList.SelectedIndices.CopyTo(selectedXX, 0); xxSubfilesList.Items.Clear(); int[] selectedXA = new int[xaSubfilesList.SelectedIndices.Count]; xaSubfilesList.SelectedIndices.CopyTo(selectedXA, 0); xaSubfilesList.Items.Clear(); int[] selectedImg = new int[imageSubfilesList.SelectedIndices.Count]; imageSubfilesList.SelectedIndices.CopyTo(selectedImg, 0); imageSubfilesList.Items.Clear(); int[] selectedSnd = new int[soundSubfilesList.SelectedIndices.Count]; soundSubfilesList.SelectedIndices.CopyTo(selectedSnd, 0); soundSubfilesList.Items.Clear(); int[] selectedOther = new int[otherSubfilesList.SelectedIndices.Count]; otherSubfilesList.SelectedIndices.CopyTo(selectedOther, 0); otherSubfilesList.Items.Clear(); List<ListViewItem> xxFiles = new List<ListViewItem>(Editor.Parser.Subfiles.Count); List<ListViewItem> xaFiles = new List<ListViewItem>(Editor.Parser.Subfiles.Count); List<ListViewItem> imageFiles = new List<ListViewItem>(Editor.Parser.Subfiles.Count); List<ListViewItem> soundFiles = new List<ListViewItem>(Editor.Parser.Subfiles.Count); List<ListViewItem> otherFiles = new List<ListViewItem>(Editor.Parser.Subfiles.Count); Font bold = new Font(xxSubfilesList.Font, FontStyle.Bold); for (int i = 0; i < Editor.Parser.Subfiles.Count; i++) { IWriteFile subfile = Editor.Parser.Subfiles[i]; ListViewItem item = new ListViewItem(subfile.Name); item.Tag = subfile; if (!(subfile is ppSubfile)) { item.Font = new Font(xxSubfilesList.Font, subfile is ppSwapfile || subfile is RawFile ? FontStyle.Italic : FontStyle.Bold); } int itemWidth = (int)Math.Ceiling(Graphics.FromHwnd(Handle).MeasureString(item.Text, bold).Width) + 16; string ext = Path.GetExtension(subfile.Name).ToLower(); if (ext.Equals(".xx")) { xxFiles.Add(item); if (itemWidth > xxSubfilesListHeader.Width) { xxSubfilesListHeader.Width = itemWidth; } } else if (ext.Equals(".xa")) { xaFiles.Add(item); if (itemWidth > xaSubfilesListHeader.Width) { xaSubfilesListHeader.Width = itemWidth; } } else if (ext.Equals(".ema") || Utility.ImageSupported(ext)) { imageFiles.Add(item); if (itemWidth > imageSubfilesListHeader.Width) { imageSubfilesListHeader.Width = itemWidth; } } else if (ext.Equals(".ogg") || ext.Equals(".wav")) { soundFiles.Add(item); if (itemWidth > soundSubfilesListHeader.Width) { soundSubfilesListHeader.Width = itemWidth; } } else { List<ExternalTool> toolList; if (!ext.EndsWith(".lst") && !ppEditor.ExternalTools.TryGetValue(ext.ToUpper(), out toolList)) { item.BackColor = Color.LightCoral; } otherFiles.Add(item); if (itemWidth > otherSubfilesListHeader.Width) { otherSubfilesListHeader.Width = itemWidth; } } } xxSubfilesList.Items.AddRange(xxFiles.ToArray()); xaSubfilesList.Items.AddRange(xaFiles.ToArray()); imageSubfilesList.Items.AddRange(imageFiles.ToArray()); soundSubfilesList.Items.AddRange(soundFiles.ToArray()); otherSubfilesList.Items.AddRange(otherFiles.ToArray()); adjustSubfileListsEnabled(true); adjustSubfileLists(opening); ReselectItems(xxSubfilesList, selectedXX); ReselectItems(xaSubfilesList, selectedXA); ReselectItems(imageSubfilesList, selectedImg); ReselectItems(soundSubfilesList, selectedSnd); ReselectItems(otherSubfilesList, selectedOther); if (soundSubfilesList.Items.Count > 0 && soundLib == null) { soundLib = new Utility.SoundLib(); } }
private void InitSubfileLists() { remSubfilesList.Items.Clear(); reaSubfilesList.Items.Clear(); imageSubfilesList.Items.Clear(); soundSubfilesList.Items.Clear(); otherSubfilesList.Items.Clear(); adjustSubfileListsEnabled(false); List<ListViewItem> remFiles = new List<ListViewItem>(Editor.Parser.Subfiles.Count); List<ListViewItem> reaFiles = new List<ListViewItem>(Editor.Parser.Subfiles.Count); List<ListViewItem> imageFiles = new List<ListViewItem>(Editor.Parser.Subfiles.Count); List<ListViewItem> soundFiles = new List<ListViewItem>(Editor.Parser.Subfiles.Count); List<ListViewItem> otherFiles = new List<ListViewItem>(Editor.Parser.Subfiles.Count); for (int i = 0; i < Editor.Parser.Subfiles.Count; i++) { IWriteFile subfile = Editor.Parser.Subfiles[i]; ListViewItem item = new ListViewItem(subfile.Name); item.Tag = subfile; string ext = Path.GetExtension(subfile.Name).ToUpper(); if (ext.Equals(".REM")) { remFiles.Add(item); } else if (ext.Equals(".REA")) { reaFiles.Add(item); } else if (Utility.ImageSupported(ext)) { imageFiles.Add(item); } else if (ext.Equals(".WAV") || ext.Equals(".OGG")) { soundFiles.Add(item); } else { otherFiles.Add(item); } } remSubfilesList.Items.AddRange(remFiles.ToArray()); reaSubfilesList.Items.AddRange(reaFiles.ToArray()); OptionalTab(imageSubfilesList, imageFiles, tabPageImageSubfiles, 2); OptionalTab(soundSubfilesList, soundFiles, tabPageSoundSubfiles, 3); otherSubfilesList.Items.AddRange(otherFiles.ToArray()); adjustSubfileLists(); adjustSubfileListsEnabled(true); if (soundSubfilesList.Items.Count > 0 && soundLib == null) { soundLib = new Utility.SoundLib(); } }
private void InitSubfileLists() { xxSubfilesList.Items.Clear(); xaSubfilesList.Items.Clear(); imageSubfilesList.Items.Clear(); soundSubfilesList.Items.Clear(); otherSubfilesList.Items.Clear(); adjustSubfileListsEnabled(false); List<ListViewItem> xxFiles = new List<ListViewItem>(Editor.Parser.Subfiles.Count); List<ListViewItem> xaFiles = new List<ListViewItem>(Editor.Parser.Subfiles.Count); List<ListViewItem> imageFiles = new List<ListViewItem>(Editor.Parser.Subfiles.Count); List<ListViewItem> soundFiles = new List<ListViewItem>(Editor.Parser.Subfiles.Count); List<ListViewItem> otherFiles = new List<ListViewItem>(Editor.Parser.Subfiles.Count); for (int i = 0; i < Editor.Parser.Subfiles.Count; i++) { IWriteFile subfile = Editor.Parser.Subfiles[i]; ListViewItem item = new ListViewItem(subfile.Name); item.Tag = subfile; string ext = Path.GetExtension(subfile.Name).ToLower(); if (ext.Equals(".xx")) { xxFiles.Add(item); } else if (ext.Equals(".xa")) { xaFiles.Add(item); } else if (ext.Equals(".ema") || Utility.ImageSupported(ext)) { imageFiles.Add(item); } else if (ext.Equals(".ogg") || ext.Equals(".wav")) { soundFiles.Add(item); } else { otherFiles.Add(item); } } xxSubfilesList.Items.AddRange(xxFiles.ToArray()); xaSubfilesList.Items.AddRange(xaFiles.ToArray()); imageSubfilesList.Items.AddRange(imageFiles.ToArray()); soundSubfilesList.Items.AddRange(soundFiles.ToArray()); otherSubfilesList.Items.AddRange(otherFiles.ToArray()); adjustSubfileLists(); adjustSubfileListsEnabled(true); if (soundSubfilesList.Items.Count > 0 && soundLib == null) { soundLib = new Utility.SoundLib(); } }
public void InitSubfileLists(bool opening) { adjustSubfileListsEnabled(false); int[] selectedAnimators = new int[animatorsList.SelectedIndices.Count]; animatorsList.SelectedIndices.CopyTo(selectedAnimators, 0); animatorsList.Items.Clear(); int[] selectedMaterials = new int[materialsList.SelectedIndices.Count]; materialsList.SelectedIndices.CopyTo(selectedMaterials, 0); materialsList.Items.Clear(); int[] selectedImg = new int[imagesList.SelectedIndices.Count]; imagesList.SelectedIndices.CopyTo(selectedImg, 0); imagesList.Items.Clear(); int[] selectedSounds = new int[soundsList.SelectedIndices.Count]; soundsList.SelectedIndices.CopyTo(selectedSounds, 0); soundsList.Items.Clear(); int[] selectedOthers = new int[othersList.SelectedIndices.Count]; othersList.SelectedIndices.CopyTo(selectedOthers, 0); othersList.Items.Clear(); if (!filterIncludedAssetsToolStripMenuItem.Checked) { filteredList.Items.Clear(); } List<ListViewItem> animators = new List<ListViewItem>(Editor.Parser.Cabinet.Components.Count); List<ListViewItem> materials = new List<ListViewItem>(Editor.Parser.Cabinet.Components.Count); List<ListViewItem> images = new List<ListViewItem>(Editor.Parser.Cabinet.Components.Count); List<ListViewItem> sounds = new List<ListViewItem>(Editor.Parser.Cabinet.Components.Count); List<ListViewItem> others = new List<ListViewItem>(Editor.Parser.Cabinet.Components.Count); List<ListViewItem> filtered = new List<ListViewItem>(Editor.Parser.Cabinet.Components.Count); Font bold = new Font(animatorsList.Font, FontStyle.Bold); string[] assetNames = (string[])Gui.Scripting.RunScript(EditorVar + ".GetAssetNames(filter=" + filterIncludedAssetsToolStripMenuItem.Checked + ")"); for (int i = 0; i < Editor.Parser.Cabinet.Components.Count; i++) { Component subfile = Editor.Parser.Cabinet.Components[i]; if (filterIncludedAssetsToolStripMenuItem.Checked) { switch (subfile.classID1) { case UnityClassID.AudioSource: case UnityClassID.AudioListener: case UnityClassID.Avatar: case UnityClassID.Camera: case UnityClassID.CapsuleCollider: case UnityClassID.FlareLayer: case UnityClassID.LinkToGameObject: case UnityClassID.LinkToGameObject223: case UnityClassID.LinkToGameObject225: case UnityClassID.Mesh: case UnityClassID.MeshCollider: case UnityClassID.MeshFilter: case UnityClassID.MeshRenderer: case UnityClassID.MultiLink: case UnityClassID.Projector: case UnityClassID.Rigidbody: case UnityClassID.SkinnedMeshRenderer: case UnityClassID.SphereCollider: case UnityClassID.SpriteRenderer: case UnityClassID.Transform: case UnityClassID.GameObject: continue; } } string text = subfile.classID2.ToString() + (subfile.classID1 != subfile.classID2 ? " " + (int)subfile.classID1 : String.Empty); ListViewItem item = new ListViewItem(new string[] { assetNames[i], text }); item.Tag = subfile; if (!(subfile is NotLoaded)) { item.Font = new Font(animatorsList.Font, FontStyle.Bold | (Editor.Marked.Contains(subfile) ? FontStyle.Underline : 0)); } else { NotLoaded asset = (NotLoaded)subfile; item.SubItems.Add(asset.size.ToString()); if (Editor.Marked.Contains(subfile)) { item.Font = new Font(animatorsList.Font, FontStyle.Underline); } } int itemWidth = (int)Math.Ceiling(Graphics.FromHwnd(Handle).MeasureString(item.Text, bold).Width) + 16; switch (subfile.classID1) { case UnityClassID.Animator: animators.Add(item); if (itemWidth > animatorsListHeader.Width) { animatorsListHeader.Width = itemWidth; } break; case UnityClassID.Material: case UnityClassID.Shader: materials.Add(item); if (itemWidth > materialsListHeaderName.Width) { materialsListHeaderName.Width = itemWidth; } break; case UnityClassID.Texture2D: case UnityClassID.Cubemap: images.Add(item); if (itemWidth > imagesListHeaderName.Width) { imagesListHeaderName.Width = itemWidth; } break; case UnityClassID.AudioClip: sounds.Add(item); if (itemWidth > soundsListHeaderName.Width) { soundsListHeaderName.Width = itemWidth; } break; case UnityClassID.AudioSource: case UnityClassID.AudioListener: case UnityClassID.Avatar: case UnityClassID.BoxCollider: case UnityClassID.Camera: case UnityClassID.CapsuleCollider: case UnityClassID.FlareLayer: case UnityClassID.LinkToGameObject: case UnityClassID.LinkToGameObject223: case UnityClassID.LinkToGameObject225: case UnityClassID.Mesh: case UnityClassID.MeshCollider: case UnityClassID.MeshFilter: case UnityClassID.MeshRenderer: case UnityClassID.MultiLink: case UnityClassID.Projector: case UnityClassID.Rigidbody: case UnityClassID.SkinnedMeshRenderer: case UnityClassID.SphereCollider: case UnityClassID.SpriteRenderer: case UnityClassID.Transform: case UnityClassID.GameObject: filtered.Add(item); break; default: if (subfile.classID1 != UnityClassID.AnimationClip && subfile.classID1 != UnityClassID.AnimatorController && subfile.classID1 != UnityClassID.AssetBundle && subfile.classID1 != UnityClassID.Cubemap && subfile.classID1 != UnityClassID.EllipsoidParticleEmitter && subfile.classID1 != UnityClassID.Light && (subfile.classID2 != UnityClassID.MonoBehaviour || Editor.Parser.Cabinet.Types.Count == 0) && subfile.classID1 != UnityClassID.MonoScript && subfile.classID1 != UnityClassID.ParticleAnimator && subfile.classID1 != UnityClassID.ParticleRenderer && subfile.classID1 != UnityClassID.ParticleSystem && subfile.classID1 != UnityClassID.ParticleSystemRenderer && subfile.classID1 != UnityClassID.Sprite && subfile.classID1 != UnityClassID.TextAsset) { item.BackColor = Color.LightCoral; } others.Add(item); if (itemWidth > othersListHeaderNamePathID.Width) { othersListHeaderNamePathID.Width = itemWidth; } break; } } foreach (Animator anim in Editor.VirtualAnimators) { string name = anim.m_GameObject.asset is NotLoaded ? ((NotLoaded)anim.m_GameObject.asset).Name : anim.m_GameObject.instance.m_Name; FontStyle marked = Editor.Marked.Contains(anim.m_GameObject.asset) ? FontStyle.Underline : 0; ListViewItem item = new ListViewItem(new string[] { name, anim.classID2.ToString() }); item.Tag = anim; if (!(anim.m_GameObject.asset is NotLoaded)) { item.Font = new Font(animatorsList.Font, FontStyle.Bold | marked); } else { NotLoaded asset = (NotLoaded)anim.m_GameObject.asset; item.SubItems.Add(asset.size.ToString()); if (marked != 0) { item.Font = new Font(animatorsList.Font, marked); } } item.ForeColor = Color.Purple; int itemWidth = (int)Math.Ceiling(Graphics.FromHwnd(Handle).MeasureString(item.Text, bold).Width) + 16; animators.Add(item); if (itemWidth > animatorsListHeader.Width) { animatorsListHeader.Width = itemWidth; } } animatorsList.Items.AddRange(animators.ToArray()); materialsList.Items.AddRange(materials.ToArray()); imagesList.Items.AddRange(images.ToArray()); soundsList.Items.AddRange(sounds.ToArray()); othersList.Items.AddRange(others.ToArray()); if (!filterIncludedAssetsToolStripMenuItem.Checked) { filteredList.Items.AddRange(filtered.ToArray()); } filteredList.ListViewItemSorter = listViewItemComparer; adjustSubfileListsEnabled(true); adjustSubfileLists(opening); ReselectItems(animatorsList, selectedAnimators); ReselectItems(materialsList, selectedMaterials); ReselectItems(imagesList, selectedImg); ReselectItems(soundsList, selectedSounds); ReselectItems(othersList, selectedOthers); if (soundsList.Items.Count > 0 && soundLib == null) { soundLib = new Utility.SoundLib(); } }