def scene_setting_init(use_gpu):
    'initialize blender setting configurations\n\n    '
    sce = bpy.context.scene.name
    bpy.data.scenes[sce].render.engine = g_engine_type
    bpy.data.scenes[sce].cycles.film_transparent = g_use_film_transparent
    bpy.data.scenes[sce].render.image_settings.color_mode = g_rgb_color_mode
    bpy.data.scenes[sce].render.image_settings.color_depth = g_rgb_color_depth
    bpy.data.scenes[sce].render.image_settings.file_format = g_rgb_file_format
    bpy.data.scenes[sce].render.use_overwrite = g_depth_use_overwrite
    bpy.data.scenes[sce].render.use_file_extension = g_depth_use_file_extension
    if g_ambient_light:
        world = bpy.data.worlds['World']
        world.use_nodes = True
        bg = world.node_tree.nodes['Background']
        bg.inputs[0].default_value[:3] = g_bg_color
        bg.inputs[1].default_value = 1.0
    bpy.data.scenes[sce].render.resolution_x = g_resolution_x
    bpy.data.scenes[sce].render.resolution_y = g_resolution_y
    bpy.data.scenes[sce].render.resolution_percentage = g_resolution_percentage
    if use_gpu:
        bpy.data.scenes[sce].render.engine = 'CYCLES'
        bpy.data.scenes[sce].render.tile_x = g_hilbert_spiral
        bpy.data.scenes[sce].render.tile_x = g_hilbert_spiral
        bpy.context.user_preferences.addons['cycles'].preferences.devices[0].use = False
        bpy.context.user_preferences.addons['cycles'].preferences.devices[1].use = True
        ndev = len(bpy.context.user_preferences.addons['cycles'].preferences.devices)
        print('Number of devices {}'.format(ndev))
        for ki in range(2, ndev):
            bpy.context.user_preferences.addons['cycles'].preferences.devices[ki].use = False
        bpy.context.user_preferences.addons['cycles'].preferences.compute_device_type = 'CUDA'
        bpy.data.scenes[sce].cycles.device = 'GPU'
initialize blender setting configurations
def scene_setting_init(use_gpu):
    '\n\n    '
    sce = bpy.context.scene.name
    bpy.data.scenes[sce].render.engine = g_engine_type
    bpy.data.scenes[sce].cycles.film_transparent = g_use_film_transparent
    bpy.data.scenes[sce].render.image_settings.color_mode = g_rgb_color_mode
    bpy.data.scenes[sce].render.image_settings.color_depth = g_rgb_color_depth
    bpy.data.scenes[sce].render.image_settings.file_format = g_rgb_file_format
    bpy.data.scenes[sce].render.use_overwrite = g_depth_use_overwrite
    bpy.data.scenes[sce].render.use_file_extension = g_depth_use_file_extension
    if g_ambient_light:
        world = bpy.data.worlds['World']
        world.use_nodes = True
        bg = world.node_tree.nodes['Background']
        bg.inputs[0].default_value[:3] = g_bg_color
        bg.inputs[1].default_value = 1.0
    bpy.data.scenes[sce].render.resolution_x = g_resolution_x
    bpy.data.scenes[sce].render.resolution_y = g_resolution_y
    bpy.data.scenes[sce].render.resolution_percentage = g_resolution_percentage
    if use_gpu:
        bpy.data.scenes[sce].render.engine = 'CYCLES'
        bpy.data.scenes[sce].render.tile_x = g_hilbert_spiral
        bpy.data.scenes[sce].render.tile_x = g_hilbert_spiral
        bpy.context.user_preferences.addons['cycles'].preferences.devices[0].use = False
        bpy.context.user_preferences.addons['cycles'].preferences.devices[1].use = True
        ndev = len(bpy.context.user_preferences.addons['cycles'].preferences.devices)
        print('Number of devices {}'.format(ndev))
        for ki in range(2, ndev):
            bpy.context.user_preferences.addons['cycles'].preferences.devices[ki].use = False
        bpy.context.user_preferences.addons['cycles'].preferences.compute_device_type = 'CUDA'
        bpy.data.scenes[sce].cycles.device = 'GPU'