diff options
author | Campbell Barton <ideasman42@gmail.com> | 2009-12-29 18:40:26 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2009-12-29 18:40:26 +0300 |
commit | 5cd837a562d773cdff155ab05084af590341758d (patch) | |
tree | 20609a23f562cbf8ccf91b41af3f80240551b977 /source/blender/makesrna/intern/rna_pose.c | |
parent | d5cef9a30d1febb22b760eb7d5cdac0fd628bb06 (diff) |
* speedup for animating bones, in one scene with sintel and a dragon animated its over 4x faster.
* utility function BLI_findstring to avoid listbase lookup loops everywhere.
eg:
ListBase *lb= objects= &CTX_data_main(C)->object;
Object *ob= BLI_findstring(lb, name, offsetof(ID, name) + 2);
* made some more math functions use const's, (fix warnings I made in previous commits)
Diffstat (limited to 'source/blender/makesrna/intern/rna_pose.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_pose.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/source/blender/makesrna/intern/rna_pose.c b/source/blender/makesrna/intern/rna_pose.c index 7e2b9d7875b..07c4445872e 100644 --- a/source/blender/makesrna/intern/rna_pose.c +++ b/source/blender/makesrna/intern/rna_pose.c @@ -58,6 +58,8 @@ #include "MEM_guardedalloc.h" +#include "RNA_access.h" + static void rna_Pose_update(Main *bmain, Scene *scene, PointerRNA *ptr) { // XXX when to use this? ob->pose->flag |= (POSE_LOCKED|POSE_DO_UNLOCK); @@ -509,6 +511,16 @@ static int rna_PoseChannel_rotation_4d_editable(PointerRNA *ptr, int index) return PROP_EDITABLE; } +/* not essential, but much faster then the default lookup function */ +PointerRNA rna_PoseBones_lookup_string(PointerRNA *ptr, const char *key) +{ + PointerRNA rptr; + bPose *pose= (bPose*)ptr->data; + bPoseChannel *pchan= BLI_findstring(&pose->chanbase, key, offsetof(bPoseChannel, name)); + RNA_pointer_create(ptr->id.data, &RNA_PoseBone, pchan, &rptr); + return rptr; +} + #else static void rna_def_bone_group(BlenderRNA *brna) @@ -1077,7 +1089,7 @@ static void rna_def_pose(BlenderRNA *brna) RNA_def_property_collection_sdna(prop, NULL, "chanbase", NULL); RNA_def_property_struct_type(prop, "PoseBone"); RNA_def_property_ui_text(prop, "Pose Bones", "Individual pose bones for the armature."); - + RNA_def_property_collection_funcs(prop, 0, 0, 0, 0, 0, 0, "rna_PoseBones_lookup_string"); /* can be removed, only for fast lookup */ /* bone groups */ prop= RNA_def_property(srna, "bone_groups", PROP_COLLECTION, PROP_NONE); RNA_def_property_collection_sdna(prop, NULL, "agroups", NULL); |