Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/editors/util/ed_util.c')
-rw-r--r--source/blender/editors/util/ed_util.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/source/blender/editors/util/ed_util.c b/source/blender/editors/util/ed_util.c
index 73062c57526..7e14e8cf2a3 100644
--- a/source/blender/editors/util/ed_util.c
+++ b/source/blender/editors/util/ed_util.c
@@ -37,11 +37,15 @@
#include "DNA_mesh_types.h"
#include "DNA_object_types.h"
+#include "DNA_screen_types.h"
#include "DNA_scene_types.h"
#include "DNA_packedFile_types.h"
#include "BLI_blenlib.h"
+#include "BIF_gl.h"
+#include "BIF_glutil.h"
+
#include "BLF_translation.h"
#include "BKE_context.h"
@@ -54,6 +58,7 @@
#include "ED_mesh.h"
#include "ED_object.h"
#include "ED_sculpt.h"
+#include "ED_space_api.h"
#include "ED_util.h"
#include "UI_interface.h"
@@ -255,3 +260,24 @@ void unpack_menu(bContext *C, const char *opname, const char *id_name, const cha
uiPupMenuEnd(C, pup);
}
+
+/* ********************* generic callbacks for drawcall api *********************** */
+
+/**
+ * Callback that draws a line between the mouse and a position given as the initial argument.
+ */
+void ED_region_draw_mouse_line_cb(const bContext *C, ARegion *ar, void *arg_info)
+{
+ wmWindow *win = CTX_wm_window(C);
+ const int *mval_src = (int *)arg_info;
+ const int mval_dst[2] = {win->eventstate->x - ar->winrct.xmin,
+ win->eventstate->y - ar->winrct.ymin};
+
+ UI_ThemeColor(TH_WIRE);
+ setlinestyle(3);
+ glBegin(GL_LINE_STRIP);
+ glVertex2iv(mval_dst);
+ glVertex2iv(mval_src);
+ glEnd();
+ setlinestyle(0);
+}