Assorted UI tweaks/cleanups
[blender.git] / release / ui / buttons_world.py
1
2 import bpy
3
4 class WorldButtonsPanel(bpy.types.Panel):
5         __space_type__ = "BUTTONS_WINDOW"
6         __region_type__ = "WINDOW"
7         __context__ = "world"
8
9         def poll(self, context):
10                 return (context.scene.world != None)
11         
12 class WORLD_PT_world(WorldButtonsPanel):
13         __label__ = "World"
14
15         def draw(self, context):
16                 world = context.scene.world
17                 layout = self.layout
18                 
19                 row = layout.row()
20                 row.itemR(world, "blend_sky")
21                 row.itemR(world, "paper_sky")
22                 row.itemR(world, "real_sky")
23                 
24                 row = layout.row()
25                 row.column().itemR(world, "horizon_color")
26                 row.column().itemR(world, "zenith_color")
27                 row.column().itemR(world, "ambient_color")
28                 
29 class WORLD_PT_color_correction(WorldButtonsPanel):
30         __label__ = "Color Correction"
31
32         def draw(self, context):
33                 world = context.scene.world
34                 layout = self.layout
35
36                 row = layout.row()
37                 row.itemR(world, "exposure")
38                 row.itemR(world, "range")
39         
40 class WORLD_PT_mist(WorldButtonsPanel):
41         __label__ = "Mist"
42
43         def draw(self, context):
44                 world = context.scene.world
45                 layout = self.layout
46
47                 row = layout.row()
48                 row.itemR(world.mist, "enabled", text="Enable")
49
50                 flow = layout.column_flow()
51                 flow.itemR(world.mist, "start")
52                 flow.itemR(world.mist, "depth")
53                 flow.itemR(world.mist, "height")
54                 flow.itemR(world.mist, "intensity")
55                 col = layout.column()
56                 col.itemL(text="Fallof:")
57                 col.row().itemR(world.mist, "falloff", expand=True)
58                 
59 class WORLD_PT_stars(WorldButtonsPanel):
60         __label__ = "Stars"
61
62         def draw(self, context):
63                 world = context.scene.world
64                 layout = self.layout
65
66                 row = layout.row()
67                 row.itemR(world.stars, "enabled", text="Enable")
68
69                 flow = layout.column_flow()
70                 flow.itemR(world.stars, "size")
71                 flow.itemR(world.stars, "min_distance", text="Min. Dist")
72                 flow.itemR(world.stars, "average_separation", text="Separation")
73                 flow.itemR(world.stars, "color_randomization", text="Random:")
74                 
75 class WORLD_PT_ambient_occlusion(WorldButtonsPanel):
76         __label__ = "Ambient Occlusion"
77
78         def draw(self, context):
79                 world = context.scene.world
80                 layout = self.layout
81
82                 ao = world.ambient_occlusion
83                 
84                 row = layout.row()
85                 row.itemR(ao, "enabled", text="Enable")
86                 row = layout.row()
87                 row.itemR(ao, "gather_method", expand=True)
88                 
89                 if ao.gather_method == 'RAYTRACE':
90                         row = layout.row()
91                         row.itemR(ao, "samples")
92                         row.itemR(ao, "distance")
93                         
94                         row = layout.row()
95                         row.itemR(ao, "sample_method")
96                         if ao.sample_method == 'ADAPTIVE_QMC':
97                                 row = layout.row()
98                                 row.itemR(ao, "threshold")
99                                 row.itemR(ao, "adapt_to_speed")
100                                 
101                         if ao.sample_method == 'CONSTANT_JITTERED':
102                                 row = layout.row()
103                                 row.itemR(ao, "bias")
104                                                 
105                 if ao.gather_method == 'APPROXIMATE':
106                         row = layout.row()
107                         row.itemR(ao, "passes")
108                         row.itemR(ao, "error_tolerance", text="Error")
109                         
110                         row = layout.row()
111                         row.itemR(ao, "correction")
112                         row.itemR(ao, "pixel_cache")
113
114                 row = layout.row()
115                 row.itemS()
116                         
117                 row = layout.row()
118                 row.itemR(ao, "falloff")        
119                 row.itemR(ao, "strength")
120                 
121                 col = layout.column()
122                 col.row().itemR(ao, "blend_mode", expand=True)
123                 col.row().itemR(ao, "color", expand=True)
124                 col.itemR(ao, "energy")
125         
126 bpy.types.register(WORLD_PT_world)
127 bpy.types.register(WORLD_PT_ambient_occlusion)
128 bpy.types.register(WORLD_PT_mist)
129 bpy.types.register(WORLD_PT_stars)
130 bpy.types.register(WORLD_PT_color_correction)
131