[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [21573] branches/blender2.5/blender/source /blender/editors/space_outliner: 2.5 Outliner - Restored all the 'toggle' operators

Joshua Leung aligorith at gmail.com
Tue Jul 14 14:23:08 CEST 2009


Revision: 21573
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=21573
Author:   aligorith
Date:     2009-07-14 14:23:08 +0200 (Tue, 14 Jul 2009)

Log Message:
-----------
2.5 Outliner - Restored all the 'toggle' operators

* AKEY - Toggle Outliner Selection (*1)
* Shift-AKEY - Expand/Collapse All
* RKEY - Toggle Renderability
* SKEY - Toggle Selectability
* VKEY - Toggle Visiblity

(*1) - The keymap-order of these has been swapped from the ones used in 2.4x. The old keys used here were inconsistent with the rest of Blender (at least I found myself always getting annoyed that I'd accidentally collapsed/expanded all items by hitting AKEY many times).

Modified Paths:
--------------
    branches/blender2.5/blender/source/blender/editors/space_outliner/outliner.c
    branches/blender2.5/blender/source/blender/editors/space_outliner/outliner_intern.h
    branches/blender2.5/blender/source/blender/editors/space_outliner/outliner_ops.c

Modified: branches/blender2.5/blender/source/blender/editors/space_outliner/outliner.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/space_outliner/outliner.c	2009-07-14 11:56:24 UTC (rev 21572)
+++ branches/blender2.5/blender/source/blender/editors/space_outliner/outliner.c	2009-07-14 12:23:08 UTC (rev 21573)
@@ -98,6 +98,7 @@
 #include "UI_view2d.h"
 
 #include "RNA_access.h"
+#include "RNA_define.h"
 
 #include "ED_armature.h"
 #include "ED_keyframing.h"
@@ -1445,6 +1446,8 @@
 	}
 }
 
+/* --- */
+
 void object_toggle_visibility_cb(TreeElement *te, TreeStoreElem *tsep, TreeStoreElem *tselem)
 {
 	Scene *scene= NULL;		// XXX
@@ -1456,15 +1459,36 @@
 	}
 }
 
-void outliner_toggle_visibility(Scene *scene, SpaceOops *soops)
+static int outliner_toggle_visibility_exec(bContext *C, wmOperator *op)
 {
-
+	SpaceOops *soops= (SpaceOops *)CTX_wm_space_data(C);
+	Scene *scene= CTX_data_scene(C);
+	ARegion *ar= CTX_wm_region(C);
+	
 	outliner_do_object_operation(scene, soops, &soops->tree, object_toggle_visibility_cb);
 	
-	BIF_undo_push("Outliner toggle selectability");
+	// XXX need proper notifiers here instead
+	ED_region_tag_redraw(ar);
+	
+	return OPERATOR_FINISHED;
+}
 
+void OUTLINER_OT_visibility_toggle(wmOperatorType *ot)
+{
+	/* identifiers */
+	ot->name= "Toggle Visability";
+	ot->idname= "OUTLINER_OT_visibility_toggle";
+	ot->description= "Toggle the visibility of selected items.";
+	
+	/* callbacks */
+	ot->exec= outliner_toggle_visibility_exec;
+	ot->poll= ED_operator_outliner_active;
+	
+	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
+/* --- */
+
 static void object_toggle_selectability_cb(TreeElement *te, TreeStoreElem *tsep, TreeStoreElem *tselem)
 {
 	Scene *scene= NULL; // XXX
@@ -1476,15 +1500,36 @@
 	}
 }
 
-void outliner_toggle_selectability(Scene *scene, SpaceOops *soops)
+static int outliner_toggle_selectability_exec(bContext *C, wmOperator *op)
 {
+	SpaceOops *soops= (SpaceOops *)CTX_wm_space_data(C);
+	Scene *scene= CTX_data_scene(C);
+	ARegion *ar= CTX_wm_region(C);
 	
 	outliner_do_object_operation(scene, soops, &soops->tree, object_toggle_selectability_cb);
 	
-	BIF_undo_push("Outliner toggle selectability");
+	// XXX need proper notifiers here instead
+	ED_region_tag_redraw(ar);
+	
+	return OPERATOR_FINISHED;
+}
 
