renamed buttons ui files to properties to match UI name change, needed to update...
[blender-staging.git] / release / scripts / ui / properties_physics_common.py
1 import bpy
2
3 def point_cache_ui(self, cache, enabled, particles, smoke):
4     layout = self.layout
5     layout.set_context_pointer("PointCache", cache)
6
7     row = layout.row()
8     row.template_list(cache, "point_cache_list", cache, "active_point_cache_index", rows=2 )
9     col = row.column(align=True)
10     col.itemO("ptcache.add_new", icon='ICON_ZOOMIN', text="")
11     col.itemO("ptcache.remove", icon='ICON_ZOOMOUT', text="")
12
13     row = layout.row()
14     row.itemL(text="File Name:")
15     if particles:
16         row.itemR(cache, "external")
17
18     if cache.external:
19         split = layout.split(percentage=0.80)
20         split.itemR(cache, "name", text="")
21         split.itemR(cache, "index", text="")
22
23         layout.itemL(text="File Path:")
24         layout.itemR(cache, "filepath", text="")
25
26         layout.itemL(text=cache.info)
27     else:
28         layout.itemR(cache, "name", text="")
29
30         if not particles:
31             row = layout.row()
32             row.enabled = enabled
33             row.itemR(cache, "start_frame")
34             row.itemR(cache, "end_frame")
35
36         row = layout.row()
37
38         if cache.baked == True:
39             row.itemO("ptcache.free_bake", text="Free Bake")
40         else:
41             row.item_booleanO("ptcache.bake", "bake", True, text="Bake")
42
43         sub = row.row()
44         sub.enabled = (cache.frames_skipped or cache.outdated) and enabled
45         sub.itemO("ptcache.bake", "bake", False, text="Calculate to Current Frame")
46
47         row = layout.row()
48         row.enabled = enabled
49         row.itemO("ptcache.bake_from_cache", text="Current Cache to Bake")
50         if not smoke:
51             row.itemR(cache, "step");
52
53         if not smoke:
54             row = layout.row()
55             sub = row.row()
56             sub.enabled = enabled
57             sub.itemR(cache, "quick_cache")
58             row.itemR(cache, "disk_cache")
59
60         layout.itemL(text=cache.info)
61
62         layout.itemS()
63
64         row = layout.row()
65         row.item_booleanO("ptcache.bake_all", "bake", True, text="Bake All Dynamics")
66         row.itemO("ptcache.free_bake_all", text="Free All Bakes")
67         layout.itemO("ptcache.bake_all", "bake", False, text="Update All Dynamics to current frame")
68
69 def effector_weights_ui(self, weights):
70         layout = self.layout
71
72         layout.itemR(weights, "group")
73
74         split = layout.split()
75         split.itemR(weights, "gravity", slider=True)
76         split.itemR(weights, "all", slider=True)
77
78         layout.itemS()
79
80         flow = layout.column_flow()
81         flow.itemR(weights, "force", slider=True)
82         flow.itemR(weights, "vortex", slider=True)
83         flow.itemR(weights, "magnetic", slider=True)
84         flow.itemR(weights, "wind", slider=True)
85         flow.itemR(weights, "curveguide", slider=True)
86         flow.itemR(weights, "texture", slider=True)
87         flow.itemR(weights, "harmonic", slider=True)
88         flow.itemR(weights, "charge", slider=True)
89         flow.itemR(weights, "lennardjones", slider=True)
90         flow.itemR(weights, "turbulence", slider=True)
91         flow.itemR(weights, "drag", slider=True)
92         flow.itemR(weights, "boid", slider=True)
93
94 def basic_force_field_settings_ui(self, field):
95     layout = self.layout
96     split = layout.split()
97
98     if not field or field.type == 'NONE':
99         return
100
101     col = split.column()
102
103     if field.type == 'DRAG':
104         col.itemR(field, "linear_drag", text="Linear")
105     else:
106         col.itemR(field, "strength")
107
108     if field.type == 'TURBULENCE':
109         col.itemR(field, "size")
110         col.itemR(field, "flow")
111     elif field.type == 'HARMONIC':
112         col.itemR(field, "harmonic_damping", text="Damping")
113     elif field.type == 'VORTEX' and field.shape != 'POINT':
114         col.itemR(field, "inflow")
115     elif field.type == 'DRAG':
116         col.itemR(field, "quadratic_drag", text="Quadratic")
117     else:
118         col.itemR(field, "flow")
119
120     col = split.column()
121     col.itemR(field, "noise")
122     col.itemR(field, "seed")
123     if field.type == 'TURBULENCE':
124         col.itemR(field, "global_coordinates", text="Global")
125
126     split = layout.split()
127
128     col = split.column()
129     col.itemL(text="Effect point:")
130     col.itemR(field, "do_location")
131     col.itemR(field, "do_rotation")
132
133     sub = split.column()
134     sub.itemL(text="Collision:")
135     sub.itemR(field, "do_absorption")
136
137
138 def basic_force_field_falloff_ui(self, field):
139     layout = self.layout
140     split = layout.split(percentage=0.35)
141
142     if not field or field.type == 'NONE':
143         return
144
145     col = split.column()
146     col.itemR(field, "z_direction", text="")
147     col.itemR(field, "use_min_distance", text="Use Minimum")
148     col.itemR(field, "use_max_distance", text="Use Maximum")
149
150     col = split.column()
151     col.itemR(field, "falloff_power", text="Power")
152
153     sub = col.column()
154     sub.active = field.use_min_distance
155     sub.itemR(field, "minimum_distance", text="Distance")
156
157     sub = col.column()
158     sub.active = field.use_max_distance
159     sub.itemR(field, "maximum_distance", text="Distance")