diff options
author | Lukas Tönne <lukas.toenne@gmail.com> | 2015-01-16 19:06:17 +0300 |
---|---|---|
committer | Lukas Tönne <lukas.toenne@gmail.com> | 2015-01-16 19:08:07 +0300 |
commit | 913e2bae19f8fbbfbc85eb11521fe77c1e298f64 (patch) | |
tree | 197be5c37c29322b1846e2f95ab97ef513162e95 | |
parent | 5685c43586b900ed561eac3e5762a7d68b304447 (diff) |
Show buttons for particle system modifiers render/viewport toggles
in the particle buttons list.
This is much more convenient than having to switch back and forth
between particle and modifier buttons. The modifier box for particles
does not contain anything useful other than these two toggles anyway.
-rw-r--r-- | release/scripts/startup/bl_ui/properties_particle.py | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/release/scripts/startup/bl_ui/properties_particle.py b/release/scripts/startup/bl_ui/properties_particle.py index 30fc3a9e373..d0b079cbf0d 100644 --- a/release/scripts/startup/bl_ui/properties_particle.py +++ b/release/scripts/startup/bl_ui/properties_particle.py @@ -73,6 +73,30 @@ class ParticleButtonsPanel(): return particle_panel_poll(cls, context) +def find_modifier(ob, psys): + for md in ob.modifiers: + if md.type == 'PARTICLE_SYSTEM': + if md.particle_system == psys: + return md + +class PARTICLE_UL_particle_systems(bpy.types.UIList): + def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index, flt_flag): + ob = data + psys = item + + if self.layout_type in {'DEFAULT', 'COMPACT'}: + md = find_modifier(ob, psys) + + layout.prop(psys, "name", text="", emboss=False, icon_value=icon) + if md: + layout.prop(md, "show_render", emboss=False, icon_only=True, icon='RESTRICT_RENDER_OFF' if md.show_render else 'RESTRICT_RENDER_ON') + layout.prop(md, "show_viewport", emboss=False, icon_only=True, icon='RESTRICT_VIEW_OFF' if md.show_viewport else 'RESTRICT_VIEW_ON') + + elif self.layout_type in {'GRID'}: + layout.alignment = 'CENTER' + layout.label(text="", icon_value=icon) + + class PARTICLE_PT_context_particles(ParticleButtonsPanel, Panel): bl_label = "" bl_options = {'HIDE_HEADER'} @@ -97,7 +121,7 @@ class PARTICLE_PT_context_particles(ParticleButtonsPanel, Panel): if ob: row = layout.row() - row.template_list("UI_UL_list", "particle_systems", ob, "particle_systems", + row.template_list("PARTICLE_UL_particle_systems", "particle_systems", ob, "particle_systems", ob.particle_systems, "active_index", rows=1) col = row.column(align=True) |