[Bf-blender-cvs] [193e77c] master: Fix T40201: Keyframe edits fail to update the viewport

Campbell Barton noreply at git.blender.org
Sun May 18 16:27:09 CEST 2014


Commit: 193e77cc673e6836525ab1a0bad0ff5491e04d23
Author: Campbell Barton
Date:   Mon May 19 00:24:45 2014 +1000
https://developer.blender.org/rB193e77cc673e6836525ab1a0bad0ff5491e04d23

Fix T40201: Keyframe edits fail to update the viewport

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

M	source/blender/blenlib/intern/listbase.c
M	source/blender/editors/animation/anim_channels_defines.c
M	source/blender/editors/animation/anim_channels_edit.c
M	source/blender/editors/animation/anim_deps.c
M	source/blender/editors/animation/keyframes_draw.c
M	source/blender/editors/animation/keyframes_edit.c
M	source/blender/editors/animation/keyframes_general.c
M	source/blender/editors/include/ED_anim_api.h
M	source/blender/editors/space_action/action_draw.c
M	source/blender/editors/space_action/action_edit.c
M	source/blender/editors/space_action/action_select.c
M	source/blender/editors/space_graph/graph_draw.c
M	source/blender/editors/space_graph/graph_edit.c
M	source/blender/editors/space_graph/graph_select.c
M	source/blender/editors/space_graph/graph_utils.c
M	source/blender/editors/space_graph/space_graph.c
M	source/blender/editors/space_nla/nla_buttons.c
M	source/blender/editors/space_nla/nla_channels.c
M	source/blender/editors/space_nla/nla_draw.c
M	source/blender/editors/space_nla/nla_edit.c
M	source/blender/editors/space_nla/nla_select.c
M	source/blender/editors/transform/transform_conversions.c
M	source/blender/editors/transform/transform_generics.c

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

diff --git a/source/blender/blenlib/intern/listbase.c b/source/blender/blenlib/intern/listbase.c
index 17e7bf8..76ad687 100644
--- a/source/blender/blenlib/intern/listbase.c
+++ b/source/blender/blenlib/intern/listbase.c
@@ -313,9 +313,8 @@ void BLI_freelist(ListBase *listbase)
 		free(link);
 		link = next;
 	}
-	
-	listbase->first = NULL;
-	listbase->last = NULL;
+
+	BLI_listbase_clear(listbase);
 }
 
 /**
@@ -331,9 +330,8 @@ void BLI_freelistN(ListBase *listbase)
 		MEM_freeN(link);
 		link = next;
 	}
-	
-	listbase->first = NULL;
-	listbase->last = NULL;
+
+	BLI_listbase_clear(listbase);
 }
 
 
diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c
index 1cd1a26..26ab4d8 100644
--- a/source/blender/editors/animation/anim_channels_defines.c
+++ b/source/blender/editors/animation/anim_channels_defines.c
@@ -3569,7 +3569,7 @@ static void achannel_setting_flush_widget_cb(bContext *C, void *ale_npoin, void
 	ANIM_flush_setting_anim_channels(&ac, &anim_data, ale_setting, setting, on);
 	
 	/* free temp data */
-	BLI_freelistN(&anim_data);
+	ANIM_animdata_freelist(&anim_data);
 }
 
 /* callback for wrapping NLA Track "solo" toggle logic */
diff --git a/source/blender/editors/animation/anim_channels_edit.c b/source/blender/editors/animation/anim_channels_edit.c
index 5d97b7b..2b85cae 100644
--- a/source/blender/editors/animation/anim_channels_edit.c
+++ b/source/blender/editors/animation/anim_channels_edit.c
@@ -184,7 +184,7 @@ void ANIM_set_active_channel(bAnimContext *ac, void *data, short datatype, int f
 	}
 	
 	/* clean up */