+void OUTLINER_OT_selectability_toggle(wmOperatorType *ot)
+{
+	/* identifiers */
+	ot->name= "Toggle Selectability";
+	ot->idname= "OUTLINER_OT_selectability_toggle";
+	ot->description= "Toggle the selectability";
+	
+	/* callbacks */
+	ot->exec= outliner_toggle_selectability_exec;
+	ot->poll= ED_operator_outliner_active;
+	
+	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
+/* --- */
+
 void object_toggle_renderability_cb(TreeElement *te, TreeStoreElem *tsep, TreeStoreElem *tselem)
 {
 	Scene *scene= NULL;	// XXX
@@ -1496,38 +1541,102 @@
 	}
 }
 
-void outliner_toggle_renderability(Scene *scene, SpaceOops *soops)
+static int outliner_toggle_renderability_exec(bContext *C, wmOperator *op)
 {
-
+	SpaceOops *soops= (SpaceOops *)CTX_wm_space_data(C);
+	Scene *scene= CTX_data_scene(C);
+	ARegion *ar= CTX_wm_region(C);
+	
 	outliner_do_object_operation(scene, soops, &soops->tree, object_toggle_renderability_cb);
 	
-	BIF_undo_push("Outliner toggle renderability");
+	// XXX need proper notifiers here instead
+	ED_region_tag_redraw(ar);
+	
+	return OPERATOR_FINISHED;
+}
 
