diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2013-02-19 12:37:08 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2013-02-19 12:37:08 +0400 |
commit | e5a135e0b26d7a268e7507ffb1be2f2fcc1b0b9c (patch) | |
tree | 82bd3feee50e121dd1e5dcbd6957b1e0ba3ac742 /source/blender/blenkernel/intern/sequencer.c | |
parent | c68d5325d0706305937372e42bd981197440de24 (diff) |
Fixes for alpha mode do_versions code
Before this change only old flag "Premultiply" was used to
detect alpha mode, which is not enough actually.
Now the logic here is:
- If "Premultiply" was enabled it is likely float image with
straight alpha, which shall be premultiplied before usage.
In this case image/sequence Alpha Mode is set to Straight.
- Otherwise use default alpha mode for image format based on
an extension. This could fail in some cases like TIFF, but
this wasn't handled fully correct in older blender anyway.
Initial discovered issue was that EXR images saved in older
Blender versions were set to Straight alpha mode, which is
obviously a straight way to lots of headache.
Diffstat (limited to 'source/blender/blenkernel/intern/sequencer.c')
-rw-r--r-- | source/blender/blenkernel/intern/sequencer.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index 45393726add..68618287546 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -3955,6 +3955,24 @@ Sequence *BKE_sequence_alloc(ListBase *lb, int cfra, int machine) return seq; } +void BKE_sequence_alpha_mode_from_extension(Sequence *seq) +{ + if (seq->strip && seq->strip->stripdata) { + char *name = seq->strip->stripdata->name; + + if (BLI_testextensie(name, ".exr") || + BLI_testextensie(name, ".cin") || + BLI_testextensie(name, ".dpx") || + BLI_testextensie(name, ".hdr")) + { + seq->alpha_mode = IMA_ALPHA_PREMUL; + } + else { + seq->alpha_mode = IMA_ALPHA_STRAIGHT; + } + } +} + void BKE_sequence_init_colorspace(Sequence *seq) { if (seq->strip && seq->strip->stripdata) { |