Bugfix: Autokeying was non-functional after the Keying Sets refactor
authorJoshua Leung <aligorith@gmail.com>
Thu, 18 Mar 2010 07:53:46 +0000 (07:53 +0000)
committerJoshua Leung <aligorith@gmail.com>
Thu, 18 Mar 2010 07:53:46 +0000 (07:53 +0000)
- The RNA wrapping for the generate callback was still wrong, with the primary effect being that C-code calling this had unexpected consequences that were hard to debug.
- Fixed some defective checks that meant that when specifying the RNA-pointers for the Keying Set to use (rather than using the Keying Set's own iterator callback) would never add any info.

source/blender/editors/animation/keyingsets.c
source/blender/makesrna/intern/rna_animation.c

index b1f1cbbea1eeb474387348176ed6c8ecf85940bc..a93220aeb67c9b3bff0e207fbabbb0d0f13ec195 100644 (file)
@@ -662,11 +662,14 @@ void ANIM_relative_keyingset_add_source (ListBase *dsources, ID *id, StructRNA *
        tRKS_DSource *ds;
        
        /* sanity checks 
-        *      we must have at least one valid data pointer to use 
+        *      - we must have somewhere to output the data
+        *      - we must have both srna+data (and with id too optionally), or id by itself only
         */
-       if (ELEM(NULL, dsources, srna) || ((id == data) && (id == NULL)))
+       if (dsources == NULL)
                return;
-
+       if (ELEM(NULL, srna, data) && (id == NULL))
+               return;
+       
        /* allocate new elem, and add to the list */
        ds = MEM_callocN(sizeof(tRKS_DSource), "tRKS_DSource");
        BLI_addtail(dsources, ds);
index 27f0dc5eafbb354b08ab8a6d42f8e12fbdd473d5..ebb251c32ca060defcbd766c25b9ef297dd1a696 100644 (file)
@@ -131,7 +131,7 @@ static void RKS_GEN_rna_internal(KeyingSetInfo *ksi, bContext *C, KeyingSet *ks,
                RNA_parameter_set_lookup(&list, "ksi", &ksi);
                RNA_parameter_set_lookup(&list, "context", &C);
                RNA_parameter_set_lookup(&list, "ks", &ks);
-               RNA_parameter_set_lookup(&list, "data", &data);
+               RNA_parameter_set_lookup(&list, "data", data);
                
                /* execute the function */
                ksi->ext.call(&ptr, func, &list);
@@ -404,7 +404,7 @@ static void rna_def_keyingset_info(BlenderRNA *brna)
        RNA_def_property_flag(parm, PROP_REQUIRED);
        parm= RNA_def_pointer(func, "ks", "KeyingSet", "", "");
        RNA_def_property_flag(parm, PROP_REQUIRED);
-       parm= RNA_def_pointer(func, "data", NULL, "", ""); // "AnyType"...
+       parm= RNA_def_pointer(func, "data", "AnyType", "", ""); 
        RNA_def_property_flag(parm, PROP_REQUIRED|PROP_RNAPTR|PROP_NEVER_NULL);
 }