[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [52028] trunk/blender/source/blender: Fix crash when copying scene with sequencer' s animation using Link Objects or Link Object Data methods

Sergey Sharybin sergey.vfx at gmail.com
Fri Nov 9 08:29:29 CET 2012


Revision: 52028
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=52028
Author:   nazgul
Date:     2012-11-09 07:29:27 +0000 (Fri, 09 Nov 2012)
Log Message:
-----------
Fix crash when copying scene with sequencer's animation using Link Objects or Link Object Data methods

- Don't crash if there's any fcurves created for sequencer but no sequencer itself
- Don't copy sequencer's fcurves when copy new scene with linking data/objects method

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/intern/scene.c
    trunk/blender/source/blender/editors/animation/anim_filter.c

Modified: trunk/blender/source/blender/blenkernel/intern/scene.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/scene.c	2012-11-09 06:36:38 UTC (rev 52027)
+++ trunk/blender/source/blender/blenkernel/intern/scene.c	2012-11-09 07:29:27 UTC (rev 52028)
@@ -58,8 +58,10 @@
 
 #include "BKE_anim.h"
 #include "BKE_animsys.h"
+#include "BKE_action.h"
 #include "BKE_colortools.h"
 #include "BKE_depsgraph.h"
+#include "BKE_fcurve.h"
 #include "BKE_global.h"
 #include "BKE_group.h"
 #include "BKE_idprop.h"
@@ -115,6 +117,24 @@
 	}
 }
 
+static void remove_sequencer_fcurves(Scene *sce)
+{
+	AnimData *ad = BKE_animdata_from_id(&sce->id);
+
+	if (ad && ad->action) {
+		FCurve *fcu, *nextfcu;
+
+		for (fcu = ad->action->curves.first; fcu; fcu = nextfcu)  {
+			nextfcu = fcu->next;
+
+			if ((fcu->rna_path) && strstr(fcu->rna_path, "sequences_all")) {
+				action_groups_remove_channel(ad->action, fcu);
+				free_fcurve(fcu);
+			}
+		}
+	}
+}
+
 Scene *BKE_scene_copy(Scene *sce, int type)
 {
 	Scene *scen;
@@ -179,6 +199,10 @@
 
 		BLI_strncpy(scen->sequencer_colorspace_settings.name, sce->sequencer_colorspace_settings.name,
 		            sizeof(scen->sequencer_colorspace_settings.name));
+
+		/* remove animation used by sequencer */
+		if (type != SCE_COPY_FULL)
+			remove_sequencer_fcurves(scen);
 	}
 
 	/* tool settings */

Modified: trunk/blender/source/blender/editors/animation/anim_filter.c
===================================================================
--- trunk/blender/source/blender/editors/animation/anim_filter.c	2012-11-09 06:36:38 UTC (rev 52027)
+++ trunk/blender/source/blender/editors/animation/anim_filter.c	2012-11-09 07:29:27 UTC (rev 52028)
@@ -911,14 +911,16 @@
 		/* only consider if F-Curve involves sequence_editor.sequences */
 		if ((fcu->rna_path) && strstr(fcu->rna_path, "sequences_all")) {
 			Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
-			Sequence *seq;
+			Sequence *seq = NULL;
 			char *seq_name;
-			
-			/* get strip name, and check if this strip is selected */
-			seq_name = BLI_str_quoted_substrN(fcu->rna_path, "sequences_all[");
-			seq = BKE_sequence_get_by_name(ed->seqbasep, seq_name, FALSE);
-			if (seq_name) MEM_freeN(seq_name);
-			
+
+			if (ed) {
+				/* get strip name, and check if this strip is selected */
+				seq_name = BLI_str_quoted_substrN(fcu->rna_path, "sequences_all[");
+				seq = BKE_sequence_get_by_name(ed->seqbasep, seq_name, FALSE);
+				if (seq_name) MEM_freeN(seq_name);
+			}
+
 			/* can only add this F-Curve if it is selected */
 			if (ads->filterflag & ADS_FILTER_ONLYSEL) {
 				if ((seq == NULL) || (seq->flag & SELECT) == 0)




More information about the Bf-blender-cvs mailing list