diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2018-10-19 14:29:15 +0300 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2018-10-19 14:31:58 +0300 |
commit | d01e0d1ef1c4ddc45ee8e054aae7b08bbe57d0bf (patch) | |
tree | a9c7fee9ede3ff6df64378b3de67d6d31040dc0e /source/blender/editors/screen/screen_context.c | |
parent | 51b2d06613bb3a11a04f051d7dabaa6530a0e5c0 (diff) |
CTX_DATA_BEGIN for active object only (..._from_active_object)
For now only `selected_pose_bones_from_active_object`, more options can
be added on demand.
Discussed this with Campbell Barton. We may need this only for selected
pose bones, time will tell.
Diffstat (limited to 'source/blender/editors/screen/screen_context.c')
-rw-r--r-- | source/blender/editors/screen/screen_context.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/source/blender/editors/screen/screen_context.c b/source/blender/editors/screen/screen_context.c index 021f5b9abd1..ff048edae9c 100644 --- a/source/blender/editors/screen/screen_context.c +++ b/source/blender/editors/screen/screen_context.c @@ -78,7 +78,8 @@ const char *screen_context_dir[] = { "editable_objects", "editable_bases", "selected_editable_objects", "selected_editable_bases", "visible_bones", "editable_bones", "selected_bones", "selected_editable_bones", - "visible_pose_bones", "selected_pose_bones", "active_bone", "active_pose_bone", + "visible_pose_bones", "selected_pose_bones", "selected_pose_bones_from_active_object", + "active_bone", "active_pose_bone", "active_base", "active_object", "object", "edit_object", "sculpt_object", "vertex_paint_object", "weight_paint_object", "image_paint_object", "particle_edit_object", "uv_sculpt_object", @@ -347,6 +348,23 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult return 1; } } + else if (CTX_data_equals(member, "selected_pose_bones_from_active_object")) { + Object *obpose = BKE_object_pose_armature_get(obact); + if (obpose && obpose->pose && obpose->data) { + if (obpose != obact) { + FOREACH_PCHAN_SELECTED_IN_OBJECT_BEGIN (obpose, pchan) { + CTX_data_list_add(result, &obpose->id, &RNA_PoseBone, pchan); + } FOREACH_PCHAN_SELECTED_IN_OBJECT_END; + } + else if (obact->mode & OB_MODE_POSE) { + FOREACH_PCHAN_SELECTED_IN_OBJECT_BEGIN (obact, pchan) { + CTX_data_list_add(result, &obact->id, &RNA_PoseBone, pchan); + } FOREACH_PCHAN_SELECTED_IN_OBJECT_END; + } + CTX_data_type_set(result, CTX_DATA_TYPE_COLLECTION); + return 1; + } + } else if (CTX_data_equals(member, "active_bone")) { if (obact && obact->type == OB_ARMATURE) { bArmature *arm = obact->data; |