def processXMLElement(xmlElement, xmlProcessor): "Process the xml element." target = evaluate.getXMLElementByKey('target', xmlElement) if target == None: print('Warning, array could not get target for:') print(xmlElement) return vertices = getVerticesByKey('vertices', xmlElement) if len(vertices) == 0: print('Warning, array could not get vertices for:') print(xmlElement) return arrayDictionary = xmlElement.attributeDictionary.copy() targetMatrix4X4Copy = matrix4x4.Matrix4X4().getFromXMLElement(target) matrix4x4.setAttributeDictionaryToMatrix(target.attributeDictionary, targetMatrix4X4Copy) xmlElement.className = 'group' for vector3Index in xrange(len(vertices)): vector3 = vertices[vector3Index] vector3Matrix4X4 = matrix4x4.Matrix4X4( targetMatrix4X4Copy.matrixTetragrid) lastChild = target.getCopy(xmlElement.getIDSuffix(vector3Index), xmlElement) euclidean.overwriteDictionary(xmlElement.attributeDictionary, ['id'], ['visible'], lastChild.attributeDictionary) vertexElement = vertex.getUnboundVertexElement(vector3) matrix4x4.setXMLElementDictionaryToOtherElementDictionary( vertexElement, vector3Matrix4X4, lastChild) xmlProcessor.processXMLElement(xmlElement)
def processShape( archivableClass, xmlElement, xmlProcessor ): "Get any new elements and process the shape." if xmlElement == None: return archivableObject = evaluate.getArchivableObject( archivableClass, xmlElement ) matrix4x4.setXMLElementDictionaryToOtherElementDictionary( xmlElement, xmlElement.object.matrix4X4, xmlElement ) xmlProcessor.processChildren( xmlElement )
def processShape(archivableClass, xmlElement, xmlProcessor): "Get any new elements and process the shape." if xmlElement == None: return archivableObject = evaluate.getArchivableObject(archivableClass, xmlElement) matrix4x4.setXMLElementDictionaryToOtherElementDictionary( xmlElement, xmlElement.object.matrix4X4, xmlElement) xmlProcessor.processChildren(xmlElement)
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' ) matrix4x4.setXMLElementDictionaryToOtherElementDictionary( transformXMLElement, object.object.matrix4X4, object ) return archivableObject
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') matrix4x4.setXMLElementDictionaryToOtherElementDictionary( transformXMLElement, object.object.matrix4X4, object) return archivableObject
def processXMLElement( xmlElement, xmlProcessor ): "Process the xml element." target = evaluate.getXMLElementByKey( 'target', xmlElement ) if target == None: print( 'Warning, translate could not get target.' ) return translateDictionary = xmlElement.attributeDictionary.copy() targetMatrix4X4Copy = matrix4x4.Matrix4X4().getFromXMLElement( target ) xmlElement.attributeDictionary = target.attributeDictionary.copy() matrix4x4.setAttributeDictionaryToMatrix( target.attributeDictionary, targetMatrix4X4Copy ) euclidean.overwriteDictionary( translateDictionary, [], [ 'visible' ], xmlElement.attributeDictionary ) xmlElement.className = target.className matrix4x4.setXMLElementDictionaryToOtherElementDictionary( xmlElement, targetMatrix4X4Copy, xmlElement ) target.copyXMLChildren( xmlElement.getIDSuffix(), xmlElement ) xmlProcessor.processXMLElement( xmlElement )
def processXMLElement(xmlElement, xmlProcessor): "Process the xml element." target = evaluate.getXMLElementByKey('target', xmlElement) if target == None: print('Warning, translate could not get target.') return translateDictionary = xmlElement.attributeDictionary.copy() targetMatrix4X4Copy = matrix4x4.Matrix4X4().getFromXMLElement(target) xmlElement.attributeDictionary = target.attributeDictionary.copy() matrix4x4.setAttributeDictionaryToMatrix(target.attributeDictionary, targetMatrix4X4Copy) euclidean.overwriteDictionary(translateDictionary, [], ['visible'], xmlElement.attributeDictionary) xmlElement.className = target.className matrix4x4.setXMLElementDictionaryToOtherElementDictionary( xmlElement, targetMatrix4X4Copy, xmlElement) target.copyXMLChildren(xmlElement.getIDSuffix(), xmlElement) xmlProcessor.processXMLElement(xmlElement)
def processXMLElement( xmlElement, xmlProcessor ): "Process the xml element." target = evaluate.getXMLElementByKey( 'target', xmlElement ) if target == None: print( 'Warning, array could not get target for:' ) print( xmlElement ) return vertices = getVerticesByKey( 'vertices', xmlElement ) if len( vertices ) == 0: print( 'Warning, array could not get vertices for:' ) print( xmlElement ) return arrayDictionary = xmlElement.attributeDictionary.copy() targetMatrix4X4Copy = matrix4x4.Matrix4X4().getFromXMLElement( target ) matrix4x4.setAttributeDictionaryToMatrix( target.attributeDictionary, targetMatrix4X4Copy ) xmlElement.className = 'group' for vector3Index in xrange( len( vertices ) ): vector3 = vertices[ vector3Index ] vector3Matrix4X4 = matrix4x4.Matrix4X4( targetMatrix4X4Copy.matrixTetragrid ) lastChild = target.getCopy( xmlElement.getIDSuffix( vector3Index ), xmlElement ) euclidean.overwriteDictionary( xmlElement.attributeDictionary, [ 'id' ], [ 'visible' ], lastChild.attributeDictionary ) vertexElement = vertex.getUnboundVertexElement( vector3 ) matrix4x4.setXMLElementDictionaryToOtherElementDictionary( vertexElement, vector3Matrix4X4, lastChild ) xmlProcessor.processXMLElement( xmlElement )