diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-11-23 08:25:00 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-11-23 08:27:54 +0300 |
commit | 93c143ecf375b57deff612d3e0f4e283369bff3b (patch) | |
tree | a5e2595810ac3e57bb61925fc51b724efaa65458 /source/blender | |
parent | 811814b60c5bf24c14ff51fe49ab0116b6fbd7a5 (diff) |
Fix wire-toggle restoring previous shading mode
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/editors/space_view3d/view3d_edit.c | 14 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_view3d_types.h | 8 |
2 files changed, 14 insertions, 8 deletions
diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index 5f0ce77703d..58bf91e5a17 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -4872,7 +4872,7 @@ static int toggle_shading_exec(bContext *C, wmOperator *op) ScrArea *sa = CTX_wm_area(C); int type = RNA_enum_get(op->ptr, "type"); - if (ELEM(type, OB_WIRE, OB_SOLID)) { + if (type == OB_SOLID) { if (v3d->shading.type != type) { v3d->shading.type = type; } @@ -4884,12 +4884,18 @@ static int toggle_shading_exec(bContext *C, wmOperator *op) } } else { - + char *prev_type = ( + (type == OB_WIRE) ? + &v3d->shading.prev_type_wire : + &v3d->shading.prev_type)); if (v3d->shading.type == type) { - v3d->shading.type = v3d->shading.prev_type; + if (*prev_type == type || !ELEM(*prev_type, OB_WIRE, OB_SOLID, OB_MATERIAL, OB_RENDER)) { + *prev_type = OB_SOLID; + } + v3d->shading.type = *prev_type; } else { - v3d->shading.prev_type = v3d->shading.type; + *prev_type = v3d->shading.type; v3d->shading.type = type; } } diff --git a/source/blender/makesdna/DNA_view3d_types.h b/source/blender/makesdna/DNA_view3d_types.h index 30b3f0ba688..e778edff52e 100644 --- a/source/blender/makesdna/DNA_view3d_types.h +++ b/source/blender/makesdna/DNA_view3d_types.h @@ -135,12 +135,12 @@ typedef struct View3DCursor { /* 3D Viewport Shading settings */ typedef struct View3DShading { - short type; /* Shading type (VIEW3D_SHADE_SOLID, ..) */ - short prev_type; /* Runtime, for toggle between rendered viewport. */ + char type; /* Shading type (VIEW3D_SHADE_SOLID, ..) */ + char prev_type; /* Runtime, for toggle between rendered viewport. */ + char prev_type_wire; - short flag; char color_type; - char _pad0[7]; + short flag; char light; char background_type; |