Example #1
0
def fileRefs_testWrite(fileName):
    """Does a read write test on cells."""
    init(3)
    fileRefs = mosh.FileRefs(mosh.saveInfos[fileName])
    fileRefs.refresh()
    for cell in fileRefs.cells:
        cellId = cell.getId()
        oldData = cell.data
        cell.changed = True
        cell.getSize()
        if cell.data != oldData: print cellId, 'BAD'
        else: pass
Example #2
0
def refInfo(fileName, forMods=-1, forCellId=None):
    """Prints reference info for specified file."""
    init(3)
    forMods = int(forMods)
    fileInfo = mosh.modInfos.data.get(fileName) or mosh.saveInfos.data.get(
        fileName)
    if not fileInfo: raise 'No such file: ' + fileName
    masters = fileInfo.tes3.masters
    fileRefs = mosh.FileRefs(fileInfo, True)
    fileRefs.refresh()
    for cell in sorted(fileRefs.cells, cmp=lambda a, b: a.cmpId(b)):
        if forCellId and forCellId != cell.getId(): continue
        printCell = cell.getId()
        objects = cell.getObjects().list()
        objects.sort(key=lambda a: a[1])
        for object in objects:
            if forMods != -1 and forMods != object[0]: continue
            if printCell:
                print printCell
                printCell = False
            master = object[0] and masters[object[0] - 1][0]
            print ' ', object[:3], master