public StructureVoxelModel(MyObjectBuilder_EntityBase entityBase, string voxelPath)
: base(entityBase)
{
var contentPath = ToolboxUpdater.GetApplicationContentPath();
if (voxelPath != null)
{
VoxelFilepath = Path.Combine(voxelPath, Name + MyVoxelMap.V2FileExtension);
var previewFile = VoxelFilepath;
if (!File.Exists(VoxelFilepath))
{
var oldFilepath = Path.Combine(voxelPath, Name + MyVoxelMap.V1FileExtension);
if (File.Exists(oldFilepath))
{
SourceVoxelFilepath = oldFilepath;
previewFile = oldFilepath;
SpaceEngineersCore.ManageDeleteVoxelList.Add(oldFilepath);
}
}
ReadVoxelDetails(previewFile);
}
var materialList = new Dictionary<string, string>();
foreach (MyVoxelMaterialDefinition item in SpaceEngineersCore.Resources.VoxelMaterialDefinitions.OrderBy(m => m.Id.SubtypeName))
{
string texture = item.GetVoxelDisplayTexture();
materialList.Add(item.Id.SubtypeName, texture == null ? null : SpaceEngineersCore.GetDataPathOrDefault(texture, Path.Combine(contentPath, texture)));
}
GameMaterialList = new List<VoxelMaterialAssetModel>(materialList.Select(m => new VoxelMaterialAssetModel { MaterialName = m.Key, DisplayName = m.Key, TextureFile = m.Value }));
EditMaterialList = new List<VoxelMaterialAssetModel> { new VoxelMaterialAssetModel { MaterialName = null, DisplayName = "Delete/Remove" } };
EditMaterialList.AddRange(materialList.Select(m => new VoxelMaterialAssetModel { MaterialName = m.Key, DisplayName = m.Key, TextureFile = m.Value }));
}