-	BLI_freelistN(&anim_data);
+	ANIM_animdata_freelist(&anim_data);
 }
 
 /* Deselect all animation channels 
@@ -373,7 +373,7 @@ void ANIM_deselect_anim_channels(bAnimContext *ac, void *data, short datatype, s
 	}
 	
 	/* Cleanup */
-	BLI_freelistN(&anim_data);
+	ANIM_animdata_freelist(&anim_data);
 }
 
 /* ---------------------------- Graph Editor ------------------------------------- */
@@ -1177,7 +1177,7 @@ static int animchannels_rearrange_exec(bContext *C, wmOperator *op)
 		}
 		
 		/* free temp data */
-		BLI_freelistN(&anim_data);
+		ANIM_animdata_freelist(&anim_data);
 	}
 	
 	/* send notifier that things have changed */
@@ -1290,7 +1290,7 @@ static void animchannels_group_channels(bAnimContext *ac, bAnimListElem *adt_ref
 		}
 		
 		/* cleanup */
-		BLI_freelistN(&anim_data);
+		ANIM_animdata_freelist(&anim_data);
 	}
 }
 
@@ -1321,7 +1321,7 @@ static int animchannels_group_exec(bContext *C, wmOperator *op)
 		}
 		
 		/* free temp data */
-		BLI_freelistN(&anim_data);
+		ANIM_animdata_freelist(&anim_data);
 		
 		/* updatss */
 		WM_event_add_notifier(C, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
@@ -1393,7 +1393,7 @@ static int animchannels_ungroup_exec(bContext *C, wmOperator *UNUSED(op))
 	}
 	
 	/* cleanup */
-	BLI_freelistN(&anim_data);
+	ANIM_animdata_freelist(&anim_data);
 	
 	/* updates */
 	WM_event_add_notifier(C, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
@@ -1470,7 +1470,7 @@ static int animchannels_delete_exec(bContext *C, wmOperator *UNUSED(op))
 		}
 		
 		/* cleanup */
-		BLI_freelistN(&anim_data);
+		ANIM_animdata_freelist(&anim_data);
 	}
 	
 	/* filter data */
@@ -1515,7 +1515,7 @@ static int animchannels_delete_exec(bContext *C, wmOperator *UNUSED(op))
 	}
 	
 	/* cleanup */
-	BLI_freelistN(&anim_data);
+	ANIM_animdata_freelist(&anim_data);
 	
 	/* send notifier that things have changed */
 	WM_event_add_notifier(C, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
@@ -1586,7 +1586,7 @@ static int animchannels_visibility_set_exec(bContext *C, wmOperator *UNUSED(op))
 		ANIM_flush_setting_anim_channels(&ac, &all_data, ale, ACHANNEL_SETTING_VISIBLE, 0);
 	}
 	
-	BLI_freelistN(&anim_data);
+	ANIM_animdata_freelist(&anim_data);
 	
 	/* make all the selected channels visible */
 	filter = (ANIMFILTER_SEL | ANIMFILTER_NODUPLIS);
@@ -1605,7 +1605,7 @@ static int animchannels_visibility_set_exec(bContext *C, wmOperator *UNUSED(op))
 		ANIM_flush_setting_anim_channels(&ac, &all_data, ale, ACHANNEL_SETTING_VISIBLE, 1);
 	}
 	
-	BLI_freelistN(&anim_data);
+	ANIM_animdata_freelist(&anim_data);
 	BLI_freelistN(&all_data);
 	
 	
@@ -1683,7 +1683,7 @@ static int animchannels_visibility_toggle_exec(bContext *C, wmOperator *UNUSED(o
 	}
 	
 	/* cleanup */
-	BLI_freelistN(&anim_data);
+	ANIM_animdata_freelist(&anim_data);
 	BLI_freelistN(&all_data);
 	
 	/* send notifier that things have changed */
@@ -1799,7 +1799,7 @@ static void setflag_anim_channels(bAnimContext *ac, short setting, short mode, s
 			ANIM_flush_setting_anim_channels(ac, &all_data, ale, setting, mode);
 	}
 	
-	BLI_freelistN(&anim_data);
+	ANIM_animdata_freelist(&anim_data);
 	BLI_freelistN(&all_data);
 }
 
