diff options
Diffstat (limited to 'source/blender/blenloader')
-rw-r--r-- | source/blender/blenloader/intern/readfile.c | 29 | ||||
-rw-r--r-- | source/blender/blenloader/intern/writefile.c | 26 |
2 files changed, 35 insertions, 20 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 279dca5e0a5..91596cf8843 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -4011,6 +4011,14 @@ static void composite_patch(bNodeTree *ntree, Scene *scene) node->id= &scene->id; } +static void link_paint(FileData *fd, Scene *sce, Paint *p) +{ + if(p && p->brushes) { + int i; + for(i = 0; i < p->brush_count; ++i) + p->brushes[i]= newlibadr_us(fd, sce->id.lib, p->brushes[i]); + } +} static void lib_link_scene(FileData *fd, Main *main) { @@ -4036,12 +4044,9 @@ static void lib_link_scene(FileData *fd, Main *main) sce->toolsettings->imapaint.brush= newlibadr_us(fd, sce->id.lib, sce->toolsettings->imapaint.brush); - if(sce->toolsettings->sculpt && sce->toolsettings->sculpt->paint.brushes) { - int i; - for(i = 0; i < sce->toolsettings->sculpt->paint.brush_count; ++i) - sce->toolsettings->sculpt->paint.brushes[i]= - newlibadr_us(fd, sce->id.lib, sce->toolsettings->sculpt->paint.brushes[i]); - } + + link_paint(fd, sce, &sce->toolsettings->sculpt->paint); + if(sce->toolsettings->vpaint) sce->toolsettings->vpaint->brush= newlibadr_us(fd, sce->id.lib, sce->toolsettings->vpaint->brush); @@ -4121,6 +4126,13 @@ static void link_recurs_seq(FileData *fd, ListBase *lb) link_recurs_seq(fd, &seq->seqbase); } +static void direct_link_paint(FileData *fd, Paint **paint) +{ + (*paint)= newdataadr(fd, (*paint)); + if(*paint) + (*paint)->brushes= newdataadr(fd, (*paint)->brushes); +} + static void direct_link_scene(FileData *fd, Scene *sce) { Editing *ed; @@ -4150,9 +4162,8 @@ static void direct_link_scene(FileData *fd, Scene *sce) if(sce->toolsettings) { sce->toolsettings->vpaint= newdataadr(fd, sce->toolsettings->vpaint); sce->toolsettings->wpaint= newdataadr(fd, sce->toolsettings->wpaint); - sce->toolsettings->sculpt= newdataadr(fd, sce->toolsettings->sculpt); - if(sce->toolsettings->sculpt) - sce->toolsettings->sculpt->paint.brushes= newdataadr(fd, sce->toolsettings->sculpt->paint.brushes); + direct_link_paint(fd, (Paint**)&sce->toolsettings->sculpt); + sce->toolsettings->imapaint.paintcursor= NULL; sce->toolsettings->particle.paintcursor= NULL; } diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c index 366480f3c82..6822305e75f 100644 --- a/source/blender/blenloader/intern/writefile.c +++ b/source/blender/blenloader/intern/writefile.c @@ -1676,6 +1676,11 @@ static void write_lamps(WriteData *wd, ListBase *idbase) } } +static void write_paint(WriteData *wd, Paint *p) +{ + if(p && p->brushes) + writedata(wd, DATA, p->brush_count * sizeof(Brush*), p->brushes); +} static void write_scenes(WriteData *wd, ListBase *scebase) { @@ -1688,6 +1693,7 @@ static void write_scenes(WriteData *wd, ListBase *scebase) TimeMarker *marker; TransformOrientation *ts; SceneRenderLayer *srl; + ToolSettings *tos; sce= scebase->first; while(sce) { @@ -1705,17 +1711,15 @@ static void write_scenes(WriteData *wd, ListBase *scebase) base= base->next; } - writestruct(wd, DATA, "ToolSettings", 1, sce->toolsettings); - if(sce->toolsettings->vpaint) - writestruct(wd, DATA, "VPaint", 1, sce->toolsettings->vpaint); - if(sce->toolsettings->wpaint) - writestruct(wd, DATA, "VPaint", 1, sce->toolsettings->wpaint); - if(sce->toolsettings->sculpt) { - writestruct(wd, DATA, "Sculpt", 1, sce->toolsettings->sculpt); - if(sce->toolsettings->sculpt->paint.brushes) { - Paint *p = &sce->toolsettings->sculpt->paint; - writedata(wd, DATA, p->brush_count * sizeof(Brush*), p->brushes); - } + tos = sce->toolsettings; + writestruct(wd, DATA, "ToolSettings", 1, tos); + if(tos->vpaint) + writestruct(wd, DATA, "VPaint", 1, tos->vpaint); + if(tos->wpaint) + writestruct(wd, DATA, "VPaint", 1, tos->wpaint); + if(tos->sculpt) { + writestruct(wd, DATA, "Sculpt", 1, tos->sculpt); + write_paint(wd, &tos->sculpt->paint); } ed= sce->ed; |