public void TestConvert(StructureCubeGridModel viewModel)
{
// Trim Horse image.
//viewModel.CubeGrid.CubeBlocks.RemoveAll(b => b.SubtypeName.EndsWith("White"));
//foreach (var block in viewModel.CubeGrid.CubeBlocks)
//{
// if (block.SubtypeName == SubtypeId.SmallBlockArmorBlock.ToString())
// {
// block.SubtypeName = SubtypeId.SmallBlockArmorBlockRed.ToString();
// }
//}
//IsModified = true;
//viewModel.CubeGrid.CubeBlocks.RemoveAll(b => b.SubtypeName == SubtypeId.SmallLight.ToString());
//var newBlocks = new List<MyObjectBuilder_CubeBlock>();
foreach (var block in viewModel.CubeGrid.CubeBlocks)
{
if (block.SubtypeName == SubtypeId.SmallBlockArmorBlock.ToString())
{
//block.SubtypeName = SubtypeId.SmallBlockArmorBlockBlack.ToString();
//var light = block as MyObjectBuilder_ReflectorLight;
//light.Intensity = 5;
//light.Radius = 5;
}
//if (block.SubtypeName == SubtypeId.LargeBlockArmorBlockBlack.ToString())
//{
// for (var i = 0; i < 3; i++)
// {
// var newBlock = new MyObjectBuilder_CubeBlock()
// {
// SubtypeName = block.SubtypeName, // SubtypeId.LargeBlockArmorBlockWhite.ToString(),
// EntityId = block.EntityId == 0 ? 0 : SpaceEngineersAPI.GenerateEntityId(),
// PersistentFlags = block.PersistentFlags,
// Min = new Vector3I(block.Min.X, block.Min.Y, block.Min.Z + 1 + i),
// Max = new Vector3I(block.Max.X, block.Max.Y, block.Max.Z + 1 + i),
// Orientation = Quaternion.CreateFromRotationMatrix(MatrixD.CreateLookAt(Vector3D.Zero, Vector3.Forward, Vector3.Up))
// };
// newBlocks.Add(newBlock);
// }
//}
//if (block.SubtypeName == SubtypeId.LargeBlockArmorBlockWhite.ToString())
//{
// var newBlock = new MyObjectBuilder_CubeBlock()
// {
// SubtypeName = block.SubtypeName, // SubtypeId.LargeBlockArmorBlockWhite.ToString(),
// EntityId = block.EntityId == 0 ? 0 : SpaceEngineersAPI.GenerateEntityId(),
// PersistentFlags = block.PersistentFlags,
// Min = new Vector3I(block.Min.X, block.Min.Y, block.Min.Z + 3),
// Max = new Vector3I(block.Max.X, block.Max.Y, block.Max.Z + 3),
// Orientation = Quaternion.CreateFromRotationMatrix(MatrixD.CreateLookAt(Vector3D.Zero, Vector3.Forward, Vector3.Up))
// };
// newBlocks.Add(newBlock);
//}
//if (block.Min.Z == 3 && block.Min.X % 2 == 1 && block.Min.Y % 2 == 1)
//{
// var newBlock = new MyObjectBuilder_InteriorLight()
// {
// SubtypeName = SubtypeId.SmallLight.ToString(),
// EntityId = SpaceEngineersAPI.GenerateEntityId(),
// PersistentFlags = MyPersistentEntityFlags2.Enabled | MyPersistentEntityFlags2.CastShadows | MyPersistentEntityFlags2.InScene,
// Min = new Vector3I(block.Min.X, block.Min.Y, 1),
// Max = new Vector3I(block.Max.X, block.Max.Y, 1),
// Orientation = new Quaternion(1, 0, 0, 0),
// Radius = 3.6f,
// Falloff = 1.3f,
// Intensity = 1.5f,
// PositionAndOrientation = new MyPositionAndOrientation()
// {
// Position = new Vector3D(),
// //Position = new Vector3D(-7.5f, -10, 27.5f),
// Forward = new Vector3(0,-1,0),
// Up = new Vector3(1,0,0)
// }
// };
// newBlocks.Add(newBlock);
//}
}
//viewModel.CubeGrid.CubeBlocks.AddRange(newBlocks);
OptimizeModel(viewModel);
}