Commit: 6cc78927a301a35dcfdb0bd3ccd03cc3ca3a8863
Author: Joshua Leung
Date:   Thu Jun 26 16:46:19 2014 +1200
https://developer.blender.org/rB6cc78927a301a35dcfdb0bd3ccd03cc3ca3a8863

Select Grouped -> KeyingSet for bones also shows error messages now when the 
Keying Set is inappropriate

===================================================================

M       source/blender/editors/armature/pose_select.c
M       source/blender/editors/object/object_select.c

===================================================================

diff --git a/source/blender/editors/armature/pose_select.c 
b/source/blender/editors/armature/pose_select.c
index a626463..b0a8268 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 2e1e8a9..5590d02 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 */

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to