-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathSRF_Complimentary.py
63 lines (50 loc) · 2.06 KB
/
SRF_Complimentary.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import bpy
from bpy.types import (
Operator
)
import addon_utils
import webbrowser
class SFR_Complimentary(Operator):
bl_idname = "initalise.complimentary"
bl_label = "Complimentary Addons"
GetSID: bpy.props.BoolProperty(name="Enable / Download SID", default=True)
#GetSRR: bpy.props.BoolProperty(name="Enable / Download SRR", default=True)
ComputeDevice: bpy.props.BoolProperty(
name="Detect Best Compute Device", default=True)
def execute(self, context):
# SID helps with denoising
if self.GetSID:
if 'Super Image Denoiser (SID)' in bpy.context.preferences.addons:
addon_utils.enable('Super Image Denoiser (SID)', default_set=True)
else:
webbrowser.open(
'https://gumroad.com/l/superimagedenoiser', new=2)
# SRR helps with large resolutions
# if self.GetSID:
# if 'SuperResRender' in bpy.context.preferences.addons:
# print('Detected SRR')
# addon_utils.enable('SuperResRender', default_set=True)
# else:
# print('SRR not detected opening download link')
# webbrowser.open('https://gumroad.com/l/superresrender', new=2)
# SFR detects best compute device
if self.ComputeDevice:
prefs = bpy.context.preferences.addons['cycles'].preferences
for device_type in prefs.get_device_types(bpy.context):
prefs.get_devices_for_type(device_type[0])
# NVIDIA RTX
if prefs.get_devices_for_type:
'OPTIX'
prefs.compute_device_type = "OPTIX"
# NVIDIA
elif prefs.get_devices_for_type:
'CUDA'
prefs.compute_device_type = "CUDA"
# AMD
elif prefs.get_devices_for_type:
'OPENCL'
prefs.compute_device_type = "OPENCL"
return {'FINISHED'}
def invoke(self, context, event):
OpenWindow = context.window_manager
return OpenWindow.invoke_props_dialog(self)