Esempio n. 1
0
def convertXMLElement(geometryOutput, xmlElement):
	'Convert the xml element to a TriangleMesh xml element.'
	xmlElement.linkObject(TriangleMesh())
	matrix.setXMLElementDictionaryToOtherElementDictionary(xmlElement, xmlElement.object.matrix4X4, 'matrix.', xmlElement)
	vertex.addGeometryList(geometryOutput['vertex'], xmlElement)
	face.addGeometryList(geometryOutput['face'], xmlElement)
	xmlElement.getXMLProcessor().processChildren(xmlElement)
Esempio n. 2
0
def processShape(archivableClass, xmlElement):
	"Get any new elements and process the shape."
	if xmlElement == None:
		return
	evaluate.getArchivableObjectAddToParent(archivableClass, xmlElement)
	matrix.setXMLElementDictionaryToOtherElementDictionary(xmlElement, xmlElement.object.matrix4X4, 'matrix.', xmlElement)
	xmlElement.getXMLProcessor().processChildren(xmlElement)
Esempio n. 3
0
def getCarvableObject(globalObject, object, xmlElement):
	"Get new carvable object info."
	archivableObject = globalObject()
	archivableObject.xmlElement = object
	object.attributeDictionary['id'] = xmlElement.getFirstChildWithClassName('name').text
	object.object = archivableObject
	coords = xmlElement.getFirstChildWithClassName('coords')
	transformXMLElement = getTransformXMLElement(coords, 'transformFrom')
	if len(transformXMLElement.attributeDictionary) < 16:
		transformXMLElement = getTransformXMLElement(coords, 'transformTo')
	matrix.setXMLElementDictionaryToOtherElementDictionary( transformXMLElement, object.object.matrix4X4, '', object )
	return archivableObject
Esempio n. 4
0
def getCarvableObject(globalObject, object, xmlElement):
    "Get new carvable object info."
    archivableObject = globalObject()
    archivableObject.xmlElement = object
    object.attributeDictionary['id'] = xmlElement.getFirstChildWithClassName(
        'name').text
    object.object = archivableObject
    coords = xmlElement.getFirstChildWithClassName('coords')
    transformXMLElement = getTransformXMLElement(coords, 'transformFrom')
    if len(transformXMLElement.attributeDictionary) < 16:
        transformXMLElement = getTransformXMLElement(coords, 'transformTo')
    matrix.setXMLElementDictionaryToOtherElementDictionary(
        transformXMLElement, object.object.matrix4X4, '', object)
    return archivableObject
Esempio n. 5
0
def processXMLElement(xmlElement):
	"Process the xml element."
	target = evaluate.getXMLElementByKey('target', xmlElement)
	if target == None:
		print('Warning, array could not get target for:')
		print(xmlElement)
		return
	vertexes = getVertexesByKey('vertexes', xmlElement)
	if len(vertexes) == 0:
		print('Warning, array could not get vertexes for:')
		print(xmlElement)
		return
	arrayDictionary = xmlElement.attributeDictionary.copy()
	targetMatrixCopy = matrix.getFromObjectOrXMLElement(target)
	matrix.setAttributeDictionaryToMatrix(target.attributeDictionary, targetMatrixCopy)
	xmlElement.className = 'group'
	for vector3Index in xrange(len(vertexes)):
		vector3 = vertexes[vector3Index]
		vector3Matrix = matrix.Matrix(targetMatrixCopy.tetragrid)
		lastChild = target.getCopy(xmlElement.getIDSuffix(vector3Index), xmlElement)
		euclidean.overwriteDictionary(xmlElement.attributeDictionary, ['id'], ['visible'], lastChild.attributeDictionary)
		vertexElement = vertex.getUnboundVertexElement(vector3)
		matrix.setXMLElementDictionaryToOtherElementDictionary(vertexElement, vector3Matrix, 'matrix.', lastChild)
	xmlElement.getXMLProcessor().processXMLElement(xmlElement)
Esempio n. 6
0
def convertContainerXMLElement(geometryOutput, object, xmlElement):
	"Convert the xml element to a group xml element."
	xmlElement.linkObject(object)
	matrix.setXMLElementDictionaryToOtherElementDictionary(xmlElement, xmlElement.object.matrix4X4, 'matrix.', xmlElement)
	xmlElement.getXMLProcessor().createChildren(geometryOutput['shapes'], xmlElement)