File importer now supports shapes, camera pan is now locked to 45 degree increments

this was a massive pain in the ass :)
This commit is contained in:
DirtPiper
2019-11-10 22:59:08 -05:00
parent 1f4147fd90
commit 98f4246f17
4 changed files with 61 additions and 5 deletions

View File

@@ -257,6 +257,7 @@ bool DataModelInstance::scanXMLObject(xml_node<> * scanNode)
xml_node<> *propNode = node->first_node();
xml_node<> *cFrameNode=0;
xml_node<> *sizeNode=0;
xml_node<> *shapeNode=0;
xml_node<> *colorNode=0;
xml_node<> *brickColorNode=0;
xml_node<> *nameNode=0;
@@ -276,6 +277,11 @@ bool DataModelInstance::scanXMLObject(xml_node<> * scanNode)
{
nameNode = partPropNode;
}
if (xmlValue=="shape")
{
shapeNode = partPropNode;
_legacyLoad=false;
}
if (xmlValue=="Color")
{
colorNode=partPropNode;
@@ -297,11 +303,16 @@ bool DataModelInstance::scanXMLObject(xml_node<> * scanNode)
{
std::string xmlName = attr->name();
std::string xmlValue = attr->value();
if (xmlValue=="shape")
{
shapeNode = featureNode;
_legacyLoad=true;
}
if (xmlValue=="size")
{
sizeNode=featureNode;
_legacyLoad=true;
}
}
}
}
}
@@ -328,7 +339,21 @@ bool DataModelInstance::scanXMLObject(xml_node<> * scanNode)
B = getFloatValue(colorNode,"B");
}
Enum::Shape::Value partshape = Enum::Shape::Block;
std::string pshape = shapeNode->value();
if (shapeNode)
{
if(pshape == "0" || pshape == "Ball"){
partshape = Enum::Shape::Ball;
}
if(pshape == "1" || pshape == "Block"){
partshape = Enum::Shape::Block;
}
if(pshape == "2" || pshape == "Cylinder"){
partshape = Enum::Shape::Cylinder;
}
}
std::string newName = nameNode->value();
float X = getFloatValue(cFrameNode,"X");
float Y = getFloatValue(cFrameNode,"Y");
@@ -353,6 +378,7 @@ bool DataModelInstance::scanXMLObject(xml_node<> * scanNode)
PartInstance* test = makePart();
test->setParent(getWorkspace());
test->color = Color3(R,G,B);
test->shape = partshape;
if(brickColorNode)
{
test->color = bcToRGB(atoi(brickColorNode->value()));