Revision: 27715
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=27715
Author:   aligorith
Date:     2010-03-24 13:48:03 +0100 (Wed, 24 Mar 2010)

Log Message:
-----------
Keying Sets - PyAPI consistency issues:
* Added 'id_name' property, which is used as the "typeinfo_name" by Keying Set 
instances. This is simply the name of the relevant KeyingSetInfo classes.

* Renamed the 'array_index' arg for ks.add_path() to 'index'. Also removed the 
'entire array' toggle arg in favour of just passing -1 to index. However, 
Keying Sets in general still maintain their 'entire array' toggle flags for 
now, it's just that the API function does conversion between the two. 

Modified Paths:
--------------
    trunk/blender/release/scripts/keyingsets/keyingsets_utils.py
    trunk/blender/source/blender/editors/animation/keyingsets.c
    trunk/blender/source/blender/editors/include/ED_keyframing.h
    trunk/blender/source/blender/makesrna/intern/rna_animation.c
    trunk/blender/source/blender/makesrna/intern/rna_animation_api.c

Modified: trunk/blender/release/scripts/keyingsets/keyingsets_utils.py
===================================================================
--- trunk/blender/release/scripts/keyingsets/keyingsets_utils.py        
2010-03-24 12:39:51 UTC (rev 27714)
+++ trunk/blender/release/scripts/keyingsets/keyingsets_utils.py        
2010-03-24 12:48:03 UTC (rev 27715)
@@ -70,7 +70,7 @@
     # for each F-Curve, include an path to key it
     # NOTE: we don't need to set the group settings here
     for fcu in adt.action.fcurves:
-        ks.add_path(id_block, fcu.rna_path, array_index=fcu.array_index, 
entire_array=False)
+        ks.add_path(id_block, fcu.rna_path, index=fcu.array_index)
     
 # ------
 

Modified: trunk/blender/source/blender/editors/animation/keyingsets.c
===================================================================
--- trunk/blender/source/blender/editors/animation/keyingsets.c 2010-03-24 
12:39:51 UTC (rev 27714)
+++ trunk/blender/source/blender/editors/animation/keyingsets.c 2010-03-24 
12:48:03 UTC (rev 27715)
@@ -471,7 +471,7 @@
                
        /* search by comparing names */
        for (ksi = keyingset_type_infos.first; ksi; ksi = ksi->next) {
-               if (strcmp(ksi->name, name) == 0)
+               if (strcmp(ksi->idname, name) == 0)
                        return ksi;
        }
        
@@ -517,7 +517,7 @@
        ks = BKE_keyingset_add(&builtin_keyingsets, ksi->name, 1, 
ksi->keyingflag);
        
        /* link this KeyingSet with its typeinfo */
-       memcpy(&ks->typeinfo, ksi->name, sizeof(ks->typeinfo));
+       memcpy(&ks->typeinfo, ksi->idname, sizeof(ks->typeinfo));
        
        /* add type-info to the list */
        BLI_addtail(&keyingset_type_infos, ksi);
@@ -536,7 +536,7 @@
                ksn = ks->next;
                
                /* remove if matching typeinfo name */
