[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [21057] branches/soc-2009-yukishiro/source /blender/editors: fix two crashes

Jingyuan Huang jingyuan.huang at gmail.com
Sun Jun 21 17:38:48 CEST 2009


Revision: 21057
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=21057
Author:   yukishiro
Date:     2009-06-21 17:38:47 +0200 (Sun, 21 Jun 2009)

Log Message:
-----------
fix two crashes

Modified Paths:
--------------
    branches/soc-2009-yukishiro/source/blender/editors/sculpt_paint/paint_light.c
    branches/soc-2009-yukishiro/source/blender/editors/space_view3d/drawobject.c

Modified: branches/soc-2009-yukishiro/source/blender/editors/sculpt_paint/paint_light.c
===================================================================
--- branches/soc-2009-yukishiro/source/blender/editors/sculpt_paint/paint_light.c	2009-06-21 14:30:59 UTC (rev 21056)
+++ branches/soc-2009-yukishiro/source/blender/editors/sculpt_paint/paint_light.c	2009-06-21 15:38:47 UTC (rev 21057)
@@ -643,6 +643,9 @@
 	VPaint *lp= CTX_data_tool_settings(C)->lpaint;
 	float mat[4][4], imat[4][4];
 
+	if (ob == NULL) 
+		return OPERATOR_CANCELLED;
+
 	op->customdata= pop = MEM_callocN(sizeof(PaintOperation), "LightPOP");
 	view3d_set_viewcontext(C, &pop->vc);
 	pop->indexar= get_indexarray();

Modified: branches/soc-2009-yukishiro/source/blender/editors/space_view3d/drawobject.c
===================================================================
--- branches/soc-2009-yukishiro/source/blender/editors/space_view3d/drawobject.c	2009-06-21 14:30:59 UTC (rev 21056)
+++ branches/soc-2009-yukishiro/source/blender/editors/space_view3d/drawobject.c	2009-06-21 15:38:47 UTC (rev 21057)
@@ -2354,6 +2354,7 @@
 	int hasHaloMat = (ma && (ma->material_type == MA_TYPE_HALO));
 	int draw_wire = 0;
 	int totvert, totedge, totface;
+	unsigned char *shcol = 0;
 	DispList *dl;
 	DerivedMesh *dm= mesh_get_derived_final(scene, ob, v3d->customdata_mask);
 
@@ -2363,6 +2364,11 @@
 	if (ob->dtx&OB_DRAWWIRE) {
 		draw_wire = 2; /* draw wire after solid using zoffset and depth buffer adjusment */
 	}
+
+	if ((G.f & G_LIGHTPAINT) && (rv3d->rflag & RV3D_SHRESULT)) {
+		shcol= DM_get_face_data_layer(dm, CD_SH_MCOL);
+		if (shcol == NULL) shcol = add_sh_mcol_dm(scene, ob, dm);
+	}
 	
 	totvert = dm->getNumVerts(dm);
 	totedge = dm->getNumEdges(dm);
@@ -2424,8 +2430,7 @@
 
 		if (G.f & G_LIGHTPAINT) {
 			if (rv3d->rflag & RV3D_SHRESULT) {
-				unsigned char *shcol= DM_get_face_data_layer(dm, CD_SH_MCOL);
-				if (shcol == NULL) shcol = add_sh_mcol_dm(scene, ob, dm);
+				shcol= DM_get_face_data_layer(dm, CD_SH_MCOL);
 				
 				if (rv3d->rflag & RV3D_RECALCMCOL) {
 				        calc_sh_color(scene, ob, dm, shcol);





More information about the Bf-blender-cvs mailing list