From 1f77f7b05af24d3117d76d8c2ec43dbee031ab6a Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 4 Aug 2010 12:18:07 +0000 Subject: Brush/Paint internal changes - remove brush array for each Paint struct, just use a single brush pointer. - removed rna function based template filtering. - filter brushes using a flag on the brush and the pointer poll function. - set the brushes using a new operator WM_OT_context_set_id(). TODO - remake startup.blend, currently brush groupings are lost. - rewrite WM_OT_context_set_id() to use rna introspection. --- source/blender/blenloader/intern/readfile.c | 22 +++++++++------------- source/blender/blenloader/intern/writefile.c | 10 +--------- 2 files changed, 10 insertions(+), 22 deletions(-) (limited to 'source/blender/blenloader') diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 9a81974349c..88ddca3328c 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -4123,10 +4123,8 @@ static void composite_patch(bNodeTree *ntree, Scene *scene) 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]); + if(p && p->brush) { + p->brush= newlibadr_us(fd, sce->id.lib, p->brush); } } @@ -4242,13 +4240,8 @@ static void link_recurs_seq(FileData *fd, ListBase *lb) static void direct_link_paint(FileData *fd, Paint **paint) { Paint *p; - +/* TODO. is this needed */ p= (*paint)= newdataadr(fd, (*paint)); - if(p) { - p->paint_cursor= NULL; - p->brushes= newdataadr(fd, p->brushes); - test_pointer_array(fd, (void**)&p->brushes); - } } static void direct_link_scene(FileData *fd, Scene *sce) @@ -4284,9 +4277,6 @@ static void direct_link_scene(FileData *fd, Scene *sce) direct_link_paint(fd, (Paint**)&sce->toolsettings->vpaint); direct_link_paint(fd, (Paint**)&sce->toolsettings->wpaint); - sce->toolsettings->imapaint.paint.brushes= newdataadr(fd, sce->toolsettings->imapaint.paint.brushes); - test_pointer_array(fd, (void**)&sce->toolsettings->imapaint.paint.brushes); - sce->toolsettings->imapaint.paintcursor= NULL; sce->toolsettings->particle.paintcursor= NULL; } @@ -11117,6 +11107,12 @@ static void do_versions(FileData *fd, Library *lib, Main *main) /* put compatibility code here until next subversion bump */ { + Brush *br; + for(br= main->brush.first; br; br= br->id.next) { + if(br->ob_mode==0) + br->ob_mode= (OB_MODE_SCULPT|OB_MODE_WEIGHT_PAINT|OB_MODE_TEXTURE_PAINT|OB_MODE_VERTEX_PAINT); + } + } /* WATCH IT!!!: pointers from libdata have not been converted yet here! */ diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c index eab6a4c2b55..dbe869450a5 100644 --- a/source/blender/blenloader/intern/writefile.c +++ b/source/blender/blenloader/intern/writefile.c @@ -1770,11 +1770,6 @@ 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) { @@ -1809,18 +1804,15 @@ static void write_scenes(WriteData *wd, ListBase *scebase) writestruct(wd, DATA, "ToolSettings", 1, tos); if(tos->vpaint) { writestruct(wd, DATA, "VPaint", 1, tos->vpaint); - write_paint(wd, &tos->vpaint->paint); } if(tos->wpaint) { writestruct(wd, DATA, "VPaint", 1, tos->wpaint); - write_paint(wd, &tos->wpaint->paint); } if(tos->sculpt) { writestruct(wd, DATA, "Sculpt", 1, tos->sculpt); - write_paint(wd, &tos->sculpt->paint); } - write_paint(wd, &tos->imapaint.paint); + // write_paint(wd, &tos->imapaint.paint); ed= sce->ed; if(ed) { -- cgit v1.2.3