diff options
author | Antony Riakiotakis <kalast@gmail.com> | 2015-02-11 17:07:04 +0300 |
---|---|---|
committer | Antony Riakiotakis <kalast@gmail.com> | 2015-02-11 17:07:24 +0300 |
commit | f7e131a6acd800a311e50b680e5be6d9824a1df7 (patch) | |
tree | 30cbe9ff93d0e59d806df735a83ba0f3d4df99a1 /source/blender/blenloader | |
parent | b7bac19acaa41567967a43ae8aa8756e23f27a83 (diff) |
Cavity masking - add curve control to cavity mask and move relevant
structs to paint struct (might be useful for vertex paint too in the
future)
Cavity masking now has a curve control. The control will set the amount
of masking for positive cavity ("pointness") or negative cavity
("cavity") with x axis being the amount of cavity and 0.0 = full cavity,
1.0 = full pointness, 0.5 = no cavity and the y axis being the amount of
alpha.
Diffstat (limited to 'source/blender/blenloader')
-rw-r--r-- | source/blender/blenloader/intern/readfile.c | 30 | ||||
-rw-r--r-- | source/blender/blenloader/intern/writefile.c | 14 |
2 files changed, 35 insertions, 9 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 7bfe6f0397b..5e481369546 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -5428,12 +5428,26 @@ static void link_recurs_seq(FileData *fd, ListBase *lb) } } -static void direct_link_paint(FileData *fd, Paint **paint) +static void direct_link_paint(FileData *fd, Paint *p) +{ + if (p->num_input_samples < 1) + p->num_input_samples = 1; + + p->cavity_curve = newdataadr(fd, p->cavity_curve); + if (p->cavity_curve) + direct_link_curvemapping(fd, p->cavity_curve); + else + BKE_paint_cavity_curve_preset(p, CURVE_PRESET_SHARP); +} + +static void direct_link_paint_helper(FileData *fd, Paint **paint) { /* TODO. is this needed */ (*paint) = newdataadr(fd, (*paint)); - if (*paint && (*paint)->num_input_samples < 1) - (*paint)->num_input_samples = 1; + + if (*paint) { + direct_link_paint(fd, *paint); + } } static void direct_link_sequence_modifiers(FileData *fd, ListBase *lb) @@ -5499,11 +5513,13 @@ static void direct_link_scene(FileData *fd, Scene *sce) sce->toolsettings= newdataadr(fd, sce->toolsettings); if (sce->toolsettings) { - direct_link_paint(fd, (Paint**)&sce->toolsettings->sculpt); - direct_link_paint(fd, (Paint**)&sce->toolsettings->vpaint); - direct_link_paint(fd, (Paint**)&sce->toolsettings->wpaint); - direct_link_paint(fd, (Paint**)&sce->toolsettings->uvsculpt); + direct_link_paint_helper(fd, (Paint**)&sce->toolsettings->sculpt); + direct_link_paint_helper(fd, (Paint**)&sce->toolsettings->vpaint); + direct_link_paint_helper(fd, (Paint**)&sce->toolsettings->wpaint); + direct_link_paint_helper(fd, (Paint**)&sce->toolsettings->uvsculpt); + direct_link_paint(fd, &sce->toolsettings->imapaint.paint); + sce->toolsettings->imapaint.paintcursor = NULL; sce->toolsettings->particle.paintcursor = NULL; sce->toolsettings->particle.scene = NULL; diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c index e671e102f0b..6031400684c 100644 --- a/source/blender/blenloader/intern/writefile.c +++ b/source/blender/blenloader/intern/writefile.c @@ -2316,6 +2316,12 @@ static void write_view_settings(WriteData *wd, ColorManagedViewSettings *view_se } } +static void write_paint(WriteData *wd, Paint *p) +{ + if (p->cavity_curve) + write_curvemapping(wd, p->cavity_curve); +} + static void write_scenes(WriteData *wd, ListBase *scebase) { Scene *sce; @@ -2351,18 +2357,22 @@ 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); } if (tos->uvsculpt) { writestruct(wd, DATA, "UvSculpt", 1, tos->uvsculpt); + write_paint (wd, &tos->uvsculpt->paint); } - // write_paint(wd, &tos->imapaint.paint); + write_paint(wd, &tos->imapaint.paint); ed= sce->ed; if (ed) { @@ -3069,7 +3079,7 @@ static void write_brushes(WriteData *wd, ListBase *idbase) if (brush->curve) write_curvemapping(wd, brush->curve); - if (brush->curve) + if (brush->gradient) writestruct(wd, DATA, "ColorBand", 1, brush->gradient); } } |