# -*- coding: utf-8 -*-
"""
DESCRIPTION.
This script setup render settings for reduce rendertime!
DEPRECATED
"""
__version__ = "0.1"

import bpy


def settings(optimisation_level='medium'):
    """ select optimisation_level:
        'small',
        'medium',
        'large'
    """
    if optimisation_level == 'small':
        bpy.context.scene.render.engine = 'CYCLES'
        bpy.context.scene.cycles.device = 'GPU'
        bpy.context.scene.cycles.adaptive_threshold = 0.02
        bpy.data.scenes["Scene"].cycles.samples = 256
        bpy.data.scenes["Scene"].cycles.use_denoising = True
        bpy.data.scenes["Scene"].cycles.denoiser = 'OPENIMAGEDENOISE'
        bpy.data.scenes["Scene"].cycles.denoising_input_passes = 'RGB_ALBEDO_NORMAL'
        bpy.data.scenes["Scene"].cycles.denoising_prefilter = 'ACCURATE'
        bpy.data.scenes["Scene"].cycles.use_fast_gi = False
        bpy.data.scenes["Scene"].cycles.max_bounces = 12
        bpy.data.scenes["Scene"].cycles.diffuse_bounces = 4
        bpy.data.scenes["Scene"].cycles.glossy_bounces = 4
        bpy.data.scenes["Scene"].cycles.transmission_bounces = 12
        bpy.data.scenes["Scene"].cycles.transparent_max_bounces = 12

        bpy.data.scenes["Scene"].cycles.use_animated_seed = True
        bpy.data.scenes["Scene"].cycles.sample_clamp_indirect = 10
        bpy.data.scenes["Scene"].cycles.caustics_reflective = False
        bpy.data.scenes["Scene"].cycles.caustics_refractive = False

        bpy.data.scenes["Scene"].render.use_motion_blur = False

        bpy.data.scenes["Scene"].cycles.use_auto_tile = False

        bpy.data.scenes["Scene"].view_settings.view_transform = 'Standard'
        bpy.data.scenes["Scene"].view_settings.look = 'None'

        bpy.data.worlds["World"].cycles.sampling_method = 'MANUAL'
        bpy.data.worlds["World"].cycles.sample_map_resolution = 1024
        bpy.data.worlds["World"].cycles.max_bounces = 1024

    if optimisation_level == 'medium':
        bpy.context.scene.render.engine = 'CYCLES'
        bpy.context.scene.cycles.device = 'GPU'
        bpy.data.scenes["Scene"].cycles.adaptive_threshold = 0.03
        bpy.data.scenes["Scene"].cycles.samples = 256
        bpy.data.scenes["Scene"].cycles.use_denoising = True
        bpy.data.scenes["Scene"].cycles.denoiser = 'OPENIMAGEDENOISE'
        bpy.data.scenes["Scene"].cycles.denoising_input_passes = 'RGB_ALBEDO_NORMAL'
        bpy.data.scenes["Scene"].cycles.denoising_prefilter = 'ACCURATE'
        bpy.data.scenes["Scene"].cycles.use_fast_gi = False
        bpy.data.scenes["Scene"].cycles.max_bounces = 8
        bpy.data.scenes["Scene"].cycles.diffuse_bounces = 4
        bpy.data.scenes["Scene"].cycles.glossy_bounces = 2
        bpy.data.scenes["Scene"].cycles.transmission_bounces = 4
        bpy.data.scenes["Scene"].cycles.transparent_max_bounces = 8

        bpy.data.scenes["Scene"].cycles.use_animated_seed = True
        bpy.data.scenes["Scene"].cycles.sample_clamp_indirect = 10
        bpy.data.scenes["Scene"].cycles.caustics_reflective = False
        bpy.data.scenes["Scene"].cycles.caustics_refractive = False

        bpy.data.scenes["Scene"].render.use_motion_blur = False

        bpy.data.scenes["Scene"].cycles.use_auto_tile = False

        bpy.data.scenes["Scene"].view_settings.view_transform = 'Standard'
        bpy.data.scenes["Scene"].view_settings.look = 'None'

        bpy.data.worlds["World"].cycles.sampling_method = 'MANUAL'
        bpy.data.worlds["World"].cycles.sample_map_resolution = 1024
        bpy.data.worlds["World"].cycles.max_bounces = 1024

    if optimisation_level == 'large':
        bpy.context.scene.render.engine = 'CYCLES'
        bpy.context.scene.cycles.device = 'GPU'
        bpy.data.scenes["Scene"].cycles.adaptive_threshold = 0.05
        bpy.data.scenes["Scene"].cycles.samples = 128
        bpy.data.scenes["Scene"].cycles.use_denoising = True
        bpy.data.scenes["Scene"].cycles.denoiser = 'OPTIX'
        bpy.data.scenes["Scene"].cycles.denoising_input_passes = 'RGB_ALBEDO'
        bpy.data.scenes["Scene"].cycles.use_fast_gi = False
        bpy.data.scenes["Scene"].cycles.max_bounces = 4
        bpy.data.scenes["Scene"].cycles.diffuse_bounces = 2
        bpy.data.scenes["Scene"].cycles.glossy_bounces = 2
        bpy.data.scenes["Scene"].cycles.transmission_bounces = 4
        bpy.data.scenes["Scene"].cycles.transparent_max_bounces = 4

        bpy.data.scenes["Scene"].cycles.use_animated_seed = True
        bpy.data.scenes["Scene"].cycles.sample_clamp_indirect = 10
        bpy.data.scenes["Scene"].cycles.caustics_reflective = False
        bpy.data.scenes["Scene"].cycles.caustics_refractive = False

        bpy.data.scenes["Scene"].render.use_motion_blur = False

        bpy.data.scenes["Scene"].cycles.use_auto_tile = False

        bpy.data.scenes["Scene"].view_settings.view_transform = 'Standard'
        bpy.data.scenes["Scene"].view_settings.look = 'None'

        bpy.data.worlds["World"].cycles.sampling_method = 'MANUAL'
        bpy.data.worlds["World"].cycles.sample_map_resolution = 1024
        bpy.data.worlds["World"].cycles.max_bounces = 1024
