diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2018-09-29 01:06:07 +0300 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2018-09-29 01:06:07 +0300 |
commit | 3a8b56ce24c9228a885d3c44f4c22d90be04ae4c (patch) | |
tree | fda0b0f267bc63f0873dc43aa5e0c483f7d6fca0 /source/blender/editors/armature/pose_edit.c | |
parent | 1eb26680d4b382104a6260a5e4788166d65bdb89 (diff) |
Multi-Objects: ARMATURE_OT_armature_layers
Diffstat (limited to 'source/blender/editors/armature/pose_edit.c')
-rw-r--r-- | source/blender/editors/armature/pose_edit.c | 36 |
1 files changed, 23 insertions, 13 deletions
diff --git a/source/blender/editors/armature/pose_edit.c b/source/blender/editors/armature/pose_edit.c index 136f17156e1..58b7a8ab969 100644 --- a/source/blender/editors/armature/pose_edit.c +++ b/source/blender/editors/armature/pose_edit.c @@ -974,27 +974,37 @@ static int armature_layers_invoke(bContext *C, wmOperator *op, const wmEvent *ev /* Set the visible layers for the active armature (edit and pose modes) */ static int armature_layers_exec(bContext *C, wmOperator *op) { - Object *ob = CTX_data_active_object(C); - bArmature *arm = armature_layers_get_data(&ob); + ViewLayer *view_layer = CTX_data_view_layer(C); PointerRNA ptr; bool layers[32]; /* hardcoded for now - we can only have 32 armature layers, so this should be fine... */ - - if (arm == NULL) { - return OPERATOR_CANCELLED; - } + bool changed = false; /* get the values set in the operator properties */ RNA_boolean_get_array(op->ptr, "layers", layers); - /* get pointer for armature, and write data there... */ - RNA_id_pointer_create((ID *)arm, &ptr); - RNA_boolean_set_array(&ptr, "layers", layers); + uint objects_len = 0; + Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data(view_layer, &objects_len); + for (uint ob_index = 0; ob_index < objects_len; ob_index++) { + Object *ob = objects[ob_index]; + bArmature *arm = armature_layers_get_data(&ob); - /* note, notifier might evolve */ - WM_event_add_notifier(C, NC_OBJECT | ND_POSE, ob); - DEG_id_tag_update(&arm->id, DEG_TAG_COPY_ON_WRITE); + if (arm == NULL) { + continue; + } - return OPERATOR_FINISHED; + /* Get pointer for armature, and write data there... */ + RNA_id_pointer_create((ID *)arm, &ptr); + RNA_boolean_set_array(&ptr, "layers", layers); + + /* Note, notifier might evolve. */ + WM_event_add_notifier(C, NC_OBJECT | ND_POSE, ob); + DEG_id_tag_update(&arm->id, DEG_TAG_COPY_ON_WRITE); + + changed = true; + } + MEM_freeN(objects); + + return changed ? OPERATOR_FINISHED : OPERATOR_CANCELLED; } void ARMATURE_OT_armature_layers(wmOperatorType *ot) |