Fix leak of manipulator tooltip timers.

This was causing performance degradation over time in posing, as the
manipulator recomputes the center locations for every event.

Ref T55442.
This commit is contained in:
Brecht Van Lommel 2018-06-12 16:57:01 +02:00
parent 3801736b89
commit 376bc88dc0
Notes: blender-bot 2023-02-14 11:01:33 +01:00
Referenced by issue #55442, slow translate/rotate manipulator
4 changed files with 9 additions and 4 deletions

View File

@ -2386,8 +2386,7 @@ static int wm_handlers_do_intern(bContext *C, wmEvent *event, ListBase *handlers
if (event->type == MOUSEMOVE && !wm_manipulatormap_modal_get(mmap)) {
int part;
mpr = wm_manipulatormap_highlight_find(mmap, C, event, &part);
wm_manipulatormap_highlight_set(mmap, C, mpr, part);
if (mpr != NULL) {
if (wm_manipulatormap_highlight_set(mmap, C, mpr, part) && mpr != NULL) {
WM_tooltip_timer_init(C, CTX_wm_window(C), region, WM_manipulatormap_tooltip_init);
}
}

View File

@ -41,6 +41,8 @@ void WM_tooltip_timer_init(
bContext *C, wmWindow *win, ARegion *ar,
wmTooltipInitFn init)
{
WM_tooltip_timer_clear(C, win);
bScreen *screen = WM_window_get_active_screen(win);
wmWindowManager *wm = CTX_wm_manager(C);
if (screen->tool_tip == NULL) {

View File

@ -846,7 +846,7 @@ bool WM_manipulatormap_cursor_set(const wmManipulatorMap *mmap, wmWindow *win)
return false;
}
void wm_manipulatormap_highlight_set(
bool wm_manipulatormap_highlight_set(
wmManipulatorMap *mmap, const bContext *C, wmManipulator *mpr, int part)
{
if ((mpr != mmap->mmap_context.highlight) ||
@ -881,7 +881,11 @@ void wm_manipulatormap_highlight_set(
ARegion *ar = CTX_wm_region(C);
ED_region_tag_redraw(ar);
}
return true;
}
return false;
}
wmManipulator *wm_manipulatormap_highlight_get(wmManipulatorMap *mmap)

View File

@ -77,7 +77,7 @@ void wm_manipulatormap_handler_context(bContext *C, struct wmEventHandler *handl
struct wmManipulator *wm_manipulatormap_highlight_find(
struct wmManipulatorMap *mmap, bContext *C, const struct wmEvent *event,
int *r_part);
void wm_manipulatormap_highlight_set(
bool wm_manipulatormap_highlight_set(
struct wmManipulatorMap *mmap, const bContext *C,
struct wmManipulator *mpr, int part);
struct wmManipulator *wm_manipulatormap_highlight_get(struct wmManipulatorMap *mmap);