[Bf-blender-cvs] [a10e7ca] blender-v2.74-release: Make sure matcap icons are within range.

Antony Riakiotakis noreply at git.blender.org
Tue Mar 24 15:59:47 CET 2015


Commit: a10e7ca83078e7e96d3d53900c49d6da51b61d4a
Author: Antony Riakiotakis
Date:   Mon Mar 23 12:00:34 2015 +0100
Branches: blender-v2.74-release
https://developer.blender.org/rBa10e7ca83078e7e96d3d53900c49d6da51b61d4a

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.

===================================================================

M	source/blender/editors/space_view3d/drawobject.c
M	source/blender/makesrna/intern/rna_space.c

===================================================================

diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c
index 61c9891..d4d8db6 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 9e7d70a..5a0b66a 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)




More information about the Bf-blender-cvs mailing list