-
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy path__init__.py
More file actions
162 lines (135 loc) · 4.86 KB
/
__init__.py
File metadata and controls
162 lines (135 loc) · 4.86 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTIBILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
bl_info = {
"name": "Super Resolution Render (SRR)",
"author": "Kevin Lorengel, Chris Bond (Kamikaze)",
"description": "Render in extreme resolution!",
"blender": (2, 92, 0),
"version": (1, 3, 1),
"location": "Properties > Output > SuperResRender",
"warning": "",
"endpoint_url": "https://raw.githubusercontent.com/PidgeonTools/SAM-Endpoints/main/SuperResRender.json",
"tracker_url": "https://github.com/PidgeonTools/SuperResRender/issues",
"category": "Render"
}
import bpy
from bpy.app.handlers import persistent
from bpy.props import PointerProperty
from .SRR_Settings import (
SRR_RenderStatus,
SRR_Settings,
)
from .SuperResRender import (
SRR_OT_Render,
SRR_OT_StopRender,
SRR_OT_Merge,
)
from .SplitCamera import (
SRR_OT_SplitCamera,
)
from .SRR_Panel import (
SRR_UI_PT_Panel,
)
from . import addon_updater_ops
class DemoPreferences(bpy.types.AddonPreferences):
bl_idname = __package__
# addon updater preferences
auto_check_update: bpy.props.BoolProperty(
name="Auto-check for Update",
description="If enabled, auto-check for updates using an interval",
default=True,
)
updater_intrval_months: bpy.props.IntProperty(
name='Months',
description="Number of months between checking for updates",
default=0,
min=0,
)
updater_intrval_days: bpy.props.IntProperty(
name='Days',
description="Number of days between checking for updates",
default=7,
min=0,
max=31,
)
updater_intrval_hours: bpy.props.IntProperty(
name='Hours',
description="Number of hours between checking for updates",
default=0,
min=0,
max=23,
)
updater_intrval_minutes: bpy.props.IntProperty(
name='Minutes',
description="Number of minutes between checking for updates",
default=0,
min=0,
max=59,
)
def draw(self, context):
layout = self.layout
# col = layout.column() # works best if a column, or even just self.layout
mainrow = layout.row()
col = mainrow.column()
# updater draw function
# could also pass in col as third arg
addon_updater_ops.update_settings_ui(self, context)
# Alternate draw function, which is more condensed and can be
# placed within an existing draw function. Only contains:
# 1) check for update/update now buttons
# 2) toggle for auto-check (interval will be equal to what is set above)
# addon_updater_ops.update_settings_ui_condensed(self, context, col)
# Adding another column to help show the above condensed ui as one column
# col = mainrow.column()
# col.scale_y = 2
# col.operator("wm.url_open","Open webpage ").url=addon_updater_ops.updater.website
### Addon Registration
@persistent
def load_handler(dummy):
try:
settings: SRR_Settings = bpy.context.scene.srr_settings
settings.status.is_rendering = False
settings.status.should_stop = False
except:
pass
classes = (
SRR_RenderStatus,
SRR_Settings,
SRR_OT_Render,
SRR_OT_StopRender,
SRR_OT_Merge,
SRR_OT_SplitCamera,
SRR_UI_PT_Panel,
DemoPreferences,
)
def register():
# addon updater code and configurations
# in case of broken version, try to register the updater first
# so that users can revert back to a working version
addon_updater_ops.register(bl_info)
# register the example panel, to show updater buttons
for cls in classes:
# to avoid blender 2.8 warnings
addon_updater_ops.make_annotations(cls)
bpy.utils.register_class(cls)
bpy.types.Scene.srr_settings = PointerProperty(type=SRR_Settings)
bpy.app.handlers.load_post.append(load_handler)
def unregister():
del bpy.types.Scene.srr_settings
# addon updater unregister
addon_updater_ops.unregister()
# register the example panel, to show updater buttons
for cls in reversed(classes):
bpy.utils.unregister_class(cls)
if __name__ == "__main__":
register()