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:
authormano-wii <germano.costa@ig.com.br>2019-07-17 20:17:16 +0300
committermano-wii <germano.costa@ig.com.br>2019-07-17 20:17:34 +0300
commit709f126e8143da4fa28a08a94e13581c68ab6b29 (patch)
tree3c1d1bf71376904c4816af0d16a5c11cde639ddf /source/blender/editors/armature
parent4ddc7e8d1b2c22463d4d181d8bb3bb9bb17b1b35 (diff)
Fix T59713: Armature layer dots not updated on changes
`layer_used` runtime data, which controls the drawing of dots in the UI was not getting refreshed properly. This used to happen in the drawing code, but was no longer working for reasons explained in: {rB2b09062defa093a243b5fe64b099accb07b440a3} The solution was to update each layer manually in the operators: * ARMATURE_OT_bone_primitive_add * ARMATURE_OT_delete * ARMATURE_OT_dissolve * ARMATURE_OT_fill * ARMATURE_OT_merge * ARMATURE_OT_separate * ARMATURE_OT_bone_layers * POSE_OT_bone_layers Differential Revision: https://developer.blender.org/D5281
Diffstat (limited to 'source/blender/editors/armature')
-rw-r--r--source/blender/editors/armature/armature_add.c2
-rw-r--r--source/blender/editors/armature/armature_edit.c5
-rw-r--r--source/blender/editors/armature/armature_relations.c5
-rw-r--r--source/blender/editors/armature/armature_utils.c12
-rw-r--r--source/blender/editors/armature/pose_edit.c4
5 files changed, 27 insertions, 1 deletions
diff --git a/source/blender/editors/armature/armature_add.c b/source/blender/editors/armature/armature_add.c
index d02e58d48a9..d2fa77f90be 100644
--- a/source/blender/editors/armature/armature_add.c
+++ b/source/blender/editors/armature/armature_add.c
@@ -1121,6 +1121,8 @@ static int armature_bone_primitive_add_exec(bContext *C, wmOperator *op)
add_v3_v3v3(bone->tail, bone->head, imat[2]); // bone with unit length 1, pointing up Z
}
+ ED_armature_edit_refresh_layer_used(obedit->data);
+
/* note, notifier might evolve */
WM_event_add_notifier(C, NC_OBJECT | ND_BONE_SELECT, obedit);
diff --git a/source/blender/editors/armature/armature_edit.c b/source/blender/editors/armature/armature_edit.c
index c5430e06b6e..4e6661b1d15 100644
--- a/source/blender/editors/armature/armature_edit.c
+++ b/source/blender/editors/armature/armature_edit.c
@@ -862,6 +862,7 @@ static int armature_fill_bones_exec(bContext *C, wmOperator *op)
}
/* updates */
+ ED_armature_edit_refresh_layer_used(arm);
WM_event_add_notifier(C, NC_OBJECT | ND_POSE, obedit);
/* free points */
@@ -1053,6 +1054,7 @@ static int armature_merge_exec(bContext *C, wmOperator *op)
/* updates */
ED_armature_edit_sync_selection(arm->edbo);
+ ED_armature_edit_refresh_layer_used(arm);
WM_event_add_notifier(C, NC_OBJECT | ND_POSE, obedit);
}
MEM_freeN(objects);
@@ -1460,8 +1462,8 @@ static int armature_delete_selected_exec(bContext *C, wmOperator *UNUSED(op))
changed_multi = true;
ED_armature_edit_sync_selection(arm->edbo);
+ ED_armature_edit_refresh_layer_used(arm);
BKE_pose_tag_recalc(CTX_data_main(C), obedit->pose);
-
WM_event_add_notifier(C, NC_OBJECT | ND_BONE_SELECT, obedit);
}
}
@@ -1635,6 +1637,7 @@ static int armature_dissolve_selected_exec(bContext *C, wmOperator *UNUSED(op))
if (changed) {
changed_multi = true;
ED_armature_edit_sync_selection(arm->edbo);
+ ED_armature_edit_refresh_layer_used(arm);
WM_event_add_notifier(C, NC_OBJECT | ND_BONE_SELECT, obedit);
}
}
diff --git a/source/blender/editors/armature/armature_relations.c b/source/blender/editors/armature/armature_relations.c
index 2c61818d902..8722e575d15 100644
--- a/source/blender/editors/armature/armature_relations.c
+++ b/source/blender/editors/armature/armature_relations.c
@@ -38,6 +38,7 @@
#include "BKE_action.h"
#include "BKE_animsys.h"
+#include "BKE_armature.h"
#include "BKE_constraint.h"
#include "BKE_context.h"
#include "BKE_fcurve.h"
@@ -426,6 +427,7 @@ int join_armature_exec(bContext *C, wmOperator *op)
ED_armature_from_edit(bmain, arm);
ED_armature_edit_free(arm);
+ BKE_armature_refresh_layer_used(arm);
DEG_id_tag_update(&scene->id, ID_RECALC_SELECT);
WM_event_add_notifier(C, NC_SCENE | ND_OB_ACTIVE, scene);
@@ -671,6 +673,9 @@ static int separate_armature_exec(bContext *C, wmOperator *op)
ED_armature_to_edit(obedit->data);
+ ED_armature_edit_refresh_layer_used(obedit->data);
+ BKE_armature_refresh_layer_used(newob->data);
+
/* parents tips remain selected when connected children are removed. */
ED_armature_edit_deselect_all(obedit);
diff --git a/source/blender/editors/armature/armature_utils.c b/source/blender/editors/armature/armature_utils.c
index 5d424594229..d8777b7e0b7 100644
--- a/source/blender/editors/armature/armature_utils.c
+++ b/source/blender/editors/armature/armature_utils.c
@@ -85,6 +85,18 @@ void ED_armature_edit_validate_active(struct bArmature *arm)
}
}
+/* 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 ED_armature_edit_refresh_layer_used(bArmature *arm)
+{
+ arm->layer_used = 0;
+ for (EditBone *ebo = arm->edbo->first; ebo; ebo = ebo->next) {
+ arm->layer_used |= ebo->layer;
+ }
+}
+
/* *************************************************************** */
/* Bone Operations */
diff --git a/source/blender/editors/armature/pose_edit.c b/source/blender/editors/armature/pose_edit.c
index 745af06c7af..5daf6b584e5 100644
--- a/source/blender/editors/armature/pose_edit.c
+++ b/source/blender/editors/armature/pose_edit.c
@@ -872,6 +872,8 @@ static int pose_bone_layers_exec(bContext *C, wmOperator *op)
RNA_boolean_set_array(&ptr, "layers", layers);
if (prev_ob != ob) {
+ BKE_armature_refresh_layer_used(ob->data);
+
/* Note, notifier might evolve. */
WM_event_add_notifier(C, NC_OBJECT | ND_POSE, ob);
DEG_id_tag_update((ID *)ob->data, ID_RECALC_COPY_ON_WRITE);
@@ -949,6 +951,8 @@ static int armature_bone_layers_exec(bContext *C, wmOperator *op)
}
CTX_DATA_END;
+ ED_armature_edit_refresh_layer_used(ob->data);
+
/* note, notifier might evolve */
WM_event_add_notifier(C, NC_OBJECT | ND_POSE, ob);