def mockData(): xpsHeader = buildHeader() bones = buildBones() meshes = buildMeshes() xpsData = xps_types.XpsData(xpsHeader, bones, meshes) return xpsData
def xpsExport(): global rootDir global xpsData print("------------------------------------------------------------") print("---------------EXECUTING XPS PYTHON EXPORTER----------------") print("------------------------------------------------------------") print("Exporting file: ", xpsSettings.filename) if xpsSettings.exportOnlySelected: exportObjects = bpy.context.selected_objects else: exportObjects = bpy.context.visible_objects selectedArmature, selectedMeshes = exportSelected(exportObjects) xpsBones = exportArmature(selectedArmature) xpsMeshes = exportMeshes(selectedArmature, selectedMeshes, xpsSettings.modProtected) poseString = '' if (xpsSettings.expDefPose): xpsPoseData = export_xnalara_pose.xpsPoseData(selectedArmature) poseString = write_ascii_xps.writePose(xpsPoseData).read() header = mock_xps_data.buildHeader(poseString) xpsData = xps_types.XpsData(header=header, bones=xpsBones, meshes=xpsMeshes) saveXpsFile(xpsSettings.filename, xpsData)
def readXpsModel(filename): ioStream = readIoStream(filename) # print('Reading Header') # xpsHeader = readHeader(ioStream) print('Reading Bones') bones = readBones(ioStream) hasBones = bool(bones) print('Reading Meshes') meshes = readMeshes(ioStream, hasBones) xpsModelData = xps_types.XpsData(bones=bones, meshes=meshes) return xpsModelData
def readXpsModel(filename): print('File:', filename) ioStream = readIoStream(filename) print('Reading Header') xpsHeader = findHeader(ioStream) print('Reading Bones') bones = readBones(ioStream) hasBones = bool(bones) print('Read', len(bones), 'Bones') print('Reading Meshes') meshes = readMeshes(ioStream, xpsHeader, hasBones) print('Read', len(meshes), 'Meshes') xpsData = xps_types.XpsData(xpsHeader, bones, meshes) return xpsData