Exemplo n.º 1
0
def export(blender_scene):
    # Export the scene (with silenced pyluxcore)
    pyluxcore.SetLogHandler(luxcore_logger)
    blender_scene.luxcore.active_layer_index = 0
    exporter = Exporter(blender_scene)
    session = exporter.create_session()

    config = session.GetRenderConfig()
    luxcore_scene = config.GetScene()
    scene_props = luxcore_scene.ToProperties()
    return scene_props
Exemplo n.º 2
0
    def test_user_abort(self):
        start = time()

        with open("./full_export/log.txt", "w") as log:
            with redirect_stdout(log):
                pyluxcore.SetLogHandler(luxcore_logger)
                # Test user aborting the export process
                _exporter = export.Exporter(bpy.context.scene)
                engine = RenderEngineMockup(abort_immediately=True)
                _session = _exporter.create_session(context=None,
                                                    engine=engine)

        print("test_user_abort(): Export took %.1f s" % (time() - start))

        self.assertIsNone(_session)
Exemplo n.º 3
0
    def test_final_export(self):
        start = time()

        with open("./full_export/log.txt", "w") as log:
            with redirect_stdout(log):
                pyluxcore.SetLogHandler(luxcore_logger)
                # Test final render export from the engine's point of view
                scene = bpy.context.scene
                scene.luxcore.active_layer_index = 0
                _exporter = export.Exporter(scene)
                engine = RenderEngineMockup()
                _session = _exporter.create_session(context=None,
                                                    engine=engine)

        print("test_final_export(): Export took %.1f s" % (time() - start))

        # TODO: We could check a lot more here
        self.assertIsNotNone(_session)
Exemplo n.º 4
0
        props = config.convert(exporter, scene)
        check_resolution(self, props, 30, 10)

    def test_different_resolution(self):
        scene = bpy.context.scene

        backup_x = scene.render.resolution_x
        backup_y = scene.render.resolution_y

        scene.render.resolution_x = 543
        scene.render.resolution_y = 789
        scene.render.use_crop_to_border = False

        scene.luxcore.active_layer_index = 0
        exporter = Exporter(scene)
        props = config.convert(exporter, scene)

        # Restore original resolution
        scene.render.resolution_x = backup_x
        scene.render.resolution_y = backup_y

        check_resolution(self, props, 163, 79)


# we have to manually invoke the test runner here, as we cannot use the CLI
suite = unittest.defaultTestLoader.loadTestsFromTestCase(TestBorder)
result = unittest.TextTestRunner().run(suite)

pyluxcore.SetLogHandler(None)
sys.exit(not result.wasSuccessful())