2.5 Buttons
[blender-staging.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_preview(WorldButtonsPanel):
13         __label__ = "Preview"
14
15         def draw(self, context):
16                 layout = self.layout
17
18                 world = context.scene.world
19                 layout.template_preview(world)
20         
21 class WORLD_PT_world(WorldButtonsPanel):
22         __label__ = "World"
23
24         def draw(self, context):
25                 world = context.scene.world
26                 layout = self.layout
27                 
28                 row = layout.row()
29                 row.itemR(world, "blend_sky")
30                 row.itemR(world, "paper_sky")
31                 row.itemR(world, "real_sky")
32                 
33                 row = layout.row()
34                 row.column().itemR(world, "horizon_color")
35                 row.column().itemR(world, "zenith_color")
36                 row.column().itemR(world, "ambient_color")
37                 
38 class WORLD_PT_color_correction(WorldButtonsPanel):
39         __label__ = "Color Correction"
40
41         def draw(self, context):
42                 world = context.scene.world
43                 layout = self.layout
44
45                 row = layout.row()
46                 row.itemR(world, "exposure")
47                 row.itemR(world, "range")
48         
49 class WORLD_PT_mist(WorldButtonsPanel):
50         __label__ = "Mist"
51
52         def draw_header(self, context):
53                 world = context.scene.world
54
55                 layout = self.layout
56                 layout.itemR(world.mist, "enabled", text="")
57
58         def draw(self, context):
59                 world = context.scene.world
60                 layout = self.layout
61                 layout.active = world.mist.enabled
62
63                 flow = layout.column_flow()
64                 flow.itemR(world.mist, "start")
65                 flow.itemR(world.mist, "depth")
66                 flow.itemR(world.mist, "height")
67                 flow.itemR(world.mist, "intensity")
68                 col = layout.column()
69                 col.itemL(text="Fallof:")
70                 col.row().itemR(world.mist, "falloff", expand=True)
71                 
72 class WORLD_PT_stars(WorldButtonsPanel):
73         __label__ = "Stars"
74
75         def draw_header(self, context):
76                 world = context.scene.world
77
78                 layout = self.layout
79                 layout.itemR(world.stars, "enabled", text="")
80
81         def draw(self, context):
82                 world = context.scene.world
83                 layout = self.layout
84                 layout.active = world.stars.enabled
85
86                 flow = layout.column_flow()
87                 flow.itemR(world.stars, "size")
88                 flow.itemR(world.stars, "min_distance", text="Min. Dist")
89                 flow.itemR(world.stars, "average_separation", text="Separation")
90                 flow.itemR(world.stars, "color_randomization", text="Random:")
91                 
92 class WORLD_PT_ambient_occlusion(WorldButtonsPanel):
93         __label__ = "Ambient Occlusion"
94
95         def draw_header(self, context):
96                 world = context.scene.world
97
98                 layout = self.layout
99                 layout.itemR(world.ambient_occlusion, "enabled", text="")
100
101         def draw(self, context):
102                 world = context.scene.world
103                 ao = world.ambient_occlusion
104                 layout = self.layout
105                 layout.active = ao.enabled
106                 
107                 layout.itemR(ao, "gather_method", expand=True)
108                 
109                 if ao.gather_method == 'RAYTRACE':
110                         row = layout.row()
111                         row.itemR(ao, "samples")
112                         row.itemR(ao, "distance")
113                         
114                         layout.itemR(ao, "sample_method")
115                         if ao.sample_method == 'ADAPTIVE_QMC':
116                                 row = layout.row()
117                                 row.itemR(ao, "threshold")
118                                 row.itemR(ao, "adapt_to_speed")
119                                 
120                         if ao.sample_method == 'CONSTANT_JITTERED':
121                                 row = layout.row()
122                                 row.itemR(ao, "bias")
123                                                 
124                 if ao.gather_method == 'APPROXIMATE':
125                         col = layout.column_flow()
126                         col.itemR(ao, "passes")
127                         col.itemR(ao, "error_tolerance", text="Error")
128                         col.itemR(ao, "correction")
129                         col.itemR(ao, "pixel_cache")
130
131                 row = layout.row()
132                 row.itemR(ao, "falloff")        
133                 row.itemR(ao, "strength")
134                 
135                 col = layout.column()
136                 col.row().itemR(ao, "blend_mode", expand=True)
137                 col.row().itemR(ao, "color", expand=True)
138                 col.itemR(ao, "energy")
139         
140 bpy.types.register(WORLD_PT_preview)
141 bpy.types.register(WORLD_PT_world)
142 bpy.types.register(WORLD_PT_ambient_occlusion)
143 bpy.types.register(WORLD_PT_mist)
144 bpy.types.register(WORLD_PT_stars)
145 bpy.types.register(WORLD_PT_color_correction)
146