whitespace commit, (was some tabs mixed with spaces too)
[blender.git] / release / scripts / ui / properties_particle.py
1 # ##### BEGIN GPL LICENSE BLOCK #####
2 #
3 #  This program is free software; you can redistribute it and/or
4 #  modify it under the terms of the GNU General Public License
5 #  as published by the Free Software Foundation; either version 2
6 #  of the License, or (at your option) any later version.
7 #
8 #  This program is distributed in the hope that it will be useful,
9 #  but WITHOUT ANY WARRANTY; without even the implied warranty of
10 #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11 #  GNU General Public License for more details.
12 #
13 #  You should have received a copy of the GNU General Public License
14 #  along with this program; if not, write to the Free Software Foundation,
15 #  Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
16 #
17 # ##### END GPL LICENSE BLOCK #####
18
19 # <pep8 compliant>
20 import bpy
21
22 from properties_physics_common import point_cache_ui
23 from properties_physics_common import effector_weights_ui
24 from properties_physics_common import basic_force_field_settings_ui
25 from properties_physics_common import basic_force_field_falloff_ui
26
27
28 def particle_panel_enabled(context, psys):
29     return psys.point_cache.baked == False and psys.edited == False and (not context.particle_system_editable)
30
31
32 def particle_panel_poll(context):
33     psys = context.particle_system
34     if psys == None:
35         return False
36     if psys.settings == None:
37         return False
38     return psys.settings.type in ('EMITTER', 'REACTOR', 'HAIR')
39
40
41 class ParticleButtonsPanel(bpy.types.Panel):
42     bl_space_type = 'PROPERTIES'
43     bl_region_type = 'WINDOW'
44     bl_context = "particle"
45
46     def poll(self, context):
47         return particle_panel_poll(context)
48
49
50 class PARTICLE_PT_particles(ParticleButtonsPanel):
51     bl_label = ""
52     bl_show_header = False
53
54     def poll(self, context):
55         return (context.particle_system or context.object)
56
57     def draw(self, context):
58         layout = self.layout
59
60         ob = context.object
61         psys = context.particle_system
62
63         if ob:
64             row = layout.row()
65
66             row.template_list(ob, "particle_systems", ob, "active_particle_system_index", rows=2)
67
68             col = row.column(align=True)
69             col.itemO("object.particle_system_add", icon='ICON_ZOOMIN', text="")
70             col.itemO("object.particle_system_remove", icon='ICON_ZOOMOUT', text="")
71
72         if psys and not psys.settings:
73             split = layout.split(percentage=0.32)
74
75             col = split.column()
76             col.itemL(text="Name:")
77             col.itemL(text="Settings:")
78
79             col = split.column()
80             col.itemR(psys, "name", text="")
81             col.template_ID(psys, "settings", new="particle.new")
82         elif psys:
83             part = psys.settings
84
85             split = layout.split(percentage=0.32)
86             col = split.column()
87             col.itemL(text="Name:")
88             if part.type in ('EMITTER', 'REACTOR', 'HAIR'):
89                 col.itemL(text="Settings:")
90                 col.itemL(text="Type:")
91
92             col = split.column()
93             col.itemR(psys, "name", text="")
94             if part.type in ('EMITTER', 'REACTOR', 'HAIR'):
95                 col.template_ID(psys, "settings", new="particle.new")
96
97             #row = layout.row()
98             #row.itemL(text="Viewport")
99             #row.itemL(text="Render")
100
101             if part:
102                 if part.type not in ('EMITTER', 'REACTOR', 'HAIR'):
103                     layout.itemL(text="No settings for fluid particles")
104                     return
105
106                 row = col.row()
107                 row.enabled = particle_panel_enabled(context, psys)
108                 row.itemR(part, "type", text="")
109                 row.itemR(psys, "seed")
110
111                 split = layout.split(percentage=0.65)
112                 if part.type == 'HAIR':
113                     if psys.edited == True:
114                         split.itemO("particle.edited_clear", text="Free Edit")
115                     else:
116                         split.itemL(text="")
117                     row = split.row()
118                     row.enabled = particle_panel_enabled(context, psys)
119                     row.itemR(part, "hair_step")
120                     if psys.edited == True:
121                         if psys.global_hair:
122                             layout.itemO("particle.connect_hair")
123                             layout.itemL(text="Hair is disconnected.")
124                         else:
125                             layout.itemO("particle.disconnect_hair")
126                             layout.itemL(text="")
127                 elif part.type == 'REACTOR':
128                     split.enabled = particle_panel_enabled(context, psys)
129                     split.itemR(psys, "reactor_target_object")
130                     split.itemR(psys, "reactor_target_particle_system", text="Particle System")
131
132
133 class PARTICLE_PT_emission(ParticleButtonsPanel):
134     bl_label = "Emission"
135
136     def poll(self, context):
137         if particle_panel_poll(context):
138             return not context.particle_system.point_cache.external
139         else:
140             return False
141
142     def draw(self, context):
143         layout = self.layout
144
145         psys = context.particle_system
146         part = psys.settings
147
148         layout.enabled = particle_panel_enabled(context, psys) and not psys.multiple_caches
149
150         row = layout.row()
151         row.active = part.distribution != 'GRID'
152         row.itemR(part, "amount")
153
154         if part.type != 'HAIR':
155             split = layout.split()
156
157             col = split.column(align=True)
158             col.itemR(part, "start")
159             col.itemR(part, "end")
160
161             col = split.column(align=True)
162             col.itemR(part, "lifetime")
163             col.itemR(part, "random_lifetime", slider=True)
164
165         layout.row().itemL(text="Emit From:")
166
167         row = layout.row()
168         row.itemR(part, "emit_from", expand=True)
169         row = layout.row()
170         row.itemR(part, "trand")
171         if part.distribution != 'GRID':
172             row.itemR(part, "even_distribution")
173
174         if part.emit_from == 'FACE' or part.emit_from == 'VOLUME':
175             row = layout.row()
176             row.itemR(part, "distribution", expand=True)
177
178             row = layout.row()
179
180             if part.distribution == 'JIT':
181                 row.itemR(part, "userjit", text="Particles/Face")
182                 row.itemR(part, "jitter_factor", text="Jittering Amount", slider=True)
183             elif part.distribution == 'GRID':
184                 row.itemR(part, "grid_resolution")
185
186
187 class PARTICLE_PT_hair_dynamics(ParticleButtonsPanel):
188     bl_label = "Hair dynamics"
189     bl_default_closed = True
190
191     def poll(self, context):
192         psys = context.particle_system
193         if psys == None:
194             return False
195         if psys.settings == None:
196             return False
197         return psys.settings.type == 'HAIR'
198
199     def draw_header(self, context):
200         #cloth = context.cloth.collision_settings
201
202         #self.layout.active = cloth_panel_enabled(context.cloth)
203         #self.layout.itemR(cloth, "enable_collision", text="")
204         psys = context.particle_system
205         self.layout.itemR(psys, "hair_dynamics", text="")
206
207     def draw(self, context):
208         layout = self.layout
209
210         psys = context.particle_system
211         part = psys.settings
212         cloth = psys.cloth.settings
213
214         layout.enabled = psys.hair_dynamics
215
216         split = layout.split()
217
218         col = split.column()
219         col.itemL(text="Material:")
220         sub = col.column(align=True)
221         sub.itemR(cloth, "pin_stiffness", text="Stiffness")
222         sub.itemR(cloth, "mass")
223         sub.itemR(cloth, "bending_stiffness", text="Bending")
224         sub.itemR(cloth, "internal_friction", slider="True")
225
226         col = split.column()
227
228         col.itemL(text="Damping:")
229         sub = col.column(align=True)
230         sub.itemR(cloth, "spring_damping", text="Spring")
231         sub.itemR(cloth, "air_damping", text="Air")
232
233         col.itemL(text="Quality:")
234         col.itemR(cloth, "quality", text="Steps", slider=True)
235
236
237 class PARTICLE_PT_cache(ParticleButtonsPanel):
238     bl_label = "Cache"
239     bl_default_closed = True
240
241     def poll(self, context):
242         psys = context.particle_system
243         if psys == None:
244             return False
245         if psys.settings == None:
246             return False
247         phystype = psys.settings.physics_type
248         if phystype == 'NO' or phystype == 'KEYED':
249             return False
250         return psys.settings.type in ('EMITTER', 'REACTOR') or (psys.settings.type == 'HAIR' and psys.hair_dynamics)
251
252     def draw(self, context):
253         layout = self.layout
254
255         psys = context.particle_system
256
257         point_cache_ui(self, psys.point_cache, particle_panel_enabled(context, psys), not psys.hair_dynamics, 0)
258
259
260 class PARTICLE_PT_velocity(ParticleButtonsPanel):
261     bl_label = "Velocity"
262
263     def poll(self, context):
264         if particle_panel_poll(context):
265             psys = context.particle_system
266             return psys.settings.physics_type != 'BOIDS' and not psys.point_cache.external
267         else:
268             return False
269
270     def draw(self, context):
271         layout = self.layout
272
273         psys = context.particle_system
274         part = psys.settings
275
276         layout.enabled = particle_panel_enabled(context, psys)
277
278         split = layout.split()
279
280         sub = split.column()
281         sub.itemL(text="Emitter Geometry:")
282         sub.itemR(part, "normal_factor")
283         subsub = sub.column(align=True)
284         subsub.itemR(part, "tangent_factor")
285         subsub.itemR(part, "tangent_phase", slider=True)
286
287         sub = split.column()
288         sub.itemL(text="Emitter Object")
289         sub.itemR(part, "object_aligned_factor", text="")
290
291         layout.row().itemL(text="Other:")
292         split = layout.split()
293         sub = split.column()
294         if part.emit_from == 'PARTICLE':
295             sub.itemR(part, "particle_factor")
296         else:
297             sub.itemR(part, "object_factor", slider=True)
298         sub = split.column()
299         sub.itemR(part, "random_factor")
300
301         #if part.type=='REACTOR':
302         #       sub.itemR(part, "reactor_factor")
303         #       sub.itemR(part, "reaction_shape", slider=True)
304
305
306 class PARTICLE_PT_rotation(ParticleButtonsPanel):
307     bl_label = "Rotation"
308
309     def poll(self, context):
310         if particle_panel_poll(context):
311             psys = context.particle_system
312             return psys.settings.physics_type != 'BOIDS' and not psys.point_cache.external
313         else:
314             return False
315
316     def draw(self, context):
317         layout = self.layout
318
319         psys = context.particle_system
320         part = psys.settings
321
322         layout.enabled = particle_panel_enabled(context, psys)
323
324         split = layout.split()
325         split.itemL(text="Initial Rotation:")
326         split.itemR(part, "rotation_dynamic")
327         split = layout.split()
328
329         sub = split.column(align=True)
330         sub.itemR(part, "rotation_mode", text="")
331         sub.itemR(part, "random_rotation_factor", slider=True, text="Random")
332
333         sub = split.column(align=True)
334         sub.itemR(part, "phase_factor", slider=True)
335         sub.itemR(part, "random_phase_factor", text="Random", slider=True)
336
337         layout.row().itemL(text="Angular Velocity:")
338         layout.row().itemR(part, "angular_velocity_mode", expand=True)
339         split = layout.split()
340
341         sub = split.column()
342
343         sub.itemR(part, "angular_velocity_factor", text="")
344
345
346 class PARTICLE_PT_physics(ParticleButtonsPanel):
347     bl_label = "Physics"
348
349     def poll(self, context):
350         if particle_panel_poll(context):
351             return not context.particle_system.point_cache.external
352         else:
353             return False
354
355     def draw(self, context):
356         layout = self.layout
357
358         psys = context.particle_system
359         part = psys.settings
360
361         layout.enabled = particle_panel_enabled(context, psys)
362
363         row = layout.row()
364         row.itemR(part, "physics_type", expand=True)
365         if part.physics_type != 'NO':
366             row = layout.row()
367             col = row.column(align=True)
368             col.itemR(part, "particle_size")
369             col.itemR(part, "random_size", slider=True)
370             col = row.column(align=True)
371             col.itemR(part, "mass")
372             col.itemR(part, "sizemass", text="Multiply mass with size")
373
374         if part.physics_type == 'NEWTON':
375             split = layout.split()
376             sub = split.column()
377
378             sub.itemL(text="Forces:")
379             sub.itemR(part, "brownian_factor")
380             sub.itemR(part, "drag_factor", slider=True)
381             sub.itemR(part, "damp_factor", slider=True)
382             sub = split.column()
383             sub.itemR(part, "size_deflect")
384             sub.itemR(part, "die_on_collision")
385             sub.itemR(part, "integrator")
386             sub.itemR(part, "time_tweak")
387
388         elif part.physics_type == 'KEYED':
389             split = layout.split()
390             sub = split.column()
391
392             row = layout.row()
393             col = row.column()
394             col.active = not psys.keyed_timing
395             col.itemR(part, "keyed_loops", text="Loops")
396             row.itemR(psys, "keyed_timing", text="Use Timing")
397
398             layout.itemL(text="Keys:")
399         elif part.physics_type == 'BOIDS':
400             boids = part.boids
401
402
403             row = layout.row()
404             row.itemR(boids, "allow_flight")
405             row.itemR(boids, "allow_land")
406             row.itemR(boids, "allow_climb")
407
408             split = layout.split()
409
410             sub = split.column()
411             col = sub.column(align=True)
412             col.active = boids.allow_flight
413             col.itemR(boids, "air_max_speed")
414             col.itemR(boids, "air_min_speed", slider="True")
415             col.itemR(boids, "air_max_acc", slider="True")
416             col.itemR(boids, "air_max_ave", slider="True")
417             col.itemR(boids, "air_personal_space")
418             row = col.row()
419             row.active = (boids.allow_land or boids.allow_climb) and boids.allow_flight
420             row.itemR(boids, "landing_smoothness")
421
422             sub = split.column()
423             col = sub.column(align=True)
424             col.active = boids.allow_land or boids.allow_climb
425             col.itemR(boids, "land_max_speed")
426             col.itemR(boids, "land_jump_speed")
427             col.itemR(boids, "land_max_acc", slider="True")
428             col.itemR(boids, "land_max_ave", slider="True")
429             col.itemR(boids, "land_personal_space")
430             col.itemR(boids, "land_stick_force")
431
432             row = layout.row()
433
434             col = row.column(align=True)
435             col.itemL(text="Battle:")
436             col.itemR(boids, "health")
437             col.itemR(boids, "strength")
438             col.itemR(boids, "aggression")
439             col.itemR(boids, "accuracy")
440             col.itemR(boids, "range")
441
442             col = row.column()
443             col.itemL(text="Misc:")
444             col.itemR(boids, "banking", slider=True)
445             col.itemR(boids, "height", slider=True)
446
447         if part.physics_type == 'KEYED' or part.physics_type == 'BOIDS':
448             if part.physics_type == 'BOIDS':
449                 layout.itemL(text="Relations:")
450
451             row = layout.row()
452             row.template_list(psys, "targets", psys, "active_particle_target_index")
453
454             col = row.column()
455             sub = col.row()
456             subsub = sub.column(align=True)
457             subsub.itemO("particle.new_target", icon='ICON_ZOOMIN', text="")
458             subsub.itemO("particle.remove_target", icon='ICON_ZOOMOUT', text="")
459             sub = col.row()
460             subsub = sub.column(align=True)
461             subsub.itemO("particle.target_move_up", icon='VICON_MOVE_UP', text="")
462             subsub.itemO("particle.target_move_down", icon='VICON_MOVE_DOWN', text="")
463
464             key = psys.active_particle_target
465             if key:
466                 row = layout.row()
467                 if part.physics_type == 'KEYED':
468                     col = row.column()
469                     #doesn't work yet
470                     #col.red_alert = key.valid
471                     col.itemR(key, "object", text="")
472                     col.itemR(key, "system", text="System")
473                     col = row.column()
474                     col.active = psys.keyed_timing
475                     col.itemR(key, "time")
476                     col.itemR(key, "duration")
477                 else:
478                     sub = row.row()
479                     #doesn't work yet
480                     #subrow.red_alert = key.valid
481                     sub.itemR(key, "object", text="")
482                     sub.itemR(key, "system", text="System")
483
484                     layout.itemR(key, "mode", expand=True)
485
486
487 class PARTICLE_PT_boidbrain(ParticleButtonsPanel):
488     bl_label = "Boid Brain"
489
490     def poll(self, context):
491         psys = context.particle_system
492         if psys == None:
493             return False
494         if psys.settings == None:
495             return False
496         if psys.point_cache.external:
497             return False
498         return psys.settings.physics_type == 'BOIDS'
499
500     def draw(self, context):
501         layout = self.layout
502
503         boids = context.particle_system.settings.boids
504
505         layout.enabled = particle_panel_enabled(context, context.particle_system)
506
507         # Currently boids can only use the first state so these are commented out for now.
508         #row = layout.row()
509         #row.template_list(boids, "states", boids, "active_boid_state_index", compact="True")
510         #col = row.row()
511         #subrow = col.row(align=True)
512         #subrow.itemO("boid.state_add", icon='ICON_ZOOMIN', text="")
513         #subrow.itemO("boid.state_del", icon='ICON_ZOOMOUT', text="")
514         #subrow = row.row(align=True)
515         #subrow.itemO("boid.state_move_up", icon='VICON_MOVE_UP', text="")
516         #subrow.itemO("boid.state_move_down", icon='VICON_MOVE_DOWN', text="")
517
518         state = boids.active_boid_state
519
520         #layout.itemR(state, "name", text="State name")
521
522         row = layout.row()
523         row.itemR(state, "ruleset_type")
524         if state.ruleset_type == 'FUZZY':
525             row.itemR(state, "rule_fuzziness", slider=True)
526         else:
527             row.itemL(text="")
528
529         row = layout.row()
530         row.template_list(state, "rules", state, "active_boid_rule_index")
531
532         col = row.column()
533         sub = col.row()
534         subsub = sub.column(align=True)
535         subsub.item_menu_enumO("boid.rule_add", "type", icon='ICON_ZOOMIN', text="")
536         subsub.itemO("boid.rule_del", icon='ICON_ZOOMOUT', text="")
537         sub = col.row()
538         subcol = sub.column(align=True)
539         subsub.itemO("boid.rule_move_up", icon='VICON_MOVE_UP', text="")
540         subsub.itemO("boid.rule_move_down", icon='VICON_MOVE_DOWN', text="")
541
542         rule = state.active_boid_rule
543
544         if rule:
545             row = layout.row()
546             row.itemR(rule, "name", text="")
547             #somebody make nice icons for boids here please! -jahka
548             row.itemR(rule, "in_air", icon='VICON_MOVE_UP', text="")
549             row.itemR(rule, "on_land", icon='VICON_MOVE_DOWN', text="")
550
551             row = layout.row()
552
553             if rule.type == 'GOAL':
554                 row.itemR(rule, "object")
555                 row = layout.row()
556                 row.itemR(rule, "predict")
557             elif rule.type == 'AVOID':
558                 row.itemR(rule, "object")
559                 row = layout.row()
560                 row.itemR(rule, "predict")
561                 row.itemR(rule, "fear_factor")
562             elif rule.type == 'FOLLOW_PATH':
563                 row.itemL(text="Not yet functional.")
564             elif rule.type == 'AVOID_COLLISION':
565                 row.itemR(rule, "boids")
566                 row.itemR(rule, "deflectors")
567                 row.itemR(rule, "look_ahead")
568             elif rule.type == 'FOLLOW_LEADER':
569                 row.itemR(rule, "object", text="")
570                 row.itemR(rule, "distance")
571                 row = layout.row()
572                 row.itemR(rule, "line")
573                 subrow = row.row()
574                 subrow.active = rule.line
575                 subrow.itemR(rule, "queue_size")
576             elif rule.type == 'AVERAGE_SPEED':
577                 row.itemR(rule, "speed", slider=True)
578                 row.itemR(rule, "wander", slider=True)
579                 row.itemR(rule, "level", slider=True)
580             elif rule.type == 'FIGHT':
581                 row.itemR(rule, "distance")
582                 row.itemR(rule, "flee_distance")
583
584
585 class PARTICLE_PT_render(ParticleButtonsPanel):
586     bl_label = "Render"
587
588     def poll(self, context):
589         psys = context.particle_system
590         if psys == None:
591             return False
592         if psys.settings == None:
593             return False
594         return True
595
596     def draw(self, context):
597         layout = self.layout
598
599         psys = context.particle_system
600         part = psys.settings
601
602         row = layout.row()
603         row.itemR(part, "material")
604         row.itemR(psys, "parent")
605
606         split = layout.split()
607
608         sub = split.column()
609         sub.itemR(part, "emitter")
610         sub.itemR(part, "parent")
611         sub = split.column()
612         sub.itemR(part, "unborn")
613         sub.itemR(part, "died")
614
615         row = layout.row()
616         row.itemR(part, "ren_as", expand=True)
617
618         split = layout.split()
619
620         sub = split.column()
621
622         if part.ren_as == 'LINE':
623             sub.itemR(part, "line_length_tail")
624             sub.itemR(part, "line_length_head")
625             sub = split.column()
626             sub.itemR(part, "velocity_length")
627         elif part.ren_as == 'PATH':
628
629             if part.type != 'HAIR' and part.physics_type != 'KEYED' and psys.point_cache.baked == False:
630                 box = layout.box()
631                 box.itemL(text="Baked or keyed particles needed for correct rendering.")
632                 return
633
634             sub.itemR(part, "render_strand")
635             subsub = sub.column()
636             subsub.active = part.render_strand == False
637             subsub.itemR(part, "render_adaptive")
638             subsub = sub.column()
639             subsub.active = part.render_adaptive or part.render_strand == True
640             subsub.itemR(part, "adaptive_angle")
641             subsub = sub.column()
642             subsub.active = part.render_adaptive == True and part.render_strand == False
643             subsub.itemR(part, "adaptive_pix")
644             sub.itemR(part, "hair_bspline")
645             sub.itemR(part, "render_step", text="Steps")
646
647             sub = split.column()
648             sub.itemL(text="Timing:")
649             sub.itemR(part, "abs_path_time")
650             sub.itemR(part, "path_start", text="Start", slider=not part.abs_path_time)
651             sub.itemR(part, "path_end", text="End", slider=not part.abs_path_time)
652             sub.itemR(part, "random_length", text="Random", slider=True)
653
654             row = layout.row()
655             col = row.column()
656
657             if part.type == 'HAIR' and part.render_strand == True and part.child_type == 'FACES':
658                 layout.itemR(part, "enable_simplify")
659                 if part.enable_simplify == True:
660                     row = layout.row()
661                     row.itemR(part, "simplify_refsize")
662                     row.itemR(part, "simplify_rate")
663                     row.itemR(part, "simplify_transition")
664                     row = layout.row()
665                     row.itemR(part, "viewport")
666                     sub = row.row()
667                     sub.active = part.viewport == True
668                     sub.itemR(part, "simplify_viewport")
669
670         elif part.ren_as == 'OBJECT':
671             sub.itemR(part, "dupli_object")
672             sub.itemR(part, "use_global_dupli")
673         elif part.ren_as == 'GROUP':
674             sub.itemR(part, "dupli_group")
675             split = layout.split()
676             sub = split.column()
677             sub.itemR(part, "whole_group")
678             subsub = sub.column()
679             subsub.active = part.whole_group == False
680             subsub.itemR(part, "use_group_count")
681
682             sub = split.column()
683             subsub = sub.column()
684             subsub.active = part.whole_group == False
685             subsub.itemR(part, "use_global_dupli")
686             subsub.itemR(part, "rand_group")
687
688             if part.use_group_count and not part.whole_group:
689                 row = layout.row()
690                 row.template_list(part, "dupliweights", part, "active_dupliweight_index")
691
692                 col = row.column()
693                 sub = col.row()
694                 subsub = sub.column(align=True)
695                 subsub.itemO("particle.dupliob_copy", icon='ICON_ZOOMIN', text="")
696                 subsub.itemO("particle.dupliob_remove", icon='ICON_ZOOMOUT', text="")
697                 subsub.itemO("particle.dupliob_move_up", icon='VICON_MOVE_UP', text="")
698                 subsub.itemO("particle.dupliob_move_down", icon='VICON_MOVE_DOWN', text="")
699
700                 weight = part.active_dupliweight
701                 if weight:
702                     row = layout.row()
703                     row.itemR(weight, "count")
704
705         elif part.ren_as == 'BILLBOARD':
706             sub.itemL(text="Align:")
707
708             row = layout.row()
709             row.itemR(part, "billboard_align", expand=True)
710             row.itemR(part, "billboard_lock", text="Lock")
711             row = layout.row()
712             row.itemR(part, "billboard_object")
713
714             row = layout.row()
715             col = row.column(align=True)
716             col.itemL(text="Tilt:")
717             col.itemR(part, "billboard_tilt", text="Angle", slider=True)
718             col.itemR(part, "billboard_random_tilt", slider=True)
719             col = row.column()
720             col.itemR(part, "billboard_offset")
721
722             row = layout.row()
723             row.itemR(psys, "billboard_normal_uv")
724             row = layout.row()
725             row.itemR(psys, "billboard_time_index_uv")
726
727             row = layout.row()
728             row.itemL(text="Split uv's:")
729             row.itemR(part, "billboard_uv_split", text="Number of splits")
730             row = layout.row()
731             row.itemR(psys, "billboard_split_uv")
732             row = layout.row()
733             row.itemL(text="Animate:")
734             row.itemR(part, "billboard_animation", expand=True)
735             row.itemL(text="Offset:")
736             row.itemR(part, "billboard_split_offset", expand=True)
737
738         if part.ren_as == 'HALO' or part.ren_as == 'LINE' or part.ren_as == 'BILLBOARD':
739             row = layout.row()
740             col = row.column()
741             col.itemR(part, "trail_count")
742             if part.trail_count > 1:
743                 col.itemR(part, "abs_path_time", text="Length in frames")
744                 col = row.column()
745                 col.itemR(part, "path_end", text="Length", slider=not part.abs_path_time)
746                 col.itemR(part, "random_length", text="Random", slider=True)
747             else:
748                 col = row.column()
749                 col.itemL(text="")
750
751
752 class PARTICLE_PT_draw(ParticleButtonsPanel):
753     bl_label = "Display"
754     bl_default_closed = True
755
756     def poll(self, context):
757         psys = context.particle_system
758         if psys == None:
759             return False
760         if psys.settings == None:
761             return False
762         return True
763
764     def draw(self, context):
765         layout = self.layout
766
767         psys = context.particle_system
768         part = psys.settings
769
770         row = layout.row()
771         row.itemR(part, "draw_as", expand=True)
772
773         if part.draw_as == 'NONE' or (part.ren_as == 'NONE' and part.draw_as == 'RENDER'):
774             return
775
776         path = (part.ren_as == 'PATH' and part.draw_as == 'RENDER') or part.draw_as == 'PATH'
777
778         if path and part.type != 'HAIR' and part.physics_type != 'KEYED' and psys.point_cache.baked == False:
779             box = layout.box()
780             box.itemL(text="Baked or keyed particles needed for correct drawing.")
781             return
782
783         row = layout.row()
784         row.itemR(part, "display", slider=True)
785         if part.draw_as != 'RENDER' or part.ren_as == 'HALO':
786             row.itemR(part, "draw_size")
787         else:
788             row.itemL(text="")
789
790         row = layout.row()
791         col = row.column()
792         col.itemR(part, "show_size")
793         col.itemR(part, "velocity")
794         col.itemR(part, "num")
795         if part.physics_type == 'BOIDS':
796             col.itemR(part, "draw_health")
797
798         col = row.column()
799         col.itemR(part, "material_color", text="Use material color")
800
801         if (path):
802             col.itemR(part, "draw_step")
803         else:
804             sub = col.column()
805             sub.active = part.material_color == False
806             #sub.itemL(text="color")
807             #sub.itemL(text="Override material color")
808
809
810 class PARTICLE_PT_children(ParticleButtonsPanel):
811     bl_label = "Children"
812     bl_default_closed = True
813
814     def draw(self, context):
815         layout = self.layout
816
817         psys = context.particle_system
818         part = psys.settings
819
820         layout.row().itemR(part, "child_type", expand=True)
821
822         if part.child_type == 'NONE':
823             return
824
825         row = layout.row()
826
827         col = row.column(align=True)
828         col.itemR(part, "child_nbr", text="Display")
829         col.itemR(part, "rendered_child_nbr", text="Render")
830
831         col = row.column(align=True)
832
833         if part.child_type == 'FACES':
834             col.itemR(part, "virtual_parents", slider=True)
835         else:
836             col.itemR(part, "child_radius", text="Radius")
837             col.itemR(part, "child_roundness", text="Roundness", slider=True)
838
839             col = row.column(align=True)
840             col.itemR(part, "child_size", text="Size")
841             col.itemR(part, "child_random_size", text="Random")
842
843         layout.row().itemL(text="Effects:")
844
845         row = layout.row()
846
847         col = row.column(align=True)
848         col.itemR(part, "clump_factor", slider=True)
849         col.itemR(part, "clumppow", slider=True)
850
851         col = row.column(align=True)
852         col.itemR(part, "rough_endpoint")
853         col.itemR(part, "rough_end_shape")
854
855         row = layout.row()
856
857         col = row.column(align=True)
858         col.itemR(part, "rough1")
859         col.itemR(part, "rough1_size")
860
861         col = row.column(align=True)
862         col.itemR(part, "rough2")
863         col.itemR(part, "rough2_size")
864         col.itemR(part, "rough2_thres", slider=True)
865
866         row = layout.row()
867         col = row.column(align=True)
868         col.itemR(part, "child_length", slider=True)
869         col.itemR(part, "child_length_thres", slider=True)
870
871         col = row.column(align=True)
872         col.itemL(text="Space reserved for")
873         col.itemL(text="hair parting controls")
874
875         layout.row().itemL(text="Kink:")
876         layout.row().itemR(part, "kink", expand=True)
877
878         split = layout.split()
879
880         col = split.column()
881         col.itemR(part, "kink_amplitude")
882         col.itemR(part, "kink_frequency")
883         col = split.column()
884         col.itemR(part, "kink_shape", slider=True)
885
886
887 class PARTICLE_PT_field_weights(ParticleButtonsPanel):
888     bl_label = "Field Weights"
889     bl_default_closed = True
890
891     def draw(self, context):
892         part = context.particle_system.settings
893         effector_weights_ui(self, part.effector_weights)
894
895         if part.type == 'HAIR':
896             self.layout.itemR(part.effector_weights, "do_growing_hair")
897
898
899 class PARTICLE_PT_force_fields(ParticleButtonsPanel):
900     bl_label = "Force Field Settings"
901     bl_default_closed = True
902
903     def draw(self, context):
904         layout = self.layout
905
906         part = context.particle_system.settings
907
908         layout.itemR(part, "self_effect")
909
910         split = layout.split(percentage=0.2)
911         split.itemL(text="Type 1:")
912         split.itemR(part.force_field_1, "type", text="")
913         basic_force_field_settings_ui(self, part.force_field_1)
914         basic_force_field_falloff_ui(self, part.force_field_1)
915
916         if part.force_field_1.type != 'NONE':
917             layout.itemL(text="")
918
919         split = layout.split(percentage=0.2)
920         split.itemL(text="Type 2:")
921         split.itemR(part.force_field_2, "type", text="")
922         basic_force_field_settings_ui(self, part.force_field_2)
923         basic_force_field_falloff_ui(self, part.force_field_2)
924
925
926 class PARTICLE_PT_vertexgroups(ParticleButtonsPanel):
927     bl_label = "Vertexgroups"
928     bl_default_closed = True
929
930     def draw(self, context):
931         layout = self.layout
932
933         psys = context.particle_system
934         part = psys.settings
935
936         layout.itemL(text="Nothing here yet.")
937
938         #row = layout.row()
939         #row.itemL(text="Vertex Group")
940         #row.itemL(text="Negate")
941
942
943         #row = layout.row()
944         #row.itemR(psys, "vertex_group_density")
945         #row.itemR(psys, "vertex_group_density_negate", text="")
946
947         #row = layout.row()
948         #row.itemR(psys, "vertex_group_velocity")
949         #row.itemR(psys, "vertex_group_velocity_negate", text="")
950
951         #row = layout.row()
952         #row.itemR(psys, "vertex_group_length")
953         #row.itemR(psys, "vertex_group_length_negate", text="")
954
955         #row = layout.row()
956         #row.itemR(psys, "vertex_group_clump")
957         #row.itemR(psys, "vertex_group_clump_negate", text="")
958
959         #row = layout.row()
960         #row.itemR(psys, "vertex_group_kink")
961         #row.itemR(psys, "vertex_group_kink_negate", text="")
962
963         #row = layout.row()
964         #row.itemR(psys, "vertex_group_roughness1")
965         #row.itemR(psys, "vertex_group_roughness1_negate", text="")
966
967         #row = layout.row()
968         #row.itemR(psys, "vertex_group_roughness2")
969         #row.itemR(psys, "vertex_group_roughness2_negate", text="")
970
971         #row = layout.row()
972         #row.itemR(psys, "vertex_group_roughness_end")
973         #row.itemR(psys, "vertex_group_roughness_end_negate", text="")
974
975         #row = layout.row()
976         #row.itemR(psys, "vertex_group_size")
977         #row.itemR(psys, "vertex_group_size_negate", text="")
978
979         #row = layout.row()
980         #row.itemR(psys, "vertex_group_tangent")
981         #row.itemR(psys, "vertex_group_tangent_negate", text="")
982
983         #row = layout.row()
984         #row.itemR(psys, "vertex_group_rotation")
985         #row.itemR(psys, "vertex_group_rotation_negate", text="")
986
987         #row = layout.row()
988         #row.itemR(psys, "vertex_group_field")
989         #row.itemR(psys, "vertex_group_field_negate", text="")
990
991 bpy.types.register(PARTICLE_PT_particles)
992 bpy.types.register(PARTICLE_PT_hair_dynamics)
993 bpy.types.register(PARTICLE_PT_cache)
994 bpy.types.register(PARTICLE_PT_emission)
995 bpy.types.register(PARTICLE_PT_velocity)
996 bpy.types.register(PARTICLE_PT_rotation)
997 bpy.types.register(PARTICLE_PT_physics)
998 bpy.types.register(PARTICLE_PT_boidbrain)
999 bpy.types.register(PARTICLE_PT_render)
1000 bpy.types.register(PARTICLE_PT_draw)
1001 bpy.types.register(PARTICLE_PT_children)
1002 bpy.types.register(PARTICLE_PT_field_weights)
1003 bpy.types.register(PARTICLE_PT_force_fields)
1004 bpy.types.register(PARTICLE_PT_vertexgroups)