[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [59209] branches/soc-2013-ui_replay/source /blender: Custom icon shelf buttons are now context sensitive (i.e.

Vincent Akkermans vincent at ack-err.net
Sat Aug 17 14:04:59 CEST 2013


Revision: 59209
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=59209
Author:   ack-err
Date:     2013-08-17 12:04:58 +0000 (Sat, 17 Aug 2013)
Log Message:
-----------
Custom icon shelf buttons are now context sensitive (i.e. different buttons in different modes).

Modified Paths:
--------------
    branches/soc-2013-ui_replay/source/blender/editors/screen/area.c
    branches/soc-2013-ui_replay/source/blender/makesdna/DNA_screen_types.h
    branches/soc-2013-ui_replay/source/blender/windowmanager/intern/wm_operators.c

Modified: branches/soc-2013-ui_replay/source/blender/editors/screen/area.c
===================================================================
--- branches/soc-2013-ui_replay/source/blender/editors/screen/area.c	2013-08-17 11:54:23 UTC (rev 59208)
+++ branches/soc-2013-ui_replay/source/blender/editors/screen/area.c	2013-08-17 12:04:58 UTC (rev 59209)
@@ -1885,7 +1885,8 @@
 	row = uiLayoutRow(layout, TRUE);
 	
 	for (oli = ar->operators.first; oli; oli = oli->next) {
-		uiItemO(row, NULL, ICON_NONE, oli->optype_idname);
+		if (strcmp(oli->context, CTX_data_mode_string(C)) == 0)
+			uiItemO(row, NULL, ICON_NONE, oli->optype_idname);
 	}
 
 	/* draw bottom bar */

Modified: branches/soc-2013-ui_replay/source/blender/makesdna/DNA_screen_types.h
===================================================================
--- branches/soc-2013-ui_replay/source/blender/makesdna/DNA_screen_types.h	2013-08-17 11:54:23 UTC (rev 59208)
+++ branches/soc-2013-ui_replay/source/blender/makesdna/DNA_screen_types.h	2013-08-17 12:04:58 UTC (rev 59209)
@@ -165,6 +165,7 @@
 typedef struct OperatorListItem {
 	struct OperatorListItem *next, *prev;
 	char optype_idname[64];
+	char context[64];
 } OperatorListItem;
 
 

Modified: branches/soc-2013-ui_replay/source/blender/windowmanager/intern/wm_operators.c
===================================================================
--- branches/soc-2013-ui_replay/source/blender/windowmanager/intern/wm_operators.c	2013-08-17 11:54:23 UTC (rev 59208)
+++ branches/soc-2013-ui_replay/source/blender/windowmanager/intern/wm_operators.c	2013-08-17 12:04:58 UTC (rev 59209)
@@ -4262,14 +4262,16 @@
 {
 	ScrArea *sa = CTX_wm_area(C);
 	ARegion *ar = BKE_area_find_region_type(sa, RGN_TYPE_MENU_BAR);
+	
 	if (ar && arg1)
 	{
 		wmOperatorType *ot = (wmOperatorType*)arg1;
 		OperatorListItem *oli = MEM_callocN(sizeof(OperatorListItem), "add operator list item to icon shelf");
+
 		BLI_strncpy(oli->optype_idname, ot->idname, OP_MAX_TYPENAME);
+		BLI_strncpy(oli->context, CTX_data_mode_string(C), MAX_NAME);
 		
 		BLI_addtail(&ar->operators, oli);
-		
 		ED_region_tag_redraw(ar);
 	}
 }




More information about the Bf-blender-cvs mailing list