From 42a45649bd550c0e568d26ef843fca385abf37ad Mon Sep 17 00:00:00 2001
From: Daniel Salazar <zanqdo@gmail.com>
Date: Thu, 27 Jan 2011 01:07:04 +0000
Subject: [PATCH] AnimAll: check if there is an active shapekey when inserting
 a SK keyframe

---
 animation_animall.py | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/animation_animall.py b/animation_animall.py
index 9ecbf2c19..64b0f4507 100644
--- a/animation_animall.py
+++ b/animation_animall.py
@@ -136,8 +136,9 @@ class ANIM_OT_insert_keyframe_animall(bpy.types.Operator):
             Data = Obj.data
             
             if context.window_manager.key_shape:
-                for Point in Obj.active_shape_key.data:
-                    Point.keyframe_insert('co')
+                if Obj.active_shape_key:
+                    for Point in Obj.active_shape_key.data:
+                        Point.keyframe_insert('co')
             
             if context.window_manager.key_vgroups:
                 for Vert in Data.vertices:
@@ -164,8 +165,9 @@ class ANIM_OT_insert_keyframe_animall(bpy.types.Operator):
         
         if Obj.type == 'LATTICE':
             if context.window_manager.key_shape:
-                for Point in Obj.active_shape_key.data:
-                    Point.keyframe_insert('co')
+                if Obj.active_shape_key:
+                    for Point in Obj.active_shape_key.data:
+                        Point.keyframe_insert('co')
 
 
         return {'FINISHED'}
@@ -199,8 +201,9 @@ class ANIM_OT_delete_keyframe_animall(bpy.types.Operator):
             Data = Obj.data
             
             if context.window_manager.key_shape:
-                for Point in Obj.active_shape_key.data:
-                    Point.keyframe_delete('co')
+                if Obj.active_shape_key:
+                    for Point in Obj.active_shape_key.data:
+                        Point.keyframe_delete('co')
             
             if context.window_manager.key_vgroups:
                 for Vert in Data.vertices:
@@ -228,8 +231,9 @@ class ANIM_OT_delete_keyframe_animall(bpy.types.Operator):
 
         if Obj.type == 'LATTICE':
             if context.window_manager.key_shape:
-                for Point in Obj.active_shape_key.data:
-                    Point.keyframe_delete('co')
+                if Obj.active_shape_key:
+                    for Point in Obj.active_shape_key.data:
+                        Point.keyframe_delete('co')
 
         return {'FINISHED'}
 
-- 
GitLab