[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [57318] trunk/blender: Code cleanup: removed some unused UI button types

Brecht Van Lommel brechtvanlommel at pandora.be
Sun Jun 9 20:05:50 CEST 2013


Revision: 57318
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=57318
Author:   blendix
Date:     2013-06-09 18:05:50 +0000 (Sun, 09 Jun 2013)
Log Message:
-----------
Code cleanup: removed some unused UI button types

* CHARTAB: not needed anymore with improved copy/paste support and text input.
* IDPOIN: replaced by SEARCH_MENU.
* ICONROW/ICONTEXTROW: replaced by RNA enums.
* NUMABS: can use min/max limits instead.
* BUT_TOGDUAL, TOG3, TOGR, SLI: not used in 2.5 interface.

Modified Paths:
--------------
    trunk/blender/doc/guides/interface_API.txt
    trunk/blender/source/blender/blenkernel/BKE_blender.h
    trunk/blender/source/blender/blenkernel/intern/blender.c
    trunk/blender/source/blender/editors/include/UI_interface.h
    trunk/blender/source/blender/editors/interface/interface.c
    trunk/blender/source/blender/editors/interface/interface_handlers.c
    trunk/blender/source/blender/editors/interface/interface_intern.h
    trunk/blender/source/blender/editors/interface/interface_regions.c
    trunk/blender/source/blender/editors/interface/interface_utils.c
    trunk/blender/source/blender/editors/interface/interface_widgets.c
    trunk/blender/source/blender/editors/mesh/editface.c
    trunk/blender/source/blender/editors/mesh/editmesh_extrude.c

Modified: trunk/blender/doc/guides/interface_API.txt
===================================================================
--- trunk/blender/doc/guides/interface_API.txt	2013-06-09 16:37:04 UTC (rev 57317)
+++ trunk/blender/doc/guides/interface_API.txt	2013-06-09 18:05:50 UTC (rev 57318)
@@ -19,26 +19,22 @@
 4. API for uiButton 
 4.1 UiDefBut
 	1. BUT
-	2. TOG or TOGN or TOGR
+	2. TOG or TOGN
 	   TOG|BIT|<nr>
-	3. TOG3|BIT|<nr>
-	4. ROW
-	5. SLI or NUMSLI or HSVSLI
-	6. NUM
-	7. TEX
-	8. LABEL
-	9  SEPR
-	10. MENU
-	11.	COL
+	3. ROW
+	4. NUMSLI or HSVSLI
+	5. NUM
+	6. TEX
+	7. LABEL
+	8  SEPR
+	9. MENU
+	10.	COL
 4.2 Icon buttons
-	12. ICONROW
-	13. ICONTEXTROW
 4.3 pulldown menus / block buttons
 	14. BLOCK
 4.4 specials
 	15. KEYEVT
 	16. LINK and INLINK
-	17. IDPOIN
 4.5 uiButton control fuctions
 
 
@@ -289,55 +285,49 @@
 	Activation button. (like "Render")
 	Passing on a pointer is not needed
 	
-2. TOG or TOGN or TOGR
+2. TOG or TOGN
 	Toggle button (like "Lock")
 	The pointer value is set either at 0 or 1
 	If pressed, it calls the optional function with arguments provided.
 	Type TOGN: works negative, when pressed it sets at 0
-	Type TOGR: is part of a row, redraws automatically all buttons with same *poin
 
 	"|BIT|<nr>"
 	When added to type, it works on a single bit <nr> (lowest order bit: nr = '0')
 
-3. TOG3|BIT|<nr>
-	A toggle with 3 values!
-	Can be only used for short *poin.
-	In the third toggle setting, the bit <nr> of *( poin+1) is set.
-	
-4. ROW
+3. ROW
 	Button that's part of a row. 
 	in "min" you set a row-id number, in "max" the value you want *poin to be
 	assigned when you press the button. Always pass on these values as floats.
 	When this button is pressed, it sets the "max" value to *poin, and redraws
 	all buttons with the same row-id number.
 
-5. SLI or NUMSLI or HSVSLI
-	Slider, number-slider or hsv-slider button.
+4. NUMSLI or HSVSLI
+	Number-slider or hsv-slider button.
 	"min" and "max" are to clamp the value to.
 	If you want a button type "Col" to be updated, make 'a1' equal to 'retval'
 	from the COL button.
 	
-6. NUM
+5. NUM
 	Number button
 	Set the clamping values 'min' and 'max' always as float.
 	For UiDefButF, set a 'step' in 'a1', in 1/100's. The step value is the increment or
 	decrement when you click once on the right or left side of a button.
 	The optional button function is additionally called for each change of the *poin value.
 	
-7. TEX
+6. TEX
 	Text string button.
 	Pointertype is standard a char. Value 'max' is length of string (pass as float).
 	When button is left with ESC, it doesn't put the 'retval' at the queue.
 	
-8. LABEL
+7. LABEL
 	Label button.
 	Only displays text. 
 	If 'min' is set at 1.0, the text is printed in white.
 	
-9  SEPR
+8  SEPR
 	A separator line, typically used within pulldown menus.
 	
-10. MENU
+9. MENU
 	Menu button.
 	The syntax of the string in *name defines the menu items:
 		- %t means the previous text becomes the title
@@ -346,7 +336,7 @@
 			without returnvalues, the first item gets value 0 (incl. title!)
 	Example: "Do something %t| turn left %2| turn right %1| nothing %0"
 	
-11.	COLOR
+10.	COLOR
 	A special button that only visualizes a RGB value
 	In 'retval' you can put a code, which is used to identify for sliders if it needs
 	redraws while using the sliders. Check button '5'.
@@ -371,20 +361,7 @@
 
 	Same again, but now with an icon and string as button name.
 
-Two special icon buttons are available in Blender:
 
-12. ICONROW
-	(uiDefIconBut)
-	This button pops up a vertical menu with a row of icons to choose from.
-	'max' = amount of icons. The icons are supposed to be ordered in a sequence
-	It writes in *poin which item in the menu was choosen (starting with 0).
-
-13. ICONTEXTROW
-	(uiDefIconTextBut)
-	Same as previous, but with the texts next to it.
-
-
-
 -----------4.3 pulldown menus / block buttons
 
 14. BLOCK
@@ -465,37 +442,6 @@
 	
 
 
-17. IDPOIN
-void uiDefIDPoinBut(uiBlock *block, uiIDPoinFuncFP func, int retval, char *str, 
-			short x1, short y1, short x2, short y2, void *idpp, char *tip)
-
-	The ID struct is a generic part in structs like Object, Material, Mesh, etc.
-	Most linking options in Blender happens using ID's. (Mesh -> Material).
-	
-	This special button in Blender visualizes an ID pointer with its name. Typing in
-	a new name, changes the pointer. For most ID types in Blender functions have been
-	written already, needed by this button, to check validity of names, and assign the pointer.
-	
-	(BTW: the 'void *idpp' has to be a pointer to the ID pointer!)
-
-	Example function that can be put in 'func':
-	
-	void test_scriptpoin_but(char *name, ID **idpp)
-	{
-		ID *id;
-		
-		id= G.main->text.first;
-		while(id) {
-			if( strcmp(name, id->name+2)==0 ) {
-				*idpp= id;
-				return;
-			}
-			id= id->next;
-		}
-		*idpp= 0;
-	}
-
-
 ------------- 4.5 uiButton control fuctions
 
 

Modified: trunk/blender/source/blender/blenkernel/BKE_blender.h
===================================================================
--- trunk/blender/source/blender/blenkernel/BKE_blender.h	2013-06-09 16:37:04 UTC (rev 57317)
+++ trunk/blender/source/blender/blenkernel/BKE_blender.h	2013-06-09 18:05:50 UTC (rev 57318)
@@ -96,7 +96,6 @@
 extern void BKE_undo_name(struct bContext *C, const char *name);
 extern int BKE_undo_valid(const char *name);
 extern void BKE_reset_undo(void);
-extern char *BKE_undo_menu_string(void);
 extern void BKE_undo_number(struct bContext *C, int nr);
 extern const char *BKE_undo_get_name(int nr, int *active);
 extern int BKE_undo_save_file(const char *filename);

Modified: trunk/blender/source/blender/blenkernel/intern/blender.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/blender.c	2013-06-09 16:37:04 UTC (rev 57317)
+++ trunk/blender/source/blender/blenkernel/intern/blender.c	2013-06-09 18:05:50 UTC (rev 57318)
@@ -792,25 +792,6 @@
 	return NULL;
 }
 
