Changeset View
Changeset View
Standalone View
Standalone View
release/scripts/startup/bl_ui/properties_particle.py
| Show All 12 Lines | |||||
| # You should have received a copy of the GNU General Public License | # You should have received a copy of the GNU General Public License | ||||
| # along with this program; if not, write to the Free Software Foundation, | # along with this program; if not, write to the Free Software Foundation, | ||||
| # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||||
| # | # | ||||
| # ##### END GPL LICENSE BLOCK ##### | # ##### END GPL LICENSE BLOCK ##### | ||||
| # <pep8 compliant> | # <pep8 compliant> | ||||
| import bpy | import bpy | ||||
| from bpy.types import Panel | from bpy.types import Panel, UIList | ||||
| from rna_prop_ui import PropertyPanel | from rna_prop_ui import PropertyPanel | ||||
| from bpy.app.translations import pgettext_iface as iface_ | from bpy.app.translations import pgettext_iface as iface_ | ||||
| from bl_ui.properties_physics_common import (point_cache_ui, | from bl_ui.properties_physics_common import (point_cache_ui, | ||||
| effector_weights_ui, | effector_weights_ui, | ||||
| basic_force_field_settings_ui, | basic_force_field_settings_ui, | ||||
| basic_force_field_falloff_ui, | basic_force_field_falloff_ui, | ||||
| ) | ) | ||||
| class PARTICLE_UL_particle_systems(UIList): | |||||
| @staticmethod | |||||
| def particle_system_icon(psys): | |||||
| return bpy.types.ParticleSettings.bl_rna.properties['type'].enum_items[psys.settings.type].icon | |||||
| def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index, flt_flag): | |||||
| if self.layout_type in {'DEFAULT', 'COMPACT'}: | |||||
| layout.label(item.name, icon=self.particle_system_icon(item)) | |||||
| elif self.layout_type in {'GRID'}: | |||||
| layout.label("", icon=self.particle_system_icon(item)) | |||||
| def particle_panel_enabled(context, psys): | def particle_panel_enabled(context, psys): | ||||
| if psys is None: | if psys is None: | ||||
| return True | return True | ||||
| phystype = psys.settings.physics_type | phystype = psys.settings.physics_type | ||||
| if psys.settings.type in {'EMITTER', 'REACTOR'} and phystype in {'NO', 'KEYED'}: | if psys.settings.type in {'EMITTER', 'REACTOR'} and phystype in {'NO', 'KEYED'}: | ||||
| return True | return True | ||||
| else: | else: | ||||
| return (psys.point_cache.is_baked is False) and (not psys.is_edited) and (not context.particle_system_editable) | return (psys.point_cache.is_baked is False) and (not psys.is_edited) and (not context.particle_system_editable) | ||||
| ▲ Show 20 Lines • Show All 52 Lines • ▼ Show 20 Lines | def draw(self, context): | ||||
| ob = context.object | ob = context.object | ||||
| psys = context.particle_system | psys = context.particle_system | ||||
| part = 0 | part = 0 | ||||
| if ob: | if ob: | ||||
| row = layout.row() | 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) | ob.particle_systems, "active_index", rows=1) | ||||
| col = row.column(align=True) | col = row.column(align=True) | ||||
| col.operator("object.particle_system_add", icon='ZOOMIN', text="") | col.operator("object.particle_system_add", icon='ZOOMIN', text="") | ||||
| col.operator("object.particle_system_remove", icon='ZOOMOUT', text="") | col.operator("object.particle_system_remove", icon='ZOOMOUT', text="") | ||||
| if psys is None: | if psys is None: | ||||
| part = particle_get_settings(context) | part = particle_get_settings(context) | ||||
| Show All 35 Lines | def draw(self, context): | ||||
| row.template_ID(psys, "settings", new="particle.new") | row.template_ID(psys, "settings", new="particle.new") | ||||
| if part.is_fluid: | if part.is_fluid: | ||||
| layout.label(text=iface_("%d fluid particles for this frame") % part.count, translate=False) | layout.label(text=iface_("%d fluid particles for this frame") % part.count, translate=False) | ||||
| return | return | ||||
| row = col.row() | row = col.row() | ||||
| row.enabled = particle_panel_enabled(context, psys) | row.enabled = particle_panel_enabled(context, psys) | ||||
| row.prop(part, "type", text="") | |||||
| row.prop(psys, "seed") | row.prop(psys, "seed") | ||||
| if part: | if part: | ||||
| split = layout.split(percentage=0.65) | split = layout.split(percentage=0.65) | ||||
| if part.type == 'HAIR': | if part.type == 'HAIR': | ||||
| if psys is not None and psys.is_edited: | if psys is not None and psys.is_edited: | ||||
| split.operator("particle.edited_clear", text="Free Edit") | split.operator("particle.edited_clear", text="Free Edit") | ||||
| else: | else: | ||||
| ▲ Show 20 Lines • Show All 1,111 Lines • Show Last 20 Lines | |||||