[Bf-blender-cvs] [221c7fdaf08] blender2.8: Manipulator: fix broken hover option
Campbell Barton
noreply at git.blender.org
Fri Jun 23 01:15:18 CEST 2017
Commit: 221c7fdaf088fc209e8c51c07af9323ef807cb0a
Author: Campbell Barton
Date: Fri Jun 23 09:18:53 2017 +1000
Branches: blender2.8
https://developer.blender.org/rB221c7fdaf088fc209e8c51c07af9323ef807cb0a
Manipulator: fix broken hover option
Hover flag caused manipulators not to update
(Camera DOF works again).
===================================================================
M source/blender/windowmanager/manipulators/intern/wm_manipulator.c
M source/blender/windowmanager/manipulators/intern/wm_manipulator_intern.h
M source/blender/windowmanager/manipulators/intern/wm_manipulator_map.c
===================================================================
diff --git a/source/blender/windowmanager/manipulators/intern/wm_manipulator.c b/source/blender/windowmanager/manipulators/intern/wm_manipulator.c
index e9250663818..e492aed9f37 100644
--- a/source/blender/windowmanager/manipulators/intern/wm_manipulator.c
+++ b/source/blender/windowmanager/manipulators/intern/wm_manipulator.c
@@ -490,26 +490,26 @@ void wm_manipulator_update(wmManipulator *mpr, const bContext *C, const bool ref
wm_manipulator_calculate_scale(mpr, C);
}
-bool wm_manipulator_is_visible(wmManipulator *mpr)
+int wm_manipulator_is_visible(wmManipulator *mpr)
{
if (mpr->flag & WM_MANIPULATOR_HIDDEN) {
- return false;
+ return 0;
}
if ((mpr->state & WM_MANIPULATOR_STATE_ACTIVE) &&
!(mpr->flag & (WM_MANIPULATOR_DRAW_ACTIVE | WM_MANIPULATOR_DRAW_VALUE)))
{
/* don't draw while active (while dragging) */
- return false;
+ return 0;
}
if ((mpr->flag & WM_MANIPULATOR_DRAW_HOVER) &&
!(mpr->state & WM_MANIPULATOR_STATE_HIGHLIGHT) &&
!(mpr->state & WM_MANIPULATOR_STATE_SELECT)) /* still draw selected manipulators */
{
- /* only draw on mouse hover */
- return false;
+ /* update but don't draw */
+ return WM_MANIPULATOR_IS_VISIBLE_UPDATE;
}
- return true;
+ return WM_MANIPULATOR_IS_VISIBLE_UPDATE | WM_MANIPULATOR_IS_VISIBLE_DRAW;
}
diff --git a/source/blender/windowmanager/manipulators/intern/wm_manipulator_intern.h b/source/blender/windowmanager/manipulators/intern/wm_manipulator_intern.h
index 52c47f74a29..1e667913530 100644
--- a/source/blender/windowmanager/manipulators/intern/wm_manipulator_intern.h
+++ b/source/blender/windowmanager/manipulators/intern/wm_manipulator_intern.h
@@ -43,7 +43,12 @@ bool wm_manipulator_select(bContext *C, struct wmManipulatorMap *mmap, struct wm
void wm_manipulator_calculate_scale(struct wmManipulator *mpr, const bContext *C);
void wm_manipulator_update(struct wmManipulator *mpr, const bContext *C, const bool refresh_map);
-bool wm_manipulator_is_visible(struct wmManipulator *mpr);
+
+int wm_manipulator_is_visible(struct wmManipulator *mpr);
+enum {
+ WM_MANIPULATOR_IS_VISIBLE_UPDATE = (1 << 0),
+ WM_MANIPULATOR_IS_VISIBLE_DRAW = (1 << 1),
+};
/* -------------------------------------------------------------------- */
/* wmManipulatorGroup */
diff --git a/source/blender/windowmanager/manipulators/intern/wm_manipulator_map.c b/source/blender/windowmanager/manipulators/intern/wm_manipulator_map.c
index e5f32ec5eed..15bfa7b171b 100644
--- a/source/blender/windowmanager/manipulators/intern/wm_manipulator_map.c
+++ b/source/blender/windowmanager/manipulators/intern/wm_manipulator_map.c
@@ -180,12 +180,18 @@ static bool manipulator_prepare_drawing(
wmManipulatorMap *mmap, wmManipulator *mpr,
const bContext *C, ListBase *draw_manipulators)
{
- if (!wm_manipulator_is_visible(mpr)) {
+ int do_draw = wm_manipulator_is_visible(mpr);
+ if (do_draw == 0) {
/* skip */
}
else {
- wm_manipulator_update(mpr, C, (mmap->update_flag & MANIPULATORMAP_REFRESH) != 0);
- BLI_addhead(draw_manipulators, BLI_genericNodeN(mpr));
+ if (do_draw & WM_MANIPULATOR_IS_VISIBLE_UPDATE) {
+ /* hover manipulators need updating, even if we don't draw them */
+ wm_manipulator_update(mpr, C, (mmap->update_flag & MANIPULATORMAP_REFRESH) != 0);
+ }
+ if (do_draw & WM_MANIPULATOR_IS_VISIBLE_DRAW) {
+ BLI_addhead(draw_manipulators, BLI_genericNodeN(mpr));
+ }
return true;
}
More information about the Bf-blender-cvs
mailing list