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