Esempio n. 1
0
    def test_load_task_definition(self):
        gui = self.gui.get_main_window()
        gui.ui = Mock()

        controller = TestRendererCustomizer.TestRC(gui, self.logic)

        assert isinstance(controller, RendererCustomizer)
        task_def = RenderingTaskDefinition()
        files = self.additional_dir_content([1, [2]])
        task_def.resources = files
        task_def.main_scene_file = files[2]
        self.logic.dir_manager.root_path = self.path
        controller.load_task_definition(task_def)
        assert task_def.resources == files[:2]
Esempio n. 2
0
    def test_compositing(self):
        task_definition = RenderingTaskDefinition()
        task_definition.options = BlenderRendererOptions()
        task_definition.options.use_frames = True
        task_definition.options.frames = [7, 8, 10]
        task_definition.main_scene_file = self.temp_file_name("example.blend")
        task_definition.output_file = self.temp_file_name('output')
        task_definition.output_format = 'PNG'
        task_definition.resolution = [2, 300]
        task_definition.task_id = "ABC"

        def _get_blender_task(task_definition, total_tasks=6):
            return BlenderRenderTask(
                owner=Node(node_name="exmaple-node-name"),
                task_definition=task_definition,
                total_tasks=total_tasks,
                root_path=self.tempdir,
            )

        # Compostiting set to False
        task_definition.options.compositing = False
        bt = _get_blender_task(task_definition)
        assert not bt.compositing

        # Compositing True, use frames, more subtasks than frames
        task_definition.options.compositing = True
        bt = _get_blender_task(task_definition)
        assert not bt.compositing

        # Compositing True, use frames, as many subtasks as frames
        bt = _get_blender_task(task_definition, 3)
        assert not bt.compositing

        # Compositing True, use frames, less subtasks than frames
        bt = _get_blender_task(task_definition, 1)
        assert not bt.compositing

        # Compositing True, use frames is False, as many subtask as frames
        task_definition.options.use_frames = False
        bt = _get_blender_task(task_definition, 3)
        assert not bt.compositing
Esempio n. 3
0
    def setUp(self):
        super(TestBlenderFrameTask, self).setUp()
        program_file = self.temp_file_name('program')
        task_definition = RenderingTaskDefinition()
        task_definition.options = BlenderRendererOptions()
        task_definition.options.compositing = False
        task_definition.options.use_frames = True
        task_definition.options.frames = [7, 8, 10]
        task_definition.main_scene_file = self.temp_file_name("example.blend")
        task_definition.output_file = self.temp_file_name('output')
        task_definition.output_format = 'PNG'
        task_definition.resolution = [2, 300]
        self.bt = BlenderRenderTask(
            node_name="example-node-name",
            task_definition=task_definition,
            total_tasks=6,
            root_path=self.tempdir,
        )

        dm = DirManager(self.path)
        self.bt.initialize(dm)
Esempio n. 4
0
    def setUp(self):
        super(TestBlenderFrameTask, self).setUp()
        task_definition = RenderingTaskDefinition()
        task_definition.options = BlenderRendererOptions()
        task_definition.options.compositing = False
        task_definition.options.use_frames = True
        task_definition.options.frames = [7, 8, 10]
        task_definition.main_scene_file = self.temp_file_name("example.blend")
        task_definition.output_file = self.temp_file_name('output')
        task_definition.output_format = 'PNG'
        task_definition.resolution = [200, 300]
        task_definition.task_id = str(uuid.uuid4())
        BlenderRenderTask.VERIFICATION_QUEUE._reset()
        self.bt = BlenderRenderTask(
            owner=Node(node_name="example-node-name"),
            task_definition=task_definition,
            total_tasks=6,
            root_path=self.tempdir,
        )

        dm = DirManager(self.path)
        self.bt.initialize(dm)
Esempio n. 5
0
 def _get_frame_task(self, use_frames=True, num_tasks=3):
     files_ = self.additional_dir_content([3])
     rt = RenderingTaskDefinition()
     rt.options = FrameRendererOptions()
     rt.options.use_frames = use_frames
     rt.options.frames = list(range(6))
     rt.main_scene_file = files_[1]
     rt.output_format = "PNG"
     rt.output_file = files_[2]
     rt.resources = []
     rt.resolution = [800, 600]
     rt.timeout = 3600
     rt.subtask_timeout = 600
     rt.estimated_memory = 1000
     rt.max_price = 15
     task = FrameRenderingTaskMock(files_[0],
                                   owner=Node(node_name="ABC"),
                                   task_definition=rt,
                                   total_tasks=num_tasks,
                                   root_path=self.path)
     dm = DirManager(self.path)
     task.initialize(dm)
     return task
Esempio n. 6
0
    def build_bt(self, res_x, res_y, total_tasks, frames=None):
        output_file = self.temp_file_name('output')
        if frames is None:
            use_frames = False
            frames = [1]
        else:
            use_frames = True

        task_definition = RenderingTaskDefinition()
        task_definition.options = BlenderRendererOptions()
        task_definition.options.use_frames = use_frames
        task_definition.options.frames = frames
        task_definition.output_file = output_file
        task_definition.output_format = "PNG"
        task_definition.resolution = [res_x, res_y]
        task_definition.main_scene_file = path.join(self.path, "example.blend")
        task_definition.task_id = str(uuid.uuid4())
        bt = BlenderRenderTask(owner=Node(node_name="example-node-name"),
                               task_definition=task_definition,
                               total_tasks=total_tasks,
                               root_path=self.tempdir)
        bt.initialize(DirManager(self.tempdir))
        return bt