-               if (strcmp(ks->typeinfo, ksi->name) == 0) {
+               if (strcmp(ks->typeinfo, ksi->idname) == 0) {
                        BKE_keyingset_free(ks);
                        BLI_freelinkN(&scene->keyingsets, ks);
                }

Modified: trunk/blender/source/blender/editors/include/ED_keyframing.h
===================================================================
--- trunk/blender/source/blender/editors/include/ED_keyframing.h        
2010-03-24 12:39:51 UTC (rev 27714)
+++ trunk/blender/source/blender/editors/include/ED_keyframing.h        
2010-03-24 12:48:03 UTC (rev 27715)
@@ -125,6 +125,8 @@
        /* info */
                /* identifier so that user can hook this up to a KeyingSet */
        char name[64];
+               /* identifier used for class name, which KeyingSet instances 
reference as "Typeinfo Name" */
+       char idname[64];
                /* keying settings */
        short keyingflag;
        

Modified: trunk/blender/source/blender/makesrna/intern/rna_animation.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_animation.c        
2010-03-24 12:39:51 UTC (rev 27714)
+++ trunk/blender/source/blender/makesrna/intern/rna_animation.c        
2010-03-24 12:48:03 UTC (rev 27715)
@@ -176,13 +176,13 @@
        if (validate(&dummyptr, data, have_function) != 0)
                return NULL;
        
-       if (strlen(identifier) >= sizeof(dummyksi.name)) {
-               BKE_reportf(reports, RPT_ERROR, "registering keying set info 
class: '%s' is too long, maximum length is %d.", identifier, 
sizeof(dummyksi.name));
+       if (strlen(identifier) >= sizeof(dummyksi.idname)) {
+               BKE_reportf(reports, RPT_ERROR, "registering keying set info 
class: '%s' is too long, maximum length is %d.", identifier, 
sizeof(dummyksi.idname));
                return NULL;
        }
        
        /* check if we have registered this info before, and remove it */
-       ksi = ANIM_keyingset_info_find_named(dummyksi.name);
+       ksi = ANIM_keyingset_info_find_named(dummyksi.idname);
        if (ksi && ksi->ext.srna)
                rna_KeyingSetInfo_unregister(C, ksi->ext.srna);
        
@@ -191,7 +191,7 @@
        memcpy(ksi, &dummyksi, sizeof(KeyingSetInfo));
        
        /* set RNA-extensions info */
-       ksi->ext.srna= RNA_def_struct(&BLENDER_RNA, ksi->name, 
"KeyingSetInfo"); 
+       ksi->ext.srna= RNA_def_struct(&BLENDER_RNA, ksi->idname, 
"KeyingSetInfo"); 
        ksi->ext.data= data;
        ksi->ext.call= call;
        ksi->ext.free= free;
@@ -361,6 +361,10 @@
        
        RNA_define_verify_sdna(0); // not in sdna
                
+       prop= RNA_def_property(srna, "bl_idname", PROP_STRING, PROP_NONE);
+       RNA_def_property_string_sdna(prop, NULL, "idname");
+       RNA_def_property_flag(prop, PROP_REGISTER);
+               
        /* Name */
        prop= RNA_def_property(srna, "bl_label", PROP_STRING, PROP_NONE);
        RNA_def_property_string_sdna(prop, NULL, "name");

Modified: trunk/blender/source/blender/makesrna/intern/rna_animation_api.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_animation_api.c    
2010-03-24 12:39:51 UTC (rev 27714)
+++ trunk/blender/source/blender/makesrna/intern/rna_animation_api.c    
2010-03-24 12:48:03 UTC (rev 27715)
@@ -41,19 +41,20 @@
 #include "BKE_animsys.h"
 
 static KS_Path *rna_KeyingSet_add_path(KeyingSet *keyingset, ReportList 
*reports, 
-               ID *id, char rna_path[], int array_index, int entire_array,
-               int grouping_method, char group_name[])
+               ID *id, char rna_path[], int index, int grouping_method, char 
group_name[])
 {
        KS_Path *ksp = NULL;
        short flag = 0;
        
-       /* validate flags */
-       if (entire_array)
+       /* special case when index = -1, we key the whole array (as with other 
places where index is used) */
+       if (index == -1) {
                flag |= KSP_FLAG_WHOLE_ARRAY;
+               index = 0;
+       }
        
        /* if data is valid, call the API function for this */
        if (keyingset) {
-               ksp= BKE_keyingset_add_path(keyingset, id, group_name, 
rna_path, array_index, flag, grouping_method);
+               ksp= BKE_keyingset_add_path(keyingset, id, group_name, 
rna_path, index, flag, grouping_method);
                keyingset->active_path= BLI_countlist(&keyingset->paths); 
        }
        else {
@@ -100,9 +101,8 @@
                /* rna-path */
        parm= RNA_def_string(func, "data_path", "", 256, "Data-Path", "RNA-Path 
to destination property."); // xxx hopefully this is long enough
                RNA_def_property_flag(parm, PROP_REQUIRED);
-       parm=RNA_def_int(func, "array_index", 0, 0, INT_MAX, "Array Index", "If 
applicable, the index ", 0, INT_MAX);
-               /* flags */
-       parm=RNA_def_boolean(func, "entire_array", 1, "Entire Array", "When an 
'array/vector' type is chosen (Location, Rotation, Color, etc.), entire array 
is to be used.");
+               /* index (defaults to -1 for entire array) */
+       parm=RNA_def_int(func, "index", -1, 0, INT_MAX, "Index", "The index of 
the destination property (i.e. axis of Location/Rotation/etc.), or -1 for the 
entire array.", 0, INT_MAX);
                /* grouping */
        parm=RNA_def_enum(func, "grouping_method", 
keyingset_path_grouping_items, KSP_GROUP_KSNAME, "Grouping Method", "Method 
used to define which Group-name to use.");
        parm=RNA_def_string(func, "group_name", "", 64, "Group Name", "Name of 
Action Group to assign destination to (only if grouping mode is to use this 
name).");


_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to