[Bf-blender-cvs] [1e48880] master: NLA: The "filter by name" functionality now works with NLA strips too

Joshua Leung noreply at git.blender.org
Tue Apr 14 08:40:30 CEST 2015


Commit: 1e488802dc866c919a421a1c33d2b1c459096459
Author: Joshua Leung
Date:   Tue Apr 14 18:27:05 2015 +1200
Branches: master
https://developer.blender.org/rB1e488802dc866c919a421a1c33d2b1c459096459

NLA: The "filter by name" functionality now works with NLA strips too

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

M	release/scripts/startup/bl_ui/space_dopesheet.py
M	source/blender/editors/animation/anim_filter.c
M	source/blender/makesrna/intern/rna_action.c

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

diff --git a/release/scripts/startup/bl_ui/space_dopesheet.py b/release/scripts/startup/bl_ui/space_dopesheet.py
index 13c3718..0b7502b 100644
--- a/release/scripts/startup/bl_ui/space_dopesheet.py
+++ b/release/scripts/startup/bl_ui/space_dopesheet.py
@@ -51,6 +51,11 @@ def dopesheet_filter(layout, context, genericFiltersOnly=False):
         row.prop(dopesheet, "show_only_matching_fcurves", text="")
         if dopesheet.show_only_matching_fcurves:
             row.prop(dopesheet, "filter_fcurve_name", text="")
+    else:
+        row = layout.row(align=True)
+        row.prop(dopesheet, "use_filter_text", text="")
+        if dopesheet.use_filter_text:
+            row.prop(dopesheet, "filter_text", text="")
 
     if not genericFiltersOnly:
         row = layout.row(align=True)
diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c
index f575326..8c598d4 100644
--- a/source/blender/editors/animation/anim_filter.c
+++ b/source/blender/editors/animation/anim_filter.c
@@ -1310,6 +1310,30 @@ static size_t animfilter_nla(bAnimContext *UNUSED(ac), ListBase *anim_data, bDop
 			if (ANIMCHANNEL_SELOK(SEL_NLT(nlt))) {
 				/* only include if this track is active */
 				if (!(filter_mode & ANIMFILTER_ACTIVE) || (nlt->flag & NLATRACK_ACTIVE)) {
+					/* name based filtering... */
+					if (((ads) && (ads->filterflag & ADS_FILTER_BY_FCU_NAME)) && (owner_id)) {
+						bool track_ok = false, strip_ok = false;
+						
+						/* check if the name of the track, or the strips it has are ok... */
+						track_ok = BLI_strcasestr(nlt->name, ads->searchstr);
+						
+						if (track_ok == false) {
+							NlaStrip *strip;
+							for (strip = nlt->strips.first; strip; strip = strip->next) {
+								if (BLI_strcasestr(strip->name, ads->searchstr)) {
+									strip_ok = true;
+									break;
+								}
+							}
+						}
+						
+						/* skip if both fail this test... */
+						if (!track_ok && !strip_ok) {
+							continue;
+						}
+					}
+					
+					/* add the track now that it has passed all our tests */
 					ANIMCHANNEL_NEW_CHANNEL(nlt, ANIMTYPE_NLATRACK, owner_id);
 				}
 			}
diff --git a/source/blender/makesrna/intern/rna_action.c b/source/blender/makesrna/intern/rna_action.c
index 3fed505..0cf2c88 100644
--- a/source/blender/makesrna/intern/rna_action.c
+++ b/source/blender/makesrna/intern/rna_action.c
@@ -331,6 +331,19 @@ static void rna_def_dopesheet(BlenderRNA *brna)
 	RNA_def_property_ui_text(prop, "F-Curve Name Filter", "F-Curve live filtering string");
 	RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
 	
+	/* NLA Name Search Settings (Shared with FCurve setting, but with different labels) */
+	prop = RNA_def_property(srna, "use_filter_text", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_sdna(prop, NULL, "filterflag", ADS_FILTER_BY_FCU_NAME);
+	RNA_def_property_ui_text(prop, "Only Matching Channels",
+	                         "Only include channels with names containing search text");
+	RNA_def_property_ui_icon(prop, ICON_VIEWZOOM, 0);
+	RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
+	
+	prop = RNA_def_property(srna, "filter_text", PROP_STRING, PROP_NONE);
+	RNA_def_property_string_sdna(prop, NULL, "searchstr");
+	RNA_def_property_ui_text(prop, "Name Filter", "Live filtering string");
+	RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
+	
 	/* NLA Specific Settings */
 	prop = RNA_def_property(srna, "show_missing_nla", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "filterflag", ADS_FILTER_NLA_NOACT);




More information about the Bf-blender-cvs mailing list