Merge pull request #22 from devZoGok/imp-21-child-node-trans

wrting and reading child node transforms
This commit is contained in:
devZoGok
2023-12-07 18:52:26 +00:00
committed by GitHub
2 changed files with 19 additions and 2 deletions
+13
View File
@@ -151,6 +151,19 @@ def export(node, parentTag):
nodeTag = ET.SubElement(parentTag, 'node')
nodeTag.set('name', node.name)
nodeTag.set('px', str(node.location[0]))
nodeTag.set('py', str(node.location[2]))
nodeTag.set('pz', str(-node.location[1]))
nodeTag.set('rw', str(node.rotation_quaternion[0]))
nodeTag.set('rx', str(node.rotation_quaternion[1]))
nodeTag.set('ry', str(node.rotation_quaternion[2]))
nodeTag.set('rz', str(node.rotation_quaternion[3]))
nodeTag.set('sx', str(node.scale[0]))
nodeTag.set('sy', str(node.scale[1]))
nodeTag.set('sz', str(node.scale[2]))
if node.type == 'MESH':
mesh = node.data
numFaces = len(mesh.polygons)
+6 -2
View File
@@ -276,8 +276,12 @@ namespace vb01{
((Bone*)node)->setIkChainLength(ikChainLength);
}
}
else
node = new Node(Vector3::VEC_ZERO, Quaternion::QUAT_W, Vector3::VEC_IJK, name);
else{
Vector3 pos = Vector3(atof(xmlEl->Attribute("px")), atof(xmlEl->Attribute("py")), atof(xmlEl->Attribute("pz")));
Quaternion rot = Quaternion(atof(xmlEl->Attribute("rw")), atof(xmlEl->Attribute("rx")), atof(xmlEl->Attribute("ry")), atof(xmlEl->Attribute("rz")));
Vector3 scale = Vector3(atof(xmlEl->Attribute("sx")), atof(xmlEl->Attribute("sy")), atof(xmlEl->Attribute("sz")));
node = new Node(pos, rot, scale, name);
}
XMLElement *skeletonTag = xmlEl->FirstChildElement("skeleton");