diff options
author | Antony Riakiotakis <kalast@gmail.com> | 2015-03-23 14:00:34 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2015-03-24 17:47:49 +0300 |
commit | a10e7ca83078e7e96d3d53900c49d6da51b61d4a (patch) | |
tree | f36d6dbf41a30326d6f0e84244f51bbdbfc48746 | |
parent | 01ee21ffb930d1e75c8501da44b06d63b6d46704 (diff) |
Make sure matcap icons are within range.
Basically out of range could happen when opening files made in 2.72 when
the new icons for texture painting were added. Apparently some more
caution is needed here.
-rw-r--r-- | source/blender/editors/space_view3d/drawobject.c | 5 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_space.c | 5 |
2 files changed, 8 insertions, 2 deletions
diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 61c9891e201..d4d8db6d6c7 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -7232,8 +7232,11 @@ static void draw_object_matcap_check(View3D *v3d, Object *ob) v3d->defmaterial->preview = NULL; } /* first time users */ - if (v3d->matcap_icon == 0) + if (v3d->matcap_icon < ICON_MATCAP_01 || + v3d->matcap_icon > ICON_MATCAP_24) + { v3d->matcap_icon = ICON_MATCAP_01; + } if (v3d->defmaterial->preview == NULL) v3d->defmaterial->preview = UI_icon_to_preview(v3d->matcap_icon); diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index 9e7d70ab3b2..5a0b66addee 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -493,8 +493,11 @@ static void rna_SpaceView3D_matcap_enable(Main *UNUSED(bmain), Scene *UNUSED(sce { View3D *v3d = (View3D *)(ptr->data); - if (v3d->matcap_icon == 0) + if (v3d->matcap_icon < ICON_MATCAP_01 || + v3d->matcap_icon > ICON_MATCAP_24) + { v3d->matcap_icon = ICON_MATCAP_01; + } } static void rna_SpaceView3D_pivot_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr) |