Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua Leung <aligorith@gmail.com>2010-03-24 15:48:03 +0300
committerJoshua Leung <aligorith@gmail.com>2010-03-24 15:48:03 +0300
commit230a2e62f09f3e9c18aa585231985023a7c270bb (patch)
tree5d2a415f08d4ee1886bd961b9920450d9edf836b
parent094098fa9d8caba99376e6b33dd607c8a0ece448 (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.
-rw-r--r--release/scripts/keyingsets/keyingsets_utils.py2
-rw-r--r--source/blender/editors/animation/keyingsets.c6
-rw-r--r--source/blender/editors/include/ED_keyframing.h2
-rw-r--r--source/blender/makesrna/intern/rna_animation.c12
-rw-r--r--source/blender/makesrna/intern/rna_animation_api.c16
5 files changed, 22 insertions, 16 deletions
diff --git a/release/scripts/keyingsets/keyingsets_utils.py b/release/scripts/keyingsets/keyingsets_utils.py
index 78e170c88f9..2097018fffb 100644
--- a/release/scripts/keyingsets/keyingsets_utils.py
+++ b/release/scripts/keyingsets/keyingsets_utils.py
@@ -70,7 +70,7 @@ def RKS_GEN_available(ksi, context, ks, data):
# 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)
# ------
diff --git a/source/blender/editors/animation/keyingsets.c b/source/blender/editors/animation/keyingsets.c
index f7a4fe69d26..5e2bf4a7061 100644
--- a/source/blender/editors/animation/keyingsets.c
+++ b/source/blender/editors/animation/keyingsets.c
@@ -471,7 +471,7 @@ KeyingSetInfo *ANIM_keyingset_info_find_named (const char name[])
/* 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 @@ void ANIM_keyingset_info_register (const bContext *C, KeyingSetInfo *ksi)
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 @@ void ANIM_keyingset_info_unregister (const bContext *C, KeyingSetInfo *ksi)
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);
}
diff --git a/source/blender/editors/include/ED_keyframing.h b/source/blender/editors/include/ED_keyframing.h
index b1407ac8f2e..92e9c541b6a 100644
--- a/source/blender/editors/include/ED_keyframing.h
+++ b/source/blender/editors/include/ED_keyframing.h
@@ -125,6 +125,8 @@ typedef struct KeyingSetInfo {
/* 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;
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).");