diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-04-02 14:48:11 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-04-02 14:48:11 +0400 |
commit | 37bf7dd98a494c1dd80459aa017bb796f699261b (patch) | |
tree | 81e5ff2c24c074b0d64e88b37e186496a81e6a8d /source/blender/editors/util/ed_util.c | |
parent | 932820499a2a012cc0bb7df7ae4f7a8275d2944f (diff) |
draw helper lines for inset and bevel operators, the mouse distance from the selection center was used, but often it was hard to tell where this was and you'd have to guess.
adds ED_region_draw_mouse_line_cb() generic draw callback for mouse helper lines.
Diffstat (limited to 'source/blender/editors/util/ed_util.c')
-rw-r--r-- | source/blender/editors/util/ed_util.c | 26 |
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); +} |