+void OUTLINER_OT_renderability_toggle(wmOperatorType *ot)
+{
+	/* identifiers */
+	ot->name= "Toggle Renderability";
+	ot->idname= "OUTLINER_OT_renederability_toggle";
+	ot->description= "Toggle the renderbility of selected items.";
+	
+	/* callbacks */
+	ot->exec= outliner_toggle_renderability_exec;
+	ot->poll= ED_operator_outliner_active;
+	
+	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
-void outliner_toggle_visible(SpaceOops *soops)
+/* --- */
+
+static int outliner_toggle_expanded_exec(bContext *C, wmOperator *op)
 {
+	SpaceOops *soops= (SpaceOops *)CTX_wm_space_data(C);
+	ARegion *ar= CTX_wm_region(C);
 	
-	if( outliner_has_one_flag(soops, &soops->tree, TSE_CLOSED, 1))
+	if (outliner_has_one_flag(soops, &soops->tree, TSE_CLOSED, 1))
 		outliner_set_flag(soops, &soops->tree, TSE_CLOSED, 0);
 	else 
 		outliner_set_flag(soops, &soops->tree, TSE_CLOSED, 1);
+	
+	// XXX need proper notifiers here instead
+	ED_region_tag_redraw(ar);
+	
+	return OPERATOR_FINISHED;
+}
 
-	BIF_undo_push("Outliner toggle visible");
+void OUTLINER_OT_expanded_toggle(wmOperatorType *ot)
+{
+	/* identifiers */
+	ot->name= "Expand/Collapse All";
+	ot->idname= "OUTLINER_OT_expanded_toggle";
+	ot->description= "Expand/Collapse all items.";
+	
+	/* callbacks */
+	ot->exec= outliner_toggle_expanded_exec;
+	ot->poll= ED_operator_outliner_active;
+	
+	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
-void outliner_toggle_selected(ARegion *ar, SpaceOops *soops)
+/* --- */
+
+static int outliner_toggle_selected_exec(bContext *C, wmOperator *op)
 {
+	SpaceOops *soops= (SpaceOops *)CTX_wm_space_data(C);
+	ARegion *ar= CTX_wm_region(C);
 	
-	if( outliner_has_one_flag(soops, &soops->tree, TSE_SELECTED, 1))
+	if (outliner_has_one_flag(soops, &soops->tree, TSE_SELECTED, 1))
 		outliner_set_flag(soops, &soops->tree, TSE_SELECTED, 0);
 	else 
 		outliner_set_flag(soops, &soops->tree, TSE_SELECTED, 1);
 	
-	BIF_undo_push("Outliner toggle selected");
 	soops->storeflag |= SO_TREESTORE_REDRAW;
+	
+	// XXX need proper notifiers here instead
+	ED_region_tag_redraw(ar);
+	
+	return OPERATOR_FINISHED;
 }
 
+void OUTLINER_OT_selected_toggle(wmOperatorType *ot)
+{
+	/* identifiers */
+	ot->name= "Toggle Selected";
+	ot->idname= "OUTLINER_OT_selected_toggle";
+	ot->description= "Toggle the Outliner selection of items.";
+	
+	/* callbacks */
+	ot->exec= outliner_toggle_selected_exec;
+	ot->poll= ED_operator_outliner_active;
+	
+	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+}
+
+/* --- */
+
 /* helper function for Show/Hide one level operator */
 static void outliner_openclose_level(SpaceOops *soops, ListBase *lb, int curlevel, int level, int open)
 {

Modified: branches/blender2.5/blender/source/blender/editors/space_outliner/outliner_intern.h
===================================================================
--- branches/blender2.5/blender/source/blender/editors/space_outliner/outliner_intern.h	2009-07-14 11:56:24 UTC (rev 21572)
+++ branches/blender2.5/blender/source/blender/editors/space_outliner/outliner_intern.h	2009-07-14 12:23:08 UTC (rev 21573)
@@ -120,10 +120,18 @@
 void draw_outliner(const struct bContext *C);
 
 void OUTLINER_OT_activate_click(struct wmOperatorType *ot);
+
 void OUTLINER_OT_show_one_level(struct wmOperatorType *ot);
 void OUTLINER_OT_show_active(struct wmOperatorType *ot);
 void OUTLINER_OT_show_hierarchy(struct wmOperatorType *ot);
 
+void OUTLINER_OT_selected_toggle(struct wmOperatorType *ot);
+void OUTLINER_OT_expanded_toggle(struct wmOperatorType *ot);
+
+void OUTLINER_OT_renderability_toggle(struct wmOperatorType *ot);
+void OUTLINER_OT_selectability_toggle(struct wmOperatorType *ot);
+void OUTLINER_OT_visibility_toggle(struct wmOperatorType *ot);
+
 void OUTLINER_OT_keyingset_add_selected(struct wmOperatorType *ot);
 void OUTLINER_OT_keyingset_remove_selected(struct wmOperatorType *ot);
 

Modified: branches/blender2.5/blender/source/blender/editors/space_outliner/outliner_ops.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/space_outliner/outliner_ops.c	2009-07-14 11:56:24 UTC (rev 21572)
+++ branches/blender2.5/blender/source/blender/editors/space_outliner/outliner_ops.c	2009-07-14 12:23:08 UTC (rev 21573)
@@ -33,6 +33,7 @@
 
 #include "WM_api.h"
 #include "WM_types.h"
+#include "RNA_define.h"
 #include "ED_screen.h"
 
 #include "outliner_intern.h"
@@ -49,6 +50,13 @@
 	WM_operatortype_append(OUTLINER_OT_show_active);
 	WM_operatortype_append(OUTLINER_OT_show_hierarchy);
 	
+	WM_operatortype_append(OUTLINER_OT_selected_toggle);
+	WM_operatortype_append(OUTLINER_OT_expanded_toggle);
+	
+	WM_operatortype_append(OUTLINER_OT_renderability_toggle);
+	WM_operatortype_append(OUTLINER_OT_selectability_toggle);
+	WM_operatortype_append(OUTLINER_OT_visibility_toggle);
+	
 	WM_operatortype_append(OUTLINER_OT_keyingset_add_selected);
 	WM_operatortype_append(OUTLINER_OT_keyingset_remove_selected);
 	
@@ -70,7 +78,14 @@
 	WM_keymap_add_item(keymap, "OUTLINER_OT_show_one_level", PADPLUSKEY, KM_PRESS, 0, 0); /* open */
 	RNA_boolean_set(WM_keymap_add_item(keymap, "OUTLINER_OT_show_one_level", PADMINUS, KM_PRESS, 0, 0)->ptr, "open", 0); /* close */
 	
+	WM_keymap_verify_item(keymap, "OUTLINER_OT_selected_toggle", AKEY, KM_PRESS, 0, 0);
+	WM_keymap_verify_item(keymap, "OUTLINER_OT_expanded_toggle", AKEY, KM_PRESS, KM_SHIFT, 0);
 	
+	WM_keymap_verify_item(keymap, "OUTLINER_OT_renderability_toggle", RKEY, KM_PRESS, 0, 0);
+	WM_keymap_verify_item(keymap, "OUTLINER_OT_selectability_toggle", SKEY, KM_PRESS, 0, 0);
+	WM_keymap_verify_item(keymap, "OUTLINER_OT_visibility_toggle", VKEY, KM_PRESS, 0, 0);
+	
+	
 	/* keying sets - only for databrowse */
 	WM_keymap_verify_item(keymap, "OUTLINER_OT_keyingset_add_selected", KKEY, KM_PRESS, 0, 0);
 	WM_keymap_verify_item(keymap, "OUTLINER_OT_keyingset_remove_selected", KKEY, KM_PRESS, KM_ALT, 0);





More information about the Bf-blender-cvs mailing list