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:
authorBastien Montagne <montagne29@wanadoo.fr>2015-09-04 13:12:49 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2015-09-04 13:26:52 +0300
commitf79c748246b075fddf719d2a7a7cbd764f4c5a60 (patch)
tree29006a3d23db2961d55a43001f1e88e7afe91ef6 /source/blender/blenkernel/intern/armature.c
parent52fda9b0dbdc561f905cd691532e361a0254113a (diff)
Armature: Cheap edit-to-object mode speedup.
`fix_bonelist_roll()` is already recursive, and was calling recursive `BKE_armature_where_is_bone()` twice! Changed `BKE_armature_where_is_bone()` to controll whether we recurse over children or not. With full Victor's rig, we gain 16% in `ED_armature_from_edit()` (from 31ms to 26ms). With a dummy test-case 100 bones chain, we gain 80% in `ED_armature_from_edit()` (from 1.25ms to 0.25ms). Not crucial, but still worth it. ;)
Diffstat (limited to 'source/blender/blenkernel/intern/armature.c')
-rw-r--r--source/blender/blenkernel/intern/armature.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c
index 9bb8726cdb3..639249eab21 100644
--- a/source/blender/blenkernel/intern/armature.c
+++ b/source/blender/blenkernel/intern/armature.c
@@ -1568,16 +1568,15 @@ void vec_roll_to_mat3(const float vec[3], const float roll, float mat[3][3])
/* recursive part, calculates restposition of entire tree of children */
/* used by exiting editmode too */
-void BKE_armature_where_is_bone(Bone *bone, Bone *prevbone)
+void BKE_armature_where_is_bone(Bone *bone, Bone *prevbone, const bool use_recursion)
{
float vec[3];
/* Bone Space */
sub_v3_v3v3(vec, bone->tail, bone->head);
+ bone->length = len_v3(vec);
vec_roll_to_mat3(vec, bone->roll, bone->bone_mat);
- bone->length = len_v3v3(bone->head, bone->tail);
-
/* this is called on old file reading too... */
if (bone->xwidth == 0.0f) {
bone->xwidth = 0.1f;
@@ -1599,9 +1598,11 @@ void BKE_armature_where_is_bone(Bone *bone, Bone *prevbone)
}
/* and the kiddies */
- prevbone = bone;
- for (bone = bone->childbase.first; bone; bone = bone->next) {
- BKE_armature_where_is_bone(bone, prevbone);
+ if (use_recursion) {
+ prevbone = bone;
+ for (bone = bone->childbase.first; bone; bone = bone->next) {
+ BKE_armature_where_is_bone(bone, prevbone, use_recursion);
+ }
}
}
@@ -1613,7 +1614,7 @@ void BKE_armature_where_is(bArmature *arm)
/* hierarchical from root to children */
for (bone = arm->bonebase.first; bone; bone = bone->next) {
- BKE_armature_where_is_bone(bone, NULL);
+ BKE_armature_where_is_bone(bone, NULL, true);
}
}