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