def execute(self, context):
        log_report('INFO', 'Export opengl render as animation: ...', self)
        write_point_size = context.scene.opengl_panel_write_settings.write_point_size

        use_camera_keyframes = context.scene.opengl_panel_export_animation_settings.use_camera_keyframes
        file_format = context.scene.opengl_panel_export_image_settings.file_format

        # The export helper stores the path in self.filepath (even if its a directory)
        output_dp = self.filepath
        log_report('INFO', 'Output Directory Path: ' + str(output_dp), self)

        if not os.path.isdir(output_dp):
            os.mkdir(output_dp)

        # Used to cache the results
        image_name = "Export Opengl"
        ext = '.' + file_format
        scene = bpy.context.scene
        cam = get_selected_camera()
        indices = self.get_indices(use_camera_keyframes, cam)
        for idx in indices:
            scene.frame_set(idx)
            current_frame_fn = str(idx).zfill(5) + ext
            current_frame_fp = os.path.join(output_dp, current_frame_fn)

            log_report('INFO', 'Output File Path: ' + str(current_frame_fp),
                       self)
            render_opengl_image(image_name, cam, write_point_size)
            bpy.data.images[image_name].save_render(current_frame_fp)

        log_report('INFO', 'Save opengl render as animation: Done', self)
        return {'FINISHED'}
 def execute(self, context):
     self.report({'INFO'}, 'Save opengl render as image: ...')
     write_point_size = context.scene.opengl_panel_write_settings.write_point_size
     cam = get_selected_camera()
     image_name = "OpenGL Render"
     log_report('INFO', 'image_name: ' + image_name, self)
     render_opengl_image(image_name, cam, write_point_size)
     log_report('INFO', 'Save opengl render as image: Done', self)
     return {'FINISHED'}
Пример #3
0
 def execute(self, context):
     self.report({'INFO'}, 'Save opengl render as image: ...')
     point_size = context.scene.opengl_panel_general_settings.point_size
     cam = get_selected_camera()
     image_name = "OpenGL Render"
     self.report({'INFO'}, 'image_name: ' + image_name)
     render_opengl_image(image_name, cam, point_size)
     self.report({'INFO'}, 'Save opengl render as image: Done')
     return {'FINISHED'}
    def execute(self, context):
        log_report('INFO', 'Export opengl render as image: ...', self)
        write_point_size = context.scene.opengl_panel_write_settings.write_point_size
        file_format = context.scene.opengl_panel_export_image_settings.file_format

        log_report('INFO', 'Output File Path: ' + str(self.filepath), self)

        # Used to cache the results
        image_name = "Export Opengl"
        ext = '.' + file_format
        scene = bpy.context.scene

        cam = get_selected_camera()

        render_opengl_image(image_name, cam, write_point_size)
        bpy.data.images[image_name].save_render(self.filepath)
        log_report('INFO', 'Save opengl render as image: Done', self)
        return {'FINISHED'}