@@ -2064,11 +2064,11 @@ static int animchannels_enable_exec(bContext *C, wmOperator *UNUSED(op))
 			fcu->driver->flag &= ~DRIVER_FLAG_INVALID;
 			
 		/* tag everything for updates - in particular, this is needed to get drivers working again */
-		ANIM_list_elem_update(ac.scene, ale);
+		ale->update |= ANIM_UPDATE_DEPS;
 	}
 	
-	/* free temp data */
-	BLI_freelistN(&anim_data);
+	ANIM_animdata_update(&ac, &anim_data);
+	ANIM_animdata_freelist(&anim_data);
 		
 	/* send notifier that things have changed */
 	WM_event_add_notifier(C, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
@@ -2228,7 +2228,7 @@ static void borderselect_anim_channels(bAnimContext *ac, rcti *rect, short selec
 	}
 	
 	/* cleanup */
-	BLI_freelistN(&anim_data);
+	ANIM_animdata_freelist(&anim_data);
 }
 
 /* ------------------- */
@@ -2312,7 +2312,7 @@ static void rename_anim_channels(bAnimContext *ac, int channel_index)
 		if (G.debug & G_DEBUG)
 			printf("Error: animation channel (index = %d) not found in rename_anim_channels()\n", channel_index);
 		
-		BLI_freelistN(&anim_data);
+		ANIM_animdata_freelist(&anim_data);
 		return;
 	}
 	
@@ -2338,7 +2338,7 @@ static void rename_anim_channels(bAnimContext *ac, int channel_index)
 	}
 	
 	/* free temp data and tag for refresh */
-	BLI_freelistN(&anim_data);
+	ANIM_animdata_freelist(&anim_data);
 	ED_region_tag_redraw(ac->ar);
 }
 
@@ -2413,7 +2413,7 @@ static int mouse_anim_channels(bContext *C, bAnimContext *ac, int channel_index,
 		if (G.debug & G_DEBUG)
 			printf("Error: animation channel (index = %d) not found in mouse_anim_channels()\n", channel_index);
 		
-		BLI_freelistN(&anim_data);
+		ANIM_animdata_freelist(&anim_data);
 		return 0;
 	}
 
@@ -2421,7 +2421,7 @@ static int mouse_anim_channels(bContext *C, bAnimContext *ac, int channel_index,
 	/* TODO: should this feature be extended to work with other channel types too? */
 	if ((selectmode == -1) && (ale->type != ANIMTYPE_GROUP)) {
 		/* normal channels should not behave normally in this case */
-		BLI_freelistN(&anim_data);
+		ANIM_animdata_freelist(&anim_data);
 		return 0;
 	}
 
@@ -2706,7 +2706,7 @@ static int mouse_anim_channels(bContext *C, bAnimContext *ac, int channel_index,
 	}
 	
 	/* free channels */
-	BLI_freelistN(&anim_data);
+	ANIM_animdata_freelist(&anim_data);
 	
 	/* return notifier flags */
 	return notifierFlags;
diff --git a/source/blender/editors/animation/anim_deps.c b/source/blender/editors/animation/anim_deps.c
index c054386..5bffdfb 100644
--- a/source/blender/editors/animation/anim_deps.c
+++ b/source/blender/editors/animation/anim_deps.c
@@ -45,6 +45,7 @@
 
 #include "BKE_animsys.h"
 #include "BKE_action.h"
+#include "BKE_fcurve.h"
 #include "BKE_context.h"
 #include "BKE_depsgraph.h"
 #include "BKE_global.h"
@@ -341,5 +342,49 @@ void ANIM_sync_animchannels_to_data(const bContext *C)
 		}
 	}
 	
