4 def particle_panel_enabled(psys):
5 return psys.point_cache.baked==False and psys.editable==False
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')
13 class ParticleButtonsPanel(bpy.types.Panel):
14 __space_type__ = "BUTTONS_WINDOW"
15 __region_type__ = "WINDOW"
16 __context__ = "particle"
18 def poll(self, context):
19 return particle_panel_poll(context)
21 class PARTICLE_PT_particles(ParticleButtonsPanel):
22 __idname__= "PARTICLE_PT_particles"
23 __label__ = "Particle System"
25 def poll(self, context):
26 return (context.particle_system or context.object)
28 def draw(self, context):
31 psys = context.particle_system
36 row.template_list(ob, "particle_systems", "active_particle_system_index")
38 col = row.column(align=True)
39 col.itemO("OBJECT_OT_particle_system_slot_add", icon="ICON_ZOOMIN", text="")
40 col.itemO("OBJECT_OT_particle_system_slot_remove", icon="ICON_ZOOMOUT", text="")
43 split = layout.split(percentage=0.65)
45 split.template_ID(psys, "settings", new="PARTICLE_OT_new")
48 #row.itemL(text="Viewport")
49 #row.itemL(text="Render")
54 ptype = psys.settings.type
55 if ptype not in ('EMITTER', 'REACTOR', 'HAIR'):
56 layout.itemL(text="No settings for fluid particles")
59 split = layout.split(percentage=0.65)
61 split.enabled = particle_panel_enabled(psys)
62 split.itemR(part, "type")
63 split.itemR(psys, "seed")
65 split = layout.split(percentage=0.65)
67 if psys.editable==True:
68 split.itemO("PARTICLE_OT_editable_set", text="Free Edit")
70 split.itemO("PARTICLE_OT_editable_set", text="Make Editable")
72 row.enabled = particle_panel_enabled(psys)
73 row.itemR(part, "hair_step")
74 elif part.type=='REACTOR':
75 split.enabled = particle_panel_enabled(psys)
76 split.itemR(psys, "reactor_target_object")
77 split.itemR(psys, "reactor_target_particle_system", text="Particle System")
79 class PARTICLE_PT_emission(ParticleButtonsPanel):
80 __idname__= "PARTICLE_PT_emission"
81 __label__ = "Emission"
83 def draw(self, context):
86 psys = context.particle_system
89 layout.enabled = particle_panel_enabled(psys)
92 row.itemR(part, "amount")
94 split = layout.split()
96 col = split.column(align=True)
97 col.itemR(part, "start")
98 col.itemR(part, "end")
100 col = split.column(align=True)
101 col.itemR(part, "lifetime")
102 col.itemR(part, "random_lifetime", slider=True)
104 layout.row().itemL(text="Emit From:")
107 row.itemR(part, "emit_from", expand=True)
109 row.itemR(part, "trand")
110 if part.distribution!='GRID':
111 row.itemR(part, "even_distribution")
113 if part.emit_from=='FACE' or part.emit_from=='VOLUME':
115 row.itemR(part, "distribution", expand=True)
119 if part.distribution=='JIT':
120 row.itemR(part, "userjit", text="Particles/Face")
121 row.itemR(part, "jitter_factor", text="Jittering Amount", slider=True)
122 elif part.distribution=='GRID':
123 row.itemR(part, "grid_resolution")
125 class PARTICLE_PT_cache(ParticleButtonsPanel):
126 __idname__= "PARTICLE_PT_cache"
128 __default_closed__ = True
130 def poll(self, context):
131 psys = context.particle_system
132 if psys==None: return False
133 if psys.settings==None: return False
134 return psys.settings.type in ('EMITTER', 'REACTOR')
136 def draw(self, context):
139 psys = context.particle_system
141 cache = psys.point_cache
144 row.itemR(cache, "name")
148 if cache.baked == True:
149 row.itemO("PTCACHE_OT_free_bake_particle_system", text="Free Bake")
151 row.item_booleanO("PTCACHE_OT_cache_particle_system", "bake", True, text="Bake")
154 subrow.enabled = (cache.frames_skipped or cache.outdated) and particle_panel_enabled(psys)
155 subrow.itemO("PTCACHE_OT_cache_particle_system", text="Calculate to Current Frame")
158 row.enabled = particle_panel_enabled(psys)
159 row.itemO("PTCACHE_OT_bake_from_particles_cache", text="Current Cache to Bake")
160 row.itemR(cache, "step");
163 row.enabled = particle_panel_enabled(psys)
164 row.itemR(cache, "quick_cache")
165 row.itemR(cache, "disk_cache")
167 layout.itemL(text=cache.info)
172 row.item_booleanO("PTCACHE_OT_bake_all", "bake", True, text="Bake All Dynamics")
173 row.itemO("PTCACHE_OT_free_bake_all", text="Free All Bakes")
174 layout.itemO("PTCACHE_OT_bake_all", text="Update All Dynamics to current frame")
176 # for particles these are figured out automatically
177 #row.itemR(cache, "start_frame")
178 #row.itemR(cache, "end_frame")
180 class PARTICLE_PT_initial(ParticleButtonsPanel):
181 __idname__= "PARTICLE_PT_initial"
182 __label__ = "Velocity"
184 def draw(self, context):
187 psys = context.particle_system
190 layout.enabled = particle_panel_enabled(psys)
192 layout.row().itemL(text="Direction:")
194 split = layout.split()
197 sub.itemR(part, "normal_factor")
198 if part.emit_from=='PARTICLE':
199 sub.itemR(part, "particle_factor")
201 sub.itemR(part, "object_factor", slider=True)
202 sub.itemR(part, "random_factor")
203 sub.itemR(part, "tangent_factor")
204 sub.itemR(part, "tangent_phase", slider=True)
207 sub.itemL(text="TODO:")
208 sub.itemL(text="Object aligned")
209 sub.itemL(text="direction: X, Y, Z")
211 if part.type=='REACTOR':
212 sub.itemR(part, "reactor_factor")
213 sub.itemR(part, "reaction_shape", slider=True)
217 layout.row().itemL(text="Rotation:")
218 split = layout.split()
222 sub.itemR(part, "rotation_mode", text="Axis")
223 split = layout.split()
226 sub.itemR(part, "rotation_dynamic")
227 sub.itemR(part, "random_rotation_factor", slider=True)
229 sub.itemR(part, "phase_factor", slider=True)
230 sub.itemR(part, "random_phase_factor", text="Random", slider=True)
232 layout.row().itemL(text="Angular velocity:")
233 layout.row().itemR(part, "angular_velocity_mode", expand=True)
234 split = layout.split()
238 sub.itemR(part, "angular_velocity_factor", text="")
240 class PARTICLE_PT_physics(ParticleButtonsPanel):
241 __idname__= "PARTICLE_PT_physics"
242 __label__ = "Physics"
244 def draw(self, context):
247 psys = context.particle_system
250 layout.enabled = layout.enabled = particle_panel_enabled(psys)
253 row.itemR(part, "physics_type", expand=True)
254 if part.physics_type != 'NO':
255 layout.itemR(part, "effector_group")
258 col = row.column(align=True)
259 col.itemR(part, "particle_size")
260 col.itemR(part, "random_size", slider=True)
261 col = row.column(align=True)
262 col.itemR(part, "mass")
263 col.itemR(part, "sizemass", text="Multiply mass with size")
265 split = layout.split()
269 if part.physics_type == 'NEWTON':
271 sub.itemL(text="Forces:")
272 sub.itemR(part, "brownian_factor")
273 sub.itemR(part, "drag_factor", slider=True)
274 sub.itemR(part, "damp_factor", slider=True)
275 sub.itemR(part, "integrator")
277 sub.itemR(part, "acceleration")
279 elif part.physics_type == 'KEYED':
280 sub.itemR(psys, "keyed_first")
281 if psys.keyed_first==True:
282 sub.itemR(psys, "timed_keys", text="Key timing")
284 sub.itemR(part, "keyed_time")
286 sub.itemL(text="Next key from object:")
287 sub.itemR(psys, "keyed_object", text="")
288 sub.itemR(psys, "keyed_particle_system")
290 if part.physics_type=='NEWTON' or part.physics_type=='BOIDS':
292 sub.itemR(part, "size_deflect")
293 sub.itemR(part, "die_on_collision")
294 sub.itemR(part, "sticky")
296 class PARTICLE_PT_render(ParticleButtonsPanel):
297 __idname__= "PARTICLE_PT_render"
300 def poll(self, context):
301 psys = context.particle_system
302 if psys==None: return False
303 if psys.settings==None: return False
306 def draw(self, context):
309 psys = context.particle_system
313 row.itemR(part, "material")
314 row.itemR(psys, "parent");
316 split = layout.split()
319 sub.itemR(part, "emitter");
320 sub.itemR(part, "parent");
322 sub.itemR(part, "unborn");
323 sub.itemR(part, "died");
326 row.itemR(part, "ren_as", expand=True)
328 split = layout.split()
332 if part.ren_as == 'LINE':
333 sub.itemR(part, "line_length_tail")
334 sub.itemR(part, "line_length_head")
336 sub.itemR(part, "velocity_length")
337 elif part.ren_as == 'PATH':
339 if (part.type!='HAIR' and psys.point_cache.baked==False):
341 box.itemL(text="Baked or keyed particles needed for correct rendering.")
344 sub.itemR(part, "render_strand")
345 colsub = sub.column()
346 colsub.active = part.render_strand == False
347 colsub.itemR(part, "render_adaptive")
348 colsub = sub.column()
349 colsub.active = part.render_adaptive or part.render_strand == True
350 colsub.itemR(part, "adaptive_angle")
351 colsub = sub.column()
352 colsub.active = part.render_adaptive == True and part.render_strand == False
353 colsub.itemR(part, "adaptive_pix")
354 sub.itemR(part, "hair_bspline")
355 sub.itemR(part, "render_step", text="Steps")
357 sub.itemL(text="Length:")
358 sub.itemR(part, "abs_length", text="Absolute")
359 sub.itemR(part, "absolute_length", text="Maximum")
360 sub.itemR(part, "random_length", text="Random", slider=True)
363 #row.itemR(part, "timed_path")
364 #col = row.column(align=True)
365 #col.active = part.timed_path == True
366 #col.itemR(part, "line_length_tail", text="Start")
367 #col.itemR(part, "line_length_head", text="End")
372 if part.type=='HAIR' and part.render_strand==True and part.child_type=='FACES':
373 layout.itemR(part, "enable_simplify")
374 if part.enable_simplify==True:
376 row.itemR(part, "simplify_refsize")
377 row.itemR(part, "simplify_rate")
378 row.itemR(part, "simplify_transition")
380 row.itemR(part, "viewport")
382 subrow.active = part.viewport==True
383 subrow.itemR(part, "simplify_viewport")
386 elif part.ren_as == 'OBJECT':
387 #sub = split.column()
388 sub.itemR(part, "dupli_object")
389 elif part.ren_as == 'GROUP':
390 sub.itemR(part, "dupli_group")
391 split = layout.split()
393 sub.itemR(part, "whole_group")
395 colsub = sub.column()
396 colsub.active = part.whole_group == False
397 colsub.itemR(part, "rand_group")
399 elif part.ren_as == 'BILLBOARD':
400 sub.itemL(text="Align:")
403 row.itemR(part, "billboard_align", expand=True)
404 row.itemR(part, "billboard_lock", text="Lock")
406 row.itemR(part, "billboard_object")
409 col = row.column(align=True)
410 col.itemL(text="Tilt:")
411 col.itemR(part, "billboard_tilt", text="Angle", slider=True)
412 col.itemR(part, "billboard_random_tilt", slider=True)
414 col.itemR(part, "billboard_offset")
417 row.itemR(psys, "billboard_normal_uv")
419 row.itemR(psys, "billboard_time_index_uv")
422 row.itemL(text="Split uv's:")
423 row.itemR(part, "billboard_uv_split", text="Number of splits")
425 row.itemR(psys, "billboard_split_uv")
427 row.itemL(text="Animate:")
428 row.itemR(part, "billboard_animation", expand=True)
429 row.itemL(text="Offset:")
430 row.itemR(part, "billboard_split_offset", expand=True)
432 class PARTICLE_PT_draw(ParticleButtonsPanel):
433 __idname__= "PARTICLE_PT_draw"
434 __label__ = "Display"
435 __default_closed__ = True
437 def poll(self, context):
438 psys = context.particle_system
439 if psys==None: return False
440 if psys.settings==None: return False
443 def draw(self, context):
446 psys = context.particle_system
450 row.itemR(part, "draw_as", expand=True)
452 if part.draw_as=='NONE' or (part.ren_as=='NONE' and part.draw_as=='RENDER'):
455 path = (part.ren_as=='PATH' and part.draw_as=='RENDER') or part.draw_as=='PATH'
457 if path and part.type!='HAIR' and psys.point_cache.baked==False:
459 box.itemL(text="Baked or keyed particles needed for correct drawing.")
463 row.itemR(part, "display", slider=True)
464 if part.draw_as!='RENDER' or part.ren_as=='HALO':
465 row.itemR(part, "draw_size")
471 col.itemR(part, "show_size")
472 col.itemR(part, "velocity")
473 col.itemR(part, "num")
474 if part.physics_type == 'BOIDS':
475 col.itemR(part, "draw_health")
480 box.itemR(part, "draw_step")
482 col.itemR(part, "material_color", text="Use material color")
483 subcol = col.column()
484 subcol.active = part.material_color==False
485 #subcol.itemL(text="color")
486 #subcol.itemL(text="Override material color")
488 class PARTICLE_PT_children(ParticleButtonsPanel):
489 __idname__= "PARTICLE_PT_children"
490 __label__ = "Children"
491 __default_closed__ = True
493 def draw(self, context):
496 psys = context.particle_system
499 layout.row().itemR(part, "child_type", expand=True)
501 if part.child_type=='NONE':
506 col = row.column(align=True)
507 col.itemR(part, "child_nbr", text="Display")
508 col.itemR(part, "rendered_child_nbr", text="Render")
510 col = row.column(align=True)
512 if part.child_type=='FACES':
513 col.itemR(part, "virtual_parents", slider=True)
515 col.itemR(part, "child_radius", text="Radius")
516 col.itemR(part, "child_roundness", text="Roundness", slider=True)
518 col = row.column(align=True)
519 col.itemR(part, "child_size", text="Size")
520 col.itemR(part, "child_random_size", text="Random")
522 layout.row().itemL(text="Effects:")
526 col = row.column(align=True)
527 col.itemR(part, "clump_factor", slider=True)
528 col.itemR(part, "clumppow", slider=True)
530 col = row.column(align=True)
531 col.itemR(part, "rough_endpoint")
532 col.itemR(part, "rough_end_shape")
536 col = row.column(align=True)
537 col.itemR(part, "rough1")
538 col.itemR(part, "rough1_size")
540 col = row.column(align=True)
541 col.itemR(part, "rough2")
542 col.itemR(part, "rough2_size")
543 col.itemR(part, "rough2_thres", slider=True)
545 layout.row().itemL(text="Kink:")
546 layout.row().itemR(part, "kink", expand=True)
548 split = layout.split()
551 sub.itemR(part, "kink_amplitude")
552 sub.itemR(part, "kink_frequency")
554 sub.itemR(part, "kink_shape", slider=True)
556 class PARTICLE_PT_vertexgroups(ParticleButtonsPanel):
557 __idname__= "PARTICLE_PT_vertexgroups"
558 __label__ = "Vertexgroups"
559 __default_closed__ = True
561 def draw(self, context):
564 psys = context.particle_system
567 layout.itemL(text="Nothing here yet.")
570 #row.itemL(text="Vertex Group")
571 #row.itemL(text="Negate")
575 #row.itemR(psys, "vertex_group_density")
576 #row.itemR(psys, "vertex_group_density_negate", text="")
579 #row.itemR(psys, "vertex_group_velocity")
580 #row.itemR(psys, "vertex_group_velocity_negate", text="")
583 #row.itemR(psys, "vertex_group_length")
584 #row.itemR(psys, "vertex_group_length_negate", text="")
587 #row.itemR(psys, "vertex_group_clump")
588 #row.itemR(psys, "vertex_group_clump_negate", text="")
591 #row.itemR(psys, "vertex_group_kink")
592 #row.itemR(psys, "vertex_group_kink_negate", text="")
595 #row.itemR(psys, "vertex_group_roughness1")
596 #row.itemR(psys, "vertex_group_roughness1_negate", text="")
599 #row.itemR(psys, "vertex_group_roughness2")
600 #row.itemR(psys, "vertex_group_roughness2_negate", text="")
603 #row.itemR(psys, "vertex_group_roughness_end")
604 #row.itemR(psys, "vertex_group_roughness_end_negate", text="")
607 #row.itemR(psys, "vertex_group_size")
608 #row.itemR(psys, "vertex_group_size_negate", text="")
611 #row.itemR(psys, "vertex_group_tangent")
612 #row.itemR(psys, "vertex_group_tangent_negate", text="")
615 #row.itemR(psys, "vertex_group_rotation")
616 #row.itemR(psys, "vertex_group_rotation_negate", text="")
619 #row.itemR(psys, "vertex_group_field")
620 #row.itemR(psys, "vertex_group_field_negate", text="")
622 bpy.types.register(PARTICLE_PT_particles)
623 bpy.types.register(PARTICLE_PT_cache)
624 bpy.types.register(PARTICLE_PT_emission)
625 bpy.types.register(PARTICLE_PT_initial)
626 bpy.types.register(PARTICLE_PT_physics)
627 bpy.types.register(PARTICLE_PT_render)
628 bpy.types.register(PARTICLE_PT_draw)
629 bpy.types.register(PARTICLE_PT_children)
630 bpy.types.register(PARTICLE_PT_vertexgroups)