-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path__init__.py
executable file
·64 lines (45 loc) · 1.42 KB
/
__init__.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
64
'''
Created on 13.01.2017
Updated to 2.8 on 11.11.2018
@author: r.trummer
'''
bl_info = {
"name": "Calculate FStop Range",
"author": "Rainer Trummer, based on Troy James Sobotka's work",
"version": (0, 3, 0),
"blender": (2, 80, 0),
"description": "calculates the dynamic range of an image by comparing darkest and brightest scene referred value",
"category": "Image"
}
if 'bpy' in locals():
import importlib as imp
imp.reload(image_calculate_fstop_range) # @UndefinedVariable
else:
import bpy, logging
from . import image_calculate_fstop_range as icfsr
logger = logging.getLogger('image_measure_fstop_range')
__classes__ = (
icfsr.IMAGE_OT_CalcFStopOperator,
icfsr.IMAGE_PT_fstop_range
)
def bg_check():
if bpy.app.background:
logger.warning(f'running in background mode, skipping registering {__package__}')
return bpy.app.background
def register():
if bg_check(): return
# add a FloatProperty to the image type to store the fstop range
bpy.types.Image.fstop_range = bpy.props.FloatProperty()
bpy.types.Image.pixel_min = bpy.props.FloatProperty()
bpy.types.Image.pixel_max = bpy.props.FloatProperty()
for cls in __classes__:
bpy.utils.register_class(cls)
def unregister():
if bg_check(): return
del bpy.types.Image.fstop_range
del bpy.types.Image.pixel_min
del bpy.types.Image.pixel_max
for cls in reversed(__classes__):
bpy.utils.unregister_class(cls)
if __name__ == "__main__":
register()