First merge with 2.5 branch.
[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                 layout.row()
20                 layout.itemR(world, "blend_sky")
21                 layout.itemR(world, "paper_sky")
22                 layout.itemR(world, "real_sky")
23                 
24                 layout.row()
25                 layout.itemR(world, "horizon_color")
26                 layout.itemR(world, "zenith_color")
27                 layout.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                 layout.row()
37                 layout.itemR(world, "exposure")
38                 layout.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                 layout.row()
48                 layout.itemR(world.mist, "enabled", text="Enable")
49                 if (world.mist.enabled):
50         
51                         layout.column_flow()
52                         layout.itemR(world.mist, "start")
53                         layout.itemR(world.mist, "depth")
54                         layout.itemR(world.mist, "height")
55                         layout.itemR(world.mist, "intensity")
56                         layout.column()
57                         layout.itemL(text="Fallof:")
58                         layout.itemR(world.mist, "falloff", expand=True)
59                 
60 class WORLD_PT_stars(WorldButtonsPanel):
61         __label__ = "Stars"
62
63         def draw(self, context):
64                 world = context.scene.world
65                 layout = self.layout
66
67                 layout.row()
68                 layout.itemR(world.stars, "enabled", text="Enable")
69                 if (world.stars.enabled):
70
71                         layout.column_flow()
72                         layout.itemR(world.stars, "size")
73                         layout.itemR(world.stars, "min_distance", text="MinDist")
74                         layout.itemR(world.stars, "average_separation", text="StarDist")
75                         layout.itemR(world.stars, "color_randomization", text="Colnoise")
76                 
77 class WORLD_PT_ambient_occlusion(WorldButtonsPanel):
78         __label__ = "Ambient Occlusion"
79
80         def draw(self, context):
81                 world = context.scene.world
82                 layout = self.layout
83
84                 ao = world.ambient_occlusion
85                 
86                 layout.row()
87                 layout.itemR(ao, "enabled", text="Enable")
88                 if (ao.enabled):
89
90                         layout.row()
91                         layout.itemR(ao, "gather_method", expand=True)
92                         
93                         if ao.gather_method == 'RAYTRACE':
94                                 layout.row()
95                                 layout.itemR(ao, "samples")
96                                 layout.itemR(ao, "distance")
97                                 
98                                 layout.row()
99                                 layout.itemR(ao, "sample_method")
100                                 if ao.sample_method == 'ADAPTIVE_QMC':
101                                         layout.row()
102                                         layout.itemR(ao, "threshold")
103                                         layout.itemR(ao, "adapt_to_speed")
104                                         
105                                 if ao.sample_method == 'CONSTANT_JITTERED':
106                                         layout.row()
107                                         layout.itemR(ao, "bias")
108                                                         
109                         if ao.gather_method == 'APPROXIMATE':
110                                 layout.row()
111                                 layout.itemR(ao, "passes")
112                                 layout.itemR(ao, "error_tolerance")
113                                 
114                                 layout.row()
115                                 layout.itemR(ao, "correction")
116                                 layout.itemR(ao, "pixel_cache")
117
118                         layout.row()
119                         layout.itemS()
120                                 
121                         layout.row()
122                         layout.itemR(ao, "falloff")     
123                         layout.itemR(ao, "strength")
124                         
125                         layout.column()
126                         layout.itemR(ao, "blend_mode", expand=True)
127                         layout.itemR(ao, "color", expand=True)
128                         layout.itemR(ao, "energy")
129         
130 bpy.types.register(WORLD_PT_world)
131 bpy.types.register(WORLD_PT_mist)
132 bpy.types.register(WORLD_PT_stars)
133 bpy.types.register(WORLD_PT_ambient_occlusion)
134 bpy.types.register(WORLD_PT_color_correction)
135