diff options
Diffstat (limited to 'release/scripts/ui/properties_particle.py')
-rw-r--r-- | release/scripts/ui/properties_particle.py | 77 |
1 files changed, 52 insertions, 25 deletions
diff --git a/release/scripts/ui/properties_particle.py b/release/scripts/ui/properties_particle.py index ed516b49dea..e135b12b844 100644 --- a/release/scripts/ui/properties_particle.py +++ b/release/scripts/ui/properties_particle.py @@ -32,14 +32,14 @@ def particle_panel_enabled(context, psys): return (psys.point_cache.baked is False) and (not psys.edited) and (not context.particle_system_editable) -def particle_panel_poll(panel, context): +def particle_panel_poll(cls, context): psys = context.particle_system engine = context.scene.render.engine if psys is None: return False if psys.settings is None: return False - return psys.settings.type in ('EMITTER', 'REACTOR', 'HAIR') and (engine in panel.COMPAT_ENGINES) + return psys.settings.type in ('EMITTER', 'REACTOR', 'HAIR') and (engine in cls.COMPAT_ENGINES) class ParticleButtonsPanel(): @@ -47,18 +47,16 @@ class ParticleButtonsPanel(): bl_region_type = 'WINDOW' bl_context = "particle" - def poll(self, context): - return particle_panel_poll(self, context) - class PARTICLE_PT_context_particles(ParticleButtonsPanel, bpy.types.Panel): bl_label = "" bl_show_header = False COMPAT_ENGINES = {'BLENDER_RENDER'} - def poll(self, context): + @staticmethod + def poll(context): engine = context.scene.render.engine - return (context.particle_system or context.object) and (engine in self.COMPAT_ENGINES) + return (context.particle_system or context.object) and (engine in __class__.COMPAT_ENGINES) def draw(self, context): layout = self.layout @@ -140,13 +138,18 @@ class PARTICLE_PT_custom_props(ParticleButtonsPanel, PropertyPanel, bpy.types.Pa COMPAT_ENGINES = {'BLENDER_RENDER'} _context_path = "particle_system.settings" + @staticmethod + def poll(context): + return particle_panel_poll(__class__, context) + class PARTICLE_PT_emission(ParticleButtonsPanel, bpy.types.Panel): bl_label = "Emission" COMPAT_ENGINES = {'BLENDER_RENDER'} - def poll(self, context): - if particle_panel_poll(self, context): + @staticmethod + def poll(context): + if particle_panel_poll(PARTICLE_PT_emission, context): return not context.particle_system.point_cache.external else: return False @@ -208,14 +211,15 @@ class PARTICLE_PT_hair_dynamics(ParticleButtonsPanel, bpy.types.Panel): bl_default_closed = True COMPAT_ENGINES = {'BLENDER_RENDER'} - def poll(self, context): + @staticmethod + def poll(context): psys = context.particle_system engine = context.scene.render.engine if psys is None: return False if psys.settings is None: return False - return psys.settings.type == 'HAIR' and (engine in self.COMPAT_ENGINES) + return psys.settings.type == 'HAIR' and (engine in __class__.COMPAT_ENGINES) def draw_header(self, context): #cloth = context.cloth.collision_settings @@ -265,7 +269,8 @@ class PARTICLE_PT_cache(ParticleButtonsPanel, bpy.types.Panel): bl_default_closed = True COMPAT_ENGINES = {'BLENDER_RENDER'} - def poll(self, context): + @staticmethod + def poll(context): psys = context.particle_system engine = context.scene.render.engine if psys is None: @@ -275,7 +280,7 @@ class PARTICLE_PT_cache(ParticleButtonsPanel, bpy.types.Panel): phystype = psys.settings.physics_type if phystype == 'NO' or phystype == 'KEYED': return False - return (psys.settings.type in ('EMITTER', 'REACTOR') or (psys.settings.type == 'HAIR' and psys.hair_dynamics)) and engine in self.COMPAT_ENGINES + return (psys.settings.type in ('EMITTER', 'REACTOR') or (psys.settings.type == 'HAIR' and psys.hair_dynamics)) and engine in __class__.COMPAT_ENGINES def draw(self, context): psys = context.particle_system @@ -287,8 +292,9 @@ class PARTICLE_PT_velocity(ParticleButtonsPanel, bpy.types.Panel): bl_label = "Velocity" COMPAT_ENGINES = {'BLENDER_RENDER'} - def poll(self, context): - if particle_panel_poll(self, context): + @staticmethod + def poll(context): + if particle_panel_poll(PARTICLE_PT_velocity, context): psys = context.particle_system return psys.settings.physics_type != 'BOIDS' and not psys.point_cache.external else: @@ -334,8 +340,9 @@ class PARTICLE_PT_rotation(ParticleButtonsPanel, bpy.types.Panel): bl_label = "Rotation" COMPAT_ENGINES = {'BLENDER_RENDER'} - def poll(self, context): - if particle_panel_poll(self, context): + @staticmethod + def poll(context): + if particle_panel_poll(PARTICLE_PT_rotation, context): psys = context.particle_system return psys.settings.physics_type != 'BOIDS' and not psys.point_cache.external else: @@ -380,8 +387,9 @@ class PARTICLE_PT_physics(ParticleButtonsPanel, bpy.types.Panel): bl_label = "Physics" COMPAT_ENGINES = {'BLENDER_RENDER'} - def poll(self, context): - if particle_panel_poll(self, context): + @staticmethod + def poll(context): + if particle_panel_poll(PARTICLE_PT_physics, context): return not context.particle_system.point_cache.external else: return False @@ -577,7 +585,8 @@ class PARTICLE_PT_boidbrain(ParticleButtonsPanel, bpy.types.Panel): bl_label = "Boid Brain" COMPAT_ENGINES = {'BLENDER_RENDER'} - def poll(self, context): + @staticmethod + def poll(context): psys = context.particle_system engine = context.scene.render.engine if psys is None: @@ -586,7 +595,7 @@ class PARTICLE_PT_boidbrain(ParticleButtonsPanel, bpy.types.Panel): return False if psys.point_cache.external: return False - return psys.settings.physics_type == 'BOIDS' and engine in self.COMPAT_ENGINES + return psys.settings.physics_type == 'BOIDS' and engine in __class__.COMPAT_ENGINES def draw(self, context): layout = self.layout @@ -677,14 +686,15 @@ class PARTICLE_PT_render(ParticleButtonsPanel, bpy.types.Panel): bl_label = "Render" COMPAT_ENGINES = {'BLENDER_RENDER'} - def poll(self, context): + @staticmethod + def poll(context): psys = context.particle_system engine = context.scene.render.engine if psys is None: return False if psys.settings is None: return False - return engine in self.COMPAT_ENGINES + return engine in __class__.COMPAT_ENGINES def draw(self, context): layout = self.layout @@ -848,14 +858,15 @@ class PARTICLE_PT_draw(ParticleButtonsPanel, bpy.types.Panel): bl_default_closed = True COMPAT_ENGINES = {'BLENDER_RENDER'} - def poll(self, context): + @staticmethod + def poll(context): psys = context.particle_system engine = context.scene.render.engine if psys is None: return False if psys.settings is None: return False - return engine in self.COMPAT_ENGINES + return engine in __class__.COMPAT_ENGINES def draw(self, context): layout = self.layout @@ -907,6 +918,10 @@ class PARTICLE_PT_children(ParticleButtonsPanel, bpy.types.Panel): bl_default_closed = True COMPAT_ENGINES = {'BLENDER_RENDER'} + @staticmethod + def poll(context): + return particle_panel_poll(__class__, context) + def draw(self, context): layout = self.layout @@ -992,6 +1007,10 @@ class PARTICLE_PT_field_weights(ParticleButtonsPanel, bpy.types.Panel): bl_default_closed = True COMPAT_ENGINES = {'BLENDER_RENDER'} + @staticmethod + def poll(context): + return particle_panel_poll(__class__, context) + def draw(self, context): part = context.particle_system.settings effector_weights_ui(self, context, part.effector_weights) @@ -1005,6 +1024,10 @@ class PARTICLE_PT_force_fields(ParticleButtonsPanel, bpy.types.Panel): bl_default_closed = True COMPAT_ENGINES = {'BLENDER_RENDER'} + @staticmethod + def poll(context): + return particle_panel_poll(__class__, context) + def draw(self, context): layout = self.layout @@ -1033,6 +1056,10 @@ class PARTICLE_PT_vertexgroups(ParticleButtonsPanel, bpy.types.Panel): bl_default_closed = True COMPAT_ENGINES = {'BLENDER_RENDER'} + @staticmethod + def poll(context): + return particle_panel_poll(__class__, context) + def draw(self, context): layout = self.layout |