Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Bishop <nicholasbishop@gmail.com>2006-11-06 04:08:26 +0300
committerNicholas Bishop <nicholasbishop@gmail.com>2006-11-06 04:08:26 +0300
commit8e97a2955b2f99ec61189cb972c09676a013a60b (patch)
tree89e67578ceac5a670a309b72295156cbfc7f05c7 /source/blender/blenloader
parent6feb2cc4f6d4c2131b959b77a8b87a5d7c9412a4 (diff)
Merged Google Summer of Code sculptmode/multires/retopo tools.
From the tracker: https://projects.blender.org/tracker/index.php?func=detail&aid=5018&group_id=9&atid=127
Diffstat (limited to 'source/blender/blenloader')
-rw-r--r--source/blender/blenloader/intern/readfile.c54
-rw-r--r--source/blender/blenloader/intern/writefile.c29
2 files changed, 79 insertions, 4 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 0808ea636ad..39ba28912fd 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -105,6 +105,8 @@
#include "BLI_arithb.h"
#include "BLI_storage_types.h" // for relname flags
+#include "BDR_sculptmode.h"
+
#include "BKE_bad_level_calls.h" // for reopen_text build_seqar (from WHILE_SEQ) set_rects_butspace check_imasel_copy
#include "BKE_action.h"
@@ -136,6 +138,8 @@
#include "BLO_undofile.h"
#include "BLO_readblenfile.h" // streaming read pipe, for BLO_readblenfile BLO_readblenfilememory
+#include "multires.h"
+
#include "readfile.h"
#include "genfile.h"
@@ -2249,6 +2253,31 @@ static void direct_link_mesh(FileData *fd, Mesh *mesh)
mesh->oc= 0;
mesh->dface= NULL;
mesh->mselect= NULL;
+
+ /* Multires data */
+ mesh->mr= newdataadr(fd, mesh->mr);
+ if(mesh->mr) {
+ MultiresLevel *lvl;
+ link_list(fd, &mesh->mr->levels);
+ for(lvl= mesh->mr->levels.first; lvl; lvl= lvl->next) {
+ lvl->verts= newdataadr(fd, lvl->verts);
+ lvl->faces= newdataadr(fd, lvl->faces);
+ lvl->edges= newdataadr(fd, lvl->edges);
+ lvl->texcolfaces= newdataadr(fd, lvl->texcolfaces);
+
+ /* Recalculating the maps is faster than reading them from the file */
+ multires_calc_level_maps(lvl);
+ }
+ }
+
+ /* PMV */
+ mesh->pv= newdataadr(fd, mesh->pv);
+ if(mesh->pv) {
+ mesh->pv->vert_map= newdataadr(fd, mesh->pv->vert_map);
+ mesh->pv->edge_map= newdataadr(fd, mesh->pv->edge_map);
+ mesh->pv->old_faces= newdataadr(fd, mesh->pv->old_faces);
+ mesh->pv->old_edges= newdataadr(fd, mesh->pv->old_edges);
+ }
if (mesh->tface) {
TFace *tfaces= mesh->tface;
@@ -2699,7 +2728,8 @@ static void lib_link_scene(FileData *fd, Main *main)
Base *base, *next;
Editing *ed;
Sequence *seq;
-
+ int a;
+
sce= main->scene.first;
while(sce) {
if(sce->id.flag & LIB_NEEDLINK) {
@@ -2711,6 +2741,13 @@ static void lib_link_scene(FileData *fd, Main *main)
sce->toolsettings->imapaint.brush=
newlibadr_us(fd, sce->id.lib, sce->toolsettings->imapaint.brush);
+ /* Sculptdata textures */
+ for(a=0; a<MAX_MTEX; ++a) {
+ MTex *mtex= sce->sculptdata.mtex[a];
+ if(mtex)
+ mtex->tex= newlibadr_us(fd, sce->id.lib, mtex->tex);
+ }
+
base= sce->base.first;
while(base) {
next= base->next;
@@ -2792,7 +2829,18 @@ static void direct_link_scene(FileData *fd, Scene *sce)
sce->radio= newdataadr(fd, sce->radio);
sce->toolsettings= newdataadr(fd, sce->toolsettings);
-
+
+ /* SculptData */
+ sce->sculptdata.active_ob= NULL;
+ sce->sculptdata.vertex_users= NULL;
+ sce->sculptdata.texrndr= NULL;
+ sce->sculptdata.propset= 0;
+ sce->sculptdata.undo_cur= NULL;
+ sce->sculptdata.undo.first= sce->sculptdata.undo.last= NULL;
+ /* SculptData textures */
+ for(a=0; a<MAX_MTEX; ++a)
+ sce->sculptdata.mtex[a]= newdataadr(fd,sce->sculptdata.mtex[a]);
+
if(sce->ed) {
ed= sce->ed= newdataadr(fd, sce->ed);
@@ -3030,6 +3078,7 @@ static void lib_link_screen(FileData *fd, Main *main)
if(v3d->localvd) {
v3d->localvd->camera= newlibadr(fd, sc->id.lib, v3d->localvd->camera);
}
+ v3d->depths= NULL;
v3d->ri= NULL;
}
else if(sl->spacetype==SPACE_IPO) {
@@ -3352,6 +3401,7 @@ static void direct_link_screen(FileData *fd, bScreen *sc)
v3d->localvd= newdataadr(fd, v3d->localvd);
v3d->afterdraw.first= v3d->afterdraw.last= NULL;
v3d->clipbb= newdataadr(fd, v3d->clipbb);
+ v3d->retopo_view_data= NULL;
}
else if (sl->spacetype==SPACE_OOPS) {
SpaceOops *soops= (SpaceOops*) sl;
diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c
index 3955530b3b3..0e16706eb74 100644
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@ -1007,6 +1007,7 @@ static void write_dverts(WriteData *wd, int count, MDeformVert *dvlist)
static void write_meshs(WriteData *wd, ListBase *idbase)
{
Mesh *mesh;
+ MultiresLevel *lvl;
mesh= idbase->first;
while(mesh) {
@@ -1029,7 +1030,7 @@ static void write_meshs(WriteData *wd, ListBase *idbase)
/* direct data */
writedata(wd, DATA, sizeof(void *)*mesh->totcol, mesh->mat);
- writestruct(wd, DATA, "MVert", mesh->totvert, mesh->mvert);
+ writestruct(wd, DATA, "MVert", mesh->pv?mesh->pv->totvert:mesh->totvert, mesh->mvert);
writestruct(wd, DATA, "MEdge", mesh->totedge, mesh->medge);
writestruct(wd, DATA, "MFace", mesh->totface, mesh->mface);
writestruct(wd, DATA, "TFace", mesh->totface, mesh->tface);
@@ -1038,6 +1039,26 @@ static void write_meshs(WriteData *wd, ListBase *idbase)
write_dverts(wd, mesh->totvert, mesh->dvert);
+ /* Multires data */
+ writestruct(wd, DATA, "Multires", 1, mesh->mr);
+ if(mesh->mr) {
+ for(lvl= mesh->mr->levels.first; lvl; lvl= lvl->next) {
+ writestruct(wd, DATA, "MultiresLevel", 1, lvl);
+ writestruct(wd, DATA, "MVert", lvl->totvert, lvl->verts);
+ writestruct(wd, DATA, "MultiresFace", lvl->totface, lvl->faces);
+ writestruct(wd, DATA, "MultiresEdge", lvl->totedge, lvl->edges);
+ writestruct(wd, DATA, "MultiresTexColFace", lvl->totface, lvl->texcolfaces);
+ }
+ }
+
+ /* PMV data */
+ if(mesh->pv) {
+ writestruct(wd, DATA, "PartialVisibility", 1, mesh->pv);
+ writedata(wd, DATA, sizeof(unsigned int)*mesh->pv->totvert, mesh->pv->vert_map);
+ writedata(wd, DATA, sizeof(int)*mesh->pv->totedge, mesh->pv->edge_map);
+ writestruct(wd, DATA, "MFace", mesh->pv->totface, mesh->pv->old_faces);
+ writestruct(wd, DATA, "MEdge", mesh->pv->totedge, mesh->pv->old_edges);
+ }
}
mesh= mesh->id.next;
}
@@ -1199,6 +1220,7 @@ static void write_scenes(WriteData *wd, ListBase *scebase)
Strip *strip;
TimeMarker *marker;
SceneRenderLayer *srl;
+ int a;
sce= scebase->first;
while(sce) {
@@ -1214,7 +1236,10 @@ static void write_scenes(WriteData *wd, ListBase *scebase)
writestruct(wd, DATA, "Radio", 1, sce->radio);
writestruct(wd, DATA, "ToolSettings", 1, sce->toolsettings);
-
+
+ for(a=0; a<MAX_MTEX; ++a)
+ writestruct(wd, DATA, "MTex", 1, sce->sculptdata.mtex[a]);
+
ed= sce->ed;
if(ed) {
writestruct(wd, DATA, "Editing", 1, ed);