[Bf-blender-cvs] [62ff53ff19e] blender2.8: UI: move queries into interface_query.c

Campbell Barton noreply at git.blender.org
Sat Jun 30 11:00:07 CEST 2018


Commit: 62ff53ff19e36da0203915d04fc0ce295002f173
Author: Campbell Barton
Date:   Sat Jun 30 10:58:56 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB62ff53ff19e36da0203915d04fc0ce295002f173

UI: move queries into interface_query.c

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

M	source/blender/editors/include/UI_interface.h
M	source/blender/editors/interface/interface_handlers.c
M	source/blender/editors/interface/interface_query.c

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

diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h
index 7540e6ed602..b30ae67a3bd 100644
--- a/source/blender/editors/include/UI_interface.h
+++ b/source/blender/editors/include/UI_interface.h
@@ -404,6 +404,10 @@ typedef bool (*uiMenuStepFunc)(struct bContext *C, int direction, void *arg1);
 
 
 /* interface_query.c */
+bool UI_but_is_tool(const uiBut *but);
+#define UI_but_is_decorator(but) \
+	((but)->func == ui_but_anim_decorate_cb)
+
 bool UI_block_is_empty(const uiBlock *block);
 
 
@@ -1265,8 +1269,4 @@ void UI_widgetbase_draw_cache_end(void);
 /* Support click-drag motion which presses the button and closes a popover (like a menu). */
 #define USE_UI_POPOVER_ONCE
 
-bool UI_but_is_tool(const uiBut *but);
-#define UI_but_is_decorator(but) \
-	((but)->func == ui_but_anim_decorate_cb)
-
 #endif  /* __UI_INTERFACE_H__ */
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index 893700376b0..b60042b92a6 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -467,16 +467,6 @@ void ui_pan_to_scroll(const wmEvent *event, int *type, int *val)
 	}
 }
 
-#ifdef USE_UI_POPOVER_ONCE
-bool ui_but_is_popover_once_compat(const uiBut *but)
-{
-	return (
-	        (but->type == UI_BTYPE_BUT) ||
-	        ui_but_is_toggle(but)
-	);
-}
-#endif
-
 static uiBut *ui_but_prev(uiBut *but)
 {
 	while (but->prev) {
@@ -9841,18 +9831,3 @@ void ui_but_clipboard_free(void)
 {
 	curvemapping_free_data(&but_copypaste_curve);
 }
-
-bool UI_but_is_tool(const uiBut *but)
-{
-	/* very evil! */
-	if (but->optype != NULL) {
-		static wmOperatorType *ot = NULL;
-		if (ot == NULL) {
-			ot = WM_operatortype_find("WM_OT_tool_set_by_name", false);
-		}
-		if (but->optype == ot) {
-			return true;
-		}
-	}
-	return false;
-}
diff --git a/source/blender/editors/interface/interface_query.c b/source/blender/editors/interface/interface_query.c
index 5d6d03ece60..bdd2de05ab4 100644
--- a/source/blender/editors/interface/interface_query.c
+++ b/source/blender/editors/interface/interface_query.c
@@ -32,6 +32,9 @@
 
 #include "interface_intern.h"
 
+#include "WM_api.h"
+#include "WM_types.h"
+
 /* -------------------------------------------------------------------- */
 /** \name Button (uiBut)
  * \{ */
@@ -66,6 +69,31 @@ bool ui_but_is_toggle(const uiBut *but)
 	);
 }
 
+#ifdef USE_UI_POPOVER_ONCE
+bool ui_but_is_popover_once_compat(const uiBut *but)
+{
+	return (
+	        (but->type == UI_BTYPE_BUT) ||
+	        ui_but_is_toggle(but)
+	);
+}
+#endif
+
+bool UI_but_is_tool(const uiBut *but)
+{
+	/* very evil! */
+	if (but->optype != NULL) {
+		static wmOperatorType *ot = NULL;
+		if (ot == NULL) {
+			ot = WM_operatortype_find("WM_OT_tool_set_by_name", false);
+		}
+		if (but->optype == ot) {
+			return true;
+		}
+	}
+	return false;
+}
+
 /** \} */
 
 /* -------------------------------------------------------------------- */



More information about the Bf-blender-cvs mailing list