[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [21227] branches/soc-2009-yukishiro/source /blender: store correct number of coeffs in custom data layer

Jingyuan Huang jingyuan.huang at gmail.com
Mon Jun 29 01:18:31 CEST 2009


Revision: 21227
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=21227
Author:   yukishiro
Date:     2009-06-29 01:18:30 +0200 (Mon, 29 Jun 2009)

Log Message:
-----------
store correct number of coeffs in custom data layer

Modified Paths:
--------------
    branches/soc-2009-yukishiro/source/blender/blenkernel/intern/customdata.c
    branches/soc-2009-yukishiro/source/blender/blenloader/intern/writefile.c
    branches/soc-2009-yukishiro/source/blender/makesdna/DNA_customdata_types.h

Modified: branches/soc-2009-yukishiro/source/blender/blenkernel/intern/customdata.c
===================================================================
--- branches/soc-2009-yukishiro/source/blender/blenkernel/intern/customdata.c	2009-06-28 18:09:19 UTC (rev 21226)
+++ branches/soc-2009-yukishiro/source/blender/blenkernel/intern/customdata.c	2009-06-28 23:18:30 UTC (rev 21227)
@@ -1126,6 +1126,7 @@
 
 	data->layers[index].type = type;
 	data->layers[index].flag = flag;
+	data->layers[index].totelem = totelem;
 	data->layers[index].data = newlayerdata;
 
 	if(name) {

Modified: branches/soc-2009-yukishiro/source/blender/blenloader/intern/writefile.c
===================================================================
--- branches/soc-2009-yukishiro/source/blender/blenloader/intern/writefile.c	2009-06-28 18:09:19 UTC (rev 21226)
+++ branches/soc-2009-yukishiro/source/blender/blenloader/intern/writefile.c	2009-06-28 23:18:30 UTC (rev 21227)
@@ -1318,12 +1318,14 @@
 		else {
 			CustomData_file_write_info(layer->type, &structname, &structnum);
 			if (structnum) {
+				/* number of elements is decided by the derived mesh, not mesh */
+				if (layer->type == CD_MSHCOEFFS) count = layer->totelem;
 				/* when using partial visibility, the MEdge and MFace layers
 				   are smaller than the original, so their type and count is
 				   passed to make this work */
-				if (layer->type != partial_type) datasize= structnum*count;
-				else datasize= structnum*partial_count;
+				else if (layer->type == partial_type) count = partial_count;
 
+				datasize= structnum*count;
 				writestruct(wd, DATA, structname, datasize, layer->data);
 			}
 			else

Modified: branches/soc-2009-yukishiro/source/blender/makesdna/DNA_customdata_types.h
===================================================================
--- branches/soc-2009-yukishiro/source/blender/makesdna/DNA_customdata_types.h	2009-06-28 18:09:19 UTC (rev 21226)
+++ branches/soc-2009-yukishiro/source/blender/makesdna/DNA_customdata_types.h	2009-06-28 23:18:30 UTC (rev 21227)
@@ -39,7 +39,7 @@
 	int active_rnd; /* number of the layer to render*/
 	int active_clone; /* number of the layer to render*/
 	int active_mask; /* number of the layer to render*/
-	char pad[4];
+	int totelem; /* number of elements in the layer. currently only used by SH coeffs */
 	char name[32];  /* layer name */
 	void *data;     /* layer data */
 } CustomDataLayer;





More information about the Bf-blender-cvs mailing list