2.5 Smoke:
[blender.git] / release / ui / buttons_physics_smoke.py
1
2 import bpy
3
4 class PhysicButtonsPanel(bpy.types.Panel):
5         __space_type__ = "BUTTONS_WINDOW"
6         __region_type__ = "WINDOW"
7         __context__ = "physics"
8
9         def poll(self, context):
10                 ob = context.object
11                 rd = context.scene.render_data
12                 return (ob and ob.type == 'MESH') and (not rd.use_game_engine)
13                 
14 class PHYSICS_PT_smoke(PhysicButtonsPanel):
15         __label__ = "Smoke"
16
17         def draw(self, context):
18                 layout = self.layout
19                 
20                 md = context.smoke
21                 ob = context.object
22
23                 split = layout.split()
24                 split.operator_context = 'EXEC_DEFAULT'
25
26                 if md:
27                         # remove modifier + settings
28                         split.set_context_pointer("modifier", md)
29                         split.itemO("object.modifier_remove", text="Remove")
30
31                         row = split.row(align=True)
32                         row.itemR(md, "render", text="")
33                         row.itemR(md, "realtime", text="")
34                         
35                 else:
36                         # add modifier
37                         split.item_enumO("object.modifier_add", "type", 'SMOKE', text="Add")
38                         split.itemL()
39
40                 if md:
41                         layout.itemR(md, "smoke_type")
42                 
43                         if md.smoke_type == 'TYPE_DOMAIN':
44                                 layout.itemS()
45                                 layout.itemR(md.domain_settings, "maxres")
46                                 layout.itemR(md.domain_settings, "color")
47                                 layout.itemR(md.domain_settings, "amplify")
48                                 layout.itemR(md.domain_settings, "highres")
49                                 layout.itemR(md.domain_settings, "noise_type")
50                                 layout.itemR(md.domain_settings, "visibility")
51                                 layout.itemR(md.domain_settings, "alpha")
52                                 layout.itemR(md.domain_settings, "beta")
53                                 layout.itemR(md.domain_settings, "fluid_group")
54                                 layout.itemR(md.domain_settings, "eff_group")
55                                 layout.itemR(md.domain_settings, "coll_group")
56                         elif md.smoke_type == 'TYPE_FLOW':
57                                 layout.itemS()
58                                 layout.itemR(md.flow_settings, "outflow")
59                                 layout.itemR(md.flow_settings, "density")
60                                 layout.itemR(md.flow_settings, "temperature")
61                                 layout.item_pointerR(md.flow_settings, "psys", ob, "particle_systems")
62                         elif md.smoke_type == 'TYPE_COLL':
63                                 layout.itemS()
64
65 bpy.types.register(PHYSICS_PT_smoke)