[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [20676] branches/blender2.5/blender/ release/ui/buttons_particle.py: particle buttons gave errors when there was no particle system on an object .
Campbell Barton
ideasman42 at gmail.com
Sat Jun 6 14:49:41 CEST 2009
Revision: 20676
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=20676
Author: campbellbarton
Date: 2009-06-06 14:48:56 +0200 (Sat, 06 Jun 2009)
Log Message:
-----------
particle buttons gave errors when there was no particle system on an object.
Modified Paths:
--------------
branches/blender2.5/blender/release/ui/buttons_particle.py
Modified: branches/blender2.5/blender/release/ui/buttons_particle.py
===================================================================
--- branches/blender2.5/blender/release/ui/buttons_particle.py 2009-06-06 11:56:59 UTC (rev 20675)
+++ branches/blender2.5/blender/release/ui/buttons_particle.py 2009-06-06 12:48:56 UTC (rev 20676)
@@ -6,8 +6,8 @@
def particle_panel_poll(context):
psys = context.particle_system
- type = psys.settings.type
- return psys != None and (type=='EMITTER' or type=='REACTOR'or type=='HAIR')
+ if psys==None: return False
+ return psys.settings.type in ('EMITTER', 'REACTOR', 'HAIR')
class ParticleButtonsPanel(bpy.types.Panel):
__space_type__ = "BUTTONS_WINDOW"
@@ -15,9 +15,7 @@
__context__ = "particle"
def poll(self, context):
- psys = context.particle_system
- type = psys.settings.type
- return psys != None and (type=='EMITTER' or type=='REACTOR'or type=='HAIR')
+ return particle_panel_poll(context)
class PARTICLE_PT_particles(ParticleButtonsPanel):
__idname__= "PARTICLE_PT_particles"
@@ -37,9 +35,9 @@
#row.itemL(text="Viewport")
#row.itemL(text="Render")
- type = psys.settings.type
+ ptype = psys.settings.type
- if(type!='EMITTER' and type!='REACTOR' and type!='HAIR'):
+ if ptype not in ('EMITTER', 'REACTOR', 'HAIR'):
layout.itemL(text="No settings for fluid particles")
return
@@ -94,8 +92,8 @@
def poll(self, context):
psys = context.particle_system
- type = psys.settings.type
- return psys != None and (type=='EMITTER' or type== 'REACTOR')
+ if psys==None: return False
+ return psys.settings.type in ('EMITTER', 'REACTOR')
def draw(self, context):
layout = self.layout
More information about the Bf-blender-cvs
mailing list