[Bf-blender-cvs] [51aeeb1] cycles-ptex-24: Update Blend file saving/loading for Ptex
Nicholas Bishop
noreply at git.blender.org
Fri Jan 30 18:00:35 CET 2015
Commit: 51aeeb13acf214ae9898963c1abb638056f58351
Author: Nicholas Bishop
Date: Thu Jan 22 14:31:52 2015 +0100
Branches: cycles-ptex-24
https://developer.blender.org/rB51aeeb13acf214ae9898963c1abb638056f58351
Update Blend file saving/loading for Ptex
===================================================================
M source/blender/blenloader/intern/readfile.c
M source/blender/blenloader/intern/writefile.c
===================================================================
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 3c6481a..310ec99 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -4190,6 +4190,14 @@ static void direct_link_customdata(FileData *fd, CustomData *data, int count)
direct_link_mdisps(fd, count, layer->data, layer->flag & CD_FLAG_EXTERNAL);
else if (layer->type == CD_GRID_PAINT_MASK)
direct_link_grid_paint_mask(fd, count, layer->data);
+ else if (layer->type == CD_LOOP_PTEX) {
+ MLoopPtex *loop_ptex = layer->data;
+ int j;
+ for (j = 0; j < count; ++j) {
+ loop_ptex[j].rect = newdataadr(fd, loop_ptex[j].rect);
+ loop_ptex[j].image = NULL;
+ }
+ }
i++;
}
}
diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c
index 1de2b6b..3e5bf73 100644
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@ -153,6 +153,7 @@
#include "BKE_library.h" // for set_listbasepointers
#include "BKE_main.h"
#include "BKE_node.h"
+#include "BKE_ptex.h"
#include "BKE_report.h"
#include "BKE_sequencer.h"
#include "BKE_subsurf.h"
@@ -1867,6 +1868,21 @@ static void write_grid_paint_mask(WriteData *wd, int count, GridPaintMask *grid_
}
}
+static void write_loop_ptex(WriteData *wd, int count, MLoopPtex *loop_ptex)
+{
+ if (loop_ptex) {
+ int i;
+ writestruct(wd, DATA, "MLoopPtex", count, loop_ptex);
+ for (i = 0; i < count; ++i) {
+ MLoopPtex *lp = &loop_ptex[i];
+ if (lp->rect) {
+ const size_t num_bytes = BKE_loop_ptex_rect_num_bytes(lp);
+ writedata(wd, DATA, num_bytes, lp->rect);
+ }
+ }
+ }
+}
+
static void write_customdata(WriteData *wd, ID *id, int count, CustomData *data, int partial_type, int partial_count)
{
CustomData data_tmp;
@@ -1906,6 +1922,9 @@ static void write_customdata(WriteData *wd, ID *id, int count, CustomData *data,
else if (layer->type == CD_GRID_PAINT_MASK) {
write_grid_paint_mask(wd, count, layer->data);
}
+ else if (layer->type == CD_LOOP_PTEX) {
+ write_loop_ptex(wd, count, layer->data);
+ }
else {
CustomData_file_write_info(layer->type, &structname, &structnum);
if (structnum) {
More information about the Bf-blender-cvs
mailing list