29be9ac21587c3e96b7e84820f0d61ab33a18b0d
[blender-staging.git] / release / scripts / startup / bl_ui / properties_particle.py
1 # ##### BEGIN GPL LICENSE BLOCK #####
2 #
3 #  This program is free software; you can redistribute it and/or
4 #  modify it under the terms of the GNU General Public License
5 #  as published by the Free Software Foundation; either version 2
6 #  of the License, or (at your option) any later version.
7 #
8 #  This program is distributed in the hope that it will be useful,
9 #  but WITHOUT ANY WARRANTY; without even the implied warranty of
10 #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11 #  GNU General Public License for more details.
12 #
13 #  You should have received a copy of the GNU General Public License
14 #  along with this program; if not, write to the Free Software Foundation,
15 #  Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 #
17 # ##### END GPL LICENSE BLOCK #####
18
19 # <pep8 compliant>
20 import bpy
21 from bpy.types import Panel, Menu
22 from rna_prop_ui import PropertyPanel
23 from bpy.app.translations import pgettext_iface as iface_
24
25 from bl_ui.properties_physics_common import (
26         point_cache_ui,
27         effector_weights_ui,
28         basic_force_field_settings_ui,
29         basic_force_field_falloff_ui,
30         )
31
32
33 def particle_panel_enabled(context, psys):
34     if psys is None:
35         return True
36     phystype = psys.settings.physics_type
37     if psys.settings.type in {'EMITTER', 'REACTOR'} and phystype in {'NO', 'KEYED'}:
38         return True
39     else:
40         return (psys.point_cache.is_baked is False) and (not psys.is_edited) and (not context.particle_system_editable)
41
42
43 def particle_panel_poll(cls, context):
44     psys = context.particle_system
45     engine = context.scene.render.engine
46     settings = 0
47
48     if psys:
49         settings = psys.settings
50     elif isinstance(context.space_data.pin_id, bpy.types.ParticleSettings):
51         settings = context.space_data.pin_id
52
53     if not settings:
54         return False
55
56     return settings.is_fluid is False and (engine in cls.COMPAT_ENGINES)
57
58
59 def particle_get_settings(context):
60     if context.particle_system:
61         return context.particle_system.settings
62     elif isinstance(context.space_data.pin_id, bpy.types.ParticleSettings):
63         return context.space_data.pin_id
64     return None
65
66
67 class PARTICLE_MT_specials(Menu):
68     bl_label = "Particle Specials"
69     COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
70
71     def draw(self, context):
72         layout = self.layout
73
74         props = layout.operator("particle.copy_particle_systems", text="Copy Active to Selected Objects")
75         props.use_active = True
76         props.remove_target_particles = False
77
78         props = layout.operator("particle.copy_particle_systems", text="Copy All to Selected Objects")
79         props.use_active = False
80         props.remove_target_particles = True
81
82
83 class PARTICLE_MT_hair_dynamics_presets(Menu):
84     bl_label = "Hair Dynamics Presets"
85     preset_subdir = "hair_dynamics"
86     preset_operator = "script.execute_preset"
87     COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
88     draw = Menu.draw_preset
89
90
91 class ParticleButtonsPanel:
92     bl_space_type = 'PROPERTIES'
93     bl_region_type = 'WINDOW'
94     bl_context = "particle"
95
96     @classmethod
97     def poll(cls, context):
98         return particle_panel_poll(cls, context)
99
100
101 def find_modifier(ob, psys):
102     for md in ob.modifiers:
103         if md.type == 'PARTICLE_SYSTEM':
104             if md.particle_system == psys:
105                 return md
106
107
108 class PARTICLE_UL_particle_systems(bpy.types.UIList):
109     def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index, flt_flag):
110         ob = data
111         psys = item
112
113         if self.layout_type in {'DEFAULT', 'COMPACT'}:
114             md = find_modifier(ob, psys)
115
116             layout.prop(psys, "name", text="", emboss=False, icon_value=icon)
117             if md:
118                 layout.prop(md, "show_render", emboss=False, icon_only=True, icon='RESTRICT_RENDER_OFF' if md.show_render else 'RESTRICT_RENDER_ON')
119                 layout.prop(md, "show_viewport", emboss=False, icon_only=True, icon='RESTRICT_VIEW_OFF' if md.show_viewport else 'RESTRICT_VIEW_ON')
120
121         elif self.layout_type in {'GRID'}:
122             layout.alignment = 'CENTER'
123             layout.label(text="", icon_value=icon)
124
125
126 class PARTICLE_PT_context_particles(ParticleButtonsPanel, Panel):
127     bl_label = ""
128     bl_options = {'HIDE_HEADER'}
129     COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
130
131     @classmethod
132     def poll(cls, context):
133         engine = context.scene.render.engine
134         return (context.particle_system or context.object or context.space_data.pin_id) and (engine in cls.COMPAT_ENGINES)
135
136     def draw(self, context):
137         layout = self.layout
138
139         if context.scene.render.engine == 'BLENDER_GAME':
140             layout.label("Not available in the Game Engine")
141             return
142
143         ob = context.object
144         psys = context.particle_system
145         part = 0
146
147         if ob:
148             row = layout.row()
149
150             row.template_list("PARTICLE_UL_particle_systems", "particle_systems", ob, "particle_systems",
151                               ob.particle_systems, "active_index", rows=1)
152
153             col = row.column(align=True)
154             col.operator("object.particle_system_add", icon='ZOOMIN', text="")
155             col.operator("object.particle_system_remove", icon='ZOOMOUT', text="")
156             col.menu("PARTICLE_MT_specials", icon='DOWNARROW_HLT', text="")
157
158         if psys is None:
159             part = particle_get_settings(context)
160
161             layout.operator("object.particle_system_add", icon='ZOOMIN', text="New")
162
163             if part is None:
164                 return
165
166             layout.template_ID(context.space_data, "pin_id")
167
168             if part.is_fluid:
169                 layout.label(text="Settings used for fluid")
170                 return
171
172             layout.prop(part, "type", text="Type")
173
174         elif not psys.settings:
175             split = layout.split(percentage=0.32)
176
177             col = split.column()
178             col.label(text="Settings:")
179
180             col = split.column()
181             col.template_ID(psys, "settings", new="particle.new")
182         else:
183             part = psys.settings
184
185             split = layout.split(percentage=0.32)
186             col = split.column()
187             if part.is_fluid is False:
188                 col.label(text="Settings:")
189                 col.label(text="Type:")
190
191             col = split.column()
192             if part.is_fluid is False:
193                 row = col.row()
194                 row.enabled = particle_panel_enabled(context, psys)
195                 row.template_ID(psys, "settings", new="particle.new")
196
197             if part.is_fluid:
198                 layout.label(text=iface_("%d fluid particles for this frame") % part.count, translate=False)
199                 return
200
201             row = col.row()
202             row.enabled = particle_panel_enabled(context, psys)
203             row.prop(part, "type", text="")
204             row.prop(psys, "seed")
205
206         if part:
207             split = layout.split(percentage=0.65)
208             if part.type == 'HAIR':
209                 if psys is not None and psys.is_edited:
210                     split.operator("particle.edited_clear", text="Free Edit")
211                 else:
212                     row = split.row()
213                     row.enabled = particle_panel_enabled(context, psys)
214                     row.prop(part, "regrow_hair")
215                     row.prop(part, "use_advanced_hair")
216                 row = split.row()
217                 row.enabled = particle_panel_enabled(context, psys)
218                 row.prop(part, "hair_step")
219                 if psys is not None and psys.is_edited:
220                     if psys.is_global_hair:
221                         layout.operator("particle.connect_hair")
222                     else:
223                         layout.operator("particle.disconnect_hair")
224             elif psys is not None and part.type == 'REACTOR':
225                 split.enabled = particle_panel_enabled(context, psys)
226                 split.prop(psys, "reactor_target_object")
227                 split.prop(psys, "reactor_target_particle_system", text="Particle System")
228
229
230 class PARTICLE_PT_emission(ParticleButtonsPanel, Panel):
231     bl_label = "Emission"
232     COMPAT_ENGINES = {'BLENDER_RENDER'}
233
234     @classmethod
235     def poll(cls, context):
236         psys = context.particle_system
237         settings = particle_get_settings(context)
238
239         if settings is None:
240             return False
241         if settings.is_fluid:
242             return False
243         if particle_panel_poll(PARTICLE_PT_emission, context):
244             return psys is None or not context.particle_system.point_cache.use_external
245         return False
246
247     def draw(self, context):
248         layout = self.layout
249
250         psys = context.particle_system
251         part = particle_get_settings(context)
252
253         layout.enabled = particle_panel_enabled(context, psys) and (psys is None or not psys.has_multiple_caches)
254
255         row = layout.row()
256         row.active = part.distribution != 'GRID'
257         row.prop(part, "count")
258
259         if part.type == 'HAIR':
260             row.prop(part, "hair_length")
261             if not part.use_advanced_hair:
262                 row = layout.row()
263                 row.prop(part, "use_modifier_stack")
264                 return
265
266         if part.type != 'HAIR':
267             split = layout.split()
268
269             col = split.column(align=True)
270             col.prop(part, "frame_start")
271             col.prop(part, "frame_end")
272
273             col = split.column(align=True)
274             col.prop(part, "lifetime")
275             col.prop(part, "lifetime_random", slider=True)
276
277         layout.label(text="Emit From:")
278         layout.prop(part, "emit_from", expand=True)
279
280         row = layout.row()
281         if part.emit_from == 'VERT':
282             row.prop(part, "use_emit_random")
283         elif part.distribution == 'GRID':
284             row.prop(part, "invert_grid")
285             row.prop(part, "hexagonal_grid")
286         else:
287             row.prop(part, "use_emit_random")
288             row.prop(part, "use_even_distribution")
289
290         if part.emit_from == 'FACE' or part.emit_from == 'VOLUME':
291             layout.prop(part, "distribution", expand=True)
292
293             row = layout.row()
294             if part.distribution == 'JIT':
295                 row.prop(part, "userjit", text="Particles/Face")
296                 row.prop(part, "jitter_factor", text="Jittering Amount", slider=True)
297             elif part.distribution == 'GRID':
298                 row.prop(part, "grid_resolution")
299                 row.prop(part, "grid_random", text="Random", slider=True)
300
301         row = layout.row()
302         row.prop(part, "use_modifier_stack")
303
304
305 class PARTICLE_PT_hair_dynamics(ParticleButtonsPanel, Panel):
306     bl_label = "Hair dynamics"
307     bl_options = {'DEFAULT_CLOSED'}
308     COMPAT_ENGINES = {'BLENDER_RENDER'}
309
310     @classmethod
311     def poll(cls, context):
312         psys = context.particle_system
313         engine = context.scene.render.engine
314         if psys is None:
315             return False
316         if psys.settings is None:
317             return False
318         return psys.settings.type == 'HAIR' and (engine in cls.COMPAT_ENGINES)
319
320     def draw_header(self, context):
321         psys = context.particle_system
322         self.layout.prop(psys, "use_hair_dynamics", text="")
323
324     def draw(self, context):
325         layout = self.layout
326
327         psys = context.particle_system
328
329         if not psys.cloth:
330             return
331
332         cloth_md = psys.cloth
333         cloth = cloth_md.settings
334         result = cloth_md.solver_result
335
336         layout.enabled = psys.use_hair_dynamics and psys.point_cache.is_baked is False
337
338         row = layout.row(align=True)
339         row.menu("PARTICLE_MT_hair_dynamics_presets", text=bpy.types.PARTICLE_MT_hair_dynamics_presets.bl_label)
340         row.operator("particle.hair_dynamics_preset_add", text="", icon='ZOOMIN')
341         row.operator("particle.hair_dynamics_preset_add", text="", icon='ZOOMOUT').remove_active = True
342
343         split = layout.column()
344
345         col = split.column()
346         col.label(text="Structure")
347         col.prop(cloth, "mass")
348         sub = col.column(align=True)
349         subsub = sub.row(align=True)
350         subsub.prop(cloth, "bending_stiffness", text="Stiffness")
351         subsub.prop(psys.settings, "bending_random", text="Random")
352         sub.prop(cloth, "bending_damping", text="Damping")
353         # XXX has no noticeable effect with stiff hair structure springs
354         #col.prop(cloth, "spring_damping", text="Damping")
355
356         split.separator()
357
358         col = split.column()
359         col.label(text="Volume")
360         col.prop(cloth, "air_damping", text="Air Drag")
361         col.prop(cloth, "internal_friction", slider=True)
362         sub = col.column(align=True)
363         sub.prop(cloth, "density_target", text="Density Target")
364         sub.prop(cloth, "density_strength", slider=True, text="Strength")
365         col.prop(cloth, "voxel_cell_size")
366
367         split.separator()
368
369         col = split.column()
370         col.label(text="Pinning")
371         col.prop(cloth, "pin_stiffness", text="Goal Strength")
372
373         split.separator()
374
375         col = split.column()
376         col.label(text="Quality:")
377         col.prop(cloth, "quality", text="Steps", slider=True)
378
379         row = col.row()
380         row.prop(psys.settings, "show_hair_grid", text="HairGrid")
381
382         if result:
383             box = layout.box()
384
385             if not result.status:
386                 label = " "
387                 icon = 'NONE'
388             elif result.status == {'SUCCESS'}:
389                 label = "Success"
390                 icon = 'NONE'
391             elif result.status - {'SUCCESS'} == {'NO_CONVERGENCE'}:
392                 label = "No Convergence"
393                 icon = 'ERROR'
394             else:
395                 label = "ERROR"
396                 icon = 'ERROR'
397             box.label(label, icon=icon)
398             box.label("Iterations: %d .. %d (avg. %d)" % (result.min_iterations, result.max_iterations, result.avg_iterations))
399             box.label("Error: %.5f .. %.5f (avg. %.5f)" % (result.min_error, result.max_error, result.avg_error))
400
401
402 class PARTICLE_PT_cache(ParticleButtonsPanel, Panel):
403     bl_label = "Cache"
404     bl_options = {'DEFAULT_CLOSED'}
405     COMPAT_ENGINES = {'BLENDER_RENDER'}
406
407     @classmethod
408     def poll(cls, context):
409         psys = context.particle_system
410         engine = context.scene.render.engine
411         if psys is None:
412             return False
413         if psys.settings is None:
414             return False
415         if psys.settings.is_fluid:
416             return False
417         phystype = psys.settings.physics_type
418         if phystype == 'NO' or phystype == 'KEYED':
419             return False
420         return (psys.settings.type in {'EMITTER', 'REACTOR'} or (psys.settings.type == 'HAIR' and (psys.use_hair_dynamics or psys.point_cache.is_baked))) and engine in cls.COMPAT_ENGINES
421
422     def draw(self, context):
423         psys = context.particle_system
424
425         point_cache_ui(self, context, psys.point_cache, True, 'HAIR' if (psys.settings.type == 'HAIR') else 'PSYS')
426
427
428 class PARTICLE_PT_velocity(ParticleButtonsPanel, Panel):
429     bl_label = "Velocity"
430     COMPAT_ENGINES = {'BLENDER_RENDER'}
431
432     @classmethod
433     def poll(cls, context):
434         if particle_panel_poll(PARTICLE_PT_velocity, context):
435             psys = context.particle_system
436             settings = particle_get_settings(context)
437
438             if settings.type == 'HAIR' and not settings.use_advanced_hair:
439                 return False
440             return settings.physics_type != 'BOIDS' and (psys is None or not psys.point_cache.use_external)
441         else:
442             return False
443
444     def draw(self, context):
445         layout = self.layout
446
447         psys = context.particle_system
448         part = particle_get_settings(context)
449
450         layout.enabled = particle_panel_enabled(context, psys)
451
452         split = layout.split()
453
454         col = split.column()
455         col.label(text="Emitter Geometry:")
456         col.prop(part, "normal_factor")
457         sub = col.column(align=True)
458         sub.prop(part, "tangent_factor")
459         sub.prop(part, "tangent_phase", slider=True)
460
461         col = split.column()
462         col.label(text="Emitter Object:")
463         col.prop(part, "object_align_factor", text="")
464
465         layout.label(text="Other:")
466         row = layout.row()
467         if part.emit_from == 'PARTICLE':
468             row.prop(part, "particle_factor")
469         else:
470             row.prop(part, "object_factor", slider=True)
471         row.prop(part, "factor_random")
472
473         #if part.type=='REACTOR':
474         #    sub.prop(part, "reactor_factor")
475         #    sub.prop(part, "reaction_shape", slider=True)
476
477
478 class PARTICLE_PT_rotation(ParticleButtonsPanel, Panel):
479     bl_label = "Rotation"
480     bl_options = {'DEFAULT_CLOSED'}
481     COMPAT_ENGINES = {'BLENDER_RENDER'}
482
483     @classmethod
484     def poll(cls, context):
485         if particle_panel_poll(PARTICLE_PT_rotation, context):
486             psys = context.particle_system
487             settings = particle_get_settings(context)
488
489             if settings.type == 'HAIR' and not settings.use_advanced_hair:
490                 return False
491             return settings.physics_type != 'BOIDS' and (psys is None or not psys.point_cache.use_external)
492         else:
493             return False
494
495     def draw_header(self, context):
496         psys = context.particle_system
497         if psys:
498             part = psys.settings
499         else:
500             part = context.space_data.pin_id
501
502         self.layout.prop(part, "use_rotations", text="")
503
504     def draw(self, context):
505         layout = self.layout
506
507         psys = context.particle_system
508         if psys:
509             part = psys.settings
510         else:
511             part = context.space_data.pin_id
512
513         layout.enabled = particle_panel_enabled(context, psys) and part.use_rotations
514
515         layout.label(text="Initial Orientation:")
516
517         split = layout.split()
518
519         col = split.column(align=True)
520         col.prop(part, "rotation_mode", text="")
521         col.prop(part, "rotation_factor_random", slider=True, text="Random")
522
523         col = split.column(align=True)
524         col.prop(part, "phase_factor", slider=True)
525         col.prop(part, "phase_factor_random", text="Random", slider=True)
526
527         if part.type != 'HAIR':
528             layout.label(text="Angular Velocity:")
529
530             split = layout.split()
531
532             col = split.column(align=True)
533             col.prop(part, "angular_velocity_mode", text="")
534             sub = col.column(align=True)
535             sub.active = part.angular_velocity_mode != 'NONE'
536             sub.prop(part, "angular_velocity_factor", text="")
537
538             col = split.column()
539             col.prop(part, "use_dynamic_rotation")
540
541
542 class PARTICLE_PT_physics(ParticleButtonsPanel, Panel):
543     bl_label = "Physics"
544     COMPAT_ENGINES = {'BLENDER_RENDER'}
545
546     @classmethod
547     def poll(cls, context):
548         if particle_panel_poll(PARTICLE_PT_physics, context):
549             psys = context.particle_system
550             settings = particle_get_settings(context)
551
552             if settings.type == 'HAIR' and not settings.use_advanced_hair:
553                 return False
554             return psys is None or not psys.point_cache.use_external
555         else:
556             return False
557
558     def draw(self, context):
559         layout = self.layout
560
561         psys = context.particle_system
562         part = particle_get_settings(context)
563
564         layout.enabled = particle_panel_enabled(context, psys)
565
566         layout.prop(part, "physics_type", expand=True)
567
568         row = layout.row()
569         col = row.column(align=True)
570         col.prop(part, "particle_size")
571         col.prop(part, "size_random", slider=True)
572
573         if part.physics_type != 'NO':
574             col = row.column(align=True)
575             col.prop(part, "mass")
576             col.prop(part, "use_multiply_size_mass", text="Multiply mass with size")
577
578         if part.physics_type in {'NEWTON', 'FLUID'}:
579             split = layout.split()
580
581             col = split.column()
582             col.label(text="Forces:")
583             col.prop(part, "brownian_factor")
584             col.prop(part, "drag_factor", slider=True)
585             col.prop(part, "damping", slider=True)
586
587             col = split.column()
588             col.label(text="Integration:")
589             col.prop(part, "integrator", text="")
590             col.prop(part, "timestep")
591             sub = col.row()
592             sub.prop(part, "subframes")
593             supports_courant = part.physics_type == 'FLUID'
594             subsub = sub.row()
595             subsub.enabled = supports_courant
596             subsub.prop(part, "use_adaptive_subframes", text="")
597             if supports_courant and part.use_adaptive_subframes:
598                 col.prop(part, "courant_target", text="Threshold")
599
600             row = layout.row()
601             row.prop(part, "use_size_deflect")
602             row.prop(part, "use_die_on_collision")
603
604             if part.physics_type == 'FLUID':
605                 fluid = part.fluid
606
607                 split = layout.split()
608                 sub = split.row()
609                 sub.prop(fluid, "solver", expand=True)
610
611                 split = layout.split()
612
613                 col = split.column()
614                 col.label(text="Fluid properties:")
615                 col.prop(fluid, "stiffness", text="Stiffness")
616                 col.prop(fluid, "linear_viscosity", text="Viscosity")
617                 col.prop(fluid, "buoyancy", text="Buoyancy", slider=True)
618
619                 col = split.column()
620                 col.label(text="Advanced:")
621
622                 if fluid.solver == 'DDR':
623                     sub = col.row()
624                     sub.prop(fluid, "repulsion", slider=fluid.factor_repulsion)
625                     sub.prop(fluid, "factor_repulsion", text="")
626
627                     sub = col.row()
628                     sub.prop(fluid, "stiff_viscosity", slider=fluid.factor_stiff_viscosity)
629                     sub.prop(fluid, "factor_stiff_viscosity", text="")
630
631                 sub = col.row()
632                 sub.prop(fluid, "fluid_radius", slider=fluid.factor_radius)
633                 sub.prop(fluid, "factor_radius", text="")
634
635                 sub = col.row()
636                 sub.prop(fluid, "rest_density", slider=fluid.use_factor_density)
637                 sub.prop(fluid, "use_factor_density", text="")
638
639                 if fluid.solver == 'CLASSICAL':
640                     # With the classical solver, it is possible to calculate the
641                     # spacing between particles when the fluid is at rest. This
642                     # makes it easier to set stable initial conditions.
643                     particle_volume = part.mass / fluid.rest_density
644                     spacing = pow(particle_volume, 1.0 / 3.0)
645                     sub = col.row()
646                     sub.label(text="Spacing: %g" % spacing)
647
648                 elif fluid.solver == 'DDR':
649                     split = layout.split()
650
651                     col = split.column()
652                     col.label(text="Springs:")
653                     col.prop(fluid, "spring_force", text="Force")
654                     col.prop(fluid, "use_viscoelastic_springs")
655                     sub = col.column(align=True)
656                     sub.active = fluid.use_viscoelastic_springs
657                     sub.prop(fluid, "yield_ratio", slider=True)
658                     sub.prop(fluid, "plasticity", slider=True)
659
660                     col = split.column()
661                     col.label(text="Advanced:")
662                     sub = col.row()
663                     sub.prop(fluid, "rest_length", slider=fluid.factor_rest_length)
664                     sub.prop(fluid, "factor_rest_length", text="")
665                     col.label(text="")
666                     sub = col.column()
667                     sub.active = fluid.use_viscoelastic_springs
668                     sub.prop(fluid, "use_initial_rest_length")
669                     sub.prop(fluid, "spring_frames", text="Frames")
670
671         elif part.physics_type == 'KEYED':
672             split = layout.split()
673             sub = split.column()
674
675             row = layout.row()
676             col = row.column()
677             col.active = not psys.use_keyed_timing
678             col.prop(part, "keyed_loops", text="Loops")
679             if psys:
680                 row.prop(psys, "use_keyed_timing", text="Use Timing")
681
682             layout.label(text="Keys:")
683         elif part.physics_type == 'BOIDS':
684             boids = part.boids
685
686             row = layout.row()
687             row.prop(boids, "use_flight")
688             row.prop(boids, "use_land")
689             row.prop(boids, "use_climb")
690
691             split = layout.split()
692
693             col = split.column(align=True)
694             col.active = boids.use_flight
695             col.prop(boids, "air_speed_max")
696             col.prop(boids, "air_speed_min", slider=True)
697             col.prop(boids, "air_acc_max", slider=True)
698             col.prop(boids, "air_ave_max", slider=True)
699             col.prop(boids, "air_personal_space")
700             row = col.row(align=True)
701             row.active = (boids.use_land or boids.use_climb) and boids.use_flight
702             row.prop(boids, "land_smooth")
703
704             col = split.column(align=True)
705             col.active = boids.use_land or boids.use_climb
706             col.prop(boids, "land_speed_max")
707             col.prop(boids, "land_jump_speed")
708             col.prop(boids, "land_acc_max", slider=True)
709             col.prop(boids, "land_ave_max", slider=True)
710             col.prop(boids, "land_personal_space")
711             col.prop(boids, "land_stick_force")
712
713             split = layout.split()
714
715             col = split.column(align=True)
716             col.label(text="Battle:")
717             col.prop(boids, "health")
718             col.prop(boids, "strength")
719             col.prop(boids, "aggression")
720             col.prop(boids, "accuracy")
721             col.prop(boids, "range")
722
723             col = split.column()
724             col.label(text="Misc:")
725             col.prop(boids, "bank", slider=True)
726             col.prop(boids, "pitch", slider=True)
727             col.prop(boids, "height", slider=True)
728
729         if psys and part.physics_type in {'KEYED', 'BOIDS', 'FLUID'}:
730             if part.physics_type == 'BOIDS':
731                 layout.label(text="Relations:")
732             elif part.physics_type == 'FLUID':
733                 layout.label(text="Fluid interaction:")
734
735             row = layout.row()
736             row.template_list("UI_UL_list", "particle_targets", psys, "targets", psys, "active_particle_target_index", rows=4)
737
738             col = row.column()
739             sub = col.row()
740             subsub = sub.column(align=True)
741             subsub.operator("particle.new_target", icon='ZOOMIN', text="")
742             subsub.operator("particle.target_remove", icon='ZOOMOUT', text="")
743             sub = col.row()
744             subsub = sub.column(align=True)
745             subsub.operator("particle.target_move_up", icon='MOVE_UP_VEC', text="")
746             subsub.operator("particle.target_move_down", icon='MOVE_DOWN_VEC', text="")
747
748             key = psys.active_particle_target
749             if key:
750                 row = layout.row()
751                 if part.physics_type == 'KEYED':
752                     col = row.column()
753                     #doesn't work yet
754                     #col.alert = key.valid
755                     col.prop(key, "object", text="")
756                     col.prop(key, "system", text="System")
757                     col = row.column()
758                     col.active = psys.use_keyed_timing
759                     col.prop(key, "time")
760                     col.prop(key, "duration")
761                 elif part.physics_type == 'BOIDS':
762                     sub = row.row()
763                     #doesn't work yet
764                     #sub.alert = key.valid
765                     sub.prop(key, "object", text="")
766                     sub.prop(key, "system", text="System")
767
768                     layout.prop(key, "alliance", expand=True)
769                 elif part.physics_type == 'FLUID':
770                     sub = row.row()
771                     #doesn't work yet
772                     #sub.alert = key.valid
773                     sub.prop(key, "object", text="")
774                     sub.prop(key, "system", text="System")
775
776
777 class PARTICLE_PT_boidbrain(ParticleButtonsPanel, Panel):
778     bl_label = "Boid Brain"
779     COMPAT_ENGINES = {'BLENDER_RENDER'}
780
781     @classmethod
782     def poll(cls, context):
783         psys = context.particle_system
784         settings = particle_get_settings(context)
785         engine = context.scene.render.engine
786
787         if settings is None:
788             return False
789         if psys is not None and psys.point_cache.use_external:
790             return False
791         return settings.physics_type == 'BOIDS' and engine in cls.COMPAT_ENGINES
792
793     def draw(self, context):
794         layout = self.layout
795
796         boids = particle_get_settings(context).boids
797
798         layout.enabled = particle_panel_enabled(context, context.particle_system)
799
800         # Currently boids can only use the first state so these are commented out for now.
801         #row = layout.row()
802         #row.template_list("UI_UL_list", "particle_boids", boids, "states",
803         #                  boids, "active_boid_state_index", compact="True")
804         #col = row.row()
805         #sub = col.row(align=True)
806         #sub.operator("boid.state_add", icon='ZOOMIN', text="")
807         #sub.operator("boid.state_del", icon='ZOOMOUT', text="")
808         #sub = row.row(align=True)
809         #sub.operator("boid.state_move_up", icon='MOVE_UP_VEC', text="")
810         #sub.operator("boid.state_move_down", icon='MOVE_DOWN_VEC', text="")
811
812         state = boids.active_boid_state
813
814         #layout.prop(state, "name", text="State name")
815
816         row = layout.row()
817         row.prop(state, "ruleset_type")
818         if state.ruleset_type == 'FUZZY':
819             row.prop(state, "rule_fuzzy", slider=True)
820         else:
821             row.label(text="")
822
823         row = layout.row()
824         row.template_list("UI_UL_list", "particle_boids_rules", state, "rules", state, "active_boid_rule_index", rows=4)
825
826         col = row.column()
827         sub = col.row()
828         subsub = sub.column(align=True)
829         subsub.operator_menu_enum("boid.rule_add", "type", icon='ZOOMIN', text="")
830         subsub.operator("boid.rule_del", icon='ZOOMOUT', text="")
831         sub = col.row()
832         subsub = sub.column(align=True)
833         subsub.operator("boid.rule_move_up", icon='MOVE_UP_VEC', text="")
834         subsub.operator("boid.rule_move_down", icon='MOVE_DOWN_VEC', text="")
835
836         rule = state.active_boid_rule
837
838         if rule:
839             row = layout.row()
840             row.prop(rule, "name", text="")
841             #somebody make nice icons for boids here please! -jahka
842             row.prop(rule, "use_in_air", icon='MOVE_UP_VEC', text="")
843             row.prop(rule, "use_on_land", icon='MOVE_DOWN_VEC', text="")
844
845             row = layout.row()
846
847             if rule.type == 'GOAL':
848                 row.prop(rule, "object")
849                 row = layout.row()
850                 row.prop(rule, "use_predict")
851             elif rule.type == 'AVOID':
852                 row.prop(rule, "object")
853                 row = layout.row()
854                 row.prop(rule, "use_predict")
855                 row.prop(rule, "fear_factor")
856             elif rule.type == 'FOLLOW_PATH':
857                 row.label(text="Not yet functional")
858             elif rule.type == 'AVOID_COLLISION':
859                 row.prop(rule, "use_avoid")
860                 row.prop(rule, "use_avoid_collision")
861                 row.prop(rule, "look_ahead")
862             elif rule.type == 'FOLLOW_LEADER':
863                 row.prop(rule, "object", text="")
864                 row.prop(rule, "distance")
865                 row = layout.row()
866                 row.prop(rule, "use_line")
867                 sub = row.row()
868                 sub.active = rule.line
869                 sub.prop(rule, "queue_count")
870             elif rule.type == 'AVERAGE_SPEED':
871                 row.prop(rule, "speed", slider=True)
872                 row.prop(rule, "wander", slider=True)
873                 row.prop(rule, "level", slider=True)
874             elif rule.type == 'FIGHT':
875                 row.prop(rule, "distance")
876                 row.prop(rule, "flee_distance")
877
878
879 class PARTICLE_PT_render(ParticleButtonsPanel, Panel):
880     bl_label = "Render"
881     COMPAT_ENGINES = {'BLENDER_RENDER'}
882
883     @classmethod
884     def poll(cls, context):
885         settings = particle_get_settings(context)
886         engine = context.scene.render.engine
887         if settings is None:
888             return False
889
890         return engine in cls.COMPAT_ENGINES
891
892     def draw(self, context):
893         layout = self.layout
894
895         psys = context.particle_system
896         part = particle_get_settings(context)
897
898         if psys:
899             row = layout.row()
900             if part.render_type in {'OBJECT', 'GROUP'}:
901                 row.enabled = False
902             row.prop(part, "material_slot", text="")
903             row.prop(psys, "parent")
904
905         split = layout.split()
906
907         col = split.column()
908         col.prop(part, "use_render_emitter")
909         col.prop(part, "use_parent_particles")
910
911         col = split.column()
912         col.prop(part, "show_unborn")
913         col.prop(part, "use_dead")
914
915         layout.prop(part, "render_type", expand=True)
916
917         split = layout.split()
918
919         col = split.column()
920
921         if part.render_type == 'LINE':
922             col.prop(part, "line_length_tail")
923             col.prop(part, "line_length_head")
924
925             split.prop(part, "use_velocity_length")
926         elif part.render_type == 'PATH':
927             col.prop(part, "use_strand_primitive")
928             sub = col.column()
929             sub.active = (part.use_strand_primitive is False)
930             sub.prop(part, "use_render_adaptive")
931             sub = col.column()
932             sub.active = part.use_render_adaptive or part.use_strand_primitive is True
933             sub.prop(part, "adaptive_angle")
934             sub = col.column()
935             sub.active = (part.use_render_adaptive is True and part.use_strand_primitive is False)
936             sub.prop(part, "adaptive_pixel")
937             col.prop(part, "use_hair_bspline")
938             col.prop(part, "render_step", text="Steps")
939
940             col = split.column()
941             col.label(text="Timing:")
942             col.prop(part, "use_absolute_path_time")
943
944             if part.type == 'HAIR' or psys.point_cache.is_baked:
945                 col.prop(part, "path_start", text="Start", slider=not part.use_absolute_path_time)
946             else:
947                 col.prop(part, "trail_count")
948
949             col.prop(part, "path_end", text="End", slider=not part.use_absolute_path_time)
950             col.prop(part, "length_random", text="Random", slider=True)
951
952             row = layout.row()
953             col = row.column()
954
955             if part.type == 'HAIR' and part.use_strand_primitive is True and part.child_type == 'INTERPOLATED':
956                 layout.prop(part, "use_simplify")
957                 if part.use_simplify is True:
958                     row = layout.row()
959                     row.prop(part, "simplify_refsize")
960                     row.prop(part, "simplify_rate")
961                     row.prop(part, "simplify_transition")
962                     row = layout.row()
963                     row.prop(part, "use_simplify_viewport")
964                     sub = row.row()
965                     sub.active = part.use_simplify_viewport is True
966                     sub.prop(part, "simplify_viewport")
967
968         elif part.render_type == 'OBJECT':
969             col.prop(part, "dupli_object")
970             sub = col.row()
971             sub.prop(part, "use_global_dupli")
972             sub.prop(part, "use_rotation_dupli")
973             sub.prop(part, "use_scale_dupli")
974         elif part.render_type == 'GROUP':
975             col.prop(part, "dupli_group")
976             split = layout.split()
977
978             col = split.column()
979             col.prop(part, "use_whole_group")
980             sub = col.column()
981             sub.active = (part.use_whole_group is False)
982             sub.prop(part, "use_group_pick_random")
983             sub.prop(part, "use_group_count")
984
985             col = split.column()
986             sub = col.column()
987             sub.active = (part.use_whole_group is False)
988             sub.prop(part, "use_global_dupli")
989             sub.prop(part, "use_rotation_dupli")
990             sub.prop(part, "use_scale_dupli")
991
992             if part.use_group_count and not part.use_whole_group:
993                 row = layout.row()
994                 row.template_list("UI_UL_list", "particle_dupli_weights", part, "dupli_weights",
995                                   part, "active_dupliweight_index")
996
997                 col = row.column()
998                 sub = col.row()
999                 subsub = sub.column(align=True)
1000                 subsub.operator("particle.dupliob_copy", icon='ZOOMIN', text="")
1001                 subsub.operator("particle.dupliob_remove", icon='ZOOMOUT', text="")
1002                 subsub.operator("particle.dupliob_move_up", icon='MOVE_UP_VEC', text="")
1003                 subsub.operator("particle.dupliob_move_down", icon='MOVE_DOWN_VEC', text="")
1004
1005                 weight = part.active_dupliweight
1006                 if weight:
1007                     row = layout.row()
1008                     row.prop(weight, "count")
1009
1010         elif part.render_type == 'BILLBOARD':
1011             ob = context.object
1012
1013             col.label(text="Align:")
1014
1015             row = layout.row()
1016             row.prop(part, "billboard_align", expand=True)
1017             row.prop(part, "lock_billboard", text="Lock")
1018             row = layout.row()
1019             row.prop(part, "billboard_object")
1020
1021             row = layout.row()
1022             col = row.column(align=True)
1023             col.label(text="Tilt:")
1024             col.prop(part, "billboard_tilt", text="Angle", slider=True)
1025             col.prop(part, "billboard_tilt_random", text="Random", slider=True)
1026             col = row.column()
1027             col.prop(part, "billboard_offset")
1028
1029             row = layout.row()
1030             col = row.column()
1031             col.prop(part, "billboard_size", text="Scale")
1032             if part.billboard_align == 'VEL':
1033                 col = row.column(align=True)
1034                 col.label("Velocity Scale:")
1035                 col.prop(part, "billboard_velocity_head", text="Head")
1036                 col.prop(part, "billboard_velocity_tail", text="Tail")
1037
1038             if psys:
1039                 col = layout.column()
1040                 col.prop_search(psys, "billboard_normal_uv", ob.data, "uv_textures")
1041                 col.prop_search(psys, "billboard_time_index_uv", ob.data, "uv_textures")
1042
1043             split = layout.split(percentage=0.33)
1044             split.label(text="Split UVs:")
1045             split.prop(part, "billboard_uv_split", text="Number of splits")
1046
1047             if psys:
1048                 col = layout.column()
1049                 col.active = part.billboard_uv_split > 1
1050                 col.prop_search(psys, "billboard_split_uv", ob.data, "uv_textures")
1051
1052             row = col.row()
1053             row.label(text="Animate:")
1054             row.prop(part, "billboard_animation", text="")
1055             row.label(text="Offset:")
1056             row.prop(part, "billboard_offset_split", text="")
1057
1058         if part.render_type == 'HALO' or part.render_type == 'LINE' or part.render_type == 'BILLBOARD':
1059             row = layout.row()
1060             col = row.column()
1061             col.prop(part, "trail_count")
1062             if part.trail_count > 1:
1063                 col.prop(part, "use_absolute_path_time", text="Length in frames")
1064                 col = row.column()
1065                 col.prop(part, "path_end", text="Length", slider=not part.use_absolute_path_time)
1066                 col.prop(part, "length_random", text="Random", slider=True)
1067             else:
1068                 col = row.column()
1069                 col.label(text="")
1070
1071         if part.render_type in {'OBJECT', 'GROUP'} and not part.use_advanced_hair:
1072             row = layout.row(align=True)
1073             row.prop(part, "particle_size")
1074             row.prop(part, "size_random", slider=True)
1075
1076
1077 class PARTICLE_PT_draw(ParticleButtonsPanel, Panel):
1078     bl_label = "Display"
1079     bl_options = {'DEFAULT_CLOSED'}
1080     COMPAT_ENGINES = {'BLENDER_RENDER'}
1081
1082     @classmethod
1083     def poll(cls, context):
1084         settings = particle_get_settings(context)
1085         engine = context.scene.render.engine
1086         if settings is None:
1087             return False
1088         return engine in cls.COMPAT_ENGINES
1089
1090     def draw(self, context):
1091         layout = self.layout
1092
1093         psys = context.particle_system
1094         part = particle_get_settings(context)
1095
1096         row = layout.row()
1097         row.prop(part, "draw_method", expand=True)
1098         row.prop(part, "show_guide_hairs")
1099
1100         if part.draw_method == 'NONE' or (part.render_type == 'NONE' and part.draw_method == 'RENDER'):
1101             return
1102
1103         path = (part.render_type == 'PATH' and part.draw_method == 'RENDER') or part.draw_method == 'PATH'
1104
1105         row = layout.row()
1106         row.prop(part, "draw_percentage", slider=True)
1107         if part.draw_method != 'RENDER' or part.render_type == 'HALO':
1108             row.prop(part, "draw_size")
1109         else:
1110             row.label(text="")
1111
1112         if part.draw_percentage != 100 and psys is not None:
1113             if part.type == 'HAIR':
1114                 if psys.use_hair_dynamics and psys.point_cache.is_baked is False:
1115                     layout.row().label(text="Display percentage makes dynamics inaccurate without baking!")
1116             else:
1117                 phystype = part.physics_type
1118                 if phystype != 'NO' and phystype != 'KEYED' and psys.point_cache.is_baked is False:
1119                     layout.row().label(text="Display percentage makes dynamics inaccurate without baking!")
1120
1121         row = layout.row()
1122         col = row.column()
1123         col.prop(part, "show_size")
1124         col.prop(part, "show_velocity")
1125         col.prop(part, "show_number")
1126         if part.physics_type == 'BOIDS':
1127             col.prop(part, "show_health")
1128
1129         col = row.column(align=True)
1130         col.label(text="Color:")
1131         col.prop(part, "draw_color", text="")
1132         sub = col.row(align=True)
1133         sub.active = (part.draw_color in {'VELOCITY', 'ACCELERATION'})
1134         sub.prop(part, "color_maximum", text="Max")
1135
1136         if path:
1137             col.prop(part, "draw_step")
1138
1139
1140 class PARTICLE_PT_children(ParticleButtonsPanel, Panel):
1141     bl_label = "Children"
1142     bl_options = {'DEFAULT_CLOSED'}
1143     COMPAT_ENGINES = {'BLENDER_RENDER'}
1144
1145     @classmethod
1146     def poll(cls, context):
1147         return particle_panel_poll(cls, context)
1148
1149     def draw(self, context):
1150         layout = self.layout
1151
1152         psys = context.particle_system
1153         part = particle_get_settings(context)
1154
1155         layout.row().prop(part, "child_type", expand=True)
1156
1157         if part.child_type == 'NONE':
1158             return
1159
1160         row = layout.row()
1161
1162         col = row.column(align=True)
1163         col.prop(part, "child_nbr", text="Display")
1164         col.prop(part, "rendered_child_count", text="Render")
1165
1166         if part.child_type == 'INTERPOLATED':
1167             col = row.column()
1168             if psys:
1169                 col.prop(psys, "child_seed", text="Seed")
1170             col.prop(part, "virtual_parents", slider=True)
1171             col.prop(part, "create_long_hair_children")
1172         else:
1173             col = row.column(align=True)
1174             col.prop(part, "child_size", text="Size")
1175             col.prop(part, "child_size_random", text="Random")
1176
1177         split = layout.split()
1178
1179         col = split.column()
1180         col.label(text="Effects:")
1181
1182         sub = col.column(align=True)
1183         sub.prop(part, "use_clump_curve")
1184         if part.use_clump_curve:
1185             sub.template_curve_mapping(part, "clump_curve")
1186         else:
1187             sub.prop(part, "clump_factor", slider=True)
1188             sub.prop(part, "clump_shape", slider=True)
1189         sub = col.column(align=True)
1190         sub.prop(part, "use_clump_noise")
1191         subsub = sub.column()
1192         subsub.enabled = part.use_clump_noise
1193         subsub.prop(part, "clump_noise_size")
1194
1195         sub = col.column(align=True)
1196         sub.prop(part, "child_length", slider=True)
1197         sub.prop(part, "child_length_threshold", slider=True)
1198
1199         if part.child_type == 'SIMPLE':
1200             sub = col.column(align=True)
1201             sub.prop(part, "child_radius", text="Radius")
1202             sub.prop(part, "child_roundness", text="Roundness", slider=True)
1203             if psys:
1204                 sub.prop(psys, "child_seed", text="Seed")
1205         elif part.virtual_parents > 0.0:
1206             sub = col.column(align=True)
1207             sub.label(text="Parting not")
1208             sub.label(text="available with")
1209             sub.label(text="virtual parents")
1210         else:
1211             sub = col.column(align=True)
1212             sub.prop(part, "child_parting_factor", text="Parting", slider=True)
1213             sub.prop(part, "child_parting_min", text="Min")
1214             sub.prop(part, "child_parting_max", text="Max")
1215
1216         col = split.column()
1217
1218         col.prop(part, "use_roughness_curve")
1219         if part.use_roughness_curve:
1220             sub = col.column()
1221             sub.template_curve_mapping(part, "roughness_curve")
1222             sub.prop(part, "roughness_1", text="Roughness")
1223             sub.prop(part, "roughness_1_size", text="Size")
1224         else:
1225             col.label(text="Roughness:")
1226
1227             sub = col.column(align=True)
1228             sub.prop(part, "roughness_1", text="Uniform")
1229             sub.prop(part, "roughness_1_size", text="Size")
1230
1231             sub = col.column(align=True)
1232             sub.prop(part, "roughness_endpoint", "Endpoint")
1233             sub.prop(part, "roughness_end_shape")
1234
1235             sub = col.column(align=True)
1236             sub.prop(part, "roughness_2", text="Random")
1237             sub.prop(part, "roughness_2_size", text="Size")
1238             sub.prop(part, "roughness_2_threshold", slider=True)
1239
1240         layout.row().label(text="Kink:")
1241         layout.row().prop(part, "kink", expand=True)
1242
1243         split = layout.split()
1244         split.active = part.kink != 'NO'
1245
1246         if part.kink in {'SPIRAL'}:
1247             col = split.column()
1248             sub = col.column(align=True)
1249             sub.prop(part, "kink_amplitude", text="Radius")
1250             sub.prop(part, "kink_amplitude_random", text="Random", slider=True)
1251             sub = col.column(align=True)
1252             sub.prop(part, "kink_axis")
1253             sub.prop(part, "kink_axis_random", text="Random", slider=True)
1254             col = split.column(align=True)
1255             col.prop(part, "kink_frequency", text="Frequency")
1256             col.prop(part, "kink_shape", text="Shape", slider=True)
1257             col.prop(part, "kink_extra_steps", text="Steps")
1258         else:
1259             col = split.column()
1260             sub = col.column(align=True)
1261             sub.prop(part, "kink_amplitude")
1262             sub.prop(part, "kink_amplitude_clump", text="Clump", slider=True)
1263             col.prop(part, "kink_flat", slider=True)
1264             col = split.column(align=True)
1265             col.prop(part, "kink_frequency")
1266             col.prop(part, "kink_shape", slider=True)
1267
1268
1269 class PARTICLE_PT_field_weights(ParticleButtonsPanel, Panel):
1270     bl_label = "Field Weights"
1271     bl_options = {'DEFAULT_CLOSED'}
1272     COMPAT_ENGINES = {'BLENDER_RENDER'}
1273
1274     @classmethod
1275     def poll(cls, context):
1276         return particle_panel_poll(cls, context)
1277
1278     def draw(self, context):
1279         part = particle_get_settings(context)
1280         effector_weights_ui(self, context, part.effector_weights, 'PSYS')
1281
1282         if part.type == 'HAIR':
1283             row = self.layout.row()
1284             row.prop(part.effector_weights, "apply_to_hair_growing")
1285             row.prop(part, "apply_effector_to_children")
1286             row = self.layout.row()
1287             row.prop(part, "effect_hair", slider=True)
1288
1289
1290 class PARTICLE_PT_force_fields(ParticleButtonsPanel, Panel):
1291     bl_label = "Force Field Settings"
1292     bl_options = {'DEFAULT_CLOSED'}
1293     COMPAT_ENGINES = {'BLENDER_RENDER'}
1294
1295     def draw(self, context):
1296         layout = self.layout
1297
1298         part = particle_get_settings(context)
1299
1300         row = layout.row()
1301         row.prop(part, "use_self_effect")
1302         row.prop(part, "effector_amount", text="Amount")
1303
1304         split = layout.split(percentage=0.2)
1305         split.label(text="Type 1:")
1306         split.prop(part.force_field_1, "type", text="")
1307         basic_force_field_settings_ui(self, context, part.force_field_1)
1308         if part.force_field_1.type != 'NONE':
1309             layout.label(text="Falloff:")
1310         basic_force_field_falloff_ui(self, context, part.force_field_1)
1311
1312         if part.force_field_1.type != 'NONE':
1313             layout.label(text="")
1314
1315         split = layout.split(percentage=0.2)
1316         split.label(text="Type 2:")
1317         split.prop(part.force_field_2, "type", text="")
1318         basic_force_field_settings_ui(self, context, part.force_field_2)
1319         if part.force_field_2.type != 'NONE':
1320             layout.label(text="Falloff:")
1321         basic_force_field_falloff_ui(self, context, part.force_field_2)
1322
1323
1324 class PARTICLE_PT_vertexgroups(ParticleButtonsPanel, Panel):
1325     bl_label = "Vertex Groups"
1326     bl_options = {'DEFAULT_CLOSED'}
1327     COMPAT_ENGINES = {'BLENDER_RENDER'}
1328
1329     @classmethod
1330     def poll(cls, context):
1331         if context.particle_system is None:
1332             return False
1333         return particle_panel_poll(cls, context)
1334
1335     def draw(self, context):
1336         layout = self.layout
1337
1338         ob = context.object
1339         psys = context.particle_system
1340
1341         col = layout.column()
1342         row = col.row(align=True)
1343         row.prop_search(psys, "vertex_group_density", ob, "vertex_groups", text="Density")
1344         row.prop(psys, "invert_vertex_group_density", text="", toggle=True, icon='ARROW_LEFTRIGHT')
1345
1346         row = col.row(align=True)
1347         row.prop_search(psys, "vertex_group_length", ob, "vertex_groups", text="Length")
1348         row.prop(psys, "invert_vertex_group_length", text="", toggle=True, icon='ARROW_LEFTRIGHT')
1349
1350         row = col.row(align=True)
1351         row.prop_search(psys, "vertex_group_clump", ob, "vertex_groups", text="Clump")
1352         row.prop(psys, "invert_vertex_group_clump", text="", toggle=True, icon='ARROW_LEFTRIGHT')
1353
1354         row = col.row(align=True)
1355         row.prop_search(psys, "vertex_group_kink", ob, "vertex_groups", text="Kink")
1356         row.prop(psys, "invert_vertex_group_kink", text="", toggle=True, icon='ARROW_LEFTRIGHT')
1357
1358         row = col.row(align=True)
1359         row.prop_search(psys, "vertex_group_roughness_1", ob, "vertex_groups", text="Roughness 1")
1360         row.prop(psys, "invert_vertex_group_roughness_1", text="", toggle=True, icon='ARROW_LEFTRIGHT')
1361
1362         row = col.row(align=True)
1363         row.prop_search(psys, "vertex_group_roughness_2", ob, "vertex_groups", text="Roughness 2")
1364         row.prop(psys, "invert_vertex_group_roughness_2", text="", toggle=True, icon='ARROW_LEFTRIGHT')
1365
1366         row = col.row(align=True)
1367         row.prop_search(psys, "vertex_group_roughness_end", ob, "vertex_groups", text="Roughness End")
1368         row.prop(psys, "invert_vertex_group_roughness_end", text="", toggle=True, icon='ARROW_LEFTRIGHT')
1369
1370         # Commented out vertex groups don't work and are still waiting for better implementation
1371         # row = layout.row()
1372         # row.prop_search(psys, "vertex_group_velocity", ob, "vertex_groups", text="Velocity")
1373         # row.prop(psys, "invert_vertex_group_velocity", text="")
1374
1375         # row = layout.row()
1376         # row.prop_search(psys, "vertex_group_size", ob, "vertex_groups", text="Size")
1377         # row.prop(psys, "invert_vertex_group_size", text="")
1378
1379         # row = layout.row()
1380         # row.prop_search(psys, "vertex_group_tangent", ob, "vertex_groups", text="Tangent")
1381         # row.prop(psys, "invert_vertex_group_tangent", text="")
1382
1383         # row = layout.row()
1384         # row.prop_search(psys, "vertex_group_rotation", ob, "vertex_groups", text="Rotation")
1385         # row.prop(psys, "invert_vertex_group_rotation", text="")
1386
1387         # row = layout.row()
1388         # row.prop_search(psys, "vertex_group_field", ob, "vertex_groups", text="Field")
1389         # row.prop(psys, "invert_vertex_group_field", text="")
1390
1391
1392 class PARTICLE_PT_custom_props(ParticleButtonsPanel, PropertyPanel, Panel):
1393     COMPAT_ENGINES = {'BLENDER_RENDER'}
1394     _context_path = "particle_system.settings"
1395     _property_type = bpy.types.ParticleSettings
1396
1397 if __name__ == "__main__":  # only for live edit.
1398     bpy.utils.register_module(__name__)