Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2017-06-23 10:20:25 +0300
committerCampbell Barton <ideasman42@gmail.com>2017-06-23 10:24:56 +0300
commit0f99793deeedf06afac25d0bb2211059da1975b4 (patch)
tree3648a0e35ca99091c4516715d530cd2a828568d2 /source/blender/windowmanager/manipulators/intern/wm_manipulator_map.c
parentd47cb2a4e491b229db0e8a07344d021cb051ccd4 (diff)
Manipulator: partial depth support
Use the depth flag added for this purpose. Although this only works for regular currently, not selection.
Diffstat (limited to 'source/blender/windowmanager/manipulators/intern/wm_manipulator_map.c')
-rw-r--r--source/blender/windowmanager/manipulators/intern/wm_manipulator_map.c50
1 files changed, 50 insertions, 0 deletions
diff --git a/source/blender/windowmanager/manipulators/intern/wm_manipulator_map.c b/source/blender/windowmanager/manipulators/intern/wm_manipulator_map.c
index 15bfa7b171b..f5ef5572fd4 100644
--- a/source/blender/windowmanager/manipulators/intern/wm_manipulator_map.c
+++ b/source/blender/windowmanager/manipulators/intern/wm_manipulator_map.c
@@ -267,16 +267,42 @@ static void manipulators_draw_list(const wmManipulatorMap *mmap, const bContext
glEnable(GL_MULTISAMPLE);
}
+ bool is_depth_prev = false;
+
/* draw_manipulators contains all visible manipulators - draw them */
for (LinkData *link = draw_manipulators->first, *link_next; link; link = link_next) {
wmManipulator *mpr = link->data;
link_next = link->next;
+ bool is_depth = (mpr->parent_mgroup->type->flag & WM_MANIPULATORGROUPTYPE_DEPTH_3D) != 0;
+
+ /* Weak! since we don't 100% support depth yet (select ignores depth) always show highlighted */
+ if (is_depth && (mpr->state & WM_MANIPULATOR_STATE_HIGHLIGHT)) {
+ is_depth = false;
+ }
+
+ if (is_depth == is_depth_prev) {
+ /* pass */
+ }
+ else {
+ if (is_depth) {
+ glEnable(GL_DEPTH_TEST);
+ }
+ else {
+ glDisable(GL_DEPTH_TEST);
+ }
+ is_depth_prev = is_depth;
+ }
+
mpr->type->draw(C, mpr);
/* free/remove manipulator link after drawing */
BLI_freelinkN(draw_manipulators, link);
}
+ if (is_depth_prev) {
+ glDisable(GL_DEPTH_TEST);
+ }
+
if (draw_multisample) {
glDisable(GL_MULTISAMPLE);
}
@@ -296,13 +322,37 @@ static void manipulator_find_active_3D_loop(const bContext *C, ListBase *visible
int selectionbase = 0;
wmManipulator *mpr;
+ /* TODO(campbell): this depends on depth buffer being written to, currently broken for the 3D view. */
+ bool is_depth_prev = false;
+
for (LinkData *link = visible_manipulators->first; link; link = link->next) {
mpr = link->data;
+
+ bool is_depth = (mpr->parent_mgroup->type->flag & WM_MANIPULATORGROUPTYPE_DEPTH_3D) != 0;
+ if (is_depth == is_depth_prev) {
+ /* pass */
+ }
+ else {
+ if (is_depth) {
+ glEnable(GL_DEPTH_TEST);
+ }
+ else {
+ glDisable(GL_DEPTH_TEST);
+ }
+ is_depth_prev = is_depth;
+ }
+
/* pass the selection id shifted by 8 bits. Last 8 bits are used for selected manipulator part id */
+
mpr->type->draw_select(C, mpr, selectionbase << 8);
+
selectionbase++;
}
+
+ if (is_depth_prev) {
+ glDisable(GL_DEPTH_TEST);
+ }
}
static int manipulator_find_intersected_3d_intern(