Improving warnings when keyframing fails for IKEY over a button
authorJoshua Leung <aligorith@gmail.com>
Fri, 8 Mar 2013 02:15:08 +0000 (02:15 +0000)
committerJoshua Leung <aligorith@gmail.com>
Fri, 8 Mar 2013 02:15:08 +0000 (02:15 +0000)
Now, instead of silently failing, an error message saying that the property
cannot be animated is displayed

source/blender/editors/animation/keyframing.c
source/blender/editors/animation/keyingsets.c

index 532c711..45082e4 100644 (file)
@@ -1623,17 +1623,21 @@ static int insert_key_button_exec(bContext *C, wmOperator *op)
                        success += insert_keyframe_direct(op->reports, ptr, prop, fcu, cfra, 0);
                }
                else {
-                       if (G.debug & G_DEBUG)
-                               printf("Button Insert-Key: no path to property\n");
-                       BKE_report(op->reports, RPT_WARNING, "Failed to resolve path to property, try using a keying set instead");
+                       BKE_report(op->reports, RPT_WARNING, 
+                                  "Failed to resolve path to property, try manually specifying this using a Keying Set instead");
                }
        }
-       else if (G.debug & G_DEBUG) {
-               printf("ptr.data = %p, prop = %p,", (void *)ptr.data, (void *)prop);
-               if (prop)
-                       printf("animatable = %d\n", RNA_property_animateable(&ptr, prop));
-               else
-                       printf("animatable = NULL\n");
+       else {
+               if (prop && !RNA_property_animateable(&ptr, prop)) {
+                       BKE_reportf(op->reports, RPT_WARNING, 
+                                  "\"%s\" property cannot be animated",
+                                  RNA_property_identifier(prop));
+               }
+               else {
+                       BKE_reportf(op->reports, RPT_WARNING,
+                                   "Button doesn't appear to have any property information attached (ptr.data = %p, prop = %p)",
+                                               (void *)ptr.data, (void *)prop);
+               }
        }
        
        if (success) {
index 4e8d7bd..24b1ade 100644 (file)
@@ -879,7 +879,7 @@ short ANIM_validate_keyingset(bContext *C, ListBase *dsources, KeyingSet *ks)
                if (ksi == NULL)
                        return MODIFYKEY_MISSING_TYPEINFO;
                /* TODO: check for missing callbacks! */
-
+               
                /* check if it can be used in the current context */
                if (ksi->poll(ksi, C)) {
                        /* if a list of data sources are provided, run a special iterator over them,