Add wings, rudders & rotors, temporary text block support

This commit is contained in:
Norbi Peti 2020-09-27 02:42:27 +02:00
parent 30a3f5001f
commit a0ab2ec9e7
5 changed files with 50 additions and 7 deletions

View file

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

View file

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

View file

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

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long