示例#1
0
def test_load_lwo_box0_pass():
    infile = "tests/basic/src/LWO2/box/box0.lwo"
    f = LwoFile(infile)
    f.check_file()

    x = lwoObject(infile)
    x.read()
    y = x.elements

    assert f.test_pickle(y)
示例#2
0
def main():
    infiles = [
        "tests/basic/src/LWO2/box/box0.lwo",
        "tests/basic/src/LWO2/box/box6-hidden.lwo",
        "tests/basic/src/LWO/box/box3-uv-layers.lwo",
        "tests/lwo_interceptor/src/LWO2/Federation - Interceptor/objects/interceptor_hull.lwo",
    ]
    infile = "tests/lwo_interceptor/src/LWO2/Federation - Interceptor/objects/interceptor_hull.lwo"
    infile = infiles[2]
    f = LwoFile(infile, create_pickle=True)
    f.check_file()

    x = lwoObject(infile, logging.DEBUG)
    x.ch.search_paths = ["../images"]
    x.absfilepath = False
    x.read()
    x.resolve_clips()
    x.validate_lwo()

    y = x.elements

    f.setup_pickle(y)

    b = f.load_pickle()

    print(y == b)
示例#3
0
def test_load_lwo_box0_fail():
    infile = "tests/basic/src/LWO2/box/box0.lwo"
    f = LwoFile(infile)
    f.check_file()

    x = lwoObject(infile)
    x.read()
    y = x.elements

    f.picklefile = "tests/basic/pickle/LWO2/box/box0.lwo.error0.pickle"

    if sys.version_info[1] <= 7:
        return
    assert not f.test_pickle(y)
示例#4
0
def main():
    #     #infile = "tests/basic/src/LWO2/box/box1-uv.lwo"

    #infile = "tests/basic/src/LWO2/box/box0.lwo"
    infile = "tests/basic/src/LWO2/box/box6-hidden.lwo"
    f = LwoFile(infile, create_pickle=True)
    f.check_file()

    x = lwoObject(infile)
    x.read()

    #x.pprint()

    f.setup_pickle(x)
    # x.pprint()

    b = f.load_pickle()

    # x.pprint()
    # b.pprint()
    print(x == b)
示例#5
0
def main():
    #     #infile = "../NASA-3D-Resources/3D Models/Aquarius (A)/Aquarius-2010-Composite.lwo"
    #     #infile = "../NASA-3D-Resources/3D Models/Atmosphere-Space Transition Region Explorer/Astre-main3.lwo"
    #     #infile = "../NASA-3D-Resources/3D Models/Aura/Aura_2013-2.lwo"
    #     infile = "../NASA-3D-Resources/3D Models/Gamma Ray Observatory - Composite/GRO-Composite.lwo"
    #     f = LwoFile(infile, create_pickle=True)
    #     f.check_file()

    infiles = glob("../NASA-3D-Resources/**/*.[Ll][Ww][Oo]", recursive=True)

    #infiles = infiles[:3]
    #print(infiles)
    #exit()
    #infiles = ["/home/gomez/project/NASA-3D-Resources/3D Models/RADARsat-Composite/RADARsat-Composite.lwo",]

    for infile in infiles:
        print(infile)
        try:
            x = lwoObject(infile, logging.DEBUG)
            x.read()
        except:
            print(infile)
            raise

        y = x.elements

        f = LwoFile(infile, create_pickle=False)
        f.check_file()
        f.setup_pickle(y)

        b = f.load_pickle()
        if b is None:
            return

        #print(y == b)
        if not y == b:
            for k in y.keys():
                if not y[k] == b[k]:
                    print(f'{k}')
示例#6
0
def main():
    infiles = [
        "tests/basic/src/LWO2/box/box0.lwo",
        "tests/basic/src/LWO2/box/box6-hidden.lwo",
        "tests/basic/src/LWO/box/box3-uv-layers.lwo",
        "tests/lwo_interceptor/src/LWO2/Federation - Interceptor/objects/interceptor_hull.lwo",
    ]
    for infile in infiles:
        f = LwoFile(infile, create_pickle=True)
        f.check_file()

        x = lwoObject(infile)
        x.search_paths = ["/../images"]
        x.absfilepath = False
        x.read()

        #print(f.picklefile)
        if os.path.isfile(f.picklefile):
            os.unlink(f.picklefile)
        f.setup_pickle(x)

        b = f.load_pickle()

        print(x == b)

    infile = "tests/basic/src/LWO2/box/box0.lwo"
    f = LwoFile(infile, create_pickle=True)
    f.check_file()

    x = lwoObject(infile)
    x.read()

    #print(f.picklefile)
    f.picklefile = re.sub(".lwo.pickle", ".lwo.error0.pickle", f.picklefile)
    #print(f.picklefile)

    x.layers[0].name = "Layer 2"
    os.unlink(f.picklefile)
    f.setup_pickle(x)

    b = f.load_pickle()