diff options
Diffstat (limited to 'source/blender/editors/util/ed_util.c')
-rw-r--r-- | source/blender/editors/util/ed_util.c | 37 |
1 files changed, 26 insertions, 11 deletions
diff --git a/source/blender/editors/util/ed_util.c b/source/blender/editors/util/ed_util.c index 73062c57526..35e6c40c36b 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" @@ -157,17 +162,6 @@ void apply_keyb_grid(int shift, int ctrl, float *val, float fac1, float fac2, fl } } -#if 0 /* UNUSED */ -int GetButStringLength(const char *str) -{ - int rt; - - rt = UI_GetStringWidth(str); - - return rt + 15; -} -#endif - void unpack_menu(bContext *C, const char *opname, const char *id_name, const char *abs_name, const char *folder, struct PackedFile *pf) { PointerRNA props_ptr; @@ -255,3 +249,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); +} |