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
22 from rna_prop_ui import PropertyPanel
24 from bl_ui.properties_physics_common import (point_cache_ui,
26 basic_force_field_settings_ui,
27 basic_force_field_falloff_ui,
31 def particle_panel_enabled(context, psys):
34 phystype = psys.settings.physics_type
35 if psys.settings.type in {'EMITTER', 'REACTOR'} and phystype in {'NO', 'KEYED'}:
38 return (psys.point_cache.is_baked is False) and (not psys.is_edited) and (not context.particle_system_editable)
41 def particle_panel_poll(cls, context):
42 psys = context.particle_system
43 engine = context.scene.render.engine
47 settings = psys.settings
48 elif isinstance(context.space_data.pin_id, bpy.types.ParticleSettings):
49 settings = context.space_data.pin_id
54 return settings.is_fluid is False and (engine in cls.COMPAT_ENGINES)
57 def particle_get_settings(context):
58 if context.particle_system:
59 return context.particle_system.settings
60 elif isinstance(context.space_data.pin_id, bpy.types.ParticleSettings):
61 return context.space_data.pin_id
65 class ParticleButtonsPanel():
66 bl_space_type = 'PROPERTIES'
67 bl_region_type = 'WINDOW'
68 bl_context = "particle"
71 def poll(cls, context):
72 return particle_panel_poll(cls, context)
75 class PARTICLE_PT_context_particles(ParticleButtonsPanel, Panel):
77 bl_options = {'HIDE_HEADER'}
78 COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
81 def poll(cls, context):
82 engine = context.scene.render.engine
83 return (context.particle_system or context.object or context.space_data.pin_id) and (engine in cls.COMPAT_ENGINES)
85 def draw(self, context):
88 if context.scene.render.engine == 'BLENDER_GAME':
89 layout.label("Not available in the Game Engine")
93 psys = context.particle_system
99 row.template_list(ob, "particle_systems", ob.particle_systems, "active_index", rows=2)
101 col = row.column(align=True)
102 col.operator("object.particle_system_add", icon='ZOOMIN', text="")
103 col.operator("object.particle_system_remove", icon='ZOOMOUT', text="")
106 part = particle_get_settings(context)
111 layout.template_ID(context.space_data, "pin_id")
114 layout.label(text="Settings used for fluid")
117 layout.prop(part, "type", text="Type")
119 elif not psys.settings:
120 split = layout.split(percentage=0.32)
123 col.label(text="Name:")
124 col.label(text="Settings:")
127 col.prop(psys, "name", text="")
128 col.template_ID(psys, "settings", new="particle.new")
132 split = layout.split(percentage=0.32)
134 col.label(text="Name:")
135 if part.is_fluid is False:
136 col.label(text="Settings:")
137 col.label(text="Type:")
140 col.prop(psys, "name", text="")
141 if part.is_fluid is False:
143 row.enabled = particle_panel_enabled(context, psys)
144 row.template_ID(psys, "settings", new="particle.new")
147 #row.label(text="Viewport")
148 #row.label(text="Render")
151 layout.label(text="{} fluid particles for this frame".format(str(part.count)))
155 row.enabled = particle_panel_enabled(context, psys)
156 row.prop(part, "type", text="")
157 row.prop(psys, "seed")
160 split = layout.split(percentage=0.65)
161 if part.type == 'HAIR':
162 if psys is not None and psys.is_edited:
163 split.operator("particle.edited_clear", text="Free Edit")
166 row.enabled = particle_panel_enabled(context, psys)
167 row.prop(part, "regrow_hair")
168 row.prop(part, "use_advanced_hair")
170 row.enabled = particle_panel_enabled(context, psys)
171 row.prop(part, "hair_step")
172 if psys is not None and psys.is_edited:
173 if psys.is_global_hair:
174 layout.operator("particle.connect_hair")
176 layout.operator("particle.disconnect_hair")
177 elif psys is not None and part.type == 'REACTOR':
178 split.enabled = particle_panel_enabled(context, psys)
179 split.prop(psys, "reactor_target_object")
180 split.prop(psys, "reactor_target_particle_system", text="Particle System")
183 class PARTICLE_PT_emission(ParticleButtonsPanel, Panel):
184 bl_label = "Emission"
185 COMPAT_ENGINES = {'BLENDER_RENDER'}
188 def poll(cls, context):
189 psys = context.particle_system
190 settings = particle_get_settings(context)
194 if settings.is_fluid:
196 if particle_panel_poll(PARTICLE_PT_emission, context):
197 return psys is None or not context.particle_system.point_cache.use_external
200 def draw(self, context):
203 psys = context.particle_system
204 part = particle_get_settings(context)
206 layout.enabled = particle_panel_enabled(context, psys) and (psys is None or not psys.has_multiple_caches)
209 row.active = part.distribution != 'GRID'
210 row.prop(part, "count")
212 if part.type == 'HAIR' and not part.use_advanced_hair:
213 row.prop(part, "hair_length")
216 if part.type != 'HAIR':
217 split = layout.split()
219 col = split.column(align=True)
220 col.prop(part, "frame_start")
221 col.prop(part, "frame_end")
223 col = split.column(align=True)
224 col.prop(part, "lifetime")
225 col.prop(part, "lifetime_random", slider=True)
227 layout.label(text="Emit From:")
228 layout.prop(part, "emit_from", expand=True)
231 if part.emit_from == 'VERT':
232 row.prop(part, "use_emit_random")
233 elif part.distribution == 'GRID':
234 row.prop(part, "invert_grid")
235 row.prop(part, "hexagonal_grid")
237 row.prop(part, "use_emit_random")
238 row.prop(part, "use_even_distribution")
240 if part.emit_from == 'FACE' or part.emit_from == 'VOLUME':
241 layout.prop(part, "distribution", expand=True)
244 if part.distribution == 'JIT':
245 row.prop(part, "userjit", text="Particles/Face")
246 row.prop(part, "jitter_factor", text="Jittering Amount", slider=True)
247 elif part.distribution == 'GRID':
248 row.prop(part, "grid_resolution")
249 row.prop(part, "grid_random", text="Random", slider=True)
252 class PARTICLE_PT_hair_dynamics(ParticleButtonsPanel, Panel):
253 bl_label = "Hair dynamics"
254 bl_options = {'DEFAULT_CLOSED'}
255 COMPAT_ENGINES = {'BLENDER_RENDER'}
258 def poll(cls, context):
259 psys = context.particle_system
260 engine = context.scene.render.engine
263 if psys.settings is None:
265 return psys.settings.type == 'HAIR' and (engine in cls.COMPAT_ENGINES)
267 def draw_header(self, context):
268 psys = context.particle_system
269 self.layout.prop(psys, "use_hair_dynamics", text="")
271 def draw(self, context):
274 psys = context.particle_system
279 cloth = psys.cloth.settings
281 layout.enabled = psys.use_hair_dynamics and psys.point_cache.is_baked is False
283 split = layout.split()
286 col.label(text="Material:")
287 sub = col.column(align=True)
288 sub.prop(cloth, "pin_stiffness", text="Stiffness")
289 sub.prop(cloth, "mass")
290 sub.prop(cloth, "bending_stiffness", text="Bending")
291 sub.prop(cloth, "internal_friction", slider=True)
292 sub.prop(cloth, "collider_friction", slider=True)
295 col.label(text="Damping:")
296 sub = col.column(align=True)
297 sub.prop(cloth, "spring_damping", text="Spring")
298 sub.prop(cloth, "air_damping", text="Air")
300 col.label(text="Quality:")
301 col.prop(cloth, "quality", text="Steps", slider=True)
304 class PARTICLE_PT_cache(ParticleButtonsPanel, Panel):
306 bl_options = {'DEFAULT_CLOSED'}
307 COMPAT_ENGINES = {'BLENDER_RENDER'}
310 def poll(cls, context):
311 psys = context.particle_system
312 engine = context.scene.render.engine
315 if psys.settings is None:
317 if psys.settings.is_fluid:
319 phystype = psys.settings.physics_type
320 if phystype == 'NO' or phystype == 'KEYED':
322 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
324 def draw(self, context):
325 psys = context.particle_system
327 point_cache_ui(self, context, psys.point_cache, True, 'HAIR' if (psys.settings.type == 'HAIR') else 'PSYS')
330 class PARTICLE_PT_velocity(ParticleButtonsPanel, Panel):
331 bl_label = "Velocity"
332 COMPAT_ENGINES = {'BLENDER_RENDER'}
335 def poll(cls, context):
336 if particle_panel_poll(PARTICLE_PT_velocity, context):
337 psys = context.particle_system
338 settings = particle_get_settings(context)
340 if settings.type == 'HAIR' and not settings.use_advanced_hair:
342 return settings.physics_type != 'BOIDS' and (psys is None or not psys.point_cache.use_external)
346 def draw(self, context):
349 psys = context.particle_system
350 part = particle_get_settings(context)
352 layout.enabled = particle_panel_enabled(context, psys)
354 split = layout.split()
357 col.label(text="Emitter Geometry:")
358 col.prop(part, "normal_factor")
359 sub = col.column(align=True)
360 sub.prop(part, "tangent_factor")
361 sub.prop(part, "tangent_phase", slider=True)
364 col.label(text="Emitter Object:")
365 col.prop(part, "object_align_factor", text="")
367 layout.label(text="Other:")
369 if part.emit_from == 'PARTICLE':
370 row.prop(part, "particle_factor")
372 row.prop(part, "object_factor", slider=True)
373 row.prop(part, "factor_random")
375 #if part.type=='REACTOR':
376 # sub.prop(part, "reactor_factor")
377 # sub.prop(part, "reaction_shape", slider=True)
380 class PARTICLE_PT_rotation(ParticleButtonsPanel, Panel):
381 bl_label = "Rotation"
382 bl_options = {'DEFAULT_CLOSED'}
383 COMPAT_ENGINES = {'BLENDER_RENDER'}
386 def poll(cls, context):
387 if particle_panel_poll(PARTICLE_PT_rotation, context):
388 psys = context.particle_system
389 settings = particle_get_settings(context)
391 if settings.type == 'HAIR' and not settings.use_advanced_hair:
393 return settings.physics_type != 'BOIDS' and (psys is None or not psys.point_cache.use_external)
397 def draw_header(self, context):
398 psys = context.particle_system
402 part = context.space_data.pin_id
404 self.layout.prop(part, "use_rotations", text="")
406 def draw(self, context):
409 psys = context.particle_system
413 part = context.space_data.pin_id
415 layout.enabled = particle_panel_enabled(context, psys) and part.use_rotations
417 layout.label(text="Initial Orientation:")
419 split = layout.split()
421 col = split.column(align=True)
422 col.prop(part, "rotation_mode", text="")
423 col.prop(part, "rotation_factor_random", slider=True, text="Random")
425 col = split.column(align=True)
426 col.prop(part, "phase_factor", slider=True)
427 col.prop(part, "phase_factor_random", text="Random", slider=True)
429 if part.type != 'HAIR':
430 layout.label(text="Angular Velocity:")
432 split = layout.split()
433 col = split.column(align=True)
434 col.prop(part, "angular_velocity_mode", text="")
436 sub.active = part.angular_velocity_mode != 'NONE'
437 sub.prop(part, "angular_velocity_factor", text="")
440 col.prop(part, "use_dynamic_rotation")
443 class PARTICLE_PT_physics(ParticleButtonsPanel, Panel):
445 COMPAT_ENGINES = {'BLENDER_RENDER'}
448 def poll(cls, context):
449 if particle_panel_poll(PARTICLE_PT_physics, context):
450 psys = context.particle_system
451 settings = particle_get_settings(context)
453 if settings.type == 'HAIR' and not settings.use_advanced_hair:
455 return psys is None or not psys.point_cache.use_external
459 def draw(self, context):
462 psys = context.particle_system
463 part = particle_get_settings(context)
465 layout.enabled = particle_panel_enabled(context, psys)
467 layout.prop(part, "physics_type", expand=True)
470 col = row.column(align=True)
471 col.prop(part, "particle_size")
472 col.prop(part, "size_random", slider=True)
474 if part.physics_type != 'NO':
475 col = row.column(align=True)
476 col.prop(part, "mass")
477 col.prop(part, "use_multiply_size_mass", text="Multiply mass with size")
479 if part.physics_type in {'NEWTON', 'FLUID'}:
480 split = layout.split()
483 col.label(text="Forces:")
484 col.prop(part, "brownian_factor")
485 col.prop(part, "drag_factor", slider=True)
486 col.prop(part, "damping", slider=True)
489 col.label(text="Integration:")
490 col.prop(part, "integrator", text="")
491 col.prop(part, "timestep")
493 if part.adaptive_subframes:
494 sub.prop(part, "courant_target", text="Threshold")
496 sub.prop(part, "subframes")
497 sub.prop(part, "adaptive_subframes", text="")
500 row.prop(part, "use_size_deflect")
501 row.prop(part, "use_die_on_collision")
503 if part.physics_type == 'FLUID':
506 split = layout.split()
509 col.label(text="Fluid properties:")
510 col.prop(fluid, "stiffness", text="Stiffness")
511 col.prop(fluid, "linear_viscosity", text="Viscosity")
512 col.prop(fluid, "buoyancy", text="Buoyancy", slider=True)
515 col.label(text="Advanced:")
518 sub.prop(fluid, "repulsion", slider=fluid.factor_repulsion)
519 sub.prop(fluid, "factor_repulsion", text="")
522 sub.prop(fluid, "stiff_viscosity", slider=fluid.factor_stiff_viscosity)
523 sub.prop(fluid, "factor_stiff_viscosity", text="")
526 sub.prop(fluid, "fluid_radius", slider=fluid.factor_radius)
527 sub.prop(fluid, "factor_radius", text="")
530 sub.prop(fluid, "rest_density", slider=fluid.factor_density)
531 sub.prop(fluid, "factor_density", text="")
533 split = layout.split()
536 col.label(text="Springs:")
537 col.prop(fluid, "spring_force", text="Force")
538 col.prop(fluid, "use_viscoelastic_springs")
539 sub = col.column(align=True)
540 sub.active = fluid.use_viscoelastic_springs
541 sub.prop(fluid, "yield_ratio", slider=True)
542 sub.prop(fluid, "plasticity", slider=True)
545 col.label(text="Advanced:")
547 sub.prop(fluid, "rest_length", slider=fluid.factor_rest_length)
548 sub.prop(fluid, "factor_rest_length", text="")
551 sub.active = fluid.use_viscoelastic_springs
552 sub.prop(fluid, "use_initial_rest_length")
553 sub.prop(fluid, "spring_frames", text="Frames")
555 elif part.physics_type == 'KEYED':
556 split = layout.split()
561 col.active = not psys.use_keyed_timing
562 col.prop(part, "keyed_loops", text="Loops")
564 row.prop(psys, "use_keyed_timing", text="Use Timing")
566 layout.label(text="Keys:")
567 elif part.physics_type == 'BOIDS':
571 row.prop(boids, "use_flight")
572 row.prop(boids, "use_land")
573 row.prop(boids, "use_climb")
575 split = layout.split()
578 col = sub.column(align=True)
579 col.active = boids.use_flight
580 col.prop(boids, "air_speed_max")
581 col.prop(boids, "air_speed_min", slider=True)
582 col.prop(boids, "air_acc_max", slider=True)
583 col.prop(boids, "air_ave_max", slider=True)
584 col.prop(boids, "air_personal_space")
586 row.active = (boids.use_land or boids.use_climb) and boids.use_flight
587 row.prop(boids, "land_smooth")
590 col = sub.column(align=True)
591 col.active = boids.use_land or boids.use_climb
592 col.prop(boids, "land_speed_max")
593 col.prop(boids, "land_jump_speed")
594 col.prop(boids, "land_acc_max", slider=True)
595 col.prop(boids, "land_ave_max", slider=True)
596 col.prop(boids, "land_personal_space")
597 col.prop(boids, "land_stick_force")
601 col = row.column(align=True)
602 col.label(text="Battle:")
603 col.prop(boids, "health")
604 col.prop(boids, "strength")
605 col.prop(boids, "aggression")
606 col.prop(boids, "accuracy")
607 col.prop(boids, "range")
610 col.label(text="Misc:")
611 col.prop(boids, "bank", slider=True)
612 col.prop(boids, "pitch", slider=True)
613 col.prop(boids, "height", slider=True)
615 if psys and part.physics_type in {'KEYED', 'BOIDS', 'FLUID'}:
616 if part.physics_type == 'BOIDS':
617 layout.label(text="Relations:")
618 elif part.physics_type == 'FLUID':
619 layout.label(text="Fluid interaction:")
622 row.template_list(psys, "targets", psys, "active_particle_target_index")
626 subsub = sub.column(align=True)
627 subsub.operator("particle.new_target", icon='ZOOMIN', text="")
628 subsub.operator("particle.target_remove", icon='ZOOMOUT', text="")
630 subsub = sub.column(align=True)
631 subsub.operator("particle.target_move_up", icon='MOVE_UP_VEC', text="")
632 subsub.operator("particle.target_move_down", icon='MOVE_DOWN_VEC', text="")
634 key = psys.active_particle_target
637 if part.physics_type == 'KEYED':
640 #col.alert = key.valid
641 col.prop(key, "object", text="")
642 col.prop(key, "system", text="System")
644 col.active = psys.use_keyed_timing
645 col.prop(key, "time")
646 col.prop(key, "duration")
647 elif part.physics_type == 'BOIDS':
650 #sub.alert = key.valid
651 sub.prop(key, "object", text="")
652 sub.prop(key, "system", text="System")
654 layout.prop(key, "alliance", expand=True)
655 elif part.physics_type == 'FLUID':
658 #sub.alert = key.valid
659 sub.prop(key, "object", text="")
660 sub.prop(key, "system", text="System")
663 class PARTICLE_PT_boidbrain(ParticleButtonsPanel, Panel):
664 bl_label = "Boid Brain"
665 COMPAT_ENGINES = {'BLENDER_RENDER'}
668 def poll(cls, context):
669 psys = context.particle_system
670 settings = particle_get_settings(context)
671 engine = context.scene.render.engine
675 if psys is not None and psys.point_cache.use_external:
677 return settings.physics_type == 'BOIDS' and engine in cls.COMPAT_ENGINES
679 def draw(self, context):
682 boids = particle_get_settings(context).boids
684 layout.enabled = particle_panel_enabled(context, context.particle_system)
686 # Currently boids can only use the first state so these are commented out for now.
688 #row.template_list(boids, "states", boids, "active_boid_state_index", compact="True")
690 #sub = col.row(align=True)
691 #sub.operator("boid.state_add", icon='ZOOMIN', text="")
692 #sub.operator("boid.state_del", icon='ZOOMOUT', text="")
693 #sub = row.row(align=True)
694 #sub.operator("boid.state_move_up", icon='MOVE_UP_VEC', text="")
695 #sub.operator("boid.state_move_down", icon='MOVE_DOWN_VEC', text="")
697 state = boids.active_boid_state
699 #layout.prop(state, "name", text="State name")
702 row.prop(state, "ruleset_type")
703 if state.ruleset_type == 'FUZZY':
704 row.prop(state, "rule_fuzzy", slider=True)
709 row.template_list(state, "rules", state, "active_boid_rule_index")
713 subsub = sub.column(align=True)
714 subsub.operator_menu_enum("boid.rule_add", "type", icon='ZOOMIN', text="")
715 subsub.operator("boid.rule_del", icon='ZOOMOUT', text="")
717 subsub = sub.column(align=True)
718 subsub.operator("boid.rule_move_up", icon='MOVE_UP_VEC', text="")
719 subsub.operator("boid.rule_move_down", icon='MOVE_DOWN_VEC', text="")
721 rule = state.active_boid_rule
725 row.prop(rule, "name", text="")
726 #somebody make nice icons for boids here please! -jahka
727 row.prop(rule, "use_in_air", icon='MOVE_UP_VEC', text="")
728 row.prop(rule, "use_on_land", icon='MOVE_DOWN_VEC', text="")
732 if rule.type == 'GOAL':
733 row.prop(rule, "object")
735 row.prop(rule, "use_predict")
736 elif rule.type == 'AVOID':
737 row.prop(rule, "object")
739 row.prop(rule, "use_predict")
740 row.prop(rule, "fear_factor")
741 elif rule.type == 'FOLLOW_PATH':
742 row.label(text="Not yet functional")
743 elif rule.type == 'AVOID_COLLISION':
744 row.prop(rule, "use_avoid")
745 row.prop(rule, "use_avoid_collision")
746 row.prop(rule, "look_ahead")
747 elif rule.type == 'FOLLOW_LEADER':
748 row.prop(rule, "object", text="")
749 row.prop(rule, "distance")
751 row.prop(rule, "use_line")
753 sub.active = rule.line
754 sub.prop(rule, "queue_count")
755 elif rule.type == 'AVERAGE_SPEED':
756 row.prop(rule, "speed", slider=True)
757 row.prop(rule, "wander", slider=True)
758 row.prop(rule, "level", slider=True)
759 elif rule.type == 'FIGHT':
760 row.prop(rule, "distance")
761 row.prop(rule, "flee_distance")
764 class PARTICLE_PT_render(ParticleButtonsPanel, Panel):
766 COMPAT_ENGINES = {'BLENDER_RENDER'}
769 def poll(cls, context):
770 settings = particle_get_settings(context)
771 engine = context.scene.render.engine
775 return engine in cls.COMPAT_ENGINES
777 def draw(self, context):
780 psys = context.particle_system
781 part = particle_get_settings(context)
784 row.prop(part, "material")
786 row.prop(psys, "parent")
788 split = layout.split()
791 col.prop(part, "use_render_emitter")
792 col.prop(part, "use_parent_particles")
795 col.prop(part, "show_unborn")
796 col.prop(part, "use_dead")
798 layout.prop(part, "render_type", expand=True)
800 split = layout.split()
804 if part.render_type == 'LINE':
805 col.prop(part, "line_length_tail")
806 col.prop(part, "line_length_head")
808 split.prop(part, "use_velocity_length")
809 elif part.render_type == 'PATH':
810 col.prop(part, "use_strand_primitive")
812 sub.active = (part.use_strand_primitive is False)
813 sub.prop(part, "use_render_adaptive")
815 sub.active = part.use_render_adaptive or part.use_strand_primitive is True
816 sub.prop(part, "adaptive_angle")
818 sub.active = (part.use_render_adaptive is True and part.use_strand_primitive is False)
819 sub.prop(part, "adaptive_pixel")
820 col.prop(part, "use_hair_bspline")
821 col.prop(part, "render_step", text="Steps")
824 col.label(text="Timing:")
825 col.prop(part, "use_absolute_path_time")
826 col.prop(part, "path_start", text="Start", slider=not part.use_absolute_path_time)
827 col.prop(part, "path_end", text="End", slider=not part.use_absolute_path_time)
828 col.prop(part, "length_random", text="Random", slider=True)
833 if part.type == 'HAIR' and part.use_strand_primitive is True and part.child_type == 'INTERPOLATED':
834 layout.prop(part, "use_simplify")
835 if part.use_simplify is True:
837 row.prop(part, "simplify_refsize")
838 row.prop(part, "simplify_rate")
839 row.prop(part, "simplify_transition")
841 row.prop(part, "use_simplify_viewport")
843 sub.active = part.use_simplify_viewport is True
844 sub.prop(part, "simplify_viewport")
846 elif part.render_type == 'OBJECT':
847 col.prop(part, "dupli_object")
849 sub.prop(part, "use_global_dupli")
850 sub.prop(part, "use_rotation_dupli")
851 sub.prop(part, "use_scale_dupli")
852 elif part.render_type == 'GROUP':
853 col.prop(part, "dupli_group")
854 split = layout.split()
857 col.prop(part, "use_whole_group")
859 sub.active = (part.use_whole_group is False)
860 sub.prop(part, "use_group_pick_random")
861 sub.prop(part, "use_group_count")
865 sub.active = (part.use_whole_group is False)
866 sub.prop(part, "use_global_dupli")
867 sub.prop(part, "use_rotation_dupli")
868 sub.prop(part, "use_scale_dupli")
870 if part.use_group_count and not part.use_whole_group:
872 row.template_list(part, "dupli_weights", part, "active_dupliweight_index")
876 subsub = sub.column(align=True)
877 subsub.operator("particle.dupliob_copy", icon='ZOOMIN', text="")
878 subsub.operator("particle.dupliob_remove", icon='ZOOMOUT', text="")
879 subsub.operator("particle.dupliob_move_up", icon='MOVE_UP_VEC', text="")
880 subsub.operator("particle.dupliob_move_down", icon='MOVE_DOWN_VEC', text="")
882 weight = part.active_dupliweight
885 row.prop(weight, "count")
887 elif part.render_type == 'BILLBOARD':
890 col.label(text="Align:")
893 row.prop(part, "billboard_align", expand=True)
894 row.prop(part, "lock_billboard", text="Lock")
896 row.prop(part, "billboard_object")
899 col = row.column(align=True)
900 col.label(text="Tilt:")
901 col.prop(part, "billboard_tilt", text="Angle", slider=True)
902 col.prop(part, "billboard_tilt_random", text="Random", slider=True)
904 col.prop(part, "billboard_offset")
908 col.prop(part, "billboard_size", text="Scale")
909 if part.billboard_align == 'VEL':
910 col = row.column(align=True)
911 col.label("Velocity Scale:")
912 col.prop(part, "billboard_velocity_head", text="Head")
913 col.prop(part, "billboard_velocity_tail", text="Tail")
916 col = layout.column()
917 col.prop_search(psys, "billboard_normal_uv", ob.data, "uv_textures")
918 col.prop_search(psys, "billboard_time_index_uv", ob.data, "uv_textures")
920 split = layout.split(percentage=0.33)
921 split.label(text="Split UVs:")
922 split.prop(part, "billboard_uv_split", text="Number of splits")
925 col = layout.column()
926 col.active = part.billboard_uv_split > 1
927 col.prop_search(psys, "billboard_split_uv", ob.data, "uv_textures")
930 row.label(text="Animate:")
931 row.prop(part, "billboard_animation", text="")
932 row.label(text="Offset:")
933 row.prop(part, "billboard_offset_split", text="")
935 if part.render_type == 'HALO' or part.render_type == 'LINE' or part.render_type == 'BILLBOARD':
938 col.prop(part, "trail_count")
939 if part.trail_count > 1:
940 col.prop(part, "use_absolute_path_time", text="Length in frames")
942 col.prop(part, "path_end", text="Length", slider=not part.use_absolute_path_time)
943 col.prop(part, "length_random", text="Random", slider=True)
948 if part.render_type in {'OBJECT', 'GROUP'} and not part.use_advanced_hair:
949 row = layout.row(align=True)
950 row.prop(part, "particle_size")
951 row.prop(part, "size_random", slider=True)
954 class PARTICLE_PT_draw(ParticleButtonsPanel, Panel):
956 bl_options = {'DEFAULT_CLOSED'}
957 COMPAT_ENGINES = {'BLENDER_RENDER'}
960 def poll(cls, context):
961 settings = particle_get_settings(context)
962 engine = context.scene.render.engine
965 return engine in cls.COMPAT_ENGINES
967 def draw(self, context):
970 psys = context.particle_system
971 part = particle_get_settings(context)
974 row.prop(part, "draw_method", expand=True)
976 if part.draw_method == 'NONE' or (part.render_type == 'NONE' and part.draw_method == 'RENDER'):
979 path = (part.render_type == 'PATH' and part.draw_method == 'RENDER') or part.draw_method == 'PATH'
982 row.prop(part, "draw_percentage", slider=True)
983 if part.draw_method != 'RENDER' or part.render_type == 'HALO':
984 row.prop(part, "draw_size")
988 if part.draw_percentage != 100 and psys is not None:
989 if part.type == 'HAIR':
990 if psys.use_hair_dynamics and psys.point_cache.is_baked is False:
991 layout.row().label(text="Display percentage makes dynamics inaccurate without baking!")
993 phystype = part.physics_type
994 if phystype != 'NO' and phystype != 'KEYED' and psys.point_cache.is_baked is False:
995 layout.row().label(text="Display percentage makes dynamics inaccurate without baking!")
999 col.prop(part, "show_size")
1000 col.prop(part, "show_velocity")
1001 col.prop(part, "show_number")
1002 if part.physics_type == 'BOIDS':
1003 col.prop(part, "show_health")
1005 col = row.column(align=True)
1006 col.label(text="Color:")
1007 col.prop(part, "draw_color", text="")
1009 sub.active = (part.draw_color in {'VELOCITY', 'ACCELERATION'})
1010 sub.prop(part, "color_maximum", text="Max")
1013 col.prop(part, "draw_step")
1016 class PARTICLE_PT_children(ParticleButtonsPanel, Panel):
1017 bl_label = "Children"
1018 bl_options = {'DEFAULT_CLOSED'}
1019 COMPAT_ENGINES = {'BLENDER_RENDER'}
1022 def poll(cls, context):
1023 return particle_panel_poll(cls, context)
1025 def draw(self, context):
1026 layout = self.layout
1028 psys = context.particle_system
1029 part = particle_get_settings(context)
1031 layout.row().prop(part, "child_type", expand=True)
1033 if part.child_type == 'NONE':
1038 col = row.column(align=True)
1039 col.prop(part, "child_nbr", text="Display")
1040 col.prop(part, "rendered_child_count", text="Render")
1042 if part.child_type == 'INTERPOLATED':
1045 col.prop(psys, "child_seed", text="Seed")
1046 col.prop(part, "virtual_parents", slider=True)
1047 col.prop(part, "create_long_hair_children")
1049 col = row.column(align=True)
1050 col.prop(part, "child_size", text="Size")
1051 col.prop(part, "child_size_random", text="Random")
1053 split = layout.split()
1055 col = split.column()
1056 col.label(text="Effects:")
1058 sub = col.column(align=True)
1059 sub.prop(part, "clump_factor", slider=True)
1060 sub.prop(part, "clump_shape", slider=True)
1062 sub = col.column(align=True)
1063 sub.prop(part, "child_length", slider=True)
1064 sub.prop(part, "child_length_threshold", slider=True)
1066 if part.child_type == 'SIMPLE':
1067 sub = col.column(align=True)
1068 sub.prop(part, "child_radius", text="Radius")
1069 sub.prop(part, "child_roundness", text="Roundness", slider=True)
1071 sub.prop(psys, "child_seed", text="Seed")
1072 elif part.virtual_parents > 0.0:
1073 sub = col.column(align=True)
1074 sub.label(text="Parting not")
1075 sub.label(text="available with")
1076 sub.label(text="virtual parents")
1078 sub = col.column(align=True)
1079 sub.prop(part, "child_parting_factor", text="Parting", slider=True)
1080 sub.prop(part, "child_parting_min", text="Min")
1081 sub.prop(part, "child_parting_max", text="Max")
1083 col = split.column()
1084 col.label(text="Roughness:")
1086 sub = col.column(align=True)
1087 sub.prop(part, "roughness_1", text="Uniform")
1088 sub.prop(part, "roughness_1_size", text="Size")
1090 sub = col.column(align=True)
1091 sub.prop(part, "roughness_endpoint", "Endpoint")
1092 sub.prop(part, "roughness_end_shape")
1094 sub = col.column(align=True)
1095 sub.prop(part, "roughness_2", text="Random")
1096 sub.prop(part, "roughness_2_size", text="Size")
1097 sub.prop(part, "roughness_2_threshold", slider=True)
1099 layout.row().label(text="Kink:")
1100 layout.row().prop(part, "kink", expand=True)
1102 split = layout.split()
1103 split.active = part.kink != 'NO'
1105 col = split.column()
1106 sub = col.column(align=True)
1107 sub.prop(part, "kink_amplitude")
1108 sub.prop(part, "kink_amplitude_clump", text="Clump", slider=True)
1109 col.prop(part, "kink_flat", slider=True)
1110 col = split.column()
1111 sub = col.column(align=True)
1112 sub.prop(part, "kink_frequency")
1113 sub.prop(part, "kink_shape", slider=True)
1116 class PARTICLE_PT_field_weights(ParticleButtonsPanel, Panel):
1117 bl_label = "Field Weights"
1118 bl_options = {'DEFAULT_CLOSED'}
1119 COMPAT_ENGINES = {'BLENDER_RENDER'}
1122 def poll(cls, context):
1123 return particle_panel_poll(cls, context)
1125 def draw(self, context):
1126 part = particle_get_settings(context)
1127 effector_weights_ui(self, context, part.effector_weights)
1129 if part.type == 'HAIR':
1130 row = self.layout.row()
1131 row.prop(part.effector_weights, "apply_to_hair_growing")
1132 row.prop(part, "apply_effector_to_children")
1133 row = self.layout.row()
1134 row.prop(part, "effect_hair", slider=True)
1137 class PARTICLE_PT_force_fields(ParticleButtonsPanel, Panel):
1138 bl_label = "Force Field Settings"
1139 bl_options = {'DEFAULT_CLOSED'}
1140 COMPAT_ENGINES = {'BLENDER_RENDER'}
1142 def draw(self, context):
1143 layout = self.layout
1145 part = particle_get_settings(context)
1148 row.prop(part, "use_self_effect")
1149 row.prop(part, "effector_amount", text="Amount")
1151 split = layout.split(percentage=0.2)
1152 split.label(text="Type 1:")
1153 split.prop(part.force_field_1, "type", text="")
1154 basic_force_field_settings_ui(self, context, part.force_field_1)
1155 if part.force_field_1.type != 'NONE':
1156 layout.label(text="Falloff:")
1157 basic_force_field_falloff_ui(self, context, part.force_field_1)
1159 if part.force_field_1.type != 'NONE':
1160 layout.label(text="")
1162 split = layout.split(percentage=0.2)
1163 split.label(text="Type 2:")
1164 split.prop(part.force_field_2, "type", text="")
1165 basic_force_field_settings_ui(self, context, part.force_field_2)
1166 if part.force_field_2.type != 'NONE':
1167 layout.label(text="Falloff:")
1168 basic_force_field_falloff_ui(self, context, part.force_field_2)
1171 class PARTICLE_PT_vertexgroups(ParticleButtonsPanel, Panel):
1172 bl_label = "Vertex Groups"
1173 bl_options = {'DEFAULT_CLOSED'}
1174 COMPAT_ENGINES = {'BLENDER_RENDER'}
1177 def poll(cls, context):
1178 if context.particle_system is None:
1180 return particle_panel_poll(cls, context)
1182 def draw(self, context):
1183 layout = self.layout
1186 psys = context.particle_system
1188 split = layout.split(percentage=0.85)
1190 col = split.column()
1191 col.label(text="Vertex Group:")
1192 col.prop_search(psys, "vertex_group_density", ob, "vertex_groups", text="Density")
1193 col.prop_search(psys, "vertex_group_length", ob, "vertex_groups", text="Length")
1194 col.prop_search(psys, "vertex_group_clump", ob, "vertex_groups", text="Clump")
1195 col.prop_search(psys, "vertex_group_kink", ob, "vertex_groups", text="Kink")
1196 col.prop_search(psys, "vertex_group_roughness_1", ob, "vertex_groups", text="Roughness 1")
1197 col.prop_search(psys, "vertex_group_roughness_2", ob, "vertex_groups", text="Roughness 2")
1198 col.prop_search(psys, "vertex_group_roughness_end", ob, "vertex_groups", text="Roughness End")
1200 col = split.column()
1201 col.label(text="Negate:")
1202 col.alignment = 'RIGHT'
1203 col.prop(psys, "invert_vertex_group_density", text="")
1204 col.prop(psys, "invert_vertex_group_length", text="")
1205 col.prop(psys, "invert_vertex_group_clump", text="")
1206 col.prop(psys, "invert_vertex_group_kink", text="")
1207 col.prop(psys, "invert_vertex_group_roughness_1", text="")
1208 col.prop(psys, "invert_vertex_group_roughness_2", text="")
1209 col.prop(psys, "invert_vertex_group_roughness_end", text="")
1211 # Commented out vertex groups don't work and are still waiting for better implementation
1212 # row = layout.row()
1213 # row.prop_search(psys, "vertex_group_velocity", ob, "vertex_groups", text="Velocity")
1214 # row.prop(psys, "invert_vertex_group_velocity", text="")
1216 # row = layout.row()
1217 # row.prop_search(psys, "vertex_group_size", ob, "vertex_groups", text="Size")
1218 # row.prop(psys, "invert_vertex_group_size", text="")
1220 # row = layout.row()
1221 # row.prop_search(psys, "vertex_group_tangent", ob, "vertex_groups", text="Tangent")
1222 # row.prop(psys, "invert_vertex_group_tangent", text="")
1224 # row = layout.row()
1225 # row.prop_search(psys, "vertex_group_rotation", ob, "vertex_groups", text="Rotation")
1226 # row.prop(psys, "invert_vertex_group_rotation", text="")
1228 # row = layout.row()
1229 # row.prop_search(psys, "vertex_group_field", ob, "vertex_groups", text="Field")
1230 # row.prop(psys, "invert_vertex_group_field", text="")
1233 class PARTICLE_PT_custom_props(ParticleButtonsPanel, PropertyPanel, Panel):
1234 COMPAT_ENGINES = {'BLENDER_RENDER'}
1235 _context_path = "particle_system.settings"
1236 _property_type = bpy.types.ParticleSettings
1238 if __name__ == "__main__": # only for live edit.
1239 bpy.utils.register_module(__name__)