[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [21205] branches/soc-2009-yukishiro/source /blender: fix light paint display when mesh objects are changed by modifiers

Jingyuan Huang jingyuan.huang at gmail.com
Sun Jun 28 03:38:40 CEST 2009


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

Log Message:
-----------
fix light paint display when mesh objects are changed by modifiers

Modified Paths:
--------------
    branches/soc-2009-yukishiro/source/blender/editors/space_view3d/drawobject.c
    branches/soc-2009-yukishiro/source/blender/makesdna/DNA_view3d_types.h
    branches/soc-2009-yukishiro/source/blender/sh/intern/compute.c

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-27 23:54:20 UTC (rev 21204)
+++ branches/soc-2009-yukishiro/source/blender/editors/space_view3d/drawobject.c	2009-06-28 01:38:28 UTC (rev 21205)
@@ -2348,10 +2348,9 @@
 	
 	shcol = MEM_callocN (sizeof (unsigned char) * totface * 4 * 4, "sh color");
 	calc_sh_color(scene, ob, dm, shcol);
-	return CustomData_add_layer(&dm->faceData, CD_SH_MCOL, CD_ASSIGN, shcol, dm->numFaceData);
+	return CustomData_add_layer(&dm->faceData, CD_SH_MCOL, CD_ASSIGN, shcol, totface);
 }
 
-
 static void draw_mesh_fancy(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base, int dt, int flag)
 {
 	Object *ob= base->object;
@@ -2442,7 +2441,7 @@
 			}
 			if (scene->flag & SCE_SH_RESULT) {
 				shcol= DM_get_face_data_layer(dm, CD_SH_MCOL);
-				
+
 				if (rv3d->rflag & RV3D_RECALCMCOL) {
 					calc_sh_color(scene, ob, dm, shcol);
 				}

Modified: branches/soc-2009-yukishiro/source/blender/makesdna/DNA_view3d_types.h
===================================================================
--- branches/soc-2009-yukishiro/source/blender/makesdna/DNA_view3d_types.h	2009-06-27 23:54:20 UTC (rev 21204)
+++ branches/soc-2009-yukishiro/source/blender/makesdna/DNA_view3d_types.h	2009-06-28 01:38:28 UTC (rev 21205)
@@ -205,8 +205,8 @@
 /* RegionView3d->rflag */
 #define RV3D_FLYMODE		2
 #define RV3D_CLIPPING		4
-#define RV3D_RECALCMCOL		8
-#define RV3D_SHRESULT		16
+#define RV3D_SHRESULT		8
+#define RV3D_RECALCMCOL		16
 
 /* RegionView3d->viewlock */
 #define RV3D_LOCKED		1

Modified: branches/soc-2009-yukishiro/source/blender/sh/intern/compute.c
===================================================================
--- branches/soc-2009-yukishiro/source/blender/sh/intern/compute.c	2009-06-27 23:54:20 UTC (rev 21204)
+++ branches/soc-2009-yukishiro/source/blender/sh/intern/compute.c	2009-06-28 01:38:28 UTC (rev 21205)
@@ -588,8 +588,15 @@
 		coeffs= CustomData_get_layer(&me->vdata, CD_MSHCOEFFS);
 		if (coeffs != NULL && !recompute) continue;
 
-		if (coeffs == NULL)
-                	coeffs= CustomData_add_layer(&me->vdata, CD_MSHCOEFFS, CD_CALLOC, NULL, num_verts);
+		if (coeffs == NULL) {
+			coeffs= MEM_callocN(sizeof(MShCoeffs) * num_verts, "sh coeffs");
+			CustomData_add_layer(&me->vdata, CD_MSHCOEFFS, CD_ASSIGN, coeffs, num_verts);
+		}
+		else if (recompute) {
+			MEM_freeN(coeffs);
+			coeffs= MEM_callocN(sizeof(MShCoeffs) * num_verts, "sh coeffs");
+			CustomData_set_layer(&me->vdata, CD_MSHCOEFFS, coeffs);
+		}
 
                 for (i = 0; i < num_verts; i++) {
                         for (k = 0; k < NUM_SAMPLES; k++) {





More information about the Bf-blender-cvs mailing list