-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadjustLighting.py
More file actions
129 lines (108 loc) · 3.92 KB
/
adjustLighting.py
File metadata and controls
129 lines (108 loc) · 3.92 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
import bpy
from bpy.types import Panel, Operator
bl_info = {
"name": "Adjust Lighting",
"author": "AJ Frio",
"version": (1, 0),
"blender": (4, 2, 0),
"location": "Properties > World > Adjust Lighting",
"description": "Quickly adjust lighting brightness in the Setting collection",
"category": "Lighting",
}
# Operators for different percentage adjustments
class LIGHT_OT_adjust_minus_50(Operator):
bl_idname = "light.adjust_minus_50"
bl_label = "-50%"
bl_description = "Decrease light brightness by 50%"
def execute(self, context):
if "Setting" in bpy.data.collections:
for obj in bpy.data.collections["Setting"].objects:
if obj.type == 'LIGHT':
obj.data.energy *= 0.5
return {'FINISHED'}
class LIGHT_OT_adjust_minus_25(Operator):
bl_idname = "light.adjust_minus_25"
bl_label = "-25%"
bl_description = "Decrease light brightness by 25%"
def execute(self, context):
if "Setting" in bpy.data.collections:
for obj in bpy.data.collections["Setting"].objects:
if obj.type == 'LIGHT':
obj.data.energy *= 0.75
return {'FINISHED'}
class LIGHT_OT_adjust_minus_10(Operator):
bl_idname = "light.adjust_minus_10"
bl_label = "-10%"
bl_description = "Decrease light brightness by 10%"
def execute(self, context):
if "Setting" in bpy.data.collections:
for obj in bpy.data.collections["Setting"].objects:
if obj.type == 'LIGHT':
obj.data.energy *= 0.9
return {'FINISHED'}
class LIGHT_OT_adjust_plus_10(Operator):
bl_idname = "light.adjust_plus_10"
bl_label = "+10%"
bl_description = "Increase light brightness by 10%"
def execute(self, context):
if "Setting" in bpy.data.collections:
for obj in bpy.data.collections["Setting"].objects:
if obj.type == 'LIGHT':
obj.data.energy *= 1.1
return {'FINISHED'}
class LIGHT_OT_adjust_plus_25(Operator):
bl_idname = "light.adjust_plus_25"
bl_label = "+25%"
bl_description = "Increase light brightness by 25%"
def execute(self, context):
if "Setting" in bpy.data.collections:
for obj in bpy.data.collections["Setting"].objects:
if obj.type == 'LIGHT':
obj.data.energy *= 1.25
return {'FINISHED'}
class LIGHT_OT_adjust_plus_50(Operator):
bl_idname = "light.adjust_plus_50"
bl_label = "+50%"
bl_description = "Increase light brightness by 50%"
def execute(self, context):
if "Setting" in bpy.data.collections:
for obj in bpy.data.collections["Setting"].objects:
if obj.type == 'LIGHT':
obj.data.energy *= 1.5
return {'FINISHED'}
# Panel class for the UI
class LIGHT_PT_adjust_panel(Panel):
bl_label = "Adjust Lighting"
bl_idname = "LIGHT_PT_adjust_panel"
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_context = "world"
def draw(self, context):
layout = self.layout
# Add buttons in two rows
row1 = layout.row()
row1.operator("light.adjust_minus_50")
row1.operator("light.adjust_minus_25")
row1.operator("light.adjust_minus_10")
row2 = layout.row()
row2.operator("light.adjust_plus_10")
row2.operator("light.adjust_plus_25")
row2.operator("light.adjust_plus_50")
# List of classes to register
classes = [
LIGHT_OT_adjust_minus_50,
LIGHT_OT_adjust_minus_25,
LIGHT_OT_adjust_minus_10,
LIGHT_OT_adjust_plus_10,
LIGHT_OT_adjust_plus_25,
LIGHT_OT_adjust_plus_50,
LIGHT_PT_adjust_panel
]
def register():
for cls in classes:
bpy.utils.register_class(cls)
def unregister():
for cls in classes:
bpy.utils.unregister_class(cls)
if __name__ == "__main__":
register()