[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [32768] trunk/blender: Fix for [#24374] VSE: Reassign Inputs ignores selection order.

Janne Karhu jhkarh at gmail.com
Sat Oct 30 14:04:00 CEST 2010


Revision: 32768
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=32768
Author:   jhk
Date:     2010-10-30 14:04:00 +0200 (Sat, 30 Oct 2010)

Log Message:
-----------
Fix for [#24374] VSE: Reassign Inputs ignores selection order.
* No way currently to know the order of effect inputs, so I added a swap operator for the inputs.
* Also added the effect inputs to the strip property panel (weren't even in rna before). These are not yet editable, but can be very helpful in determining what the inputs are if the strip is too short to see the name in the timeline.

Modified Paths:
--------------
    trunk/blender/release/scripts/ui/space_sequencer.py
    trunk/blender/source/blender/editors/space_sequencer/sequencer_edit.c
    trunk/blender/source/blender/editors/space_sequencer/sequencer_intern.h
    trunk/blender/source/blender/editors/space_sequencer/sequencer_ops.c
    trunk/blender/source/blender/makesrna/intern/rna_sequencer.c

Modified: trunk/blender/release/scripts/ui/space_sequencer.py
===================================================================
--- trunk/blender/release/scripts/ui/space_sequencer.py	2010-10-30 10:19:30 UTC (rev 32767)
+++ trunk/blender/release/scripts/ui/space_sequencer.py	2010-10-30 12:04:00 UTC (rev 32768)
@@ -295,6 +295,7 @@
         layout.separator()
         layout.operator("sequencer.reload")
         layout.operator("sequencer.reassign_inputs")
+        layout.operator("sequencer.swap_inputs")
         layout.separator()
         layout.operator("sequencer.lock")
         layout.operator("sequencer.unlock")
@@ -407,6 +408,13 @@
         layout = self.layout
 
         strip = act_strip(context)
+        if strip.input_count > 0:
+            col = layout.column()
+            col.prop(strip, "input_1")
+            if strip.input_count > 1:
+                col.prop(strip, "input_2")
+            if strip.input_count > 2:
+                col.prop(strip, "input_3")
 
         if strip.type == 'COLOR':
             layout.prop(strip, "color")

Modified: trunk/blender/source/blender/editors/space_sequencer/sequencer_edit.c
===================================================================
--- trunk/blender/source/blender/editors/space_sequencer/sequencer_edit.c	2010-10-30 10:19:30 UTC (rev 32767)
+++ trunk/blender/source/blender/editors/space_sequencer/sequencer_edit.c	2010-10-30 12:04:00 UTC (rev 32768)
@@ -1498,6 +1498,43 @@
 }
 
 
+static int sequencer_swap_inputs_exec(bContext *C, wmOperator *op)
+{
+	Scene *scene= CTX_data_scene(C);
+	Sequence *seq, *last_seq = seq_active_get(scene);
+	char *error_msg;
+
+	if(last_seq->seq1==NULL || last_seq->seq2 == NULL) {
+		BKE_report(op->reports, RPT_ERROR, "No valid inputs to swap");
+		return OPERATOR_CANCELLED;
+	}
+
+	seq = last_seq->seq1;
+	last_seq->seq1 = last_seq->seq2;
+	last_seq->seq2 = seq;
+
+	update_changed_seq_and_deps(scene, last_seq, 1, 1);
+
+	WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene);
+
+	return OPERATOR_FINISHED;
+}
+void SEQUENCER_OT_swap_inputs(struct wmOperatorType *ot)
+{
+	/* identifiers */
+	ot->name= "Swap Inputs";
+	ot->idname= "SEQUENCER_OT_swap_inputs";
+	ot->description="Swap the first two inputs for the effects strip";
+
+	/* api callbacks */
+	ot->exec= sequencer_swap_inputs_exec;
+	ot->poll= sequencer_effect_poll;
+
+	/* flags */
+	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+}
+
+
 /* cut operator */
 static EnumPropertyItem prop_cut_types[] = {
 	{SEQ_CUT_SOFT, "SOFT", 0, "Soft", ""},

Modified: trunk/blender/source/blender/editors/space_sequencer/sequencer_intern.h
===================================================================
--- trunk/blender/source/blender/editors/space_sequencer/sequencer_intern.h	2010-10-30 10:19:30 UTC (rev 32767)
+++ trunk/blender/source/blender/editors/space_sequencer/sequencer_intern.h	2010-10-30 12:04:00 UTC (rev 32768)
@@ -87,6 +87,7 @@
 void SEQUENCER_OT_reload(struct wmOperatorType *ot);
 void SEQUENCER_OT_refresh_all(struct wmOperatorType *ot);
 void SEQUENCER_OT_reassign_inputs(struct wmOperatorType *ot);
+void SEQUENCER_OT_swap_inputs(struct wmOperatorType *ot);
 void SEQUENCER_OT_duplicate(struct wmOperatorType *ot);
 void SEQUENCER_OT_delete(struct wmOperatorType *ot);
 void SEQUENCER_OT_images_separate(struct wmOperatorType *ot);

Modified: trunk/blender/source/blender/editors/space_sequencer/sequencer_ops.c
===================================================================
--- trunk/blender/source/blender/editors/space_sequencer/sequencer_ops.c	2010-10-30 10:19:30 UTC (rev 32767)
+++ trunk/blender/source/blender/editors/space_sequencer/sequencer_ops.c	2010-10-30 12:04:00 UTC (rev 32768)
@@ -60,6 +60,7 @@
 	WM_operatortype_append(SEQUENCER_OT_reload);
 	WM_operatortype_append(SEQUENCER_OT_refresh_all);
 	WM_operatortype_append(SEQUENCER_OT_reassign_inputs);
+	WM_operatortype_append(SEQUENCER_OT_swap_inputs);
 	WM_operatortype_append(SEQUENCER_OT_duplicate);
 	WM_operatortype_append(SEQUENCER_OT_delete);
 	WM_operatortype_append(SEQUENCER_OT_images_separate);
@@ -169,6 +170,7 @@
 	RNA_enum_set(WM_keymap_add_item(keymap, "SEQUENCER_OT_swap", RIGHTARROWKEY, KM_PRESS, KM_ALT, 0)->ptr, "side", SEQ_SIDE_RIGHT);
 	
 	WM_keymap_add_item(keymap, "SEQUENCER_OT_snap", SKEY, KM_PRESS, KM_SHIFT, 0);
+	WM_keymap_add_item(keymap, "SEQUENCER_OT_swap_inputs", SKEY, KM_PRESS, KM_ALT, 0);
 
 	/* multicam editing keyboard layout, switch to camera 1-10 using
 	   regular number keys */

Modified: trunk/blender/source/blender/makesrna/intern/rna_sequencer.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_sequencer.c	2010-10-30 10:19:30 UTC (rev 32767)
+++ trunk/blender/source/blender/makesrna/intern/rna_sequencer.c	2010-10-30 12:04:00 UTC (rev 32768)
@@ -502,6 +502,12 @@
 }
 
 
+static int rna_Sequence_input_count_get(PointerRNA *ptr)
+{
+	Sequence *seq= (Sequence*)(ptr->data);
+
+	return get_sequence_effect_num_inputs(seq->type);
+}
 /*static void rna_SoundSequence_filename_set(PointerRNA *ptr, const char *value)
 {
 	Sequence *seq= (Sequence*)(ptr->data);
@@ -985,6 +991,24 @@
 	RNA_def_property_ui_text(prop, "Speed factor", "Multiply the current speed of the sequence with this number or remap current frame to this frame");
 	RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
 
+	/* effect strip inputs */
+
+	prop= RNA_def_property(srna, "input_count", PROP_INT, PROP_UNSIGNED);
+	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+	RNA_def_property_int_funcs(prop, "rna_Sequence_input_count_get", NULL, NULL);
+
+	prop= RNA_def_property(srna, "input_1",  PROP_POINTER, PROP_NONE);
+	RNA_def_property_pointer_sdna(prop, NULL, "seq1");
+	RNA_def_property_ui_text(prop, "Input 1", "First input for the effect strip");
+
+	prop= RNA_def_property(srna, "input_2",  PROP_POINTER, PROP_NONE);
+	RNA_def_property_pointer_sdna(prop, NULL, "seq2");
+	RNA_def_property_ui_text(prop, "Input 2", "Second input for the effect strip");
+
+	prop= RNA_def_property(srna, "input_3",  PROP_POINTER, PROP_NONE);
+	RNA_def_property_pointer_sdna(prop, NULL, "seq1");
+	RNA_def_property_ui_text(prop, "Input 3", "Third input for the effect strip");
+
 	RNA_api_sequence_strip(srna);
 }
 





More information about the Bf-blender-cvs mailing list