diff options
author | Joshua Leung <aligorith@gmail.com> | 2014-06-26 08:46:19 +0400 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2014-07-03 16:09:36 +0400 |
commit | 6cc78927a301a35dcfdb0bd3ccd03cc3ca3a8863 (patch) | |
tree | d685bed0daf8e698486eb9773f0f7eb997ba8502 | |
parent | 796aef081bf3dff52bb177b247c659ef16cae6fb (diff) |
Select Grouped -> KeyingSet for bones also shows error messages now when the Keying Set is inappropriate
-rw-r--r-- | source/blender/editors/armature/pose_select.c | 26 | ||||
-rw-r--r-- | source/blender/editors/object/object_select.c | 2 |
2 files changed, 22 insertions, 6 deletions
diff --git a/source/blender/editors/armature/pose_select.c b/source/blender/editors/armature/pose_select.c index a6264632549..b0a82683c48 100644 --- a/source/blender/editors/armature/pose_select.c +++ b/source/blender/editors/armature/pose_select.c @@ -45,6 +45,7 @@ #include "BKE_context.h" #include "BKE_depsgraph.h" #include "BKE_object.h" +#include "BKE_report.h" #include "RNA_access.h" #include "RNA_define.h" @@ -732,7 +733,7 @@ static bool pose_select_same_layer(bContext *C, Object *ob, bool extend) return changed; } -static bool pose_select_same_keyingset(bContext *C, Object *ob, bool extend) +static bool pose_select_same_keyingset(bContext *C, ReportList *reports, Object *ob, bool extend) { KeyingSet *ks = ANIM_scene_get_active_keyingset(CTX_data_scene(C)); KS_Path *ksp; @@ -742,11 +743,26 @@ static bool pose_select_same_keyingset(bContext *C, Object *ob, bool extend) bool changed = false; /* sanity checks: validate Keying Set and object */ - if ((ks == NULL) || (ANIM_validate_keyingset(C, NULL, ks) != 0)) - return 0; + if (ks == NULL) { + BKE_report(reports, RPT_ERROR, "No active Keying Set to use"); + return false; + } + else if (ANIM_validate_keyingset(C, NULL, ks) != 0) { + if (ks->paths.first == NULL) { + if ((ks->flag & KEYINGSET_ABSOLUTE) == 0) { + BKE_report(reports, RPT_ERROR, + "Use another Keying Set, as the active one depends on the currently " + "selected items or cannot find any targets due to unsuitable context"); + } + else { + BKE_report(reports, RPT_ERROR, "Keying Set does not contain any paths"); + } + } + return false; + } if (ELEM3(NULL, ob, pose, arm)) - return 0; + return false; /* if not extending selection, deselect all selected first */ if (extend == false) { @@ -811,7 +827,7 @@ static int pose_select_grouped_exec(bContext *C, wmOperator *op) break; case POSE_SEL_SAME_KEYINGSET: /* Keying Set */ - changed = pose_select_same_keyingset(C, ob, extend); + changed = pose_select_same_keyingset(C, op->reports, ob, extend); break; default: diff --git a/source/blender/editors/object/object_select.c b/source/blender/editors/object/object_select.c index 2e1e8a94871..5590d028faa 100644 --- a/source/blender/editors/object/object_select.c +++ b/source/blender/editors/object/object_select.c @@ -797,7 +797,7 @@ static bool select_grouped_keyingset(bContext *C, Object *UNUSED(ob), ReportList BKE_report(reports, RPT_ERROR, "Keying Set does not contain any paths"); } } - return 0; + return false; } /* select each object that Keying Set refers to */ |