/// <summary> /// Begins building a new model permutation in the current region. /// </summary> /// <param name="name">The name stringID.</param> /// <exception cref="System.InvalidOperationException"> /// Cannot begin a new permutation if a region is not active /// or /// Cannot begin a new permutation while another is active /// </exception> public void BeginPermutation(StringId name) { if (_currentRegion == null) { throw new InvalidOperationException("Cannot begin a new permutation if a region is not active"); } if (_currentPermutation != null) { throw new InvalidOperationException("Cannot begin a new permutation while another is active"); } _currentPermutation = new RenderModel.Region.Permutation { Name = name, MeshIndex = (short)Meshes.Count, }; }
/// <summary> /// Finishes building the current permutation. /// </summary> /// <exception cref="System.InvalidOperationException"> /// Cannot end a permutation if nothing is active /// or /// Cannot end a permutation while a mesh is still active /// or /// Cannot end a permutation if no region is active /// </exception> public void EndPermutation() { if (_currentPermutation == null) { throw new InvalidOperationException("Cannot end a permutation if nothing is active"); } if (_currentMesh != null) { throw new InvalidOperationException("Cannot end a permutation while a mesh is still active"); } if (_currentRegion == null) { throw new InvalidOperationException("Cannot end a permutation if no region is active"); } _currentRegion.Permutations.Add(_currentPermutation); _currentPermutation = null; }