[Bf-extensions-cvs] [e44bdaa] master: Update to enum's `items` callback functions, `context` may be None.

Bastien Montagne noreply at git.blender.org
Mon May 25 14:31:14 CEST 2015


Commit: e44bdaac62d3c597b2bab418c34935de78fb4879
Author: Bastien Montagne
Date:   Mon May 25 14:30:05 2015 +0200
Branches: master
https://developer.blender.org/rBACe44bdaac62d3c597b2bab418c34935de78fb4879

Update to enum's `items` callback functions, `context` may be None.

See rBa80c1e50bc7f57bc for details.

===================================================================

M	mesh_extrude_along_curve.py
M	mesh_show_vgroup_weights.py
M	space_view3d_enhanced_3d_cursor.py

===================================================================

diff --git a/mesh_extrude_along_curve.py b/mesh_extrude_along_curve.py
index 2304ae0..f86d680 100644
--- a/mesh_extrude_along_curve.py
+++ b/mesh_extrude_along_curve.py
@@ -76,6 +76,8 @@ def eval_bez(mat, points, t):
 
 
 def curve_ob_enum(self, context):
+    if context is None:
+        return []
     obs = context.scene.objects
     cuobs = [(str(i), ob.name, ob.name) for i, ob in enumerate(obs) if ob.type == 'CURVE']
     curve_ob_enum.temp = cuobs
diff --git a/mesh_show_vgroup_weights.py b/mesh_show_vgroup_weights.py
index a865dcf..f4514b3 100644
--- a/mesh_show_vgroup_weights.py
+++ b/mesh_show_vgroup_weights.py
@@ -293,6 +293,8 @@ class AddToVertexGroup(bpy.types.Operator):
     bl_description = "Add a specific vertex to a specific vertex group"
 
     def avail_vgroups(self, context):
+        if context is None:
+            return []
         ob = context.active_object
         bm = bmesh.from_edit_mesh(ob.data)
         dvert_lay = bm.verts.layers.deform.active
diff --git a/space_view3d_enhanced_3d_cursor.py b/space_view3d_enhanced_3d_cursor.py
index f559008..faebc4a 100644
--- a/space_view3d_enhanced_3d_cursor.py
+++ b/space_view3d_enhanced_3d_cursor.py
@@ -4330,9 +4330,10 @@ class AlignOrientationProperties(bpy.types.PropertyGroup):
         orients.append(('NORMAL', "Normal", ""))
         orients.append(('VIEW', "View", ""))
 
-        for orientation in context.scene.orientations:
-            name = orientation.name
-            orients.append((name, name, ""))
+        if context is not None:
+            for orientation in context.scene.orientations:
+                name = orientation.name
+                orients.append((name, name, ""))
 
         return orients
 
@@ -4378,9 +4379,10 @@ class AlignOrientation(bpy.types.Operator):
         orients.append(('NORMAL', "Normal", ""))
         orients.append(('VIEW', "View", ""))
 
-        for orientation in context.scene.orientations:
-            name = orientation.name
-            orients.append((name, name, ""))
+        if context is not None:
+            for orientation in context.scene.orientations:
+                name = orientation.name
+                orients.append((name, name, ""))
 
         return orients



More information about the Bf-extensions-cvs mailing list