[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [48536] trunk/blender/source/blender: Fix for the "black F-Curves" bug on undo

Joshua Leung aligorith at gmail.com
Tue Jul 3 15:47:20 CEST 2012


Revision: 48536
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=48536
Author:   aligorith
Date:     2012-07-03 13:47:13 +0000 (Tue, 03 Jul 2012)
Log Message:
-----------
Fix for the "black F-Curves" bug on undo
(From personal stash of bugs - since early 2.5 versions)

F-Curve colors get applied only on Graph Editor "refresh()". In some cases, undo
was reverting back to a state where the colors had not yet been set. In these
cases, there would be no refresh() after that undo (until expanding a channel or
some other similar action), resulting in "black F-Curves" appearing. So, now we
force such an update after undo to ensure that the curves never display black.

(Noticed while investigating another bug for Mango related to
CLIP_OT_constraint_to_fcurve not sending notifiers required when new F-Curves
are added)

Modified Paths:
--------------
    trunk/blender/source/blender/blenloader/intern/readfile.c
    trunk/blender/source/blender/editors/space_graph/space_graph.c

Modified: trunk/blender/source/blender/blenloader/intern/readfile.c
===================================================================
--- trunk/blender/source/blender/blenloader/intern/readfile.c	2012-07-03 13:24:13 UTC (rev 48535)
+++ trunk/blender/source/blender/blenloader/intern/readfile.c	2012-07-03 13:47:13 UTC (rev 48536)
@@ -5533,6 +5533,11 @@
 						if (ads->filter_grp)
 							ads->filter_grp = restore_pointer_by_name(newmain, (ID *)ads->filter_grp, 0);
 					}
+					
+					/* force recalc of list of channels (i.e. includes calculating F-Curve colors)
+					 * thus preventing the "black curves" problem post-undo
+					 */
+					sipo->flag |= SIPO_TEMP_NEEDCHANSYNC;
 				}
 				else if (sl->spacetype == SPACE_BUTS) {
 					SpaceButs *sbuts = (SpaceButs *)sl;
@@ -5547,10 +5552,10 @@
 					SpaceAction *saction = (SpaceAction *)sl;
 					
 					saction->action = restore_pointer_by_name(newmain, (ID *)saction->action, 1);
-					saction->ads.source= restore_pointer_by_name(newmain, (ID *)saction->ads.source, 1);
+					saction->ads.source = restore_pointer_by_name(newmain, (ID *)saction->ads.source, 1);
 					
 					if (saction->ads.filter_grp)
-						saction->ads.filter_grp= restore_pointer_by_name(newmain, (ID *)saction->ads.filter_grp, 0);
+						saction->ads.filter_grp = restore_pointer_by_name(newmain, (ID *)saction->ads.filter_grp, 0);
 						
 					
 					/* force recalc of list of channels, potentially updating the active action 

Modified: trunk/blender/source/blender/editors/space_graph/space_graph.c
===================================================================
--- trunk/blender/source/blender/editors/space_graph/space_graph.c	2012-07-03 13:24:13 UTC (rev 48535)
+++ trunk/blender/source/blender/editors/space_graph/space_graph.c	2012-07-03 13:47:13 UTC (rev 48536)
@@ -189,6 +189,8 @@
 		sipo->ads->source = (ID *)(G.main->scene.first); // FIXME: this is a really nasty hack here for now...
 	}
 	
+	/* force immediate init of any invalid F-Curve colors */
+	sipo->flag |= SIPO_TEMP_NEEDCHANSYNC;
 	ED_area_tag_refresh(sa);
 }
 
@@ -477,7 +479,13 @@
 			if (wmn->data == ND_SPACE_GRAPH)
 				ED_area_tag_redraw(sa);
 			break;
-		
+		case NC_WINDOW:
+			if (sipo->flag & SIPO_TEMP_NEEDCHANSYNC) {
+				/* force redraw/refresh after undo/redo - prevents "black curve" problem */
+				ED_area_tag_refresh(sa);
+			}
+			break;
+			
 			// XXX: restore the case below if not enough updates occur...
 			//default:
 			//	if (wmn->data==ND_KEYS)




More information about the Bf-blender-cvs mailing list