def getBranchMatrix(elementNode):
 branchMatrix = Matrix()
 matrixChildElement = elementNode.getFirstChildByLocalName('matrix')
 if (matrixChildElement != None):
  branchMatrix = branchMatrix.getFromElementNode(matrixChildElement, '')
 branchMatrix = branchMatrix.getFromElementNode(elementNode, 'matrix.')
 if (elementNode.xmlObject == None):
  return branchMatrix
 elementNodeMatrix = elementNode.xmlObject.getMatrix4X4()
 if (elementNodeMatrix == None):
  return branchMatrix
 return elementNodeMatrix.getOtherTimesSelf(branchMatrix.tetragrid)

def getBranchMatrix ( elementNode ) : branchMatrix = Matrix ( ) matrixChildElement = elementNode . getFirstChildByLocalName ( 'matrix' ) if ( matrixChildElement != None ) : branchMatrix = branchMatrix . getFromElementNode ( matrixChildElement , '' ) branchMatrix = branchMatrix . getFromElementNode ( elementNode , 'matrix.' ) if ( elementNode . xmlObject == None ) : return branchMatrix elementNodeMatrix = elementNode . xmlObject . getMatrix4X4 ( ) if ( elementNodeMatrix == None ) : return branchMatrix return elementNodeMatrix . getOtherTimesSelf ( branchMatrix . tetragrid )
get matrix starting from the object if it exists .