[Bf-blender-cvs] [11e0ddd] master: Bugfix T40801: Select grouped objects by Keying Set not working with builtin Keying Sets

Joshua Leung noreply at git.blender.org
Thu Jun 26 04:39:56 CEST 2014


Commit: 11e0dddf91f76065a6dd782163eb3b75745a6b2e
Author: Joshua Leung
Date:   Thu Jun 26 14:39:44 2014 +1200
https://developer.blender.org/rB11e0dddf91f76065a6dd782163eb3b75745a6b2e

Bugfix T40801: Select grouped objects by Keying Set not working with builtin Keying Sets

Most of the default builtin Keying Sets (e.g. Loc, Rot, Available, etc.) depend
on the currently selected objects, making them unsuitable for use with this feature.
As a result, this feature would silently fail. This commit adds some error messages
which at least let users know what's going on so that they can make other plans

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

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

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

diff --git a/source/blender/editors/object/object_select.c b/source/blender/editors/object/object_select.c
index a5a96c6..8a98f38 100644
--- a/source/blender/editors/object/object_select.c
+++ b/source/blender/editors/object/object_select.c
@@ -776,14 +776,29 @@ static bool select_grouped_gameprops(bContext *C, Object *ob)
 	return changed;
 }
 
-static bool select_grouped_keyingset(bContext *C, Object *UNUSED(ob))
+static bool select_grouped_keyingset(bContext *C, ReportList *reports, Object *UNUSED(ob))
 {
 	KeyingSet *ks = ANIM_scene_get_active_keyingset(CTX_data_scene(C));
 	bool changed = false;
 	
 	/* firstly, validate KeyingSet */
-	if ((ks == NULL) || (ANIM_validate_keyingset(C, NULL, ks) != 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 objects or cannot find any targets due to unsuitable context");
+			}
+			else {
+				BKE_report(reports, RPT_ERROR, "Keying Set does not contain any paths");
+			}
+		}
 		return 0;
+	}
 	
 	/* select each object that Keying Set refers to */
 	/* TODO: perhaps to be more in line with the rest of these, we should only take objects
@@ -852,7 +867,7 @@ static int object_select_grouped_exec(bContext *C, wmOperator *op)
 	else if (nr == 9) changed |= select_grouped_index_object(C, ob);
 	else if (nr == 10) changed |= select_grouped_color(C, ob);
 	else if (nr == 11) changed |= select_grouped_gameprops(C, ob);
-	else if (nr == 12) changed |= select_grouped_keyingset(C, ob);
+	else if (nr == 12) changed |= select_grouped_keyingset(C, op->reports, ob);
 	else if (nr == 13) changed |= select_similar_lamps(C, ob);
 	else if (nr == 14) changed |= select_similar_pass_index(C, ob);




More information about the Bf-blender-cvs mailing list