Fix manipulator drawing before their refresh callback
Caused glitch with Scale-Cage tool.
This commit is contained in:
parent
ca495381c5
commit
689ad9ade4
|
@ -109,6 +109,7 @@ typedef enum eWM_ManipulatorGroupTypeFlag {
|
|||
typedef enum eWM_ManipulatorGroupInitFlag {
|
||||
/* mgroup has been initialized */
|
||||
WM_MANIPULATORGROUP_INIT_SETUP = (1 << 0),
|
||||
WM_MANIPULATORGROUP_INIT_REFRESH = (1 << 1),
|
||||
} eWM_ManipulatorGroupInitFlag;
|
||||
|
||||
/**
|
||||
|
|
|
@ -184,9 +184,16 @@ void wm_manipulatorgroup_ensure_initialized(wmManipulatorGroup *mgroup, const bC
|
|||
wm_manipulatorgrouptype_setup_keymap(wgt, wm->defaultconf);
|
||||
BLI_assert(wgt->keymap != NULL);
|
||||
}
|
||||
|
||||
mgroup->init_flag |= WM_MANIPULATORGROUP_INIT_SETUP;
|
||||
}
|
||||
|
||||
/* refresh may be called multiple times, this just ensures its called at least once before we draw. */
|
||||
if (UNLIKELY((mgroup->init_flag & WM_MANIPULATORGROUP_INIT_REFRESH) == 0)) {
|
||||
if (mgroup->type->refresh) {
|
||||
mgroup->type->refresh(C, mgroup);
|
||||
}
|
||||
mgroup->init_flag |= WM_MANIPULATORGROUP_INIT_REFRESH;
|
||||
}
|
||||
}
|
||||
|
||||
bool wm_manipulatorgroup_is_visible(const wmManipulatorGroup *mgroup, const bContext *C)
|
||||
|
|
|
@ -327,13 +327,14 @@ static void manipulatormap_prepare_drawing(
|
|||
}
|
||||
|
||||
/* needs to be initialized on first draw */
|
||||
wm_manipulatorgroup_ensure_initialized(mgroup, C);
|
||||
/* update data if needed */
|
||||
/* XXX weak: Manipulator-group may skip refreshing if it's invisible (map gets untagged nevertheless) */
|
||||
if ((mmap->update_flag[drawstep] & MANIPULATORMAP_IS_REFRESH_CALLBACK) && mgroup->type->refresh) {
|
||||
mgroup->type->refresh(C, mgroup);
|
||||
/* cleared below */
|
||||
if (mmap->update_flag[drawstep] & MANIPULATORMAP_IS_REFRESH_CALLBACK) {
|
||||
/* force refresh again. */
|
||||
mgroup->init_flag &= ~WM_MANIPULATORGROUP_INIT_REFRESH;
|
||||
}
|
||||
/* Calls `setup`, `setup_keymap` and `refresh` if they're defined. */
|
||||
wm_manipulatorgroup_ensure_initialized(mgroup, C);
|
||||
|
||||
/* prepare drawing */
|
||||
if (mgroup->type->draw_prepare) {
|
||||
mgroup->type->draw_prepare(C, mgroup);
|
||||
|
|
Loading…
Reference in New Issue