[Bf-blender-cvs] [976e591] master: Cleanup: Completely replace/remove uiBut.lock

Julian Eisel noreply at git.blender.org
Mon Sep 19 01:51:21 CEST 2016


Commit: 976e591e93dd97de2c8f5be639a78c22e6505bae
Author: Julian Eisel
Date:   Mon Sep 19 01:49:17 2016 +0200
Branches: master
https://developer.blender.org/rB976e591e93dd97de2c8f5be639a78c22e6505bae

Cleanup: Completely replace/remove uiBut.lock

Old leftover from pre 2.5 days. Now handled through UI_BUT_DISABLED button flag.

===================================================================

M	source/blender/editors/interface/interface.c
M	source/blender/editors/interface/interface_handlers.c
M	source/blender/editors/interface/interface_intern.h
M	source/blender/editors/interface/interface_layout.c
M	source/blender/editors/interface/interface_regions.c

===================================================================

diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c
index cbe8654..6d4c8f0 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -1247,7 +1247,6 @@ void UI_block_end_ex(const bContext *C, uiBlock *block, const int xy[2])
 
 			if (ot == NULL || WM_operator_poll_context((bContext *)C, ot, but->opcontext) == 0) {
 				but->flag |= UI_BUT_DISABLED;
-				but->lock = true;
 			}
 
 			if (but->context)
@@ -3122,7 +3121,6 @@ static uiBut *ui_def_but(
 	but->a2 = a2;
 	but->tip = tip;
 
-	but->lock = block->lock;
 	but->lockstr = block->lockstr;
 	but->dt = block->dt;
 	but->pie_dir = UI_RADIAL_NONE;
@@ -3171,10 +3169,8 @@ static uiBut *ui_def_but(
 
 	but->drawflag |= (block->flag & UI_BUT_ALIGN);
 
-	if (but->lock == true) {
-		if (but->lockstr) {
-			but->flag |= UI_BUT_DISABLED;
-		}
+	if (block->lock == true) {
+		but->flag |= UI_BUT_DISABLED;
 	}
 
 	/* keep track of UI_interface.h */
@@ -3222,7 +3218,6 @@ void ui_def_but_icon(uiBut *but, const int icon, const int flag)
 static void ui_def_but_rna__disable(uiBut *but)
 {
 	but->flag |= UI_BUT_DISABLED;
-	but->lock = true;
 	but->lockstr = "";
 }
 
@@ -3548,7 +3543,6 @@ static uiBut *ui_def_but_operator_ptr(uiBlock *block, int type, wmOperatorType *
 
 	if (!ot) {
 		but->flag |= UI_BUT_DISABLED;
-		but->lock = true;
 		but->lockstr = "";
 	}
 
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index 4972e16..5e9fc53 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -2248,7 +2248,7 @@ static void ui_but_copy_paste(bContext *C, uiBut *but, uiHandleButtonData *data,
 	bool buf_paste_alloc = false;
 	bool show_report = false;  /* use to display errors parsing paste input */
 
-	if (mode == 'v' && but->lock  == true) {
+	if (mode == 'v' && (but->flag & UI_BUT_DISABLED)) {
 		return;
 	}
 
@@ -7100,8 +7100,7 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, const wmEvent *
 
 	/* verify if we can edit this button */
 	if (ELEM(event->type, LEFTMOUSE, RETKEY)) {
-		/* this should become disabled button .. */
-		if (but->lock == true) {
+		if (but->flag & UI_BUT_DISABLED) {
 			if (but->lockstr) {
 				WM_report(RPT_INFO, but->lockstr);
 				button_activate_state(C, but, BUTTON_STATE_EXIT);
diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h
index 8336efa..c274210 100644
--- a/source/blender/editors/interface/interface_intern.h
+++ b/source/blender/editors/interface/interface_intern.h
@@ -274,7 +274,6 @@ struct uiBut {
 	const char *lockstr;
 
 	BIFIconID icon;
-	bool lock;
 	char dt; /* drawtype: UI_EMBOSS, UI_EMBOSS_NONE ... etc, copied from the block */
 	signed char pie_dir; /* direction in a pie menu, used for collision detection (RadialDirection) */
 	char changed; /* could be made into a single flag */
diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c
index e802cf8..672bd74 100644
--- a/source/blender/editors/interface/interface_layout.c
+++ b/source/blender/editors/interface/interface_layout.c
@@ -745,7 +745,6 @@ static void ui_item_disabled(uiLayout *layout, const char *name)
 
 	but = uiDefBut(block, UI_BTYPE_LABEL, 0, name, 0, 0, w, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");
 	but->flag |= UI_BUT_DISABLED;
-	but->lock = true;
 	but->lockstr = "";
 }
 
diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c
index 7a506c5..8073fb3 100644
--- a/source/blender/editors/interface/interface_regions.c
+++ b/source/blender/editors/interface/interface_regions.c
@@ -456,7 +456,7 @@ static uiTooltipData *ui_tooltip_data_from_button(bContext *C, uiBut *but)
 	}
 
 	/* button is disabled, we may be able to tell user why */
-	if ((but->flag & UI_BUT_DISABLED) || but->lock) {
+	if (but->flag & UI_BUT_DISABLED) {
 		const char *disabled_msg = NULL;
 
 		/* if operator poll check failed, it can give pretty precise info why */




More information about the Bf-blender-cvs mailing list