private void UpdateLayersList() { LayersListBox.Items.Clear(); LayersListBox.Items.AddRange(Engine.Layers.ToArray()); for (int i = 0; i < Engine.LayersCount; i++) { if (Engine.Layers[i].IsVisible) { LayersListBox.SetItemChecked(i, true); } } LayersListBox.SelectedItem = Engine.ActiveLayer; }
private void UpdateLayersView() { LayersListBox.SuspendLayout(); LayersListBox.BeginUpdate(); LayersListBox.Items.Clear(); //Early out if the worldspace project is null (ie: We just unloaded the project) if (_loadedWorldspaceProject == null) { LayersListBox.EndUpdate(); LayersListBox.ResumeLayout(); return; } WindWakerEntityData entData = _selectedEntityFile; List <EditorHelpers.EntityLayer> validLayers = new List <EditorHelpers.EntityLayer>(); foreach (var kvPair in entData.GetAllChunks()) { foreach (WindWakerEntityData.BaseChunk chunk in kvPair.Value) { if (validLayers.Contains(chunk.ChunkLayer)) { continue; } validLayers.Add(chunk.ChunkLayer); } } for (int i = validLayers.Count - 1; i >= 0; i--) { LayersListBox.Items.Add(EditorHelpers.LayerIdToString(validLayers[i])); } //Select the Default layer by uh... default. if (LayersListBox.Items.Count > 0) { LayersListBox.SetSelected(LayersListBox.Items.Count - 1, true); } LayersListBox.ResumeLayout(); LayersListBox.EndUpdate(); }