[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [51246] trunk/blender: Graph Editor: Added a filtering option for Drivers mode to only show F-Curves

Joshua Leung aligorith at gmail.com
Wed Oct 10 10:46:07 CEST 2012


Revision: 51246
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=51246
Author:   aligorith
Date:     2012-10-10 08:46:07 +0000 (Wed, 10 Oct 2012)
Log Message:
-----------
Graph Editor: Added a filtering option for Drivers mode to only show F-Curves
with errors

This filtering option is useful when rigging and you want to figure out if any
of your drivers are not functioning, and/or which one(s) are not, so that you
can go through fixing them. It saves you from having to check on each one
individually, or going into the console to try to infer which ones are not
working.

Modified Paths:
--------------
    trunk/blender/release/scripts/startup/bl_ui/space_dopesheet.py
    trunk/blender/source/blender/editors/animation/anim_filter.c
    trunk/blender/source/blender/makesdna/DNA_action_types.h
    trunk/blender/source/blender/makesrna/intern/rna_action.c

Modified: trunk/blender/release/scripts/startup/bl_ui/space_dopesheet.py
===================================================================
--- trunk/blender/release/scripts/startup/bl_ui/space_dopesheet.py	2012-10-10 08:29:13 UTC (rev 51245)
+++ trunk/blender/release/scripts/startup/bl_ui/space_dopesheet.py	2012-10-10 08:46:07 UTC (rev 51246)
@@ -29,6 +29,7 @@
 def dopesheet_filter(layout, context, genericFiltersOnly=False):
     dopesheet = context.space_data.dopesheet
     is_nla = context.area.type == 'NLA_EDITOR'
+    is_drivers = (context.area.type == 'GRAPH_EDITOR' and context.space_data.mode == 'DRIVERS')
 
     row = layout.row(align=True)
     row.prop(dopesheet, "show_only_selected", text="")
@@ -37,6 +38,9 @@
     if is_nla:
         row.prop(dopesheet, "show_missing_nla", text="")
 
+    if is_drivers:
+        row.prop(dopesheet, "show_only_errors", text="")
+
     if not genericFiltersOnly:
         if bpy.data.groups:
             row = layout.row(align=True)

Modified: trunk/blender/source/blender/editors/animation/anim_filter.c
===================================================================
--- trunk/blender/source/blender/editors/animation/anim_filter.c	2012-10-10 08:29:13 UTC (rev 51245)
+++ trunk/blender/source/blender/editors/animation/anim_filter.c	2012-10-10 08:46:07 UTC (rev 51246)
@@ -980,6 +980,27 @@
 	return 1;
 }
 
+/* Check if F-Curve has errors and/or is disabled 
+ * > returns: (bool) True if F-Curve has errors/is disabled
+ */
+static short fcurve_has_errors(FCurve *fcu)
+{
+	/* F-Curve disabled - path eval error */
+	if (fcu->flag & FCURVE_DISABLED) {
+		return 1;
+	}
+	
+	/* driver? */
+	if (fcu->driver) {
+		/* for now, just check if the entire thing got disabled... */
+		if (fcu->driver->flag & DRIVER_FLAG_INVALID)
+			return 1;
+	}
+	
+	/* no errors found */
+	return 0;
+}
+
 /* find the next F-Curve that is usable for inclusion */
 static FCurve *animfilter_fcurve_next(bDopeSheet *ads, FCurve *first, bActionGroup *grp, int filter_mode, ID *owner_id)
 {
@@ -1018,6 +1039,13 @@
 								continue;
 						}
 						
+						/* error-based filtering... */
+						if ((ads) && (ads->filterflag & ADS_FILTER_ONLY_ERRORS)) {
+							/* skip if no errors... */
+							if (fcurve_has_errors(fcu) == 0)
+								continue;
+						}
+						
 						/* this F-Curve can be used, so return it */
 						return fcu;
 					}

Modified: trunk/blender/source/blender/makesdna/DNA_action_types.h
===================================================================
--- trunk/blender/source/blender/makesdna/DNA_action_types.h	2012-10-10 08:29:13 UTC (rev 51245)
+++ trunk/blender/source/blender/makesdna/DNA_action_types.h	2012-10-10 08:46:07 UTC (rev 51246)
@@ -563,6 +563,7 @@
 	/* general filtering 3 */
 	ADS_FILTER_INCL_HIDDEN      = (1 << 26),  /* include 'hidden' channels too (i.e. those from hidden Objects/Bones) */
 	ADS_FILTER_BY_FCU_NAME      = (1 << 27),  /* for F-Curves, filter by the displayed name (i.e. to isolate all Location curves only) */
+	ADS_FILTER_ONLY_ERRORS		= (1 << 28),  /* show only F-Curves which are disabled/have errors - for debugging drivers */
 	
 	/* combination filters (some only used at runtime) */
 	ADS_FILTER_NOOBDATA = (ADS_FILTER_NOCAM | ADS_FILTER_NOMAT | ADS_FILTER_NOLAM | ADS_FILTER_NOCUR | ADS_FILTER_NOPART | ADS_FILTER_NOARM | ADS_FILTER_NOSPK)

Modified: trunk/blender/source/blender/makesrna/intern/rna_action.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_action.c	2012-10-10 08:29:13 UTC (rev 51245)
+++ trunk/blender/source/blender/makesrna/intern/rna_action.c	2012-10-10 08:46:07 UTC (rev 51246)
@@ -287,6 +287,13 @@
 	RNA_def_property_ui_icon(prop, ICON_GHOST_ENABLED, 0);
 	RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
 	
+	/* Debug Filtering Settings */
+	prop = RNA_def_property(srna, "show_only_errors", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_sdna(prop, NULL, "filterflag", ADS_FILTER_ONLY_ERRORS);
+	RNA_def_property_ui_text(prop, "Show Errors", "Only include F-Curves and Drivers that are disabled or have errors");
+	RNA_def_property_ui_icon(prop, ICON_HELP, 0); // XXX: this doesn't quite fit?
+	RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
+	
 	/* Object Group Filtering Settings */
 	prop = RNA_def_property(srna, "show_only_group_objects", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "filterflag", ADS_FILTER_ONLYOBGROUP);




More information about the Bf-blender-cvs mailing list