4 class WorldButtonsPanel(bpy.types.Panel):
5 __space_type__ = "BUTTONS_WINDOW"
6 __region_type__ = "WINDOW"
9 def poll(self, context):
10 return (context.world != None)
12 class WORLD_PT_preview(WorldButtonsPanel):
15 def draw(self, context):
19 layout.template_preview(world)
21 class WORLD_PT_context_world(WorldButtonsPanel):
24 def poll(self, context):
25 return (context.scene != None)
27 def draw(self, context):
32 space = context.space_data
34 split = layout.split(percentage=0.65)
37 split.template_ID(scene, "world", new="world.new")
39 split.template_ID(space, "pin_id")
41 class WORLD_PT_world(WorldButtonsPanel):
44 def draw(self, context):
52 row.itemR(world, "blend_sky")
53 row.itemR(world, "paper_sky")
54 row.itemR(world, "real_sky")
57 row.column().itemR(world, "horizon_color")
59 col.itemR(world, "zenith_color")
60 col.active = world.blend_sky
61 row.column().itemR(world, "ambient_color")
63 class WORLD_PT_color_correction(WorldButtonsPanel):
64 __label__ = "Color Correction"
66 def draw(self, context):
71 row.itemR(world, "exposure")
72 row.itemR(world, "range")
74 class WORLD_PT_mist(WorldButtonsPanel):
77 def draw_header(self, context):
81 layout.itemR(world.mist, "enabled", text="")
83 def draw(self, context):
87 layout.active = world.mist.enabled
89 flow = layout.column_flow()
90 flow.itemR(world.mist, "start")
91 flow.itemR(world.mist, "depth")
92 flow.itemR(world.mist, "height")
93 flow.itemR(world.mist, "intensity")
95 col.itemL(text="Fallof:")
96 col.row().itemR(world.mist, "falloff", expand=True)
98 class WORLD_PT_stars(WorldButtonsPanel):
101 def draw_header(self, context):
103 world = context.world
105 layout.itemR(world.stars, "enabled", text="")
107 def draw(self, context):
109 world = context.world
111 layout.active = world.stars.enabled
113 flow = layout.column_flow()
114 flow.itemR(world.stars, "size")
115 flow.itemR(world.stars, "min_distance", text="Min. Dist")
116 flow.itemR(world.stars, "average_separation", text="Separation")
117 flow.itemR(world.stars, "color_randomization", text="Random")
119 class WORLD_PT_ambient_occlusion(WorldButtonsPanel):
120 __label__ = "Ambient Occlusion"
122 def draw_header(self, context):
124 world = context.world
126 layout.itemR(world.ambient_occlusion, "enabled", text="")
128 def draw(self, context):
130 ao = context.world.ambient_occlusion
132 layout.active = ao.enabled
134 layout.itemR(ao, "gather_method", expand=True)
136 if ao.gather_method == 'RAYTRACE':
137 split = layout.split()
140 col.itemR(ao, "samples")
141 col.itemR(ao, "distance")
144 col.itemR(ao, "falloff")
145 colsub = col.column()
146 colsub.active = ao.falloff
147 colsub.itemR(ao, "strength")
149 layout.itemR(ao, "sample_method")
150 if ao.sample_method == 'ADAPTIVE_QMC':
152 row.itemR(ao, "threshold")
153 row.itemR(ao, "adapt_to_speed")
155 if ao.sample_method == 'CONSTANT_JITTERED':
157 row.itemR(ao, "bias")
159 if ao.gather_method == 'APPROXIMATE':
160 split = layout.split()
163 col.itemR(ao, "passes")
164 col.itemR(ao, "error_tolerance", text="Error")
165 col.itemR(ao, "correction")
168 col.itemR(ao, "falloff")
169 colsub = col.column()
170 colsub.active = ao.falloff
171 colsub.itemR(ao, "strength")
172 col.itemR(ao, "pixel_cache")
174 col = layout.column()
175 col.row().itemR(ao, "blend_mode", expand=True)
176 col.row().itemR(ao, "color", expand=True)
177 col.itemR(ao, "energy")
179 class WORLD_PT_game(WorldButtonsPanel):
180 __label__ = "Game Settings"
182 def draw(self, context):
184 world = context.world
186 flow = layout.column_flow()
187 flow.itemR(world, "physics_engine")
188 flow.itemR(world, "physics_gravity")
190 flow.itemR(world, "game_fps")
191 flow.itemR(world, "game_logic_step_max")
192 flow.itemR(world, "game_physics_substep")
193 flow.itemR(world, "game_physics_step_max")
195 flow.itemR(world, "game_use_occlusion_culling", text="Enable Occlusion Culling")
196 flow.itemR(world, "game_occlusion_culling_resolution")
199 bpy.types.register(WORLD_PT_context_world)
200 bpy.types.register(WORLD_PT_preview)
201 bpy.types.register(WORLD_PT_world)
202 bpy.types.register(WORLD_PT_ambient_occlusion)
203 bpy.types.register(WORLD_PT_mist)
204 bpy.types.register(WORLD_PT_stars)
205 bpy.types.register(WORLD_PT_color_correction)
206 bpy.types.register(WORLD_PT_game)