Revert "Fix for ARMATURE_OT_layers_show_all

This reverts commits:
* 2a2858b30d
* 7cf8eed5e0

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.
This commit is contained in:
Dalai Felinto 2018-10-12 15:19:48 -03:00
parent 894c3b1532
commit 75e1c70577
1 changed files with 20 additions and 29 deletions

View File

@ -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++) {
/* sanity checking */
if (arm == NULL)
return OPERATOR_CANCELLED;
/* 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;
}
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;
RNA_boolean_set_array(&ptr, "layers", layers);
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);
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;