diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2015-09-04 13:12:49 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2015-09-04 13:26:52 +0300 |
commit | f79c748246b075fddf719d2a7a7cbd764f4c5a60 (patch) | |
tree | 29006a3d23db2961d55a43001f1e88e7afe91ef6 /source/blender/editors/armature/armature_utils.c | |
parent | 52fda9b0dbdc561f905cd691532e361a0254113a (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/editors/armature/armature_utils.c')
-rw-r--r-- | source/blender/editors/armature/armature_utils.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/source/blender/editors/armature/armature_utils.c b/source/blender/editors/armature/armature_utils.c index 09284860ec4..82517404334 100644 --- a/source/blender/editors/armature/armature_utils.c +++ b/source/blender/editors/armature/armature_utils.c @@ -489,8 +489,9 @@ static void fix_bonelist_roll(ListBase *bonelist, ListBase *editbonelist) float imat[3][3]; for (curBone = bonelist->first; curBone; curBone = curBone->next) { - /* sets local matrix and arm_mat (restpos) */ - BKE_armature_where_is_bone(curBone, curBone->parent); + /* sets local matrix and arm_mat (restpos). + * Do not recurse into children here, fix_bonelist_roll is already recursive. */ + BKE_armature_where_is_bone(curBone, curBone->parent, false); /* Find the associated editbone */ for (ebone = editbonelist->first; ebone; ebone = ebone->next) @@ -516,7 +517,7 @@ static void fix_bonelist_roll(ListBase *bonelist, ListBase *editbonelist) curBone->roll = -atan2f(difmat[2][0], difmat[2][2]); /* and set restposition again */ - BKE_armature_where_is_bone(curBone, curBone->parent); + BKE_armature_where_is_bone(curBone, curBone->parent, false); } fix_bonelist_roll(&curBone->childbase, editbonelist); } |