diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2018-10-12 21:19:48 +0300 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2018-10-12 21:26:23 +0300 |
commit | 75e1c705773b613222359d7bf6dc451f2ee27af9 (patch) | |
tree | aa59c81d16ac1bd3d1888bca8e5f63fb4164aeeb /source/blender/editors/armature/pose_edit.c | |
parent | 894c3b15320da4c4b71518e0df644a872c2cadd6 (diff) |
Revert "Fix for ARMATURE_OT_layers_show_all
This reverts commits:
* 2a2858b30dbbc19246446bcc89a7a4e7f67c7ce0
* 7cf8eed5e02a1f6525c3df2f404cb78db24adc98
Similar to ARMATURE_OT_layers_show we should keep this operator
single-object oriented. This one is a bit more tricky since we
may want to quickly see all the layers of all the armatures.
I will check with animators what is the best way to proceed here.
But overall I think it makes sense to have this only for the active
object.
Diffstat (limited to 'source/blender/editors/armature/pose_edit.c')
-rw-r--r-- | source/blender/editors/armature/pose_edit.c | 47 |
1 files changed, 19 insertions, 28 deletions
diff --git a/source/blender/editors/armature/pose_edit.c b/source/blender/editors/armature/pose_edit.c index 3960b53a687..46e417f6452 100644 --- a/source/blender/editors/armature/pose_edit.c +++ b/source/blender/editors/armature/pose_edit.c @@ -903,40 +903,31 @@ static bArmature *armature_layers_get_data(Object **ob) static int pose_armature_layers_showall_exec(bContext *C, wmOperator *op) { - ViewLayer *view_layer = CTX_data_view_layer(C); - Object *ob_active = CTX_data_active_object(C); - - const int maxLayers = (RNA_boolean_get(op->ptr, "all")) ? 32 : 16; + Object *ob = CTX_data_active_object(C); + bArmature *arm = armature_layers_get_data(&ob); + PointerRNA ptr; + int maxLayers = (RNA_boolean_get(op->ptr, "all")) ? 32 : 16; bool layers[32] = {false}; /* hardcoded for now - we can only have 32 armature layers, so this should be fine... */ + int i; - for (int i = 0; i < maxLayers; i++) { - layers[i] = 1; - } - - uint objects_len = 0; - Object **objects = BKE_view_layer_array_from_objects_in_mode_unique_data(view_layer, &objects_len, ob_active->mode); - for (uint ob_index = 0; ob_index < objects_len; ob_index++) { - Object *ob = objects[ob_index]; - bArmature *arm = armature_layers_get_data(&ob); - PointerRNA ptr; + /* sanity checking */ + if (arm == NULL) + return OPERATOR_CANCELLED; - if (arm == NULL) { - continue; - } + /* use RNA to set the layers + * although it would be faster to just set directly using bitflags, we still + * need to setup a RNA pointer so that we get the "update" callbacks for free... + */ + RNA_id_pointer_create(&arm->id, &ptr); - /* use RNA to set the layers - * although it would be faster to just set directly using bitflags, we still - * need to setup a RNA pointer so that we get the "update" callbacks for free... - */ - RNA_id_pointer_create(&arm->id, &ptr); + for (i = 0; i < maxLayers; i++) + layers[i] = 1; - RNA_boolean_set_array(&ptr, "layers", layers); + 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); - } - MEM_freeN(objects); + /* 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); /* done */ return OPERATOR_FINISHED; |