-	BLI_freelistN(&anim_data);
+	ANIM_animdata_freelist(&anim_data);
+}
+
+void ANIM_animdata_update(bAnimContext *ac, ListBase *anim_data)
+{
+	bAnimListElem *ale;
+
+	if (ELEM(ac->datatype, ANIMCONT_GPENCIL, ANIMCONT_MASK))
+		return;
+
+	for (ale = anim_data->first; ale; ale = ale->next) {
+		FCurve *fcu = ale->key_data;
+
+		if (ale->update & ANIM_UPDATE_ORDER) {
+			ale->update &= ~ANIM_UPDATE_ORDER;
+			sort_time_fcurve(fcu);
+		}
+
+		if (ale->update & ANIM_UPDATE_HANDLES) {
+			ale->update &= ~ANIM_UPDATE_HANDLES;
+			calchandles_fcurve(fcu);
+		}
+
+		if (ale->update & ANIM_UPDATE_DEPS) {
+			ale->update &= ~ANIM_UPDATE_DEPS;
+			ANIM_list_elem_update(ac->scene, ale);
+		}
+
+		BLI_assert(ale->update == 0);
+	}
+}
+
+void ANIM_animdata_freelist(ListBase *anim_data)
+{
+#ifndef NDEBUG
+	bAnimListElem *ale, *ale_next;
+	for (ale = anim_data->first; ale; ale = ale_next) {
+		ale_next = ale->next;
+		BLI_assert(ale->update == 0);
+		MEM_freeN(ale);
+	}
+	BLI_listbase_clear(anim_data);
+#else
+	BLI_freelistN(anim_data);
+#endif
 }
diff --git a/source/blender/editors/animation/keyframes_draw.c b/source/blender/editors/animation/keyframes_draw.c
index e233608..c5e54cc 100644
--- a/source/blender/editors/animation/keyframes_draw.c
+++ b/source/blender/editors/animation/keyframes_draw.c
@@ -798,7 +798,7 @@ void summary_to_keylist(bAnimContext *ac, DLRBT_Tree *keys, DLRBT_Tree *blocks)
 			}
 		}
 		
-		BLI_freelistN(&anim_data);
+		ANIM_animdata_freelist(&anim_data);
 	}
 }
 
@@ -832,7 +832,7 @@ void scene_to_keylist(bDopeSheet *ads, Scene *sce, DLRBT_Tree *keys, DLRBT_Tree
 	for (ale = anim_data.first; ale; ale = ale->next)
 		fcurve_to_keylist(ale->adt, ale->data, keys, blocks);
 	
-	BLI_freelistN(&anim_data);
+	ANIM_animdata_freelist(&anim_data);
 }
 
 void ob_to_keylist(bDopeSheet *ads, Object *ob, DLRBT_Tree *keys, DLRBT_Tree *blocks)
@@ -868,7 +868,7 @@ void ob_to_keylist(bDopeSheet *ads, Object *ob, DLRBT_Tree *keys, DLRBT_Tree *bl
 	for (ale = anim_data.first; ale; ale = ale->next)
 		fcurve_to_keylist(ale->adt, ale->data, keys, blocks);
 	
-	BLI_freelistN(&anim_data);
+	ANIM_animdata_freelist(&anim_data);
 }
 
 void fcurve_to_keylist(AnimData *adt, FCurve *fcu, DLRBT_Tree *keys, DLRBT_Tree *blocks)
diff --git a/source/blender/editors/animation/keyframes_edit.c b/source/blender/editors/animation/keyframes_edit.c
index e43da75..ee50394 100644
--- a/source/blender/editors/animation/keyframes_edit.c
+++ b/source/blender/editors/animation/keyframes_edit.c
@@ -223,7 +223,7 @@ static short ob_keyframes_loop(KeyframeEditData *ked, bDopeSheet *ads, Object *o
 		}

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list