diff options
author | Joshua Leung <aligorith@gmail.com> | 2010-03-24 15:48:03 +0300 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2010-03-24 15:48:03 +0300 |
commit | 230a2e62f09f3e9c18aa585231985023a7c270bb (patch) | |
tree | 5d2a415f08d4ee1886bd961b9920450d9edf836b /source/blender/makesrna/intern | |
parent | 094098fa9d8caba99376e6b33dd607c8a0ece448 (diff) |
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.
Diffstat (limited to 'source/blender/makesrna/intern')
-rw-r--r-- | source/blender/makesrna/intern/rna_animation.c | 12 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_animation_api.c | 16 |
2 files changed, 16 insertions, 12 deletions
diff --git a/source/blender/makesrna/intern/rna_animation.c b/source/blender/makesrna/intern/rna_animation.c index 35b640cf589..a1a769f5bf5 100644 --- a/source/blender/makesrna/intern/rna_animation.c +++ b/source/blender/makesrna/intern/rna_animation.c @@ -176,13 +176,13 @@ static StructRNA *rna_KeyingSetInfo_register(const bContext *C, ReportList *repo 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 @@ static StructRNA *rna_KeyingSetInfo_register(const bContext *C, ReportList *repo 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 @@ static void rna_def_keyingset_info(BlenderRNA *brna) 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"); diff --git a/source/blender/makesrna/intern/rna_animation_api.c b/source/blender/makesrna/intern/rna_animation_api.c index b4a0c457c8e..d70370be68d 100644 --- a/source/blender/makesrna/intern/rna_animation_api.c +++ b/source/blender/makesrna/intern/rna_animation_api.c @@ -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 @@ void RNA_api_keyingset(StructRNA *srna) /* 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)."); |