smoke gui: refining the new simulation panel ui
[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                                 
45                                 split = layout.split()
46                                 
47                                 col = split.column()
48                                 col.itemL(text="Behavior:")
49                                 col.itemR(md.domain_settings, "alpha")
50                                 col.itemR(md.domain_settings, "beta")
51                                 
52                                 col.itemL(text="Resolution:")
53                                 col.itemR(md.domain_settings, "maxres", text="Low")
54                                 sub = col.column()
55                                 sub.active = md.domain_settings.highres
56                                 sub.itemR(md.domain_settings, "amplify", text="High")
57                                 col.itemR(md.domain_settings, "highres", text="Use High Resolution")
58                                 
59                                 sub = split.column()
60                                 sub.itemL(text="Display:")
61                                 sub.itemR(md.domain_settings, "visibility")
62                                 sub.itemR(md.domain_settings, "color")
63                                 
64                                 layout.itemL(text="Noise Type:")
65                                 layout.itemR(md.domain_settings, "noise_type", expand=True)
66                                 
67                                 split = layout.split()
68                                 
69                                 col = split.column()
70                                 col.itemL(text="Flow Group:")
71                                 col.itemR(md.domain_settings, "fluid_group", text="")
72                                 
73                                 #col.itemL(text="Effector Group:")
74                                 #col.itemR(md.domain_settings, "eff_group", text="")
75                                 
76                                 col = split.column()
77                                 col.itemL(text="Collision Group:")
78                                 col.itemR(md.domain_settings, "coll_group", text="")
79                                 
80                         elif md.smoke_type == 'TYPE_FLOW':
81                                 
82                                 layout.itemR(md.flow_settings, "outflow")
83                                 
84                                 split = layout.split()
85                                 
86                                 if md.flow_settings.outflow:                            
87                                         col = split.column()
88                                 else:
89                                         col = split.column()
90                                         col.itemL(text="Behavior:")
91                                         col.itemR(md.flow_settings, "temperature")
92                                         col.itemR(md.flow_settings, "density")
93                                 
94                                         sub = split.column()
95                                         sub.itemL(text="particle System:")
96                                         sub.item_pointerR(md.flow_settings, "psys", ob, "particle_systems", text="")
97                                         
98                         elif md.smoke_type == 'TYPE_COLL':
99                                 layout.itemS()
100
101 bpy.types.register(PHYSICS_PT_smoke)