[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [43366] trunk/blender: make sequencer use standard select operator with action property, remove select_inverse operator.

Campbell Barton ideasman42 at gmail.com
Sat Jan 14 08:24:13 CET 2012


Revision: 43366
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=43366
Author:   campbellbarton
Date:     2012-01-14 07:23:57 +0000 (Sat, 14 Jan 2012)
Log Message:
-----------
make sequencer use standard select operator with action property, remove select_inverse operator.

Modified Paths:
--------------
    trunk/blender/release/scripts/startup/bl_ui/space_sequencer.py
    trunk/blender/source/blender/editors/space_sequencer/sequencer_intern.h
    trunk/blender/source/blender/editors/space_sequencer/sequencer_ops.c
    trunk/blender/source/blender/editors/space_sequencer/sequencer_select.c

Modified: trunk/blender/release/scripts/startup/bl_ui/space_sequencer.py
===================================================================
--- trunk/blender/release/scripts/startup/bl_ui/space_sequencer.py	2012-01-14 06:58:03 UTC (rev 43365)
+++ trunk/blender/release/scripts/startup/bl_ui/space_sequencer.py	2012-01-14 07:23:57 UTC (rev 43366)
@@ -148,8 +148,8 @@
         layout.separator()
         layout.operator_menu_enum("object.select_grouped", "type", text="Grouped")
         layout.operator("sequencer.select_linked")
-        layout.operator("sequencer.select_all_toggle")
-        layout.operator("sequencer.select_inverse")
+        layout.operator("sequencer.select_all").action = 'TOGGLE'
+        layout.operator("sequencer.select_all").action = 'INVERT'
 
 
 class SEQUENCER_MT_marker(Menu):

Modified: trunk/blender/source/blender/editors/space_sequencer/sequencer_intern.h
===================================================================
--- trunk/blender/source/blender/editors/space_sequencer/sequencer_intern.h	2012-01-14 06:58:03 UTC (rev 43365)
+++ trunk/blender/source/blender/editors/space_sequencer/sequencer_intern.h	2012-01-14 07:23:57 UTC (rev 43366)
@@ -122,7 +122,7 @@
 void SEQUENCER_OT_view_all_preview(struct wmOperatorType *ot);
 
 /* sequencer_select.c */
-void SEQUENCER_OT_select_all_toggle(struct wmOperatorType *ot);
+void SEQUENCER_OT_select_all(struct wmOperatorType *ot);
 void SEQUENCER_OT_select(struct wmOperatorType *ot);
 void SEQUENCER_OT_select_more(struct wmOperatorType *ot);
 void SEQUENCER_OT_select_less(struct wmOperatorType *ot);

Modified: trunk/blender/source/blender/editors/space_sequencer/sequencer_ops.c
===================================================================
--- trunk/blender/source/blender/editors/space_sequencer/sequencer_ops.c	2012-01-14 06:58:03 UTC (rev 43365)
+++ trunk/blender/source/blender/editors/space_sequencer/sequencer_ops.c	2012-01-14 07:23:57 UTC (rev 43366)
@@ -92,8 +92,7 @@
 	WM_operatortype_append(SEQUENCER_OT_change_path);
 
 	/* sequencer_select.c */
-	WM_operatortype_append(SEQUENCER_OT_select_all_toggle);
-	WM_operatortype_append(SEQUENCER_OT_select_inverse);
+	WM_operatortype_append(SEQUENCER_OT_select_all);
 	WM_operatortype_append(SEQUENCER_OT_select);
 	WM_operatortype_append(SEQUENCER_OT_select_more);
 	WM_operatortype_append(SEQUENCER_OT_select_less);
@@ -133,8 +132,8 @@
 	
 	WM_keymap_add_item(keymap, "SEQUENCER_OT_properties", NKEY, KM_PRESS, 0, 0);
 	
-	WM_keymap_add_item(keymap, "SEQUENCER_OT_select_all_toggle", AKEY, KM_PRESS, 0, 0);
-	WM_keymap_add_item(keymap, "SEQUENCER_OT_select_inverse", IKEY, KM_PRESS, KM_CTRL, 0);
+	WM_keymap_add_item(keymap, "SEQUENCER_OT_select_all", AKEY, KM_PRESS, 0, 0);
+	RNA_enum_set(WM_keymap_add_item(keymap, "SEQUENCER_OT_select_all", IKEY, KM_PRESS, KM_CTRL, 0)->ptr, "action", SEL_INVERT);
 	
 	RNA_enum_set(WM_keymap_add_item(keymap, "SEQUENCER_OT_cut", KKEY, KM_PRESS, 0, 0)->ptr, "type", SEQ_CUT_SOFT);
 	RNA_enum_set(WM_keymap_add_item(keymap, "SEQUENCER_OT_cut", KKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "type", SEQ_CUT_HARD);

Modified: trunk/blender/source/blender/editors/space_sequencer/sequencer_select.c
===================================================================
--- trunk/blender/source/blender/editors/space_sequencer/sequencer_select.c	2012-01-14 06:58:03 UTC (rev 43365)
+++ trunk/blender/source/blender/editors/space_sequencer/sequencer_select.c	2012-01-14 07:23:57 UTC (rev 43366)
@@ -179,8 +179,6 @@
 	recurs_sel_seq(seq);
 }
 
-// remove this function, replace with invert operator
-//void swap_select_seq(Scene *scene)
 #if 0
 static void select_neighbor_from_last(Scene *scene, int lr)
 {
@@ -214,48 +212,65 @@
 #endif
 
 /* (de)select operator */
-static int sequencer_deselect_exec(bContext *C, wmOperator *UNUSED(op))
+static int sequencer_de_select_all_exec(bContext *C, wmOperator *op)
 {
-	Scene *scene= CTX_data_scene(C);
-	Editing *ed= seq_give_editing(scene, FALSE);
+	int action = RNA_enum_get(op->ptr, "action");
+
+	Scene *scene = CTX_data_scene(C);
+	Editing *ed = seq_give_editing(scene, FALSE);
 	Sequence *seq;
-	int desel = 0;
 
-	for(seq= ed->seqbasep->first; seq; seq=seq->next) {
-		if(seq->flag & SEQ_ALLSEL) {
-			desel= 1;
-			break;
+	if (action == SEL_TOGGLE) {
+		action = SEL_SELECT;
+		for (seq = ed->seqbasep->first; seq; seq = seq->next) {
+			if (seq->flag & SEQ_ALLSEL) {
+				action = SEL_DESELECT;
+				break;
+			}
 		}
 	}
 
-	for(seq= ed->seqbasep->first; seq; seq=seq->next) {
-		if (desel) {
-			seq->flag &= ~SEQ_ALLSEL;
+	for (seq = ed->seqbasep->first; seq; seq = seq->next) {
+		switch (action) {
+			case SEL_SELECT:
+				seq->flag &= ~(SEQ_LEFTSEL + SEQ_RIGHTSEL);
+				seq->flag |= SELECT;
+				break;
+			case SEL_DESELECT:
+				seq->flag &= ~SEQ_ALLSEL;
+				break;
+			case SEL_INVERT:
+				if (seq->flag & SEQ_ALLSEL) {
+					seq->flag &= ~SEQ_ALLSEL;
+				}
+				else {
+					seq->flag &= ~(SEQ_LEFTSEL + SEQ_RIGHTSEL);
+					seq->flag |= SELECT;
+				}
+				break;
 		}
-		else {
-			seq->flag &= ~(SEQ_LEFTSEL+SEQ_RIGHTSEL);
-			seq->flag |= SELECT;
-		}
 	}
 
-	WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER|NA_SELECTED, scene);
-	
+	WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER | NA_SELECTED, scene);
+
 	return OPERATOR_FINISHED;
 }
 
-void SEQUENCER_OT_select_all_toggle(struct wmOperatorType *ot)
+void SEQUENCER_OT_select_all(struct wmOperatorType *ot)
 {
 	/* identifiers */
 	ot->name= "Select or Deselect All";
-	ot->idname= "SEQUENCER_OT_select_all_toggle";
+	ot->idname= "SEQUENCER_OT_select_all";
 	ot->description="Select or deselect all strips";
 	
 	/* api callbacks */
-	ot->exec= sequencer_deselect_exec;
+	ot->exec= sequencer_de_select_all_exec;
 	ot->poll= sequencer_edit_poll;
 	
 	/* flags */
 	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+
+	WM_operator_properties_select_all(ot);
 }
 
 



More information about the Bf-blender-cvs mailing list