-char *BKE_undo_menu_string(void)
-{
-	UndoElem *uel;
-	DynStr *ds = BLI_dynstr_new();
-	char *menu;
-
-	BLI_dynstr_append(ds, "Global Undo History %t");
-	
-	for (uel = undobase.first; uel; uel = uel->next) {
-		BLI_dynstr_append(ds, "|");
-		BLI_dynstr_append(ds, uel->name);
-	}
-
-	menu = BLI_dynstr_get_cstring(ds);
-	BLI_dynstr_free(ds);
-
-	return menu;
-}
-
 /* saves .blend using undo buffer, returns 1 == success */
 int BKE_undo_save_file(const char *filename)
 {

Modified: trunk/blender/source/blender/editors/include/UI_interface.h
===================================================================
--- trunk/blender/source/blender/editors/include/UI_interface.h	2013-06-09 16:37:04 UTC (rev 57317)
+++ trunk/blender/source/blender/editors/include/UI_interface.h	2013-06-09 18:05:50 UTC (rev 57318)
@@ -210,20 +210,14 @@
 	BUT           = (1 << 9),
 	ROW           = (2 << 9),
 	TOG           = (3 << 9),
-	SLI           = (4 << 9),
 	NUM           = (5 << 9),
 	TEX           = (6 << 9),
-	TOG3          = (7 << 9),
-	TOGR          = (8 << 9),
 	TOGN          = (9 << 9),
 	LABEL         = (10 << 9),
 	MENU          = (11 << 9),  /* Dropdown list, actually! */
-	ICONROW       = (12 << 9),
 	ICONTOG       = (13 << 9),
 	NUMSLI        = (14 << 9),
 	COLOR         = (15 << 9),
-	IDPOIN        = (16 << 9),
-	/* HSVSLI     = (17 << 9), */  /* UNUSED */
 	SCROLL        = (18 << 9),
 	BLOCK         = (19 << 9),
 	BUTM          = (20 << 9),
@@ -231,18 +225,13 @@
 	LINK          = (22 << 9),
 	INLINK        = (23 << 9),
 	KEYEVT        = (24 << 9),
-	ICONTEXTROW   = (25 << 9),
 	HSVCUBE       = (26 << 9),
 	PULLDOWN      = (27 << 9),  /* Menu, actually! */
 	ROUNDBOX      = (28 << 9),
-	CHARTAB       = (29 << 9),
 	BUT_COLORBAND = (30 << 9),
 	BUT_NORMAL    = (31 << 9),
 	BUT_CURVE     = (32 << 9),
-	BUT_TOGDUAL   = (33 << 9),
 	ICONTOGN      = (34 << 9),
-	/* FTPREVIEW  = (35 << 9), */  /* UNUSED */
-	NUMABS        = (36 << 9),
 	TOGBUT        = (37 << 9),
 	OPTION        = (38 << 9),
 	OPTIONN       = (39 << 9),
@@ -560,7 +549,6 @@
 /* Special Buttons
  *
  * Buttons with a more specific purpose:
- * - IDPoinBut: for creating buttons that work on a pointer to an ID block.
  * - MenuBut: buttons that popup a menu (in headers usually).
  * - PulldownBut: like MenuBut, but creating a uiBlock (for compatibility).
  * - BlockBut: buttons that popup a block with more buttons.
@@ -582,12 +570,6 @@
 #define UI_ID_PREVIEWS      2048
 #define UI_ID_FULL          (UI_ID_RENAME | UI_ID_BROWSE | UI_ID_ADD_NEW | UI_ID_OPEN | UI_ID_ALONE | UI_ID_DELETE | UI_ID_LOCAL)
 
-typedef void (*uiIDPoinFuncFP)(struct bContext *C, const char *str, struct ID **idpp);
-typedef void (*uiIDPoinFunc)(struct bContext *C, struct ID *id, int event);
-
-uiBut *uiDefIDPoinBut(uiBlock *block, uiIDPoinFuncFP func, short blocktype, int retval, const char *str,
-                      int x, int y, short width, short height, void *idpp, const char *tip);
-
 int uiIconFromID(struct ID *id);
 
 uiBut *uiDefPulldownBut(uiBlock *block, uiBlockCreateFunc func, void *arg, const char *str, int x, int y, short width, short height, const char *tip);

Modified: trunk/blender/source/blender/editors/interface/interface.c
===================================================================
--- trunk/blender/source/blender/editors/interface/interface.c	2013-06-09 16:37:04 UTC (rev 57317)
+++ trunk/blender/source/blender/editors/interface/interface.c	2013-06-09 18:05:50 UTC (rev 57318)
@@ -1140,9 +1140,6 @@
 				break;
 			case TOGBUT:
 			case TOG:
-			case TOGR:
-			case TOG3:
-			case BUT_TOGDUAL:
 			case ICONTOG:
 			case OPTION:
 				UI_GET_BUT_VALUE_INIT(but, *value);
@@ -1420,7 +1417,7 @@
 
 bool ui_is_but_bool(uiBut *but)
 {
-	if (ELEM5(but->type, TOG, TOGN, TOGR, ICONTOG, ICONTOGN))
+	if (ELEM4(but->type, TOG, TOGN, ICONTOG, ICONTOGN))
 		return true;
 
 	if (but->rnaprop && RNA_property_type(but->rnaprop) == PROP_BOOLEAN)
@@ -1620,8 +1617,6 @@
 {
 	if (ELEM3(but->type, TEX, SEARCH_MENU, SEARCH_MENU_UNLINK))
 		return but->hardmax;
-	else if (but->type == IDPOIN)
-		return MAX_ID_NAME - 2;
 	else
 		return UI_MAX_DRAW_STR;
 }
@@ -1716,7 +1711,7 @@
  */
 void ui_get_but_string_ex(uiBut *but, char *str, const size_t maxlen, const int float_precision)
 {
-	if (but->rnaprop && ELEM4(but->type, TEX, IDPOIN, SEARCH_MENU, SEARCH_MENU_UNLINK)) {
+	if (but->rnaprop && ELEM3(but->type, TEX, SEARCH_MENU, SEARCH_MENU_UNLINK)) {
 		PropertyType type;
 		const char *buf = NULL;
 		int buf_len;
@@ -1753,18 +1748,6 @@
 			MEM_freeN((void *)buf);
 		}
 	}

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list