diff options
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/BKE_armature.h | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/armature.c | 18 |
2 files changed, 14 insertions, 6 deletions
diff --git a/source/blender/blenkernel/BKE_armature.h b/source/blender/blenkernel/BKE_armature.h index 6c383ae5011..54022a0a632 100644 --- a/source/blender/blenkernel/BKE_armature.h +++ b/source/blender/blenkernel/BKE_armature.h @@ -89,7 +89,7 @@ void BKE_armature_bone_hash_free(struct bArmature *arm); bool BKE_armature_bone_flag_test_recursive(const struct Bone *bone, int flag); -void BKE_armature_refresh_layer_used(struct bArmature *arm); +void BKE_armature_refresh_layer_used(struct Depsgraph *depsgraph, struct bArmature *arm); float distfactor_to_bone( const float vec[3], const float b1[3], const float b2[3], float r1, float r2, float rdist); diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c index af98992cc01..04051edd334 100644 --- a/source/blender/blenkernel/intern/armature.c +++ b/source/blender/blenkernel/intern/armature.c @@ -66,6 +66,7 @@ #include "BKE_scene.h" #include "DEG_depsgraph_build.h" +#include "DEG_depsgraph_query.h" #include "BIK_api.h" @@ -480,14 +481,21 @@ static void armature_refresh_layer_used_recursive(bArmature *arm, ListBase *bone } } -/* Update the layers_used variable after bones are moved between layer - * NOTE: Used to be done in drawing code in 2.7, but that won't work with - * Copy-on-Write, as drawing uses evaluated copies. - */ -void BKE_armature_refresh_layer_used(bArmature *arm) +void BKE_armature_refresh_layer_used(struct Depsgraph *depsgraph, struct bArmature *arm) { + if (arm->edbo != NULL) { + /* Don't perform this update when the armature is in edit mode. In that case it should be + * handled by ED_armature_edit_refresh_layer_used(). */ + return; + } + arm->layer_used = 0; armature_refresh_layer_used_recursive(arm, &arm->bonebase); + + if (depsgraph == NULL || DEG_is_active(depsgraph)) { + bArmature *arm_orig = (bArmature *)DEG_get_original_id(&arm->id); + arm_orig->layer_used = arm->layer_used; + } } /* Finds the best possible extension to the name on a particular axis. (For renaming, check for |