[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [33224] trunk/blender/source/blender/ render/intern/source/voxeldata.c: Fix: 8bit raw and 'blender voxel' voxel data texture formats didn't support relative paths

Matt Ebb matt at mke3.net
Mon Nov 22 00:36:29 CET 2010


Revision: 33224
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=33224
Author:   broken
Date:     2010-11-22 00:36:29 +0100 (Mon, 22 Nov 2010)

Log Message:
-----------
Fix: 8bit raw and 'blender voxel' voxel data texture formats didn't support relative paths

Modified Paths:
--------------
    trunk/blender/source/blender/render/intern/source/voxeldata.c

Modified: trunk/blender/source/blender/render/intern/source/voxeldata.c
===================================================================
--- trunk/blender/source/blender/render/intern/source/voxeldata.c	2010-11-21 20:00:31 UTC (rev 33223)
+++ trunk/blender/source/blender/render/intern/source/voxeldata.c	2010-11-21 23:36:29 UTC (rev 33224)
@@ -39,6 +39,7 @@
 #include "IMB_imbuf.h"
 #include "IMB_imbuf_types.h"
 
+#include "BKE_global.h"
 #include "BKE_image.h"
 #include "BKE_main.h"
 #include "BKE_modifier.h"
@@ -262,11 +263,12 @@
 	return;
 }
 
-static void cache_voxeldata(struct Render *re,Tex *tex)
+static void cache_voxeldata(struct Render *re, Tex *tex)
 {	
 	VoxelData *vd = tex->vd;
 	FILE *fp;
 	int curframe;
+	char path[FILE_MAX];
 	
 	if (!vd) return;
 	
@@ -285,6 +287,8 @@
 	else
 		curframe = re->r.cfra;
 	
+	BLI_strncpy(path, vd->source_path, FILE_MAX);
+	
 	switch(vd->file_format) {
 		case TEX_VD_IMAGE_SEQUENCE:
 			load_frame_image_sequence(vd, tex);
@@ -293,8 +297,9 @@
 			init_frame_smoke(vd);
 			return;
 		case TEX_VD_BLENDERVOXEL:
-			if (!BLI_exists(vd->source_path)) return;
-			fp = fopen(vd->source_path,"rb");
+			BLI_path_abs(path, G.main->name);
+			if (!BLI_exists(path)) { printf("invalid voxel path %s \n", path); return; }
+			fp = fopen(path,"rb");
 			if (!fp) return;
 			
 			if(read_voxeldata_header(fp, vd))
@@ -304,8 +309,9 @@
 			
 			return;
 		case TEX_VD_RAW_8BIT:
-			if (!BLI_exists(vd->source_path)) return;
-			fp = fopen(vd->source_path,"rb");
+			BLI_path_abs(path, G.main->name);
+			if (!BLI_exists(path)) { printf("invalid voxel path %s \n", path); return; }
+			fp = fopen(path,"rb");
 			if (!fp) return;
 			
 			if (load_frame_raw8(vd, fp, curframe))





More information about the Bf-blender-cvs mailing list