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/editors/space_view3d | |
parent | 811814b60c5bf24c14ff51fe49ab0116b6fbd7a5 (diff) |
Fix wire-toggle restoring previous shading mode
Diffstat (limited to 'source/blender/editors/space_view3d')
-rw-r--r-- | source/blender/editors/space_view3d/view3d_edit.c | 14 |
1 files changed, 10 insertions, 4 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; } } |