[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [46939] trunk/blender: Finish changes in up/down arrows for menus

Sergey Sharybin sergey.vfx at gmail.com
Wed May 23 16:24:41 CEST 2012


Revision: 46939
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=46939
Author:   nazgul
Date:     2012-05-23 14:24:40 +0000 (Wed, 23 May 2012)
Log Message:
-----------
Finish changes in up/down arrows for menus

Restored single triangle for special menus, which still isn't perfect but
probably makes more sense.

Added drawflag bit flags to button, which is currently used to declare, that
button need to have up/down arrows. This is needed because it's tricky to
distinguish if button should have such arrows. For example, ID search buttons
is a simple block button which doesn't directly mean it'll have pop-up menu
and not all buttons which cases pop-up menu to display need to have such
arrows.

So currently only ID selector button is forcing up/down arrows to be displayed,
all the rest buttons now behaves in the same way as it used to be before.

Modified Paths:
--------------
    trunk/blender/release/scripts/startup/bl_ui/properties_data_armature.py
    trunk/blender/release/scripts/startup/bl_ui/properties_data_mesh.py
    trunk/blender/release/scripts/startup/bl_ui/properties_material.py
    trunk/blender/release/scripts/startup/bl_ui/properties_texture.py
    trunk/blender/source/blender/editors/include/UI_interface.h
    trunk/blender/source/blender/editors/interface/interface.c
    trunk/blender/source/blender/editors/interface/interface_intern.h
    trunk/blender/source/blender/editors/interface/interface_templates.c
    trunk/blender/source/blender/editors/interface/interface_widgets.c

Modified: trunk/blender/release/scripts/startup/bl_ui/properties_data_armature.py
===================================================================
--- trunk/blender/release/scripts/startup/bl_ui/properties_data_armature.py	2012-05-23 14:13:47 UTC (rev 46938)
+++ trunk/blender/release/scripts/startup/bl_ui/properties_data_armature.py	2012-05-23 14:24:40 UTC (rev 46939)
@@ -130,7 +130,7 @@
         col.active = (ob.proxy is None)
         col.operator("pose.group_add", icon='ZOOMIN', text="")
         col.operator("pose.group_remove", icon='ZOOMOUT', text="")
-        col.menu("DATA_PT_bone_group_specials", icon='BLANK1', text="")
+        col.menu("DATA_PT_bone_group_specials", icon='DOWNARROW_HLT', text="")
         if group:
             col.separator()
             col.operator("pose.group_move", icon='TRIA_UP', text="").direction = 'UP'

Modified: trunk/blender/release/scripts/startup/bl_ui/properties_data_mesh.py
===================================================================
--- trunk/blender/release/scripts/startup/bl_ui/properties_data_mesh.py	2012-05-23 14:13:47 UTC (rev 46938)
+++ trunk/blender/release/scripts/startup/bl_ui/properties_data_mesh.py	2012-05-23 14:24:40 UTC (rev 46939)
@@ -149,7 +149,7 @@
         col = row.column(align=True)
         col.operator("object.vertex_group_add", icon='ZOOMIN', text="")
         col.operator("object.vertex_group_remove", icon='ZOOMOUT', text="")
-        col.menu("MESH_MT_vertex_group_specials", icon='BLANK1', text="")
+        col.menu("MESH_MT_vertex_group_specials", icon='DOWNARROW_HLT', text="")
         if group:
             col.operator("object.vertex_group_move", icon='TRIA_UP', text="").direction = 'UP'
             col.operator("object.vertex_group_move", icon='TRIA_DOWN', text="").direction = 'DOWN'
@@ -208,7 +208,7 @@
         sub = col.column(align=True)
         sub.operator("object.shape_key_add", icon='ZOOMIN', text="").from_mix = False
         sub.operator("object.shape_key_remove", icon='ZOOMOUT', text="")
-        sub.menu("MESH_MT_shape_key_specials", icon='BLANK1', text="")
+        sub.menu("MESH_MT_shape_key_specials", icon='DOWNARROW_HLT', text="")
 
         if kb:
             col.separator()

Modified: trunk/blender/release/scripts/startup/bl_ui/properties_material.py
===================================================================
--- trunk/blender/release/scripts/startup/bl_ui/properties_material.py	2012-05-23 14:13:47 UTC (rev 46938)
+++ trunk/blender/release/scripts/startup/bl_ui/properties_material.py	2012-05-23 14:24:40 UTC (rev 46939)
@@ -110,7 +110,7 @@
             col.operator("object.material_slot_add", icon='ZOOMIN', text="")
             col.operator("object.material_slot_remove", icon='ZOOMOUT', text="")
 
-            col.menu("MATERIAL_MT_specials", icon='BLANK1', text="")
+            col.menu("MATERIAL_MT_specials", icon='DOWNARROW_HLT', text="")
 
             if ob.mode == 'EDIT':
                 row = layout.row(align=True)

Modified: trunk/blender/release/scripts/startup/bl_ui/properties_texture.py
===================================================================
--- trunk/blender/release/scripts/startup/bl_ui/properties_texture.py	2012-05-23 14:13:47 UTC (rev 46938)
+++ trunk/blender/release/scripts/startup/bl_ui/properties_texture.py	2012-05-23 14:24:40 UTC (rev 46939)
@@ -130,7 +130,7 @@
             col = row.column(align=True)
             col.operator("texture.slot_move", text="", icon='TRIA_UP').type = 'UP'
             col.operator("texture.slot_move", text="", icon='TRIA_DOWN').type = 'DOWN'
-            col.menu("TEXTURE_MT_specials", icon='BLANK1', text="")
+            col.menu("TEXTURE_MT_specials", icon='DOWNARROW_HLT', text="")
 
         split = layout.split(percentage=0.65)
         col = split.column()
@@ -511,7 +511,7 @@
 
         row = layout.row()
         row.prop(env, "source", expand=True)
-        row.menu("TEXTURE_MT_envmap_specials", icon='BLANK1', text="")
+        row.menu("TEXTURE_MT_envmap_specials", icon='DOWNARROW_HLT', text="")
 
         if env.source == 'IMAGE_FILE':
             layout.template_ID(tex, "image", open="image.open")

Modified: trunk/blender/source/blender/editors/include/UI_interface.h
===================================================================
--- trunk/blender/source/blender/editors/include/UI_interface.h	2012-05-23 14:13:47 UTC (rev 46938)
+++ trunk/blender/source/blender/editors/include/UI_interface.h	2012-05-23 14:24:40 UTC (rev 46939)
@@ -171,6 +171,9 @@
 #define UI_PANEL_WIDTH          340
 #define UI_COMPACT_PANEL_WIDTH  160
 
+/* uiBut->drawflag */
+#define UI_BUT_DRAW_ENUM_ARROWS    (1 << 0) /* draw enum-like up/down arrows for button */
+
 /* scale fixed button widths by this to account for DPI
  * 8.4852 == sqrtf(72.0f)) */
 #define UI_DPI_FAC (sqrtf((float)U.dpi) / 8.48528137423857f)
@@ -427,6 +430,9 @@
 void    uiButSetFlag(uiBut *but, int flag);
 void    uiButClearFlag(uiBut *but, int flag);
 
+void    uiButSetDrawFlag(uiBut *but, int flag);
+void    uiButClearDrawFlag(uiBut *but, int flag);
+
 /* special button case, only draw it when used actively, for outliner etc */
 int     uiButActiveOnly(const struct bContext *C, uiBlock *block, uiBut *but);
 

Modified: trunk/blender/source/blender/editors/interface/interface.c
===================================================================
--- trunk/blender/source/blender/editors/interface/interface.c	2012-05-23 14:13:47 UTC (rev 46938)
+++ trunk/blender/source/blender/editors/interface/interface.c	2012-05-23 14:24:40 UTC (rev 46939)
@@ -3356,6 +3356,16 @@
 	but->flag &= ~flag;
 }
 
