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:
authorJoshua Leung <aligorith@gmail.com>2018-05-14 16:42:49 +0300
committerJoshua Leung <aligorith@gmail.com>2018-05-14 16:42:57 +0300
commit2b09062defa093a243b5fe64b099accb07b440a3 (patch)
treeda1e360ec2a62485bceaa3fd528573fb4bad2991 /source/blender/makesrna
parent788488b1aa0f67f49e348a135e8ef2a0241a9706 (diff)
COW Fix: The "layers used" display for armatures did not update after bones were moved between layers
Previously, the "layers_used" value was getting updated by the drawing code. However, when using copy on write, the drawing code gets evaluated copies of the armature data instead of the original data, so any updates here fail to get flushed to the original data, hence the lack of updates in the UI. Fixed by moving the calculation to RNA when setting bone layers, as it should have been done originally. (The one downside to this is if we set individual layer memberships one by one - this could be slower as the recalc would have to happen each time this changes).
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r--source/blender/makesrna/intern/rna_armature.c17
1 files changed, 17 insertions, 0 deletions
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)