* projection paint options in the toolbar
[blender.git] / release / ui / buttons_particle.py
1
2 import bpy
3
4 def particle_panel_enabled(psys):
5         return psys.point_cache.baked==False and psys.editable==False
6         
7 def particle_panel_poll(context):
8         psys = context.particle_system
9         if psys==None:  return False
10         if psys.settings==None:  return False
11         return psys.settings.type in ('EMITTER', 'REACTOR', 'HAIR')
12
13 class ParticleButtonsPanel(bpy.types.Panel):
14         __space_type__ = "BUTTONS_WINDOW"
15         __region_type__ = "WINDOW"
16         __context__ = "particle"
17
18         def poll(self, context):
19                 return particle_panel_poll(context)
20
21 class PARTICLE_PT_particles(ParticleButtonsPanel):
22         __idname__= "PARTICLE_PT_particles"
23         __show_header__ = False
24
25         def poll(self, context):
26                 return (context.particle_system or context.object)
27
28         def draw(self, context):
29                 layout = self.layout
30                 ob = context.object
31                 psys = context.particle_system
32
33                 if ob:
34                         row = layout.row()
35
36                         row.template_list(ob, "particle_systems", ob, "active_particle_system_index")
37
38                         col = row.column(align=True)
39                         col.itemO("object.particle_system_add", icon="ICON_ZOOMIN", text="")
40                         col.itemO("object.particle_system_remove", icon="ICON_ZOOMOUT", text="")
41
42                 if psys:
43                         part = psys.settings
44                         
45                         split = layout.split(percentage=0.32)
46                         col = split.column()
47                         col.itemL(text="Name:")
48                         if part.type in ('EMITTER', 'REACTOR', 'HAIR'):
49                                 col.itemL(text="Settings:")
50                                 col.itemL(text="Type:")
51                         
52                         col = split.column()
53                         col.itemR(psys, "name", text="")
54                         if part.type in ('EMITTER', 'REACTOR', 'HAIR'):
55                                 col.template_ID(psys, "settings", new="particle.new")
56                         
57                         #row = layout.row()
58                         #row.itemL(text="Viewport")
59                         #row.itemL(text="Render")
60                         
61                         if part:
62                                 if part.type not in ('EMITTER', 'REACTOR', 'HAIR'):
63                                         layout.itemL(text="No settings for fluid particles")
64                                         return
65                                 
66                                 row=col.row()
67                                 row.enabled = particle_panel_enabled(psys)
68                                 row.itemR(part, "type", text="")
69                                 row.itemR(psys, "seed")
70                                 
71                                 split = layout.split(percentage=0.65)
72                                 if part.type=='HAIR':
73                                         if psys.editable==True:
74                                                 split.itemO("particle.editable_set", text="Free Edit")
75                                         else:
76                                                 split.itemO("particle.editable_set", text="Make Editable")
77                                         row = split.row()
78                                         row.enabled = particle_panel_enabled(psys)
79                                         row.itemR(part, "hair_step")
80                                 elif part.type=='REACTOR':
81                                         split.enabled = particle_panel_enabled(psys)
82                                         split.itemR(psys, "reactor_target_object")
83                                         split.itemR(psys, "reactor_target_particle_system", text="Particle System")
84                 
85 class PARTICLE_PT_emission(ParticleButtonsPanel):
86         __idname__= "PARTICLE_PT_emission"
87         __label__ = "Emission"
88         
89         def poll(self, context):
90                 if particle_panel_poll(context):
91                         return not context.particle_system.point_cache.external
92                 else:
93                         return False
94         
95         def draw(self, context):
96                 layout = self.layout
97
98                 psys = context.particle_system
99                 part = psys.settings
100                 
101                 layout.enabled = particle_panel_enabled(psys)
102                 
103                 row = layout.row()
104                 row.itemR(part, "amount")
105                 
106                 split = layout.split()
107                 
108                 col = split.column(align=True)
109                 col.itemR(part, "start")
110                 col.itemR(part, "end")
111
112                 col = split.column(align=True)
113                 col.itemR(part, "lifetime")
114                 col.itemR(part, "random_lifetime", slider=True)
115                 
116                 layout.row().itemL(text="Emit From:")
117                 
118                 row = layout.row()
119                 row.itemR(part, "emit_from", expand=True)
120                 row = layout.row()
121                 row.itemR(part, "trand")
122                 if part.distribution!='GRID':
123                         row.itemR(part, "even_distribution")
124                 
125                 if part.emit_from=='FACE' or part.emit_from=='VOLUME':
126                         row = layout.row()
127                         row.itemR(part, "distribution", expand=True)
128                         
129                         row = layout.row()
130
131                         if part.distribution=='JIT':
132                                 row.itemR(part, "userjit", text="Particles/Face")
133                                 row.itemR(part, "jitter_factor", text="Jittering Amount", slider=True)
134                         elif part.distribution=='GRID':
135                                 row.itemR(part, "grid_resolution")
136
137 class PARTICLE_PT_cache(ParticleButtonsPanel):
138         __idname__= "PARTICLE_PT_cache"
139         __label__ = "Cache"
140         __default_closed__ = True
141         
142         def poll(self, context):
143                 psys = context.particle_system
144                 if psys==None:  return False
145                 if psys.settings==None:  return False
146                 phystype = psys.settings.physics_type
147                 if phystype == 'NO' or phystype == 'KEYED':
148                         return False
149                 return psys.settings.type in ('EMITTER', 'REACTOR')
150
151         def draw(self, context):
152                 layout = self.layout
153
154                 psys = context.particle_system
155                 part = psys.settings
156                 cache = psys.point_cache
157                 
158                 row = layout.row()
159                 row.itemL(text="File Name:")
160                 row.itemR(cache, "external")
161                 
162                 if cache.external:
163                         split = layout.split(percentage=0.80)
164                         split.itemR(cache, "name", text="")
165                         split.itemR(cache, "index", text="")
166                         
167                         layout.itemL(text="File Path:")
168                         layout.itemR(cache, "filepath", text="")
169                         
170                         layout.itemL(text=cache.info)
171                         
172                         split = layout.split()
173                         
174                         col = split.column(align=True)
175                         col.itemR(part, "start")
176                         col.itemR(part, "end")
177
178                         col = split.column(align=True)
179                         col.itemR(part, "lifetime")
180                         col.itemR(part, "random_lifetime", slider=True)
181                 else:
182                         layout.itemR(cache, "name", text="")
183                         
184                         row = layout.row()
185                 
186                         if cache.baked == True:
187                                 row.itemO("ptcache.free_bake_particle_system", text="Free Bake")
188                         else:
189                                 row.item_booleanO("ptcache.cache_particle_system", "bake", True, text="Bake")
190                 
191                         subrow = row.row()
192                         subrow.enabled = (cache.frames_skipped or cache.outdated) and particle_panel_enabled(psys)
193                         subrow.itemO("ptcache.cache_particle_system", text="Calculate to Current Frame")
194                         
195                         row = layout.row()
196                         row.enabled = particle_panel_enabled(psys)
197                         row.itemO("ptcache.bake_from_particles_cache", text="Current Cache to Bake")
198                         row.itemR(cache, "step");
199                 
200                         row = layout.row()
201                         row.enabled = particle_panel_enabled(psys)
202                         row.itemR(cache, "quick_cache")
203                         row.itemR(cache, "disk_cache")
204                 
205                         layout.itemL(text=cache.info)
206                         
207                         layout.itemS()
208                         
209                         row = layout.row()
210                         row.item_booleanO("ptcache.bake_all", "bake", True, text="Bake All Dynamics")
211                         row.itemO("ptcache.free_bake_all", text="Free All Bakes")
212                         layout.itemO("ptcache.bake_all", text="Update All Dynamics to current frame")
213                 
214                 # for particles these are figured out automatically
215                 #row.itemR(cache, "start_frame")
216                 #row.itemR(cache, "end_frame")
217
218 class PARTICLE_PT_initial(ParticleButtonsPanel):
219         __idname__= "PARTICLE_PT_initial"
220         __label__ = "Velocity"
221         
222         def poll(self, context):
223                 if particle_panel_poll(context):
224                         psys = context.particle_system
225                         return psys.settings.physics_type != 'BOIDS' and not psys.point_cache.external
226                 else:
227                         return False
228
229         def draw(self, context):
230                 layout = self.layout
231
232                 psys = context.particle_system
233                 part = psys.settings
234                 
235                 layout.enabled = particle_panel_enabled(psys)
236                                 
237                 layout.row().itemL(text="Direction:")
238         
239                 split = layout.split()
240                         
241                 sub = split.column()
242                 sub.itemR(part, "normal_factor")
243                 if part.emit_from=='PARTICLE':
244                         sub.itemR(part, "particle_factor")
245                 else:
246                         sub.itemR(part, "object_factor", slider=True)
247                 sub.itemR(part, "random_factor")
248                 sub.itemR(part, "tangent_factor")
249                 sub.itemR(part, "tangent_phase", slider=True)
250                 
251                 sub = split.column()
252                 sub.itemL(text="TODO:")
253                 sub.itemL(text="Object aligned")
254                 sub.itemL(text="direction: X, Y, Z")
255                 
256                 if part.type=='REACTOR':
257                         sub.itemR(part, "reactor_factor")
258                         sub.itemR(part, "reaction_shape", slider=True)
259                 else:
260                         sub.itemL(text="")
261                 
262                 layout.row().itemL(text="Rotation:")
263                 split = layout.split()
264                         
265                 sub = split.column()
266                 
267                 sub.itemR(part, "rotation_mode", text="Axis")
268                 split = layout.split()
269                         
270                 sub = split.column()
271                 sub.itemR(part, "rotation_dynamic")
272                 sub.itemR(part, "random_rotation_factor", slider=True)
273                 sub = split.column()
274                 sub.itemR(part, "phase_factor", slider=True)
275                 sub.itemR(part, "random_phase_factor", text="Random", slider=True)
276
277                 layout.row().itemL(text="Angular velocity:")
278                 layout.row().itemR(part, "angular_velocity_mode", expand=True)
279                 split = layout.split()
280                         
281                 sub = split.column()
282                 
283                 sub.itemR(part, "angular_velocity_factor", text="")
284                 
285 class PARTICLE_PT_physics(ParticleButtonsPanel):
286         __idname__= "PARTICLE_PT_physics"
287         __label__ = "Physics"
288         
289         def poll(self, context):
290                 if particle_panel_poll(context):
291                         return not context.particle_system.point_cache.external
292                 else:
293                         return False
294
295         def draw(self, context):
296                 layout = self.layout
297
298                 psys = context.particle_system
299                 part = psys.settings
300                 
301                 layout.enabled = particle_panel_enabled(psys)
302
303                 row = layout.row()
304                 row.itemR(part, "physics_type", expand=True)
305                 if part.physics_type != 'NO':
306                         row = layout.row()
307                         col = row.column(align=True)
308                         col.itemR(part, "particle_size")
309                         col.itemR(part, "random_size", slider=True)
310                         col = row.column(align=True)
311                         col.itemR(part, "mass")
312                         col.itemR(part, "sizemass", text="Multiply mass with size")
313                         
314                 if part.physics_type == 'NEWTON':
315                         split = layout.split()
316                         sub = split.column()
317                         
318                         sub.itemL(text="Forces:")
319                         sub.itemR(part, "brownian_factor")
320                         sub.itemR(part, "drag_factor", slider=True)
321                         sub.itemR(part, "damp_factor", slider=True)
322                         sub.itemR(part, "integrator")
323                         sub = split.column()
324                         sub.itemR(part, "acceleration")
325                         
326                 elif part.physics_type == 'KEYED':
327                         split = layout.split()
328                         sub = split.column()
329                         
330                         row = layout.row()
331                         col = row.column()
332                         col.active = not psys.keyed_timing
333                         col.itemR(part, "keyed_loops", text="Loops")
334                         row.itemR(psys, "keyed_timing", text="Use Timing")
335                         
336                         layout.itemL(text="Keys:")
337                 elif part.physics_type=='BOIDS':
338                         boids = part.boids
339                         
340
341                         row = layout.row()
342                         row.itemR(boids, "allow_flight")
343                         row.itemR(boids, "allow_land")
344                         row.itemR(boids, "allow_climb")
345                         
346                         split = layout.split()
347                         
348                         sub = split.column()
349                         col = sub.column(align=True)
350                         col.active = boids.allow_flight
351                         col.itemR(boids, "air_max_speed")
352                         col.itemR(boids, "air_min_speed", slider="True")
353                         col.itemR(boids, "air_max_acc", slider="True")
354                         col.itemR(boids, "air_max_ave", slider="True")
355                         col.itemR(boids, "air_personal_space")
356                         row = col.row()
357                         row.active = (boids.allow_land or boids.allow_climb) and boids.allow_flight
358                         row.itemR(boids, "landing_smoothness")
359                         
360                         sub = split.column()
361                         col = sub.column(align=True)
362                         col.active = boids.allow_land or boids.allow_climb
363                         col.itemR(boids, "land_max_speed")
364                         col.itemR(boids, "land_jump_speed")
365                         col.itemR(boids, "land_max_acc", slider="True")
366                         col.itemR(boids, "land_max_ave", slider="True")
367                         col.itemR(boids, "land_personal_space")
368                         col.itemR(boids, "land_stick_force")
369                         
370                         row = layout.row()
371                         
372                         col = row.column(align=True)
373                         col.itemL(text="Battle:")
374                         col.itemR(boids, "health")
375                         col.itemR(boids, "strength")
376                         col.itemR(boids, "aggression")
377                         col.itemR(boids, "accuracy")
378                         col.itemR(boids, "range")
379                         
380                         col = row.column()
381                         col.itemL(text="Misc:")
382                         col.itemR(part, "gravity")
383                         col.itemR(boids, "banking", slider=True)
384                         col.itemR(boids, "height", slider=True)
385                         
386                 if part.physics_type=='NEWTON':
387                         sub.itemR(part, "size_deflect")
388                         sub.itemR(part, "die_on_collision")
389                         sub.itemR(part, "sticky")
390                 elif part.physics_type=='KEYED' or part.physics_type=='BOIDS':
391                         if part.physics_type=='BOIDS':
392                                 layout.itemL(text="Relations:")
393                         
394                         row = layout.row()
395                         row.template_list(psys, "targets", psys, "active_particle_target_index")
396                         
397                         col = row.column()
398                         subrow = col.row()
399                         subcol = subrow.column(align=True)
400                         subcol.itemO("particle.new_target", icon="ICON_ZOOMIN", text="")
401                         subcol.itemO("particle.remove_target", icon="ICON_ZOOMOUT", text="")
402                         subrow = col.row()
403                         subcol = subrow.column(align=True)
404                         subcol.itemO("particle.target_move_up", icon="VICON_MOVE_UP", text="")
405                         subcol.itemO("particle.target_move_down", icon="VICON_MOVE_DOWN", text="")
406                         
407                         key = psys.active_particle_target
408                         if key:
409                                 row = layout.row()
410                                 if part.physics_type=='KEYED':
411                                         col = row.column()
412                                         #doesn't work yet
413                                         #col.red_alert = key.valid
414                                         col.itemR(key, "object", text="")
415                                         col.itemR(key, "system", text="System")
416                                         col = row.column();
417                                         col.active = psys.keyed_timing
418                                         col.itemR(key, "time")
419                                         col.itemR(key, "duration")
420                                 else:
421                                         subrow = row.row()
422                                         #doesn't work yet
423                                         #subrow.red_alert = key.valid
424                                         subrow.itemR(key, "object", text="")
425                                         subrow.itemR(key, "system", text="System")
426                                         
427                                         layout.itemR(key, "mode", expand=True)
428
429 class PARTICLE_PT_boidbrain(ParticleButtonsPanel):
430         __idname__ = "PARTICLE_PT_boidbrain"
431         __label__ = "Boid Brain"
432
433         def poll(self, context):
434                 psys = context.particle_system
435                 if psys==None:  return False
436                 if psys.settings==None:  return False
437                 if psys.point_cache.external: return False
438                 return psys.settings.physics_type=='BOIDS'
439         
440         def draw(self, context):
441                 boids = context.particle_system.settings.boids
442                 layout = self.layout
443                 
444                 layout.enabled = particle_panel_enabled(psys)
445                 
446                 # Currently boids can only use the first state so these are commented out for now.
447                 #row = layout.row()
448                 #row.template_list(boids, "states", boids, "active_boid_state_index", compact="True")
449                 #col = row.row()
450                 #subrow = col.row(align=True)
451                 #subrow.itemO("boid.boidstate_add", icon="ICON_ZOOMIN", text="")
452                 #subrow.itemO("boid.boidstate_del", icon="ICON_ZOOMOUT", text="")
453                 #subrow = row.row(align=True)
454                 #subrow.itemO("boid.boidstate_move_up", icon="VICON_MOVE_UP", text="")
455                 #subrow.itemO("boid.boidstate_move_down", icon="VICON_MOVE_DOWN", text="")
456                 
457                 state = boids.active_boid_state
458                 
459                 #layout.itemR(state, "name", text="State name")
460                 
461                 row = layout.row()
462                 row.itemR(state, "ruleset_type")
463                 if state.ruleset_type=='FUZZY':
464                         row.itemR(state, "rule_fuzziness", slider=True)
465                 else:
466                         row.itemL(text="")
467                 
468                 row = layout.row()
469                 row.template_list(state, "rules", state, "active_boid_rule_index")
470                 
471                 col = row.column()
472                 subrow = col.row()
473                 subcol = subrow.column(align=True)
474                 subcol.item_menu_enumO("boid.boidrule_add", "type", icon="ICON_ZOOMIN", text="")
475                 subcol.itemO("boid.boidrule_del", icon="ICON_ZOOMOUT", text="")
476                 subrow = col.row()
477                 subcol = subrow.column(align=True)
478                 subcol.itemO("boid.boidrule_move_up", icon="VICON_MOVE_UP", text="")
479                 subcol.itemO("boid.boidrule_move_down", icon="VICON_MOVE_DOWN", text="")
480                 
481                 rule = state.active_boid_rule
482                 
483                 if rule:
484                         row = layout.row()
485                         row.itemR(rule, "name", text="")
486                         #somebody make nice icons for boids here please! -jahka
487                         row.itemR(rule, "in_air", icon="VICON_MOVE_UP", text="")
488                         row.itemR(rule, "on_land", icon="VICON_MOVE_DOWN", text="")
489                         
490                         row = layout.row()
491
492                         if rule.type == 'GOAL':
493                                 row.itemR(rule, "object")
494                                 row = layout.row()
495                                 row.itemR(rule, "predict")
496                         elif rule.type == 'AVOID':
497                                 row.itemR(rule, "object")
498                                 row = layout.row()
499                                 row.itemR(rule, "predict")
500                                 row.itemR(rule, "fear_factor")
501                         elif rule.type == 'FOLLOW_PATH':
502                                 row.itemL(text="Not yet functional.")
503                         elif rule.type == 'AVOID_COLLISION':
504                                 row.itemR(rule, "boids")
505                                 row.itemR(rule, "deflectors")
506                                 row.itemR(rule, "look_ahead")
507                         elif rule.type == 'FOLLOW_LEADER':
508                                 row.itemR(rule, "object", text="")
509                                 row.itemR(rule, "distance")
510                                 row = layout.row()
511                                 row.itemR(rule, "line")
512                                 subrow = row.row()
513                                 subrow.active = rule.line
514                                 subrow.itemR(rule, "queue_size")
515                         elif rule.type == 'AVERAGE_SPEED':
516                                 row.itemR(rule, "speed", slider=True)
517                                 row.itemR(rule, "wander", slider=True)
518                                 row.itemR(rule, "level", slider=True)
519                         elif rule.type == 'FIGHT':
520                                 row.itemR(rule, "distance")
521                                 row.itemR(rule, "flee_distance")
522                 
523
524 class PARTICLE_PT_render(ParticleButtonsPanel):
525         __idname__= "PARTICLE_PT_render"
526         __label__ = "Render"
527         
528         def poll(self, context):
529                 psys = context.particle_system
530                 if psys==None: return False
531                 if psys.settings==None: return False
532                 return True;
533                 
534         def draw(self, context):
535                 layout = self.layout
536
537                 psys = context.particle_system
538                 part = psys.settings
539
540                 row = layout.row()
541                 row.itemR(part, "material")
542                 row.itemR(psys, "parent");
543                 
544                 split = layout.split()
545                         
546                 sub = split.column()
547                 sub.itemR(part, "emitter");
548                 sub.itemR(part, "parent");
549                 sub = split.column()
550                 sub.itemR(part, "unborn");
551                 sub.itemR(part, "died");
552                 
553                 row = layout.row()
554                 row.itemR(part, "ren_as", expand=True)
555                 
556                 split = layout.split()
557                         
558                 sub = split.column()
559                 
560                 if part.ren_as == 'LINE':
561                         sub.itemR(part, "line_length_tail")
562                         sub.itemR(part, "line_length_head")
563                         sub = split.column()
564                         sub.itemR(part, "velocity_length")
565                 elif part.ren_as == 'PATH':
566                 
567                         if (part.type!='HAIR' and part.physics_type!='KEYED' and psys.point_cache.baked==False):
568                                 box = layout.box()
569                                 box.itemL(text="Baked or keyed particles needed for correct rendering.")
570                                 return
571                                 
572                         sub.itemR(part, "render_strand")
573                         colsub = sub.column()
574                         colsub.active = part.render_strand == False
575                         colsub.itemR(part, "render_adaptive")
576                         colsub = sub.column()
577                         colsub.active = part.render_adaptive or part.render_strand == True
578                         colsub.itemR(part, "adaptive_angle")
579                         colsub = sub.column()
580                         colsub.active = part.render_adaptive == True and part.render_strand == False
581                         colsub.itemR(part, "adaptive_pix")
582                         sub.itemR(part, "hair_bspline")
583                         sub.itemR(part, "render_step", text="Steps")
584                         sub = split.column()    
585
586                         sub.itemL(text="Timing:")
587                         sub.itemR(part, "abs_path_time")
588                         sub.itemR(part, "path_start", text="Start", slider= not part.abs_path_time)
589                         sub.itemR(part, "path_end", text="End", slider= not part.abs_path_time)         
590                         sub.itemR(part, "random_length", text="Random", slider=True)
591                         
592                         row = layout.row()
593                         col = row.column()
594                         
595                         if part.type=='HAIR' and part.render_strand==True and part.child_type=='FACES':
596                                 layout.itemR(part, "enable_simplify")
597                                 if part.enable_simplify==True:
598                                         row = layout.row()
599                                         row.itemR(part, "simplify_refsize")
600                                         row.itemR(part, "simplify_rate")
601                                         row.itemR(part, "simplify_transition")
602                                         row = layout.row()
603                                         row.itemR(part, "viewport")
604                                         subrow = row.row()
605                                         subrow.active = part.viewport==True
606                                         subrow.itemR(part, "simplify_viewport")
607                         
608
609                 elif part.ren_as == 'OBJECT':
610                         sub.itemR(part, "dupli_object")
611                 elif part.ren_as == 'GROUP':
612                         sub.itemR(part, "dupli_group")
613                         split = layout.split()
614                         sub = split.column()
615                         sub.itemR(part, "whole_group")
616                         sub = split.column()
617                         colsub = sub.column()
618                         colsub.active = part.whole_group == False
619                         colsub.itemR(part, "rand_group")
620                         
621                 elif part.ren_as == 'BILLBOARD':
622                         sub.itemL(text="Align:")
623                         
624                         row = layout.row()
625                         row.itemR(part, "billboard_align", expand=True)
626                         row.itemR(part, "billboard_lock", text="Lock")
627                         row = layout.row()
628                         row.itemR(part, "billboard_object")
629                 
630                         row = layout.row()
631                         col = row.column(align=True)
632                         col.itemL(text="Tilt:")
633                         col.itemR(part, "billboard_tilt", text="Angle", slider=True)
634                         col.itemR(part, "billboard_random_tilt", slider=True)
635                         col = row.column()
636                         col.itemR(part, "billboard_offset")
637                         
638                         row = layout.row()
639                         row.itemR(psys, "billboard_normal_uv")
640                         row = layout.row()
641                         row.itemR(psys, "billboard_time_index_uv")
642                         
643                         row = layout.row()
644                         row.itemL(text="Split uv's:")
645                         row.itemR(part, "billboard_uv_split", text="Number of splits")
646                         row = layout.row()
647                         row.itemR(psys, "billboard_split_uv")
648                         row = layout.row()
649                         row.itemL(text="Animate:")
650                         row.itemR(part, "billboard_animation", expand=True)
651                         row.itemL(text="Offset:")
652                         row.itemR(part, "billboard_split_offset", expand=True)
653                 if part.ren_as == 'HALO' or part.ren_as == 'LINE' or part.ren_as=='BILLBOARD':
654                         row = layout.row()
655                         col = row.column()
656                         col.itemR(part, "trail_count")
657                         if part.trail_count > 1:
658                                 col.itemR(part, "abs_path_time", text="Length in frames")
659                                 col = row.column()
660                                 col.itemR(part, "path_end", text="Length", slider=not part.abs_path_time)
661                                 col.itemR(part, "random_length", text="Random", slider=True)
662                         else:
663                                 col = row.column()
664                                 col.itemL(text="")
665                                 
666 class PARTICLE_PT_draw(ParticleButtonsPanel):
667         __idname__= "PARTICLE_PT_draw"
668         __label__ = "Display"
669         __default_closed__ = True
670         
671         def poll(self, context):
672                 psys = context.particle_system
673                 if psys==None: return False
674                 if psys.settings==None: return False
675                 return True;
676         
677         def draw(self, context):
678                 layout = self.layout
679
680                 psys = context.particle_system
681                 part = psys.settings
682                 
683                 row = layout.row()
684                 row.itemR(part, "draw_as", expand=True)
685                 
686                 if part.draw_as=='NONE' or (part.ren_as=='NONE' and part.draw_as=='RENDER'):
687                         return
688                         
689                 path = (part.ren_as=='PATH' and part.draw_as=='RENDER') or part.draw_as=='PATH'
690                         
691                 if path and part.type!='HAIR' and part.physics_type!='KEYED' and psys.point_cache.baked==False:
692                         box = layout.box()
693                         box.itemL(text="Baked or keyed particles needed for correct drawing.")
694                         return
695                 
696                 row = layout.row()
697                 row.itemR(part, "display", slider=True)
698                 if part.draw_as!='RENDER' or part.ren_as=='HALO':
699                         row.itemR(part, "draw_size")
700                 else:
701                         row.itemL(text="")
702                 
703                 row = layout.row()
704                 col = row.column()
705                 col.itemR(part, "show_size")
706                 col.itemR(part, "velocity")
707                 col.itemR(part, "num")
708                 if part.physics_type == 'BOIDS':
709                         col.itemR(part, "draw_health")
710                 
711                 col = row.column()
712                 col.itemR(part, "material_color", text="Use material color")
713                 
714                 if (path):
715                         box = col.box()                         
716                         box.itemR(part, "draw_step")
717                 else:
718                         subcol = col.column()
719                         subcol.active = part.material_color==False
720                         #subcol.itemL(text="color")
721                         #subcol.itemL(text="Override material color")
722
723 class PARTICLE_PT_children(ParticleButtonsPanel):
724         __idname__= "PARTICLE_PT_children"
725         __label__ = "Children"
726         __default_closed__ = True
727
728         def draw(self, context):
729                 layout = self.layout
730
731                 psys = context.particle_system
732                 part = psys.settings
733                 
734                 layout.row().itemR(part, "child_type", expand=True)
735                 
736                 if part.child_type=='NONE':
737                         return
738                 
739                 row = layout.row()
740                 
741                 col = row.column(align=True)
742                 col.itemR(part, "child_nbr", text="Display")
743                 col.itemR(part, "rendered_child_nbr", text="Render")
744                 
745                 col = row.column(align=True)
746                 
747                 if part.child_type=='FACES':
748                         col.itemR(part, "virtual_parents", slider=True)
749                 else:
750                         col.itemR(part, "child_radius", text="Radius")
751                         col.itemR(part, "child_roundness", text="Roundness", slider=True)
752                 
753                         col = row.column(align=True)
754                         col.itemR(part, "child_size", text="Size")
755                         col.itemR(part, "child_random_size", text="Random")
756                 
757                 layout.row().itemL(text="Effects:")
758                 
759                 row = layout.row()
760                 
761                 col = row.column(align=True)
762                 col.itemR(part, "clump_factor", slider=True)
763                 col.itemR(part, "clumppow", slider=True)
764                 
765                 col = row.column(align=True)
766                 col.itemR(part, "rough_endpoint")
767                 col.itemR(part, "rough_end_shape")
768
769                 row = layout.row()
770                 
771                 col = row.column(align=True)
772                 col.itemR(part, "rough1")
773                 col.itemR(part, "rough1_size")
774
775                 col = row.column(align=True)
776                 col.itemR(part, "rough2")
777                 col.itemR(part, "rough2_size")
778                 col.itemR(part, "rough2_thres", slider=True)
779                 
780                 row = layout.row()
781                 col = row.column(align=True)
782                 col.itemR(part, "child_length", slider=True)
783                 col.itemR(part, "child_length_thres", slider=True)
784                 
785                 col = row.column(align=True)
786                 col.itemL(text="Space reserved for")
787                 col.itemL(text="hair parting controls")
788                 
789                 layout.row().itemL(text="Kink:")
790                 layout.row().itemR(part, "kink", expand=True)
791                 
792                 split = layout.split()
793                 
794                 sub = split.column()
795                 sub.itemR(part, "kink_amplitude")
796                 sub.itemR(part, "kink_frequency")
797                 sub = split.column()
798                 sub.itemR(part, "kink_shape", slider=True)
799
800 class PARTICLE_PT_effectors(ParticleButtonsPanel):
801         __idname__= "PARTICLE_PT_effectors"
802         __label__ = "Effectors"
803         __default_closed__ = True
804         
805         def draw(self, context):
806                 layout = self.layout
807
808                 psys = context.particle_system
809                 part = psys.settings
810                 
811                 layout.itemR(part, "effector_group")
812                 
813                 layout.itemR(part, "eweight_all", slider=True)
814                 
815                 layout.itemS()
816                 layout.itemR(part, "eweight_spherical", slider=True)
817                 layout.itemR(part, "eweight_vortex", slider=True)
818                 layout.itemR(part, "eweight_magnetic", slider=True)
819                 layout.itemR(part, "eweight_wind", slider=True)
820                 layout.itemR(part, "eweight_curveguide", slider=True)
821                 layout.itemR(part, "eweight_texture", slider=True)
822                 layout.itemR(part, "eweight_harmonic", slider=True)
823                 layout.itemR(part, "eweight_charge", slider=True)
824                 layout.itemR(part, "eweight_lennardjones", slider=True)
825                 
826 class PARTICLE_PT_vertexgroups(ParticleButtonsPanel):
827         __idname__= "PARTICLE_PT_vertexgroups"
828         __label__ = "Vertexgroups"
829         __default_closed__ = True
830
831         def draw(self, context):
832                 layout = self.layout
833
834                 psys = context.particle_system
835                 part = psys.settings
836                 
837                 layout.itemL(text="Nothing here yet.")
838
839                 #row = layout.row()
840                 #row.itemL(text="Vertex Group")
841                 #row.itemL(text="Negate")
842
843                 
844                 #row = layout.row()
845                 #row.itemR(psys, "vertex_group_density")
846                 #row.itemR(psys, "vertex_group_density_negate", text="")
847                 
848                 #row = layout.row()
849                 #row.itemR(psys, "vertex_group_velocity")
850                 #row.itemR(psys, "vertex_group_velocity_negate", text="")
851                 
852                 #row = layout.row()
853                 #row.itemR(psys, "vertex_group_length")
854                 #row.itemR(psys, "vertex_group_length_negate", text="")
855                 
856                 #row = layout.row()
857                 #row.itemR(psys, "vertex_group_clump")
858                 #row.itemR(psys, "vertex_group_clump_negate", text="")
859                 
860                 #row = layout.row()
861                 #row.itemR(psys, "vertex_group_kink")
862                 #row.itemR(psys, "vertex_group_kink_negate", text="")
863                 
864                 #row = layout.row()
865                 #row.itemR(psys, "vertex_group_roughness1")
866                 #row.itemR(psys, "vertex_group_roughness1_negate", text="")
867                 
868                 #row = layout.row()
869                 #row.itemR(psys, "vertex_group_roughness2")
870                 #row.itemR(psys, "vertex_group_roughness2_negate", text="")
871                 
872                 #row = layout.row()
873                 #row.itemR(psys, "vertex_group_roughness_end")
874                 #row.itemR(psys, "vertex_group_roughness_end_negate", text="")
875
876                 #row = layout.row()
877                 #row.itemR(psys, "vertex_group_size")
878                 #row.itemR(psys, "vertex_group_size_negate", text="")
879                 
880                 #row = layout.row()
881                 #row.itemR(psys, "vertex_group_tangent")
882                 #row.itemR(psys, "vertex_group_tangent_negate", text="")
883                 
884                 #row = layout.row()
885                 #row.itemR(psys, "vertex_group_rotation")
886                 #row.itemR(psys, "vertex_group_rotation_negate", text="")
887                 
888                 #row = layout.row()
889                 #row.itemR(psys, "vertex_group_field")
890                 #row.itemR(psys, "vertex_group_field_negate", text="")
891                 
892 bpy.types.register(PARTICLE_PT_particles)
893 bpy.types.register(PARTICLE_PT_cache)
894 bpy.types.register(PARTICLE_PT_emission)
895 bpy.types.register(PARTICLE_PT_initial)
896 bpy.types.register(PARTICLE_PT_physics)
897 bpy.types.register(PARTICLE_PT_boidbrain)
898 bpy.types.register(PARTICLE_PT_render)
899 bpy.types.register(PARTICLE_PT_draw)
900 bpy.types.register(PARTICLE_PT_children)
901 bpy.types.register(PARTICLE_PT_effectors)
902 bpy.types.register(PARTICLE_PT_vertexgroups)