+void uiButSetDrawFlag(uiBut *but, int flag)
+{
+	but->drawflag |= flag;
+}
+
+void uiButClearDrawFlag(uiBut *but, int flag)
+{
+	but->drawflag &= ~flag;
+}
+
 int uiButGetRetVal(uiBut *but)
 {
 	return but->retval;

Modified: trunk/blender/source/blender/editors/interface/interface_intern.h
===================================================================
--- trunk/blender/source/blender/editors/interface/interface_intern.h	2012-05-23 14:13:47 UTC (rev 46938)
+++ trunk/blender/source/blender/editors/interface/interface_intern.h	2012-05-23 14:24:40 UTC (rev 46939)
@@ -150,7 +150,7 @@
 
 struct uiBut {
 	struct uiBut *next, *prev;
-	int flag;
+	int flag, drawflag;
 	short type, pointype, bit, bitnr, retval, strwidth, ofs, pos, selsta, selend, alignnr;
 	short pad1;
 

Modified: trunk/blender/source/blender/editors/interface/interface_templates.c
===================================================================
--- trunk/blender/source/blender/editors/interface/interface_templates.c	2012-05-23 14:13:47 UTC (rev 46938)
+++ trunk/blender/source/blender/editors/interface/interface_templates.c	2012-05-23 14:24:40 UTC (rev 46939)
@@ -376,6 +376,9 @@
 	else if (flag & UI_ID_BROWSE) {
 		but = uiDefBlockButN(block, id_search_menu, MEM_dupallocN(template), "", 0, 0, UI_UNIT_X * 1.6, UI_UNIT_Y,
 		                     TIP_(template_id_browse_tip(type)));
+
+		uiButSetDrawFlag(but, UI_BUT_DRAW_ENUM_ARROWS);
+
 		if (type) {
 			but->icon = RNA_struct_ui_icon(type);
 			/* default dragging of icon for id browse buttons */

Modified: trunk/blender/source/blender/editors/interface/interface_widgets.c
===================================================================
--- trunk/blender/source/blender/editors/interface/interface_widgets.c	2012-05-23 14:13:47 UTC (rev 46938)
+++ trunk/blender/source/blender/editors/interface/interface_widgets.c	2012-05-23 14:24:40 UTC (rev 46939)
@@ -3136,10 +3136,10 @@
 
 				/* no text, with icon */
 				else if (!but->str[0] && but->icon) {
-					if (but->flag & UI_ICON_PREVIEW)
+					if (but->drawflag & UI_BUT_DRAW_ENUM_ARROWS)
+						wt = widget_type(UI_WTYPE_MENU_RADIO);  /* with arrows */
+					else
 						wt = widget_type(UI_WTYPE_MENU_ICON_RADIO); /* no arrows */
-					else
-						wt = widget_type(UI_WTYPE_MENU_RADIO);  /* with arrows */
 				}
 				/* with menu arrows */
 				else




More information about the Bf-blender-cvs mailing list