1 # ##### BEGIN GPL LICENSE BLOCK #####
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.
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.
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.
17 # ##### END GPL LICENSE BLOCK #####
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 from bl_operators.presets import PresetMenu
26 from .properties_physics_common import (
29 basic_force_field_settings_ui,
30 basic_force_field_falloff_ui,
34 def particle_panel_enabled(context, psys):
37 phystype = psys.settings.physics_type
38 if psys.settings.type in {'EMITTER', 'REACTOR'} and phystype in {'NO', 'KEYED'}:
41 return (psys.point_cache.is_baked is False) and (not psys.is_edited) and (not context.particle_system_editable)
44 def particle_panel_poll(cls, context):
45 psys = context.particle_system
46 engine = context.engine
50 settings = psys.settings
51 elif isinstance(context.space_data.pin_id, bpy.types.ParticleSettings):
52 settings = context.space_data.pin_id
57 return settings.is_fluid is False and (engine in cls.COMPAT_ENGINES)
60 def particle_get_settings(context):
61 if context.particle_system:
62 return context.particle_system.settings
63 elif isinstance(context.space_data.pin_id, bpy.types.ParticleSettings):
64 return context.space_data.pin_id
68 class PARTICLE_MT_specials(Menu):
69 bl_label = "Particle Specials"
70 COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'}
72 def draw(self, context):
75 props = layout.operator(
76 "particle.copy_particle_systems",
77 text="Copy Active to Selected Objects",
80 props.use_active = True
81 props.remove_target_particles = False
83 props = layout.operator(
84 "particle.copy_particle_systems",
85 text="Copy All to Selected Objects",
87 props.use_active = False
88 props.remove_target_particles = True
93 "particle.duplicate_particle_system",
98 class PARTICLE_PT_hair_dynamics_presets(PresetMenu):
99 bl_label = "Hair Dynamics Presets"
100 preset_subdir = "hair_dynamics"
101 preset_operator = "script.execute_preset"
102 preset_add_operator = "particle.hair_dynamics_preset_add"
103 COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'}
106 class ParticleButtonsPanel:
107 bl_space_type = 'PROPERTIES'
108 bl_region_type = 'WINDOW'
109 bl_context = "particle"
112 def poll(cls, context):
113 return particle_panel_poll(cls, context)
116 def find_modifier(ob, psys):
117 for md in ob.modifiers:
118 if md.type == 'PARTICLE_SYSTEM':
119 if md.particle_system == psys:
123 class PARTICLE_UL_particle_systems(bpy.types.UIList):
125 def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index, flt_flag):
129 if self.layout_type in {'DEFAULT', 'COMPACT'}:
130 md = find_modifier(ob, psys)
131 row = layout.row(align=True)
133 row.prop(psys, "name", text="", emboss=False, icon_value=icon)
148 elif self.layout_type == 'GRID':
149 layout.alignment = 'CENTER'
150 layout.label(text="", icon_value=icon)
153 class PARTICLE_PT_context_particles(ParticleButtonsPanel, Panel):
155 bl_options = {'HIDE_HEADER'}
156 COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'}
159 def poll(cls, context):
160 engine = context.engine
161 return (context.particle_system or context.object or context.space_data.pin_id) and (engine in cls.COMPAT_ENGINES)
163 def draw(self, context):
167 psys = context.particle_system
173 row.template_list("PARTICLE_UL_particle_systems", "particle_systems", ob, "particle_systems",
174 ob.particle_systems, "active_index", rows=3)
176 col = row.column(align=True)
177 col.operator("object.particle_system_add", icon='ADD', text="")
178 col.operator("object.particle_system_remove", icon='REMOVE', text="")
182 col.menu("PARTICLE_MT_specials", icon='DOWNARROW_HLT', text="")
185 part = particle_get_settings(context)
187 layout.operator("object.particle_system_add", icon='ADD', text="New")
192 layout.template_ID(context.space_data, "pin_id")
195 layout.label(text="Settings used for fluid")
198 layout.prop(part, "type", text="Type")
200 elif not psys.settings:
201 col.template_ID(psys, "settings", new="particle.new")
205 col = layout.column()
207 if part.is_fluid is False:
209 row.enabled = particle_panel_enabled(context, psys)
210 row.template_ID(psys, "settings", new="particle.new")
213 layout.label(text=iface_("%d fluid particles for this frame") % part.count, translate=False)
217 row.enabled = particle_panel_enabled(context, psys)
218 row.prop(part, "type", expand=True)
221 split = layout.split()
222 if part.type == 'HAIR':
223 if psys is not None and psys.is_edited:
224 split.operator("particle.edited_clear", text="Delete Edit")
227 row.enabled = particle_panel_enabled(context, psys)
228 row.prop(part, "regrow_hair")
229 row.prop(part, "use_advanced_hair")
231 if psys is not None and psys.is_edited:
232 if psys.is_global_hair:
233 row = layout.row(align=True)
234 row.operator("particle.connect_hair").all = False
235 row.operator("particle.connect_hair", text="Connect All").all = True
237 row = layout.row(align=True)
238 row.operator("particle.disconnect_hair").all = False
239 row.operator("particle.disconnect_hair", text="Disconnect All").all = True
240 elif psys is not None and part.type == 'REACTOR':
241 split.enabled = particle_panel_enabled(context, psys)
242 split.prop(psys, "reactor_target_object")
243 split.prop(psys, "reactor_target_particle_system", text="Particle System")
246 class PARTICLE_PT_emission(ParticleButtonsPanel, Panel):
247 bl_label = "Emission"
248 COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'}
251 def poll(cls, context):
252 psys = context.particle_system
253 settings = particle_get_settings(context)
257 if settings.is_fluid:
259 if particle_panel_poll(PARTICLE_PT_emission, context):
260 return psys is None or not context.particle_system.point_cache.use_external
263 def draw(self, context):
266 psys = context.particle_system
267 part = particle_get_settings(context)
269 layout.use_property_split = True
271 layout.enabled = particle_panel_enabled(context, psys) and (psys is None or not psys.has_multiple_caches)
273 col = layout.column()
274 col.active = part.emit_from == 'VERT' or part.distribution != 'GRID'
275 col.prop(part, "count")
276 col.prop(psys, "seed")
278 if part.type == 'HAIR':
279 col.prop(part, "hair_length")
280 col.prop(part, "hair_step")
282 if part.type != 'HAIR':
284 col = layout.column()
286 sub = col.column(align=True)
287 sub.prop(part, "frame_start", text="Frame Start")
288 sub.prop(part, "frame_end", text="End")
290 col.prop(part, "lifetime")
291 col.prop(part, "lifetime_random", slider=True, text="Lifetime Randomness")
294 class PARTICLE_PT_emission_source(ParticleButtonsPanel, Panel):
296 bl_parent_id = "PARTICLE_PT_emission"
297 bl_options = {'DEFAULT_CLOSED'}
298 COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'}
300 def draw(self, context):
303 part = particle_get_settings(context)
305 layout.use_property_split = True
307 col = layout.column()
308 col.prop(part, "emit_from")
309 col.prop(part, "use_modifier_stack")
310 if part.emit_from == 'FACE' or part.emit_from == 'VOLUME':
311 col.prop(part, "distribution")
313 if part.emit_from == 'VERT':
314 col.prop(part, "use_emit_random", text="Random Order")
315 elif part.distribution == 'GRID':
316 col.prop(part, "invert_grid")
317 col.prop(part, "hexagonal_grid")
319 col.prop(part, "use_emit_random")
320 col.prop(part, "use_even_distribution")
322 if part.emit_from == 'FACE' or part.emit_from == 'VOLUME':
324 if part.distribution == 'JIT':
325 col.prop(part, "userjit", text="Particles/Face")
326 col.prop(part, "jitter_factor", text="Jittering Amount", slider=True)
327 elif part.distribution == 'GRID':
328 col.prop(part, "grid_resolution")
329 col.prop(part, "grid_random", text="Random", slider=True)
332 class PARTICLE_PT_hair_dynamics(ParticleButtonsPanel, Panel):
333 bl_label = "Hair Dynamics"
334 bl_options = {'DEFAULT_CLOSED'}
335 COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'}
338 def poll(cls, context):
339 psys = context.particle_system
340 engine = context.engine
343 if psys.settings is None:
345 return psys.settings.type == 'HAIR' and (engine in cls.COMPAT_ENGINES)
347 def draw_header(self, context):
348 psys = context.particle_system
349 self.layout.prop(psys, "use_hair_dynamics", text="")
351 def draw_header_preset(self, context):
352 psys = context.particle_system
358 layout.enabled = psys.use_hair_dynamics and psys.point_cache.is_baked is False
359 PARTICLE_PT_hair_dynamics_presets.draw_panel_header(layout)
361 def draw(self, context):
364 psys = context.particle_system
367 layout.label(text="Hair dynamics disabled")
370 cloth_md = psys.cloth
371 cloth = cloth_md.settings
372 result = cloth_md.solver_result
374 layout.enabled = psys.use_hair_dynamics and psys.point_cache.is_baked is False
376 layout.use_property_split = True
380 col = layout.column()
381 col.prop(cloth, "quality", text="Quality Steps", slider=True)
382 col.prop(psys.settings, "show_hair_grid", text="Display Hair Grid")
386 col = layout.column()
387 col.prop(cloth, "pin_stiffness", text="Pin Goal Strength")
394 if not result.status:
397 elif result.status == {'SUCCESS'}:
400 elif result.status - {'SUCCESS'} == {'NO_CONVERGENCE'}:
401 label = "No Convergence"
406 box.label(text=label, icon=icon)
407 box.label(text="Iterations: %d .. %d (avg. %d)" %
408 (result.min_iterations, result.max_iterations, result.avg_iterations))
409 box.label(text="Error: %.5f .. %.5f (avg. %.5f)" % (result.min_error, result.max_error, result.avg_error))
412 class PARTICLE_PT_hair_dynamics_structure(ParticleButtonsPanel, Panel):
413 bl_label = "Structure"
414 bl_parent_id = "PARTICLE_PT_hair_dynamics"
415 bl_options = {'DEFAULT_CLOSED'}
416 COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'}
419 def poll(cls, context):
420 return context.particle_system.cloth is not None
422 def draw(self, context):
425 psys = context.particle_system
426 cloth_md = psys.cloth
427 cloth = cloth_md.settings
429 layout.enabled = psys.use_hair_dynamics and psys.point_cache.is_baked is False
431 layout.use_property_split = True
433 col = layout.column()
434 col.prop(cloth, "mass")
435 sub = col.column(align=True)
436 sub.prop(cloth, "bending_stiffness", text="Stiffness")
437 sub.prop(psys.settings, "bending_random", text="Random")
438 col.prop(cloth, "bending_damping", text="Damping")
439 # XXX has no noticeable effect with stiff hair structure springs
440 #col.prop(cloth, "spring_damping", text="Damping")
443 class PARTICLE_PT_hair_dynamics_volume(ParticleButtonsPanel, Panel):
445 bl_parent_id = "PARTICLE_PT_hair_dynamics"
446 bl_options = {'DEFAULT_CLOSED'}
447 COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'}
450 def poll(cls, context):
451 return context.particle_system.cloth is not None
453 def draw(self, context):
456 psys = context.particle_system
457 cloth_md = psys.cloth
458 cloth = cloth_md.settings
460 layout.enabled = psys.use_hair_dynamics and psys.point_cache.is_baked is False
462 layout.use_property_split = True
464 col = layout.column()
465 col.prop(cloth, "air_damping", text="Air Drag")
466 col.prop(cloth, "internal_friction", slider=True)
467 col.prop(cloth, "voxel_cell_size")
471 col.prop(cloth, "density_target", text="Density Target")
472 col.prop(cloth, "density_strength", slider=True, text="Density Strength")
475 class PARTICLE_PT_cache(ParticleButtonsPanel, Panel):
477 bl_options = {'DEFAULT_CLOSED'}
478 COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'}
481 def poll(cls, context):
482 psys = context.particle_system
483 engine = context.engine
486 if psys.settings is None:
488 if psys.settings.is_fluid:
490 phystype = psys.settings.physics_type
491 if phystype == 'NO' or phystype == 'KEYED':
494 (psys.settings.type in {'EMITTER', 'REACTOR'} or
495 (psys.settings.type == 'HAIR' and
496 (psys.use_hair_dynamics or psys.point_cache.is_baked))) and
497 engine in cls.COMPAT_ENGINES
500 def draw(self, context):
501 psys = context.particle_system
503 point_cache_ui(self, context, psys.point_cache, True, 'HAIR' if (psys.settings.type == 'HAIR') else 'PSYS')
506 class PARTICLE_PT_velocity(ParticleButtonsPanel, Panel):
507 bl_label = "Velocity"
508 bl_options = {'DEFAULT_CLOSED'}
509 COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'}
512 def poll(cls, context):
513 if particle_panel_poll(PARTICLE_PT_velocity, context):
514 psys = context.particle_system
515 settings = particle_get_settings(context)
517 if settings.type == 'HAIR' and not settings.use_advanced_hair:
519 return settings.physics_type != 'BOIDS' and (psys is None or not psys.point_cache.use_external)
523 def draw(self, context):
526 psys = context.particle_system
527 part = particle_get_settings(context)
529 layout.enabled = particle_panel_enabled(context, psys)
530 layout.use_property_split = True
532 col = layout.column()
533 col.prop(part, "normal_factor")
534 sub = col.column(align=True)
535 sub.prop(part, "tangent_factor", text="Tangent")
536 sub.prop(part, "tangent_phase", slider=True, text="Tangent Phase")
540 col.prop(part, "object_align_factor")
544 if part.emit_from == 'PARTICLE':
545 col.prop(part, "particle_factor")
547 col.prop(part, "object_factor", slider=True)
548 col.prop(part, "factor_random", text="Randomize")
550 # if part.type=='REACTOR':
551 # sub.prop(part, "reactor_factor")
552 # sub.prop(part, "reaction_shape", slider=True)
555 class PARTICLE_PT_rotation(ParticleButtonsPanel, Panel):
556 bl_label = "Rotation"
557 bl_options = {'DEFAULT_CLOSED'}
558 COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'}
561 def poll(cls, context):
562 if particle_panel_poll(PARTICLE_PT_rotation, context):
563 psys = context.particle_system
564 settings = particle_get_settings(context)
566 if settings.type == 'HAIR' and not settings.use_advanced_hair:
568 return settings.physics_type != 'BOIDS' and (psys is None or not psys.point_cache.use_external)
572 def draw_header(self, context):
573 psys = context.particle_system
577 part = context.space_data.pin_id
579 self.layout.prop(part, "use_rotations", text="")
581 def draw(self, context):
584 psys = context.particle_system
588 part = context.space_data.pin_id
590 layout.enabled = particle_panel_enabled(context, psys) and part.use_rotations
591 layout.use_property_split = True
593 col = layout.column()
595 col.prop(part, "rotation_mode")
596 col.prop(part, "rotation_factor_random", slider=True, text="Randomize")
600 col.prop(part, "phase_factor", slider=True)
601 col.prop(part, "phase_factor_random", text="Randomize Phase ", slider=True)
603 if part.type != 'HAIR':
604 col.prop(part, "use_dynamic_rotation")
607 class PARTICLE_PT_rotation_angular_velocity(ParticleButtonsPanel, Panel):
608 bl_label = "Angular Velocity"
609 bl_parent_id = "PARTICLE_PT_rotation"
610 bl_options = {'DEFAULT_CLOSED'}
611 COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'}
613 def draw(self, context):
616 psys = context.particle_system
620 part = context.space_data.pin_id
622 layout.enabled = particle_panel_enabled(context, psys) and part.use_rotations
623 layout.use_property_split = True
625 col = layout.column()
627 col.prop(part, "angular_velocity_mode", text="Axis")
628 sub = col.column(align=True)
629 sub.active = part.angular_velocity_mode != 'NONE'
630 sub.prop(part, "angular_velocity_factor", text="Amount")
633 class PARTICLE_PT_physics(ParticleButtonsPanel, Panel):
635 bl_options = {'DEFAULT_CLOSED'}
636 COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'}
639 def poll(cls, context):
640 if particle_panel_poll(PARTICLE_PT_physics, context):
641 psys = context.particle_system
642 settings = particle_get_settings(context)
644 if settings.type == 'HAIR' and not settings.use_advanced_hair:
646 return psys is None or not psys.point_cache.use_external
650 def draw(self, context):
652 layout.use_property_split = True
654 psys = context.particle_system
655 part = particle_get_settings(context)
657 layout.enabled = particle_panel_enabled(context, psys)
659 layout.prop(part, "physics_type")
661 col = layout.column()
662 if part.physics_type != 'NO':
664 col.prop(part, "mass")
665 col.prop(part, "use_multiply_size_mass", text="Multiply mass with size")
667 if part.physics_type == 'FLUID':
671 col.prop(fluid, "solver")
672 col.prop(fluid, "stiffness", text="Stiffness")
673 col.prop(fluid, "linear_viscosity", text="Viscosity")
674 col.prop(fluid, "buoyancy", text="Buoyancy", slider=True)
676 elif part.physics_type == 'KEYED':
679 sub.active = not psys.use_keyed_timing
680 sub.prop(part, "keyed_loops", text="Loops")
682 col.prop(psys, "use_keyed_timing", text="Use Timing")
684 col.label(text="Keys")
687 class PARTICLE_PT_physics_fluid_advanced(ParticleButtonsPanel, Panel):
688 bl_label = "Advanced"
689 bl_parent_id = "PARTICLE_PT_physics"
690 bl_options = {'DEFAULT_CLOSED'}
691 COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'}
694 def poll(cls, context):
695 part = particle_get_settings(context)
696 if part.physics_type == 'FLUID':
701 def draw(self, context):
703 layout.use_property_split = True
705 part = particle_get_settings(context)
708 col = layout.column()
710 if fluid.solver == 'DDR':
712 sub.prop(fluid, "repulsion", slider=fluid.factor_repulsion)
713 sub.prop(fluid, "factor_repulsion")
715 sub.prop(fluid, "stiff_viscosity", slider=fluid.factor_stiff_viscosity)
716 sub.prop(fluid, "factor_stiff_viscosity")
719 sub.prop(fluid, "fluid_radius", slider=fluid.factor_radius)
720 sub.prop(fluid, "factor_radius")
722 sub.prop(fluid, "rest_density", slider=fluid.use_factor_density)
723 sub.prop(fluid, "use_factor_density")
725 if fluid.solver == 'CLASSICAL':
726 # With the classical solver, it is possible to calculate the
727 # spacing between particles when the fluid is at rest. This
728 # makes it easier to set stable initial conditions.
729 particle_volume = part.mass / fluid.rest_density
730 spacing = pow(particle_volume, 1.0 / 3.0)
732 sub.label(text="Spacing: %g" % spacing)
735 class PARTICLE_PT_physics_fluid_springs(ParticleButtonsPanel, Panel):
737 bl_parent_id = "PARTICLE_PT_physics"
738 bl_options = {'DEFAULT_CLOSED'}
739 COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'}
742 def poll(cls, context):
743 part = particle_get_settings(context)
745 if part.physics_type == 'FLUID' and fluid.solver == 'DDR':
750 def draw(self, context):
752 layout.use_property_split = True
754 part = particle_get_settings(context)
757 col = layout.column()
759 col.prop(fluid, "spring_force", text="Force")
762 class PARTICLE_PT_physics_fluid_springs_viscoelastic(ParticleButtonsPanel, Panel):
763 bl_label = "Viscoelastic Springs"
764 bl_parent_id = "PARTICLE_PT_physics_fluid_springs"
765 bl_options = {'DEFAULT_CLOSED'}
766 COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'}
769 def poll(cls, context):
770 part = particle_get_settings(context)
772 if part.physics_type == 'FLUID' and fluid.solver == 'DDR':
777 def draw_header(self, context):
778 part = particle_get_settings(context)
781 self.layout.prop(fluid, "use_viscoelastic_springs", text="")
783 def draw(self, context):
785 layout.use_property_split = True
787 part = particle_get_settings(context)
790 col = layout.column()
791 col.active = fluid.use_viscoelastic_springs
792 col.prop(fluid, "yield_ratio", slider=True)
793 col.prop(fluid, "plasticity", slider=True)
797 col.prop(fluid, "use_initial_rest_length")
798 col.prop(fluid, "spring_frames", text="Frames")
801 class PARTICLE_PT_physics_fluid_springs_advanced(ParticleButtonsPanel, Panel):
802 bl_label = "Advanced"
803 bl_parent_id = "PARTICLE_PT_physics_fluid_springs"
804 bl_options = {'DEFAULT_CLOSED'}
805 COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'}
808 def poll(cls, context):
809 part = particle_get_settings(context)
811 if part.physics_type == 'FLUID' and fluid.solver == 'DDR':
816 def draw(self, context):
818 layout.use_property_split = True
820 part = particle_get_settings(context)
823 sub = layout.column()
824 sub.prop(fluid, "rest_length", slider=fluid.factor_rest_length)
825 sub.prop(fluid, "factor_rest_length")
828 class PARTICLE_PT_physics_boids_movement(ParticleButtonsPanel, Panel):
829 bl_label = "Movement"
830 bl_parent_id = "PARTICLE_PT_physics"
831 bl_options = {'DEFAULT_CLOSED'}
832 COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'}
835 def poll(cls, context):
836 part = particle_get_settings(context)
837 return part.physics_type in {'BOIDS'}
839 def draw(self, context):
841 layout.use_property_split = True
843 part = particle_get_settings(context)
846 col = layout.column()
848 col.prop(boids, "use_flight")
849 col.prop(boids, "use_land")
850 col.prop(boids, "use_climb")
852 col = layout.column()
854 col.active = boids.use_flight
856 sub.prop(boids, "air_speed_max")
857 sub.prop(boids, "air_speed_min", slider=True)
858 col.prop(boids, "air_acc_max", slider=True)
859 col.prop(boids, "air_ave_max", slider=True)
860 col.prop(boids, "air_personal_space")
861 row = col.row(align=True)
862 row.active = (boids.use_land or boids.use_climb) and boids.use_flight
863 row.prop(boids, "land_smooth")
867 col = layout.column()
868 col.active = boids.use_land or boids.use_climb
869 col.prop(boids, "land_speed_max")
870 col.prop(boids, "land_jump_speed")
871 col.prop(boids, "land_acc_max", slider=True)
872 col.prop(boids, "land_ave_max", slider=True)
873 col.prop(boids, "land_personal_space")
874 col.prop(boids, "land_stick_force")
878 layout.prop(part, "collision_collection")
881 class PARTICLE_PT_physics_boids_battle(ParticleButtonsPanel, Panel):
883 bl_parent_id = "PARTICLE_PT_physics"
884 bl_options = {'DEFAULT_CLOSED'}
885 COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'}
888 def poll(cls, context):
889 part = particle_get_settings(context)
890 return part.physics_type in {'BOIDS'}
892 def draw(self, context):
894 layout.use_property_split = True
896 part = particle_get_settings(context)
899 col = layout.column()
901 col.prop(boids, "health")
902 col.prop(boids, "strength")
903 col.prop(boids, "aggression")
904 col.prop(boids, "accuracy")
905 col.prop(boids, "range")
908 class PARTICLE_PT_physics_boids_misc(ParticleButtonsPanel, Panel):
910 bl_parent_id = "PARTICLE_PT_physics"
911 bl_options = {'DEFAULT_CLOSED'}
912 COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'}
915 def poll(cls, context):
916 part = particle_get_settings(context)
917 return part.physics_type in {'BOIDS'}
919 def draw(self, context):
921 layout.use_property_split = True
923 part = particle_get_settings(context)
926 col = layout.column()
928 col.prop(boids, "bank", slider=True)
929 col.prop(boids, "pitch", slider=True)
930 col.prop(boids, "height", slider=True)
933 class PARTICLE_PT_physics_relations(ParticleButtonsPanel, Panel):
934 bl_label = "Relations"
935 bl_parent_id = "PARTICLE_PT_physics"
936 bl_options = {'DEFAULT_CLOSED'}
937 COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'}
940 def poll(cls, context):
941 part = particle_get_settings(context)
942 return part.physics_type in {'KEYED', 'BOIDS', 'FLUID'}
944 def draw(self, context):
946 layout.use_property_split = True
948 psys = context.particle_system
949 part = particle_get_settings(context)
952 row.template_list("UI_UL_list", "particle_targets", psys, "targets",
953 psys, "active_particle_target_index", rows=4)
957 subsub = sub.column(align=True)
958 subsub.operator("particle.new_target", icon='ADD', text="")
959 subsub.operator("particle.target_remove", icon='REMOVE', text="")
961 subsub = sub.column(align=True)
962 subsub.operator("particle.target_move_up", icon='TRIA_UP', text="")
963 subsub.operator("particle.target_move_down", icon='TRIA_DOWN', text="")
965 key = psys.active_particle_target
968 if part.physics_type == 'KEYED':
969 col = layout.column()
971 #col.alert = key.valid
972 col.prop(key, "object")
973 col.prop(key, "system", text="System")
975 col.active = psys.use_keyed_timing
976 col.prop(key, "time")
977 col.prop(key, "duration")
978 elif part.physics_type == 'BOIDS':
979 sub = layout.column()
981 #sub.alert = key.valid
982 sub.prop(key, "object")
983 sub.prop(key, "system", text="System")
984 layout.prop(key, "alliance")
985 elif part.physics_type == 'FLUID':
986 sub = layout.column()
988 #sub.alert = key.valid
989 sub.prop(key, "object")
990 sub.prop(key, "system", text="System")
993 class PARTICLE_PT_physics_deflection(ParticleButtonsPanel, Panel):
994 bl_label = "Deflection"
995 bl_parent_id = "PARTICLE_PT_physics"
996 bl_options = {'DEFAULT_CLOSED'}
997 COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'}
1000 def poll(cls, context):
1001 part = particle_get_settings(context)
1002 return part.physics_type in {'NEWTON', 'FLUID'}
1004 def draw(self, context):
1005 layout = self.layout
1006 layout.use_property_split = True
1008 psys = context.particle_system
1009 part = particle_get_settings(context)
1011 layout.enabled = particle_panel_enabled(context, psys)
1013 col = layout.column()
1014 col.prop(part, "use_size_deflect")
1015 col.prop(part, "use_die_on_collision")
1017 col.prop(part, "collision_collection")
1020 class PARTICLE_PT_physics_forces(ParticleButtonsPanel, Panel):
1022 bl_parent_id = "PARTICLE_PT_physics"
1023 COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'}
1026 def poll(cls, context):
1027 part = particle_get_settings(context)
1028 return part.physics_type == 'NEWTON'
1030 def draw(self, context):
1031 layout = self.layout
1032 layout.use_property_split = True
1034 psys = context.particle_system
1035 part = particle_get_settings(context)
1037 layout.enabled = particle_panel_enabled(context, psys)
1039 col = layout.column()
1041 col.prop(part, "brownian_factor")
1042 col.prop(part, "drag_factor", slider=True)
1043 col.prop(part, "damping", slider=True)
1046 class PARTICLE_PT_physics_integration(ParticleButtonsPanel, Panel):
1047 bl_label = "Integration"
1048 bl_options = {'DEFAULT_CLOSED'}
1049 bl_parent_id = "PARTICLE_PT_physics"
1050 COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'}
1053 def poll(cls, context):
1054 part = particle_get_settings(context)
1055 return part.physics_type == 'NEWTON'
1057 def draw(self, context):
1058 layout = self.layout
1059 layout.use_property_split = True
1061 psys = context.particle_system
1062 part = particle_get_settings(context)
1064 layout.enabled = particle_panel_enabled(context, psys)
1066 col = layout.column()
1068 col.prop(part, "integrator")
1069 col.prop(part, "timestep")
1071 sub.prop(part, "subframes")
1072 supports_courant = part.physics_type == 'FLUID'
1074 subsub.enabled = supports_courant
1075 subsub.prop(part, "use_adaptive_subframes", text="")
1076 if supports_courant and part.use_adaptive_subframes:
1077 col.prop(part, "courant_target", text="Threshold")
1080 class PARTICLE_PT_boidbrain(ParticleButtonsPanel, Panel):
1081 bl_label = "Boid Brain"
1082 bl_options = {'DEFAULT_CLOSED'}
1083 bl_parent_id = "PARTICLE_PT_physics"
1085 COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'}
1088 def poll(cls, context):
1089 psys = context.particle_system
1090 settings = particle_get_settings(context)
1091 engine = context.engine
1093 if settings is None:
1095 if psys is not None and psys.point_cache.use_external:
1097 return settings.physics_type == 'BOIDS' and engine in cls.COMPAT_ENGINES
1099 def draw(self, context):
1100 layout = self.layout
1102 boids = particle_get_settings(context).boids
1104 layout.enabled = particle_panel_enabled(context, context.particle_system)
1106 # Currently boids can only use the first state so these are commented out for now.
1108 # row.template_list("UI_UL_list", "particle_boids", boids, "states",
1109 # boids, "active_boid_state_index", compact="True")
1111 #sub = col.row(align=True)
1112 #sub.operator("boid.state_add", icon='ADD', text="")
1113 #sub.operator("boid.state_del", icon='REMOVE', text="")
1114 #sub = row.row(align=True)
1115 #sub.operator("boid.state_move_up", icon='TRIA_UP', text="")
1116 #sub.operator("boid.state_move_down", icon='TRIA_DOWN', text="")
1118 state = boids.active_boid_state
1120 #layout.prop(state, "name", text="State name")
1123 row.prop(state, "ruleset_type")
1124 if state.ruleset_type == 'FUZZY':
1125 row.prop(state, "rule_fuzzy", slider=True)
1130 row.template_list("UI_UL_list", "particle_boids_rules", state,
1131 "rules", state, "active_boid_rule_index", rows=4)
1135 subsub = sub.column(align=True)
1136 subsub.operator_menu_enum("boid.rule_add", "type", icon='ADD', text="")
1137 subsub.operator("boid.rule_del", icon='REMOVE', text="")
1139 subsub = sub.column(align=True)
1140 subsub.operator("boid.rule_move_up", icon='TRIA_UP', text="")
1141 subsub.operator("boid.rule_move_down", icon='TRIA_DOWN', text="")
1143 rule = state.active_boid_rule
1147 row.prop(rule, "name", text="")
1148 # somebody make nice icons for boids here please! -jahka
1149 row.prop(rule, "use_in_air", icon='TRIA_UP', text="")
1150 row.prop(rule, "use_on_land", icon='TRIA_DOWN', text="")
1154 if rule.type == 'GOAL':
1155 row.prop(rule, "object")
1157 row.prop(rule, "use_predict")
1158 elif rule.type == 'AVOID':
1159 row.prop(rule, "object")
1161 row.prop(rule, "use_predict")
1162 row.prop(rule, "fear_factor")
1163 elif rule.type == 'FOLLOW_PATH':
1164 row.label(text="Not yet functional")
1165 elif rule.type == 'AVOID_COLLISION':
1166 row.prop(rule, "use_avoid")
1167 row.prop(rule, "use_avoid_collision")
1168 row.prop(rule, "look_ahead")
1169 elif rule.type == 'FOLLOW_LEADER':
1170 row.prop(rule, "object", text="")
1171 row.prop(rule, "distance")
1173 row.prop(rule, "use_line")
1175 sub.active = rule.line
1176 sub.prop(rule, "queue_count")
1177 elif rule.type == 'AVERAGE_SPEED':
1178 row.prop(rule, "speed", slider=True)
1179 row.prop(rule, "wander", slider=True)
1180 row.prop(rule, "level", slider=True)
1181 elif rule.type == 'FIGHT':
1182 row.prop(rule, "distance")
1183 row.prop(rule, "flee_distance")
1186 class PARTICLE_PT_render(ParticleButtonsPanel, Panel):
1188 bl_options = {'DEFAULT_CLOSED'}
1189 COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'}
1192 def poll(cls, context):
1193 settings = particle_get_settings(context)
1194 engine = context.engine
1195 if settings is None:
1198 return engine in cls.COMPAT_ENGINES
1200 def draw(self, context):
1201 layout = self.layout
1202 layout.use_property_split = True
1204 psys = context.particle_system
1205 part = particle_get_settings(context)
1207 layout.prop(part, "render_type", text="Render As")
1210 part.type == 'EMITTER' or
1211 (part.render_type in {'OBJECT', 'COLLECTION'} and part.type == 'HAIR')
1213 if part.render_type not in {'NONE'}:
1215 col = layout.column(align=True)
1216 col.prop(part, "particle_size", text="Scale")
1217 col.prop(part, "size_random", slider=True, text="Scale Randomness")
1220 col = layout.column()
1221 if part.render_type not in {'OBJECT', 'COLLECTION', 'NONE'}:
1222 # col.enabled = False
1223 col.prop(part, "material_slot", text="Material")
1224 col.prop(psys, "parent", text="Coordinate System")
1228 layout.prop(context.object, "show_instancer_for_render", text="Show Emitter")
1231 class PARTICLE_PT_render_extra(ParticleButtonsPanel, Panel):
1233 bl_parent_id = "PARTICLE_PT_render"
1234 bl_options = {'DEFAULT_CLOSED'}
1235 COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'}
1238 def poll(cls, context):
1239 part = particle_get_settings(context)
1240 return part.render_type != 'NONE'
1242 def draw(self, context):
1243 layout = self.layout
1244 layout.use_property_split = True
1246 part = particle_get_settings(context)
1248 col = layout.column()
1250 col = layout.column()
1251 col.prop(part, "use_parent_particles", text="Parent Particles")
1252 col.prop(part, "show_unborn", text="Unborn")
1253 col.prop(part, "use_dead", text="Dead")
1256 class PARTICLE_PT_render_line(ParticleButtonsPanel, Panel):
1258 bl_parent_id = "PARTICLE_PT_render"
1259 COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'}
1262 def poll(cls, context):
1263 part = particle_get_settings(context)
1264 return part.render_type == 'LINE'
1266 def draw(self, context):
1267 layout = self.layout
1268 layout.use_property_split = True
1270 part = particle_get_settings(context)
1272 col = layout.column()
1275 sub = col.column(align=True)
1276 sub.prop(part, "line_length_tail", text="Length Tail")
1277 sub.prop(part, "line_length_head", text="Head")
1278 col.prop(part, "use_velocity_length", text="Velocity Length")
1281 class PARTICLE_PT_render_path(ParticleButtonsPanel, Panel):
1283 bl_parent_id = "PARTICLE_PT_render"
1284 COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'}
1287 def poll(cls, context):
1288 part = particle_get_settings(context)
1289 return part.render_type == 'PATH'
1291 def draw(self, context):
1292 layout = self.layout
1293 layout.use_property_split = True
1295 part = particle_get_settings(context)
1297 col = layout.column()
1299 col.prop(part, "use_strand_primitive")
1301 sub.active = (part.use_strand_primitive is False)
1302 sub.prop(part, "use_render_adaptive")
1304 sub.active = part.use_render_adaptive or part.use_strand_primitive is True
1305 sub.prop(part, "adaptive_angle")
1307 sub.active = (part.use_render_adaptive is True and part.use_strand_primitive is False)
1308 sub.prop(part, "adaptive_pixel")
1309 col.prop(part, "use_hair_bspline")
1310 col.prop(part, "render_step", text="Steps")
1313 class PARTICLE_PT_render_path_timing(ParticleButtonsPanel, Panel):
1315 bl_parent_id = "PARTICLE_PT_render"
1316 bl_options = {'DEFAULT_CLOSED'}
1317 COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'}
1320 def poll(cls, context):
1321 part = particle_get_settings(context)
1322 return part.render_type == 'PATH'
1324 def draw(self, context):
1325 layout = self.layout
1326 layout.use_property_split = True
1328 psys = context.particle_system
1329 part = particle_get_settings(context)
1331 col = layout.column()
1333 col.prop(part, "use_absolute_path_time")
1335 if part.type == 'HAIR' or psys.point_cache.is_baked:
1336 col.prop(part, "path_start", text="Start", slider=not part.use_absolute_path_time)
1338 col.prop(part, "trail_count")
1340 col.prop(part, "path_end", text="End", slider=not part.use_absolute_path_time)
1341 col.prop(part, "length_random", text="Random", slider=True)
1344 class PARTICLE_PT_render_object(ParticleButtonsPanel, Panel):
1346 bl_parent_id = "PARTICLE_PT_render"
1347 COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'}
1350 def poll(cls, context):
1351 part = particle_get_settings(context)
1352 return part.render_type == 'OBJECT'
1354 def draw(self, context):
1355 layout = self.layout
1356 layout.use_property_split = True
1358 part = particle_get_settings(context)
1360 col = layout.column()
1362 col.prop(part, "instance_object", text="Instance Object")
1364 sub.prop(part, "use_global_instance", text="Global Coordinates")
1365 sub.prop(part, "use_rotation_instance", text="Object Rotation")
1366 sub.prop(part, "use_scale_instance", text="Object Scale")
1369 class PARTICLE_PT_render_collection(ParticleButtonsPanel, Panel):
1370 bl_label = "Collection"
1371 bl_parent_id = "PARTICLE_PT_render"
1372 COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'}
1375 def poll(cls, context):
1376 part = particle_get_settings(context)
1377 return part.render_type == 'COLLECTION'
1379 def draw(self, context):
1380 layout = self.layout
1381 layout.use_property_split = True
1383 part = particle_get_settings(context)
1385 col = layout.column()
1387 col.prop(part, "instance_collection", text="Instance Collection")
1389 col.prop(part, "use_whole_collection")
1391 sub.active = (part.use_whole_collection is False)
1392 sub.prop(part, "use_collection_pick_random")
1393 sub.prop(part, "use_global_instance", text="Global Coordinates")
1394 sub.prop(part, "use_rotation_instance", text="Object Rotation")
1395 sub.prop(part, "use_scale_instance", text="Object Scale")
1398 class PARTICLE_PT_render_collection_use_count(ParticleButtonsPanel, Panel):
1399 bl_label = "Use Count"
1400 bl_parent_id = "PARTICLE_PT_render_collection"
1401 bl_options = {'DEFAULT_CLOSED'}
1402 COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'}
1405 def poll(cls, context):
1406 part = particle_get_settings(context)
1407 return part.render_type == 'COLLECTION'
1409 def draw_header(self, context):
1410 layout = self.layout
1411 part = particle_get_settings(context)
1413 layout.active = not part.use_whole_collection
1415 layout.prop(part, "use_collection_count", text="")
1417 def draw(self, context):
1418 layout = self.layout
1419 layout.use_property_split = True
1421 part = particle_get_settings(context)
1423 col = layout.column()
1425 layout.active = part.use_collection_count and not part.use_whole_collection
1428 row.template_list("UI_UL_list", "particle_instance_weights", part, "instance_weights",
1429 part, "active_instanceweight_index")
1433 subsub = sub.column(align=True)
1434 subsub.operator("particle.dupliob_copy", icon='ADD', text="")
1435 subsub.operator("particle.dupliob_remove", icon='REMOVE', text="")
1436 subsub.operator("particle.dupliob_move_up", icon='TRIA_UP', text="")
1437 subsub.operator("particle.dupliob_move_down", icon='TRIA_DOWN', text="")
1439 subsub.operator("particle.dupliob_refresh", icon='FILE_REFRESH', text="")
1441 weight = part.active_instanceweight
1444 row.prop(weight, "count")
1447 class PARTICLE_PT_render_billboards_alignment(ParticleButtonsPanel, Panel):
1448 bl_label = "Billboard Alignment"
1449 bl_parent_id = "PARTICLE_PT_render"
1450 bl_options = {'DEFAULT_CLOSED'}
1451 COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'}
1454 def poll(cls, context):
1455 part = particle_get_settings(context)
1456 return part.render_type == 'BILLBOARD'
1458 def draw(self, context):
1459 layout = self.layout
1460 layout.use_property_split = True
1462 part = particle_get_settings(context)
1464 col = layout.column()
1466 col.prop(part, "billboard_align", text="Align To")
1467 col.prop(part, "lock_billboard", text="Lock Axis")
1468 col.prop(part, "billboard_object")
1471 class PARTICLE_PT_render_billboards_tilt(ParticleButtonsPanel, Panel):
1472 bl_label = "Billboard Tilt"
1473 bl_parent_id = "PARTICLE_PT_render"
1474 bl_options = {'DEFAULT_CLOSED'}
1475 COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'}
1478 def poll(cls, context):
1479 part = particle_get_settings(context)
1480 return part.render_type == 'BILLBOARD'
1482 def draw(self, context):
1483 layout = self.layout
1484 layout.use_property_split = True
1486 part = particle_get_settings(context)
1488 col = layout.column()
1490 sub = col.column(align=True)
1491 sub.prop(part, "billboard_tilt", text="Angle", slider=True)
1492 sub.prop(part, "billboard_tilt_random", text="Random", slider=True)
1494 sub = col.column(align=True)
1495 sub.prop(part, "billboard_offset")
1496 col.prop(part, "billboard_size", text="Scale")
1497 if part.billboard_align == 'VEL':
1498 col = col.column(align=True)
1499 col.prop(part, "billboard_velocity_head", text="Velocity ScaleHead")
1500 col.prop(part, "billboard_velocity_tail", text="Tail")
1503 class PARTICLE_PT_render_billboards_uv(ParticleButtonsPanel, Panel):
1504 bl_label = "Billboard UVs"
1505 bl_parent_id = "PARTICLE_PT_render"
1506 bl_options = {'DEFAULT_CLOSED'}
1507 COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'}
1510 def poll(cls, context):
1511 part = particle_get_settings(context)
1512 return part.render_type == 'BILLBOARD'
1514 def draw(self, context):
1515 layout = self.layout
1516 layout.use_property_split = True
1518 psys = context.particle_system
1520 part = particle_get_settings(context)
1522 col = layout.column()
1525 col.prop_search(psys, "billboard_normal_uv", ob.data, "uv_layers")
1526 col.prop_search(psys, "billboard_time_index_uv", ob.data, "uv_layers")
1528 col.prop(part, "billboard_uv_split", text="Split UVs")
1532 sub.active = part.billboard_uv_split > 1
1533 sub.prop_search(psys, "billboard_split_uv", ob.data, "uv_layers")
1535 sub.prop(part, "billboard_animation")
1536 sub.prop(part, "billboard_offset_split")
1539 class PARTICLE_PT_render_trails(ParticleButtonsPanel, Panel):
1541 bl_parent_id = "PARTICLE_PT_render"
1542 bl_options = {'DEFAULT_CLOSED'}
1543 COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'}
1546 def poll(cls, context):
1547 part = particle_get_settings(context)
1548 return part.render_type in {'HALO', 'LINE', 'BILLBOARD'}
1550 def draw(self, context):
1551 layout = self.layout
1552 layout.use_property_split = True
1554 part = particle_get_settings(context)
1556 col = layout.column()
1558 col.prop(part, "trail_count")
1561 sub.active = (part.trail_count > 1)
1562 sub.prop(part, "use_absolute_path_time", text="Length in Frames")
1563 sub.prop(part, "path_end", text="Length", slider=not part.use_absolute_path_time)
1564 sub.prop(part, "length_random", text="Random Length", slider=True)
1567 class PARTICLE_PT_draw(ParticleButtonsPanel, Panel):
1568 bl_label = "Viewport Display"
1569 bl_options = {'DEFAULT_CLOSED'}
1570 COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'}
1573 def poll(cls, context):
1574 settings = particle_get_settings(context)
1575 engine = context.engine
1576 if settings is None:
1578 return engine in cls.COMPAT_ENGINES
1580 def draw(self, context):
1581 layout = self.layout
1582 layout.use_property_split = True
1584 psys = context.particle_system
1585 part = particle_get_settings(context)
1587 layout.prop(part, "display_method", text="Display As")
1589 if part.display_method == 'NONE' or (part.render_type == 'NONE' and part.display_method == 'RENDER'):
1592 path = (part.render_type == 'PATH' and part.display_method == 'RENDER') or part.display_method == 'PATH'
1596 col = layout.column()
1597 col.prop(part, "display_color", text="Color")
1598 if part.display_color in {'VELOCITY', 'ACCELERATION'}:
1599 col.prop(part, "color_maximum", text="Fade Distance")
1601 col = layout.column()
1604 col.prop(part, "display_step", text="Strand Steps")
1605 col.prop(part, "display_percentage", slider=True, text="Amount")
1606 if part.display_method != 'RENDER' or part.render_type == 'HALO':
1607 col.prop(part, "display_size", text="Size")
1609 if part.display_percentage != 100 and psys is not None:
1610 if part.type == 'HAIR':
1611 if psys.use_hair_dynamics and psys.point_cache.is_baked is False:
1612 layout.row().label(text="Display percentage makes dynamics inaccurate without baking")
1614 phystype = part.physics_type
1615 if phystype != 'NO' and phystype != 'KEYED' and psys.point_cache.is_baked is False:
1616 layout.row().label(text="Display percentage makes dynamics inaccurate without baking")
1620 col = layout.column()
1621 col.prop(part, "show_guide_hairs", text="Guide Hairs")
1622 col.prop(part, "show_size")
1623 col.prop(part, "show_velocity")
1624 col.prop(part, "show_number")
1625 if part.physics_type == 'BOIDS':
1626 col.prop(part, "show_health")
1630 layout.prop(context.object, "show_instancer_for_viewport", text="Show Emitter")
1633 class PARTICLE_PT_children(ParticleButtonsPanel, Panel):
1634 bl_label = "Children"
1635 bl_options = {'DEFAULT_CLOSED'}
1636 COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'}
1639 def poll(cls, context):
1640 return particle_panel_poll(cls, context)
1642 def draw(self, context):
1643 layout = self.layout
1645 psys = context.particle_system
1646 part = particle_get_settings(context)
1648 layout.row().prop(part, "child_type", expand=True)
1650 layout.use_property_split = True
1652 if part.child_type == 'NONE':
1655 col = layout.column()
1657 sub = col.column(align=True)
1658 sub.prop(part, "child_nbr", text="Display Amount")
1659 sub.prop(part, "rendered_child_count", text="Render Amount")
1663 col.prop(part, "child_length", slider=True)
1664 col.prop(part, "child_length_threshold", slider=True)
1666 col.prop(psys, "child_seed", text="Seed")
1670 if part.child_type == 'INTERPOLATED':
1671 col.prop(part, "virtual_parents", slider=True)
1672 col.prop(part, "create_long_hair_children")
1675 sub = col.column(align=True)
1676 sub.prop(part, "child_size", text="Size")
1677 sub.prop(part, "child_size_random", text="Randomize Size", slider=True)
1679 if part.child_type == 'SIMPLE':
1681 col.prop(part, "child_radius", text="Radius")
1682 col.prop(part, "child_roundness", text="Roundness", slider=True)
1683 elif part.virtual_parents > 0.0:
1684 sub = col.column(align=True)
1685 sub.label(text="Parting not available with virtual parents")
1688 class PARTICLE_PT_children_parting(ParticleButtonsPanel, Panel):
1689 bl_label = "Parting"
1690 bl_parent_id = "PARTICLE_PT_children"
1691 bl_options = {'DEFAULT_CLOSED'}
1692 COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'}
1695 def poll(cls, context):
1696 part = particle_get_settings(context)
1697 return part.child_type == 'INTERPOLATED'
1699 def draw(self, context):
1700 layout = self.layout
1702 part = particle_get_settings(context)
1704 layout.use_property_split = True
1706 col = layout.column()
1707 col.prop(part, "child_parting_factor", text="Parting", slider=True)
1708 col.prop(part, "child_parting_min", text="Min")
1709 col.prop(part, "child_parting_max", text="Max")
1712 class PARTICLE_PT_children_clumping(ParticleButtonsPanel, Panel):
1713 bl_label = "Clumping"
1714 bl_parent_id = "PARTICLE_PT_children"
1715 bl_options = {'DEFAULT_CLOSED'}
1716 COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'}
1719 def poll(cls, context):
1720 part = particle_get_settings(context)
1721 return part.child_type != 'NONE'
1723 def draw(self, context):
1724 layout = self.layout
1726 part = particle_get_settings(context)
1728 layout.use_property_split = True
1730 col = layout.column()
1734 sub.prop(part, "use_clump_curve")
1735 if part.use_clump_curve:
1736 sub.template_curve_mapping(part, "clump_curve")
1738 sub.prop(part, "clump_factor", slider=True)
1739 sub.prop(part, "clump_shape", slider=True)
1740 sub = col.column(align=True)
1741 sub.prop(part, "use_clump_noise")
1742 subsub = sub.column()
1743 subsub.enabled = part.use_clump_noise
1744 subsub.prop(part, "clump_noise_size")
1746 if part.child_type == 'SIMPLE':
1747 sub.prop(part, "twist")
1748 sub.prop(part, "use_twist_curve")
1749 if part.use_twist_curve:
1750 sub.template_curve_mapping(part, "twist_curve")
1753 class PARTICLE_PT_children_roughness(ParticleButtonsPanel, Panel):
1754 bl_label = "Roughness"
1755 bl_parent_id = "PARTICLE_PT_children"
1756 bl_options = {'DEFAULT_CLOSED'}
1757 COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'}
1760 def poll(cls, context):
1761 part = particle_get_settings(context)
1762 return part.child_type != 'NONE'
1764 def draw(self, context):
1765 layout = self.layout
1767 part = particle_get_settings(context)
1769 layout.use_property_split = True
1771 col = layout.column()
1773 col.prop(part, "use_roughness_curve")
1774 if part.use_roughness_curve:
1776 sub.template_curve_mapping(part, "roughness_curve")
1777 sub.prop(part, "roughness_1", text="Roughness")
1778 sub.prop(part, "roughness_1_size", text="Size")
1780 sub = col.column(align=True)
1781 sub.prop(part, "roughness_1", text="Uniform")
1782 sub.prop(part, "roughness_1_size", text="Size")
1784 sub = col.column(align=True)
1785 sub.prop(part, "roughness_endpoint", text="Endpoint")
1786 sub.prop(part, "roughness_end_shape")
1788 sub = col.column(align=True)
1789 sub.prop(part, "roughness_2", text="Random")
1790 sub.prop(part, "roughness_2_size", text="Size")
1791 sub.prop(part, "roughness_2_threshold", slider=True)
1794 class PARTICLE_PT_children_kink(ParticleButtonsPanel, Panel):
1796 bl_parent_id = "PARTICLE_PT_children"
1797 bl_options = {'DEFAULT_CLOSED'}
1798 COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'}
1801 def poll(cls, context):
1802 part = particle_get_settings(context)
1803 return part.child_type != 'NONE'
1805 def draw(self, context):
1806 layout = self.layout
1808 part = particle_get_settings(context)
1810 layout.use_property_split = True
1812 col = layout.column()
1814 col.prop(part, "kink", text="Kink Type")
1815 col = layout.column()
1816 col.active = part.kink != 'NO'
1818 if part.kink == 'SPIRAL':
1821 sub.prop(part, "kink_amplitude", text="Amplitude")
1822 sub.prop(part, "kink_amplitude_random", text="Randomize Amplitude", slider=True)
1827 sub.prop(part, "kink_axis")
1828 sub.prop(part, "kink_axis_random", text="Randomize Axis", slider=True)
1832 col.prop(part, "kink_frequency", text="Frequency")
1833 col.prop(part, "kink_shape", text="Shape", slider=True)
1834 col.prop(part, "kink_extra_steps", text="Steps")
1836 elif part.kink in {'CURL', 'RADIAL', 'WAVE', 'BRAID', 'WAVE'}:
1837 sub = col.column(align=True)
1838 sub.prop(part, "kink_amplitude")
1839 sub.prop(part, "kink_amplitude_clump", text="Clump", slider=True)
1840 col.prop(part, "kink_flat", slider=True)
1841 col.prop(part, "kink_frequency")
1842 col.prop(part, "kink_shape", slider=True)
1845 class PARTICLE_PT_field_weights(ParticleButtonsPanel, Panel):
1846 bl_label = "Field Weights"
1847 bl_options = {'DEFAULT_CLOSED'}
1848 COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'}
1851 def poll(cls, context):
1852 return particle_panel_poll(cls, context)
1854 def draw(self, context):
1855 part = particle_get_settings(context)
1856 effector_weights_ui(self, context, part.effector_weights, 'PSYS')
1858 if part.type == 'HAIR':
1859 row = self.layout.row()
1860 row.prop(part.effector_weights, "apply_to_hair_growing")
1861 row.prop(part, "apply_effector_to_children")
1862 row = self.layout.row()
1863 row.prop(part, "effect_hair", slider=True)
1866 class PARTICLE_PT_force_fields(ParticleButtonsPanel, Panel):
1867 bl_label = "Force Field Settings"
1868 bl_options = {'DEFAULT_CLOSED'}
1869 COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'}
1871 def draw(self, context):
1872 layout = self.layout
1873 layout.use_property_split = True
1875 part = particle_get_settings(context)
1877 col = layout.column()
1878 col.prop(part, "use_self_effect")
1879 col.prop(part, "effector_amount", text="Effector Amount")
1882 class PARTICLE_PT_force_fields_type1(ParticleButtonsPanel, Panel):
1884 bl_parent_id = "PARTICLE_PT_force_fields"
1885 COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'}
1887 def draw(self, context):
1888 layout = self.layout
1889 layout.use_property_split = True
1891 part = particle_get_settings(context)
1893 col = layout.column()
1894 col.prop(part.force_field_1, "type", text="Type 1")
1895 basic_force_field_settings_ui(self, context, part.force_field_1)
1898 class PARTICLE_PT_force_fields_type2(ParticleButtonsPanel, Panel):
1900 bl_parent_id = "PARTICLE_PT_force_fields"
1901 COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'}
1903 def draw(self, context):
1904 layout = self.layout
1905 layout.use_property_split = True
1907 part = particle_get_settings(context)
1909 col = layout.column()
1910 col.prop(part.force_field_2, "type", text="Type 2")
1911 basic_force_field_settings_ui(self, context, part.force_field_2)
1914 class PARTICLE_PT_force_fields_type1_falloff(ParticleButtonsPanel, Panel):
1915 bl_label = "Falloff"
1916 bl_options = {'DEFAULT_CLOSED'}
1917 bl_parent_id = "PARTICLE_PT_force_fields_type1"
1918 COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'}
1920 def draw(self, context):
1921 layout = self.layout
1922 layout.use_property_split = True
1924 part = particle_get_settings(context)
1926 basic_force_field_falloff_ui(self, context, part.force_field_1)
1929 class PARTICLE_PT_force_fields_type2_falloff(ParticleButtonsPanel, Panel):
1930 bl_label = "Falloff"
1931 bl_options = {'DEFAULT_CLOSED'}
1932 bl_parent_id = "PARTICLE_PT_force_fields_type2"
1933 COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'}
1935 def draw(self, context):
1936 layout = self.layout
1937 layout.use_property_split = True
1939 part = particle_get_settings(context)
1941 basic_force_field_falloff_ui(self, context, part.force_field_2)
1944 class PARTICLE_PT_vertexgroups(ParticleButtonsPanel, Panel):
1945 bl_label = "Vertex Groups"
1946 bl_options = {'DEFAULT_CLOSED'}
1947 COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'}
1950 def poll(cls, context):
1951 if context.particle_system is None:
1953 return particle_panel_poll(cls, context)
1955 def draw(self, context):
1956 layout = self.layout
1957 layout.use_property_split = True
1960 psys = context.particle_system
1962 col = layout.column()
1963 row = col.row(align=True)
1964 row.prop_search(psys, "vertex_group_density", ob, "vertex_groups", text="Density")
1965 row.prop(psys, "invert_vertex_group_density", text="", toggle=True, icon='ARROW_LEFTRIGHT')
1967 row = col.row(align=True)
1968 row.prop_search(psys, "vertex_group_length", ob, "vertex_groups", text="Length")
1969 row.prop(psys, "invert_vertex_group_length", text="", toggle=True, icon='ARROW_LEFTRIGHT')
1971 row = col.row(align=True)
1972 row.prop_search(psys, "vertex_group_clump", ob, "vertex_groups", text="Clump")
1973 row.prop(psys, "invert_vertex_group_clump", text="", toggle=True, icon='ARROW_LEFTRIGHT')
1975 row = col.row(align=True)
1976 row.prop_search(psys, "vertex_group_kink", ob, "vertex_groups", text="Kink")
1977 row.prop(psys, "invert_vertex_group_kink", text="", toggle=True, icon='ARROW_LEFTRIGHT')
1979 row = col.row(align=True)
1980 row.prop_search(psys, "vertex_group_roughness_1", ob, "vertex_groups", text="Roughness 1")
1981 row.prop(psys, "invert_vertex_group_roughness_1", text="", toggle=True, icon='ARROW_LEFTRIGHT')
1983 row = col.row(align=True)
1984 row.prop_search(psys, "vertex_group_roughness_2", ob, "vertex_groups", text="Roughness 2")
1985 row.prop(psys, "invert_vertex_group_roughness_2", text="", toggle=True, icon='ARROW_LEFTRIGHT')
1987 row = col.row(align=True)
1988 row.prop_search(psys, "vertex_group_roughness_end", ob, "vertex_groups", text="Roughness End")
1989 row.prop(psys, "invert_vertex_group_roughness_end", text="", toggle=True, icon='ARROW_LEFTRIGHT')
1991 row = col.row(align=True)
1992 row.prop_search(psys, "vertex_group_twist", ob, "vertex_groups", text="Twist")
1993 row.prop(psys, "invert_vertex_group_twist", text="", toggle=True, icon='ARROW_LEFTRIGHT')
1995 # Commented out vertex groups don't work and are still waiting for better implementation
1996 # row = layout.row()
1997 # row.prop_search(psys, "vertex_group_velocity", ob, "vertex_groups", text="Velocity")
1998 # row.prop(psys, "invert_vertex_group_velocity", text="")
2000 # row = layout.row()
2001 # row.prop_search(psys, "vertex_group_size", ob, "vertex_groups", text="Size")
2002 # row.prop(psys, "invert_vertex_group_size", text="")
2004 # row = layout.row()
2005 # row.prop_search(psys, "vertex_group_tangent", ob, "vertex_groups", text="Tangent")
2006 # row.prop(psys, "invert_vertex_group_tangent", text="")
2008 # row = layout.row()
2009 # row.prop_search(psys, "vertex_group_rotation", ob, "vertex_groups", text="Rotation")
2010 # row.prop(psys, "invert_vertex_group_rotation", text="")
2012 # row = layout.row()
2013 # row.prop_search(psys, "vertex_group_field", ob, "vertex_groups", text="Field")
2014 # row.prop(psys, "invert_vertex_group_field", text="")
2017 class PARTICLE_PT_textures(ParticleButtonsPanel, Panel):
2018 bl_label = "Textures"
2019 bl_options = {'DEFAULT_CLOSED'}
2020 COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'}
2023 def poll(cls, context):
2024 if context.particle_system is None:
2026 return particle_panel_poll(cls, context)
2028 def draw(self, context):
2029 layout = self.layout
2031 psys = context.particle_system
2032 part = psys.settings
2035 row.template_list("TEXTURE_UL_texslots", "", part, "texture_slots", part, "active_texture_index", rows=2)
2037 col = row.column(align=True)
2038 col.operator("texture.slot_move", text="", icon='TRIA_UP').type = 'UP'
2039 col.operator("texture.slot_move", text="", icon='TRIA_DOWN').type = 'DOWN'
2040 col.menu("TEXTURE_MT_specials", icon='DOWNARROW_HLT', text="")
2042 if not part.active_texture:
2043 layout.template_ID(part, "active_texture", new="texture.new")
2045 slot = part.texture_slots[part.active_texture_index]
2046 layout.template_ID(slot, "texture", new="texture.new")
2049 class PARTICLE_PT_hair_shape(ParticleButtonsPanel, Panel):
2050 bl_label = "Hair Shape"
2051 bl_options = {'DEFAULT_CLOSED'}
2052 COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'}
2055 def poll(cls, context):
2056 if context.particle_system is None:
2058 return particle_panel_poll(cls, context)
2060 def draw(self, context):
2061 layout = self.layout
2062 layout.use_property_split = True
2064 psys = context.particle_system
2065 part = psys.settings
2067 layout.prop(part, "shape", text="Strand Shape")
2069 col = layout.column(align=True)
2070 col.prop(part, "root_radius", text="Radius Root")
2071 col.prop(part, "tip_radius", text="Tip")
2073 col = layout.column()
2074 col.prop(part, "radius_scale", text="Radius Scaling")
2075 col.prop(part, "use_close_tip")
2078 class PARTICLE_PT_custom_props(ParticleButtonsPanel, PropertyPanel, Panel):
2079 COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'}
2080 _context_path = "particle_system.settings"
2081 _property_type = bpy.types.ParticleSettings
2085 PARTICLE_MT_specials,
2086 PARTICLE_PT_hair_dynamics_presets,
2087 PARTICLE_UL_particle_systems,
2088 PARTICLE_PT_context_particles,
2089 PARTICLE_PT_emission,
2090 PARTICLE_PT_emission_source,
2091 PARTICLE_PT_hair_dynamics,
2092 PARTICLE_PT_hair_dynamics_structure,
2093 PARTICLE_PT_hair_dynamics_volume,
2095 PARTICLE_PT_velocity,
2096 PARTICLE_PT_rotation,
2097 PARTICLE_PT_rotation_angular_velocity,
2098 PARTICLE_PT_physics,
2099 PARTICLE_PT_physics_fluid_springs,
2100 PARTICLE_PT_physics_fluid_springs_viscoelastic,
2101 PARTICLE_PT_physics_fluid_springs_advanced,
2102 PARTICLE_PT_physics_fluid_advanced,
2103 PARTICLE_PT_physics_boids_movement,
2104 PARTICLE_PT_physics_boids_battle,
2105 PARTICLE_PT_physics_boids_misc,
2106 PARTICLE_PT_physics_forces,
2107 PARTICLE_PT_physics_deflection,
2108 PARTICLE_PT_physics_integration,
2109 PARTICLE_PT_physics_relations,
2110 PARTICLE_PT_boidbrain,
2112 PARTICLE_PT_render_line,
2113 PARTICLE_PT_render_path,
2114 PARTICLE_PT_render_path_timing,
2115 PARTICLE_PT_render_object,
2116 PARTICLE_PT_render_collection,
2117 PARTICLE_PT_render_collection_use_count,
2118 PARTICLE_PT_render_billboards_tilt,
2119 PARTICLE_PT_render_billboards_uv,
2120 PARTICLE_PT_render_trails,
2121 PARTICLE_PT_render_extra,
2123 PARTICLE_PT_children,
2124 PARTICLE_PT_children_parting,
2125 PARTICLE_PT_children_clumping,
2126 PARTICLE_PT_children_roughness,
2127 PARTICLE_PT_children_kink,
2128 PARTICLE_PT_hair_shape,
2129 PARTICLE_PT_field_weights,
2130 PARTICLE_PT_force_fields,
2131 PARTICLE_PT_force_fields_type1,
2132 PARTICLE_PT_force_fields_type1_falloff,
2133 PARTICLE_PT_force_fields_type2,
2134 PARTICLE_PT_force_fields_type2_falloff,
2135 PARTICLE_PT_vertexgroups,
2136 PARTICLE_PT_textures,
2137 PARTICLE_PT_custom_props,
2140 if __name__ == "__main__": # only for live edit.
2141 from bpy.utils import register_class