forked from HailToDodongo/f64render
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmesa_warning.py
More file actions
57 lines (48 loc) · 1.99 KB
/
mesa_warning.py
File metadata and controls
57 lines (48 loc) · 1.99 KB
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
from bpy.types import Context, Event, Operator
class MesaWarningPopup(Operator):
bl_label = "Mesa Driver Limitations"
bl_idname = "dialog.f64_mesa_warning"
bl_description = "Update color management settings to help material preview accuracy"
bl_options = {"UNDO"}
already_invoked = False # HACK: used to prevent multiple dialogs from popping up
def invoke(self, context: Context, event: Event):
prefs = context.preferences.addons[__package__].preferences
if prefs.dont_warn_about_mesa:
return {"CANCELLED"}
if MesaWarningPopup.already_invoked:
return {"FINISHED"}
MesaWarningPopup.already_invoked = True
return context.window_manager.invoke_props_dialog(self, width=400)
def draw(self, context: Context):
from fast64_internal.utility import multilineLabel
col = self.layout.column()
col.label(text="You are using Mesa drivers!", icon="MEMORY")
multilineLabel(
col,
(
(
"These are much more strict as opposed to commercial drivers\n"
"and do not allow us to enable helpful extensions!"
)
),
)
col.alert = True
col.label(text="This will hinder your accuracy and or performance.", icon="ERROR")
col.alert = False
multilineLabel(
col,
(
(
'You can add "allow_glsl_extension_directive_midshader=true" to your\n'
"blender launch arguments to bypass this restriction, or change render\n"
"device."
)
),
icon="INFO",
)
prefs = context.preferences.addons[__package__].preferences
col.prop(prefs, "dont_warn_about_mesa", text="Don't warn me again")
def cancel(self, context: Context):
MesaWarningPopup.already_invoked = False
def execute(self, context):
return {"FINISHED"}