Fix RC glass cube and revert temp text support

This commit is contained in:
Norbi Peti 2020-09-28 02:52:51 +02:00
parent a0ab2ec9e7
commit 16f833ceda
4 changed files with 25 additions and 82 deletions

View file

@ -160,21 +160,12 @@ namespace Pixi.Common
for (int i = 0; i < optVONsArr.Length; i++)
{
ProcessedVoxelObjectNotation desc = optVONsArr[i];
Block b;
if (desc.block != BlockIDs.Invalid)
{
b = Block.PlaceNew(desc.block, desc.position, desc.rotation, desc.color.Color,
Block b = Block.PlaceNew(desc.block, desc.position, desc.rotation, desc.color.Color,
desc.color.Darkness, 1, desc.scale);
blocks[i] = b;
}
else
{
TextBlock tb = Block.PlaceNew<TextBlock>(BlockIDs.TextBlock, desc.position, desc.rotation,
desc.color.Color, desc.color.Darkness, 1, desc.scale);
tb.Text = desc.metadata;
b = tb;
}
blocks[i] = b;
}
magicImporter.PostProcess(name, ref blocks);
if (magicImporter.Optimisable && blockCountPreOptimisation > blocks.Length)

View file

@ -44,7 +44,7 @@ namespace Pixi.Common
if (origin == null) origin = origin_base;
return new BlockJsonInfo
{
name = block.Type == BlockIDs.TextBlock ? block.Label : block.Type.ToString(),
name = block.Type.ToString(),
position = new float[3] { block.Position.x - origin[0], block.Position.y - origin[1], block.Position.z - origin[2]},
rotation = new float[3] { block.Rotation.x, block.Rotation.y, block.Rotation.z },
color = ColorSpaceUtility.UnquantizeToArray(block.Color),

View file

@ -215,10 +215,10 @@ namespace Pixi.Robots
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private static void TranslateBlockId(uint cubeId, ref CubeInfo result)
{
if (map == null)
if (map == null)
{
StreamReader cubemap = new StreamReader(Assembly.GetExecutingAssembly().GetManifestResourceStream("Pixi.cubes-id.json"));
map = JsonConvert.DeserializeObject<Dictionary<uint, string>>(cubemap.ReadToEnd());
map = JsonConvert.DeserializeObject<Dictionary<uint, string>>(cubemap.ReadToEnd());
}
if (!map.ContainsKey(cubeId))
@ -231,81 +231,34 @@ namespace Pixi.Robots
#endif
}
string cubeName = map[cubeId];
string gcName = cubeName.Contains("glass") || cubeName.Contains("windshield")
? "Glass"
: "Aluminium";
if (cubeName.Contains("round"))
gcName += "Rounded";
if (cubeName.Contains("cube"))
{
result.block = BlockIDs.AluminiumCube;
result.rotation = float3.zero;
}
gcName += "Cube";
else if (cubeName.Contains("prism") || cubeName.Contains("edge"))
{
if (cubeName.Contains("round"))
{
if (cubeName.Contains("glass") || cubeName.Contains("windshield"))
{
result.block = BlockIDs.GlassRoundedSlope;
} else
result.block = BlockIDs.AluminiumRoundedSlope;
}
else
{
if (cubeName.Contains("glass") || cubeName.Contains("windshield"))
{
result.block = BlockIDs.GlassSlope;
} else
result.block = BlockIDs.AluminiumSlope;
}
}
gcName += "Slope";
else if (cubeName.Contains("inner"))
{
if (cubeName.Contains("round"))
{
if (cubeName.Contains("glass") || cubeName.Contains("windshield"))
{
result.block = BlockIDs.GlassRoundedSlicedCube;
} else
result.block = BlockIDs.AluminiumRoundedSlicedCube;
}
else
{
if (cubeName.Contains("glass") || cubeName.Contains("windshield"))
{
result.block = BlockIDs.GlassSlicedCube;
} else
result.block = BlockIDs.AluminiumSlicedCube;
}
}
gcName += "SlicedCube";
else if (cubeName.Contains("tetra") || cubeName.Contains("corner"))
{
if (cubeName.Contains("round"))
{
if (cubeName.Contains("glass") || cubeName.Contains("windshield"))
{
result.block = BlockIDs.GlassRoundedCorner;
} else
result.block = BlockIDs.AluminiumRoundedCorner;
}
else
{
if (cubeName.Contains("glass") || cubeName.Contains("windshield"))
{
result.block = BlockIDs.GlassCorner;
} else
result.block = BlockIDs.AluminiumCorner;
}
}
gcName += "Corner";
else if (cubeName.Contains("pyramid"))
{
result.block = BlockIDs.AluminiumPyramidSegment;
}
gcName += "PyramidSegment";
else if (cubeName.Contains("cone"))
{
result.block = BlockIDs.AluminiumConeSegment;
}
gcName += "ConeSegment";
else
{
result.block = BlockIDs.TextBlock;
result.name = cubeName;
return;
}
BlockIDs id = VoxelObjectNotationUtility.NameToEnum(gcName);
result.block = id;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]

View file

@ -134,11 +134,10 @@ namespace Pixi.Robots
{
Block block = blocks[c];
// the goal is for this to never evaluate to true (ie all cubes are translated correctly)
if (block.Type == BlockIDs.TextBlock &&
(string.IsNullOrEmpty(block.Label) || block.Label == "Text Block"))
if (block.Type == BlockIDs.TextBlock)
{
block.Specialise<TextBlock>().Text = textBlockInfo[name][textBlockInfoIndex];
textBlockInfoIndex++;
block.Specialise<TextBlock>().Text = textBlockInfo[name][textBlockInfoIndex];
textBlockInfoIndex++;
}
}