* Enabled rna access to fluid sim velocity vectors
[blender-staging.git] / release / scripts / startup / keyingsets_builtins.py
index cefc5cf38ed52771ba12d65bec465b701c993bdf..8cb63ea48cffb2fbf41c9d0c2fdef5788ec298bd 100644 (file)
@@ -215,10 +215,14 @@ class BUILTIN_KSI_VisualLocRot(bpy.types.KeyingSetInfo):
 class BUILTIN_KSI_Available(bpy.types.KeyingSetInfo):
     bl_label = "Available"
 
-    # poll - use predefined callback for selected objects
-    # TODO: this should really check whether the selected object (or datablock)
-    #         has any animation data defined yet
-    poll = keyingsets_utils.RKS_POLL_selected_objects
+    # poll - selected objects or selected object with animation data
+    def poll(ksi, context):
+        ob = context.active_object
+        if ob:
+            # TODO: this fails if one animation-less object is active, but many others are selected
+            return ob.animation_data and ob.animation_data.action
+        else:
+            return bool(context.selected_objects)
 
     # iterator - use callback for selected bones/objects
     iterator = keyingsets_utils.RKS_ITER_selected_item
@@ -359,10 +363,11 @@ class BUILTIN_KSI_WholeCharacter(bpy.types.KeyingSetInfo):
 
 ###############################
 
+
 # Delta Location
 class BUILTIN_KSI_DeltaLocation(bpy.types.KeyingSetInfo):
     bl_label = "Delta Location"
-    
+
     # poll - selected objects only (and only if active object in object mode)
     poll = keyingsets_utils.RKS_POLL_selected_objects
 
@@ -387,7 +392,7 @@ class BUILTIN_KSI_DeltaLocation(bpy.types.KeyingSetInfo):
 # Delta Rotation
 class BUILTIN_KSI_DeltaRotation(bpy.types.KeyingSetInfo):
     bl_label = "Delta Rotation"
-    
+
     # poll - selected objects only (and only if active object in object mode)
     poll = keyingsets_utils.RKS_POLL_selected_objects
 
@@ -406,7 +411,7 @@ class BUILTIN_KSI_DeltaRotation(bpy.types.KeyingSetInfo):
         elif data.rotation_mode == 'AXIS_ANGLE':
             # XXX: for now, this is not available yet
             #path = path_add_property(base_path, "delta_rotation_axis_angle")
-            return;
+            return
         else:
             path = keyingsets_utils.path_add_property(base_path, "delta_rotation_euler")
 
@@ -415,12 +420,12 @@ class BUILTIN_KSI_DeltaRotation(bpy.types.KeyingSetInfo):
             ks.paths.add(id_block, path, group_method='NAMED', group_name=grouping)
         else:
             ks.paths.add(id_block, path)
-    
+
 
 # Delta Scale
 class BUILTIN_KSI_DeltaScale(bpy.types.KeyingSetInfo):
     bl_label = "Delta Scale"
-    
+
     # poll - selected objects only (and only if active object in object mode)
     poll = keyingsets_utils.RKS_POLL_selected_objects