diff options
-rw-r--r-- | source/blender/draw/intern/draw_armature.c | 3 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_armature.c | 17 |
2 files changed, 17 insertions, 3 deletions
diff --git a/source/blender/draw/intern/draw_armature.c b/source/blender/draw/intern/draw_armature.c index 5ad05da5cbf..d07febfdd22 100644 --- a/source/blender/draw/intern/draw_armature.c +++ b/source/blender/draw/intern/draw_armature.c @@ -1577,11 +1577,8 @@ static void draw_armature_pose(Object *ob, const float const_color[4]) const bool show_relations = true; /* TODO get value from overlays settings. */ /* being set below */ - arm->layer_used = 0; - for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) { bone = pchan->bone; - arm->layer_used |= bone->layer; /* bone must be visible */ if ((bone->flag & (BONE_HIDDEN_P | BONE_HIDDEN_PG)) == 0) { diff --git a/source/blender/makesrna/intern/rna_armature.c b/source/blender/makesrna/intern/rna_armature.c index 48ce2f03db0..0819a5e828e 100644 --- a/source/blender/makesrna/intern/rna_armature.c +++ b/source/blender/makesrna/intern/rna_armature.c @@ -240,6 +240,18 @@ static IDProperty *rna_EditBone_idprops(PointerRNA *ptr, bool create) return ebone->prop; } +/* 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. + */ +static void rna_Armature_layer_used_refresh(bArmature *arm, ListBase *bones) +{ + for (Bone *bone = bones->first; bone; bone = bone->next) { + arm->layer_used |= bone->layer; + rna_Armature_layer_used_refresh(arm, &bone->childbase); + } +} + static void rna_bone_layer_set(int *layer, const int *values) { int i, tot = 0; @@ -260,8 +272,13 @@ static void rna_bone_layer_set(int *layer, const int *values) static void rna_Bone_layer_set(PointerRNA *ptr, const int *values) { + bArmature *arm = (bArmature *)ptr->id.data; Bone *bone = (Bone *)ptr->data; + rna_bone_layer_set(&bone->layer, values); + + arm->layer_used = 0; + rna_Armature_layer_used_refresh(arm, &arm->bonebase); } static void rna_Armature_layer_set(PointerRNA *ptr, const int *values) |