[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [37654] trunk/blender/source/blender/ editors/space_sequencer/sequencer_add.c: fix [#27700] Add effect strip ignore channel argument

Campbell Barton ideasman42 at gmail.com
Mon Jun 20 06:09:35 CEST 2011


Revision: 37654
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=37654
Author:   campbellbarton
Date:     2011-06-20 04:09:33 +0000 (Mon, 20 Jun 2011)
Log Message:
-----------
fix [#27700] Add effect strip ignore channel argument

Modified Paths:
--------------
    trunk/blender/source/blender/editors/space_sequencer/sequencer_add.c

Modified: trunk/blender/source/blender/editors/space_sequencer/sequencer_add.c
===================================================================
--- trunk/blender/source/blender/editors/space_sequencer/sequencer_add.c	2011-06-20 03:37:41 UTC (rev 37653)
+++ trunk/blender/source/blender/editors/space_sequencer/sequencer_add.c	2011-06-20 04:09:33 UTC (rev 37654)
@@ -82,6 +82,7 @@
 #define SEQPROP_ENDFRAME	(1<<1)
 #define SEQPROP_FILES		(1<<2)
 #define SEQPROP_NOPATHS		(1<<3)
+#define SEQPROP_NOCHAN		(1<<4)
 
 #define SELECT 1
 
@@ -122,8 +123,12 @@
 	float mval_v2d[2];
 	
 	UI_view2d_region_to_view(v2d, event->mval[0], event->mval[1], &mval_v2d[0], &mval_v2d[1]);
-	
-	RNA_int_set(op->ptr, "channel", (int)mval_v2d[1]+0.5f);
+
+	/* effect strips dont need a channel initialized from the mouse */
+	if(!(flag & SEQPROP_NOCHAN)) {
+		RNA_int_set(op->ptr, "channel", (int)mval_v2d[1]+0.5f);
+	}
+
 	RNA_int_set(op->ptr, "frame_start", (int)mval_v2d[0]);
 	
 	if ((flag & SEQPROP_ENDFRAME) && RNA_property_is_set(op->ptr, "frame_end")==0)
@@ -636,14 +641,16 @@
 		seq->blend_mode= SEQ_CROSS;
 	}
 
-	// XXX, this conflicts with giving a channel with invoke, perhaps we should have an active channel
-	// but for now this is much more usable
-	if(seq->seq1 || seq->seq2 || seq->seq3) {
-		int chan= MAX3(	seq->seq1 ? seq->seq1->machine : 0,
-						seq->seq2 ? seq->seq2->machine : 0,
-						seq->seq3 ? seq->seq3->machine : 0);
-		if(chan < MAXSEQ)
-			seq->machine= chan;
+	/* an unset channel is a special case where we automatically go above
+	 * the other strips. */
+	if(!RNA_property_is_set(op->ptr, "channel")) {
+		if(seq->seq1) {
+			int chan= MAX3(	seq->seq1 ? seq->seq1->machine : 0,
+							seq->seq2 ? seq->seq2->machine : 0,
+							seq->seq3 ? seq->seq3->machine : 0);
+			if(chan < MAXSEQ)
+				seq->machine= chan;
+		}
 	}
 
 	if(seq_test_overlap(ed->seqbasep, seq)) shuffle_seq(ed->seqbasep, seq, scene);
@@ -670,15 +677,31 @@
 /* add color */
 static int sequencer_add_effect_strip_invoke(bContext *C, wmOperator *op, wmEvent *event)
 {
+	short is_type_set= RNA_property_is_set(op->ptr, "type");
+	int type= -1;
+	int prop_flag= SEQPROP_ENDFRAME;
+
 	if(!ED_operator_sequencer_active(C)) {
 		BKE_report(op->reports, RPT_ERROR, "Sequencer area not active");
 		return OPERATOR_CANCELLED;
 	}
 
-	sequencer_generic_invoke_xy__internal(C, op, event, SEQPROP_ENDFRAME);
+	if(is_type_set) {
+		type= RNA_enum_get(op->ptr, "type");
 
-	if (RNA_property_is_set(op->ptr, "type") && RNA_enum_get(op->ptr, "type")==SEQ_PLUGIN) {
+		/* when invoking an effect strip which uses inputs,
+		 * skip initialzing the channel from the mouse.
+		 * Instead leave the property unset so exec() initializes it to be
+		 * above the strips its applied to. */
+		if(get_sequence_effect_num_inputs(type) != 0) {
+			prop_flag |= SEQPROP_NOCHAN;
+		}
+	}
 
+	sequencer_generic_invoke_xy__internal(C, op, event, prop_flag);
+
+	if (is_type_set && type==SEQ_PLUGIN) {
+
 		if(!RNA_property_is_set(op->ptr, "relative_path"))
 			RNA_boolean_set(op->ptr, "relative_path", U.flag & USER_RELPATHS);
 




More information about the Bf-blender-cvs mailing list