UI:
[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                 layout.itemR(world.mist, "falloff")
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                 
57 class WORLD_PT_stars(WorldButtonsPanel):
58         __label__ = "Stars"
59
60         def draw(self, context):
61                 world = context.scene.world
62                 layout = self.layout
63
64                 layout.row()
65                 layout.itemR(world.stars, "enabled", text="Enable")
66
67                 layout.column_flow()
68                 layout.itemR(world.stars, "size")
69                 layout.itemR(world.stars, "min_distance", text="MinDist")
70                 layout.itemR(world.stars, "average_separation", text="StarDist")
71                 layout.itemR(world.stars, "color_randomization", text="Colnoise")
72                 
73 class WORLD_PT_ambient_occlusion(WorldButtonsPanel):
74         __label__ = "Ambient Occlusion"
75
76         def draw(self, context):
77                 world = context.scene.world
78                 layout = self.layout
79
80                 ao = world.ambient_occlusion
81                 
82                 layout.row()
83                 layout.itemR(ao, "enabled", text="Enable")
84
85                 layout.row()
86                 layout.itemR(ao, "gather_method", expand=True)
87                 
88                 if ao.gather_method == 'RAYTRACE':
89                         layout.row()
90                         layout.itemR(ao, "samples")
91                         layout.itemR(ao, "distance")
92                         
93                         layout.row()
94                         layout.itemR(ao, "sample_method")
95                         if ao.sample_method == 'ADAPTIVE_QMC':
96                                 layout.row()
97                                 layout.itemR(ao, "threshold")
98                                 layout.itemR(ao, "adapt_to_speed")
99                                 
100                         if ao.sample_method == 'CONSTANT_JITTERED':
101                                 layout.row()
102                                 layout.itemR(ao, "bias")
103                                                 
104                 if ao.gather_method == 'APPROXIMATE':
105                         layout.row()
106                         layout.itemR(ao, "passes")
107                         layout.itemR(ao, "error_tolerance")
108                         
109                         layout.row()
110                         layout.itemR(ao, "correction")
111                         layout.itemR(ao, "pixel_cache")
112
113                 layout.row()
114                 layout.itemS()
115                         
116                 layout.row()
117                 layout.itemR(ao, "falloff")     
118                 layout.itemR(ao, "strength")
119                 
120                 layout.column()
121                 layout.itemR(ao, "blend_mode", expand=True)
122                 layout.itemR(ao, "color", expand=True)
123                 layout.itemR(ao, "energy")
124         
125 bpy.types.register(WORLD_PT_world)
126 bpy.types.register(WORLD_PT_mist)
127 bpy.types.register(WORLD_PT_stars)
128 bpy.types.register(WORLD_PT_ambient_occlusion)
129 bpy.types.register(WORLD_PT_color_correction)
130