Sequencer: remove strip's color balance in favor of modifiers
Having two ways to control color balance now seems a bit overkill and not clear. Removed old Color Balance settings from the interface and logic, added versioning code to convert this settings to modifier. Unfortunately, since color balance was a pointer, it's not actually possible to preserve compatibility of old files saved in new blender and opened back in old blender. Hopefully there's no regressions :)
This commit is contained in:
@@ -793,10 +793,6 @@ class SEQUENCER_PT_filter(SequencerButtonsPanel, Panel):
|
||||
col.prop(strip, "use_premultiply")
|
||||
col.prop(strip, "use_float")
|
||||
|
||||
layout.prop(strip, "use_color_balance")
|
||||
if strip.use_color_balance and strip.color_balance: # TODO - need to add this somehow
|
||||
draw_color_balance(layout, strip.color_balance)
|
||||
|
||||
|
||||
class SEQUENCER_PT_proxy(SequencerButtonsPanel, Panel):
|
||||
bl_label = "Proxy / Timecode"
|
||||
|
||||
@@ -42,7 +42,7 @@ extern "C" {
|
||||
* and keep comment above the defines.
|
||||
* Use STRINGIFY() rather than defining with quotes */
|
||||
#define BLENDER_VERSION 263
|
||||
#define BLENDER_SUBVERSION 17
|
||||
#define BLENDER_SUBVERSION 18
|
||||
|
||||
/* 262 was the last editmesh release but its has compatibility code for bmesh data,
|
||||
* so set the minversion to 2.61 */
|
||||
|
||||
@@ -165,9 +165,6 @@ static void seq_free_strip(Strip *strip)
|
||||
if (strip->transform) {
|
||||
MEM_freeN(strip->transform);
|
||||
}
|
||||
if (strip->color_balance) {
|
||||
MEM_freeN(strip->color_balance);
|
||||
}
|
||||
|
||||
MEM_freeN(strip);
|
||||
}
|
||||
@@ -1670,26 +1667,6 @@ void BKE_sequencer_color_balance_apply(StripColorBalance *cb, ImBuf *ibuf, float
|
||||
imb_freerectImBuf(ibuf);
|
||||
}
|
||||
|
||||
static void sequence_color_balance(SeqRenderData context, Sequence *seq, ImBuf *ibuf, float mul, int cfra)
|
||||
{
|
||||
StripColorBalance *cb = seq->strip->color_balance;
|
||||
ImBuf *mask_input = NULL;
|
||||
short make_float = seq->flag & SEQ_MAKE_FLOAT;
|
||||
|
||||
if (seq->mask_sequence) {
|
||||
if (seq->mask_sequence != seq && !BKE_sequence_check_depend(seq, seq->mask_sequence)) {
|
||||
int make_float = ibuf->rect_float != NULL;
|
||||
|
||||
mask_input = BKE_sequencer_render_mask_input(context, SEQUENCE_MASK_INPUT_STRIP, seq->mask_sequence, NULL, cfra, make_float);
|
||||
}
|
||||
}
|
||||
|
||||
BKE_sequencer_color_balance_apply(cb, ibuf, mul, make_float, mask_input);
|
||||
|
||||
if (mask_input)
|
||||
IMB_freeImBuf(mask_input);
|
||||
}
|
||||
|
||||
/*
|
||||
* input preprocessing for SEQ_TYPE_IMAGE, SEQ_TYPE_MOVIE, SEQ_TYPE_MOVIECLIP and SEQ_TYPE_SCENE
|
||||
*
|
||||
@@ -1712,9 +1689,7 @@ int BKE_sequencer_input_have_to_preprocess(SeqRenderData UNUSED(context), Sequen
|
||||
{
|
||||
float mul;
|
||||
|
||||
if (seq->flag & (SEQ_FILTERY | SEQ_USE_CROP | SEQ_USE_TRANSFORM | SEQ_FLIPX |
|
||||
SEQ_FLIPY | SEQ_USE_COLOR_BALANCE | SEQ_MAKE_PREMUL))
|
||||
{
|
||||
if (seq->flag & (SEQ_FILTERY | SEQ_USE_CROP | SEQ_USE_TRANSFORM | SEQ_FLIPX | SEQ_FLIPY | SEQ_MAKE_PREMUL)) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -1833,11 +1808,6 @@ static ImBuf *input_preprocess(SeqRenderData context, Sequence *seq, float cfra,
|
||||
mul *= seq->blend_opacity / 100.0f;
|
||||
}
|
||||
|
||||
if (seq->flag & SEQ_USE_COLOR_BALANCE && seq->strip->color_balance) {
|
||||
sequence_color_balance(context, seq, ibuf, mul, cfra);
|
||||
mul = 1.0;
|
||||
}
|
||||
|
||||
if (seq->flag & SEQ_MAKE_FLOAT) {
|
||||
if (!ibuf->rect_float)
|
||||
IMB_float_from_rect_simple(ibuf);
|
||||
@@ -4037,10 +4007,6 @@ static Sequence *seq_dupli(Scene *scene, Scene *scene_to, Sequence *seq, int dup
|
||||
seqn->strip->proxy->anim = NULL;
|
||||
}
|
||||
|
||||
if (seq->strip->color_balance) {
|
||||
seqn->strip->color_balance = MEM_dupallocN(seq->strip->color_balance);
|
||||
}
|
||||
|
||||
if (seqn->modifiers.first) {
|
||||
seqn->modifiers.first = seqn->modifiers.last = NULL;
|
||||
|
||||
|
||||
@@ -5005,16 +5005,9 @@ static void direct_link_scene(FileData *fd, Scene *sce)
|
||||
else {
|
||||
seq->strip->proxy = NULL;
|
||||
}
|
||||
if (seq->flag & SEQ_USE_COLOR_BALANCE) {
|
||||
seq->strip->color_balance = newdataadr(
|
||||
fd, seq->strip->color_balance);
|
||||
}
|
||||
else {
|
||||
seq->strip->color_balance = NULL;
|
||||
}
|
||||
if (seq->strip->color_balance) {
|
||||
// seq->strip->color_balance->gui = 0; // XXX - peter, is this relevant in 2.5?
|
||||
}
|
||||
|
||||
/* need to load color balance to it could be converted to modifier */
|
||||
seq->strip->color_balance = newdataadr(fd, seq->strip->color_balance);
|
||||
}
|
||||
|
||||
direct_link_sequence_modifiers(fd, &seq->modifiers);
|
||||
@@ -7888,6 +7881,42 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
|
||||
ntreetype->foreach_nodetree(main, NULL, do_version_ntree_mask_264);
|
||||
}
|
||||
|
||||
if (main->versionfile < 263 || (main->versionfile == 263 && main->subversionfile < 18)) {
|
||||
Scene *scene;
|
||||
|
||||
for (scene = main->scene.first; scene; scene = scene->id.next) {
|
||||
if (scene->ed) {
|
||||
Sequence *seq;
|
||||
|
||||
SEQ_BEGIN (scene->ed, seq)
|
||||
{
|
||||
Strip *strip = seq->strip;
|
||||
|
||||
if (strip && strip->color_balance) {
|
||||
SequenceModifierData *smd;
|
||||
ColorBalanceModifierData *cbmd;
|
||||
|
||||
smd = BKE_sequence_modifier_new(seq, NULL, seqModifierType_ColorBalance);
|
||||
cbmd = (ColorBalanceModifierData *) smd;
|
||||
|
||||
cbmd->color_balance = *strip->color_balance;
|
||||
|
||||
/* multiplication with color balance used is handled differently,
|
||||
* so we need to move multiplication to modifier so files would be
|
||||
* compatible
|
||||
*/
|
||||
cbmd->color_multiply = seq->mul;
|
||||
seq->mul = 1.0f;
|
||||
|
||||
MEM_freeN(strip->color_balance);
|
||||
strip->color_balance = NULL;
|
||||
}
|
||||
}
|
||||
SEQ_END
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* WATCH IT!!!: pointers from libdata have not been converted yet here! */
|
||||
/* WATCH IT 2!: Userdef struct init has to be in editors/interface/resources.c! */
|
||||
|
||||
|
||||
@@ -2214,9 +2214,6 @@ static void write_scenes(WriteData *wd, ListBase *scebase)
|
||||
if (seq->flag & SEQ_USE_PROXY && strip->proxy) {
|
||||
writestruct(wd, DATA, "StripProxy", 1, strip->proxy);
|
||||
}
|
||||
if (seq->flag & SEQ_USE_COLOR_BALANCE && strip->color_balance) {
|
||||
writestruct(wd, DATA, "StripColorBalance", 1, strip->color_balance);
|
||||
}
|
||||
if (seq->type==SEQ_TYPE_IMAGE)
|
||||
writestruct(wd, DATA, "StripElem", MEM_allocN_len(strip->stripdata) / sizeof(struct StripElem), strip->stripdata);
|
||||
else if (seq->type==SEQ_TYPE_MOVIE || seq->type==SEQ_TYPE_SOUND_RAM || seq->type == SEQ_TYPE_SOUND_HD)
|
||||
|
||||
@@ -99,7 +99,7 @@ typedef struct Strip {
|
||||
StripProxy *proxy;
|
||||
StripCrop *crop;
|
||||
StripTransform *transform;
|
||||
StripColorBalance *color_balance;
|
||||
StripColorBalance *color_balance DNA_DEPRECATED;
|
||||
} Strip;
|
||||
|
||||
/**
|
||||
@@ -315,7 +315,7 @@ typedef struct BrightContrastModifierData {
|
||||
#define SEQ_USE_PROXY (1 << 15)
|
||||
#define SEQ_USE_TRANSFORM (1 << 16)
|
||||
#define SEQ_USE_CROP (1 << 17)
|
||||
#define SEQ_USE_COLOR_BALANCE (1 << 18)
|
||||
/* #define SEQ_USE_COLOR_BALANCE (1 << 18) */ /* DEPRECATED */
|
||||
#define SEQ_USE_PROXY_CUSTOM_DIR (1 << 19)
|
||||
|
||||
#define SEQ_USE_PROXY_CUSTOM_FILE (1 << 21)
|
||||
|
||||
@@ -244,28 +244,6 @@ static void rna_Sequence_channel_set(PointerRNA *ptr, int value)
|
||||
BKE_sequencer_sort(scene);
|
||||
}
|
||||
|
||||
/* properties that need to allocate structs */
|
||||
static void rna_Sequence_use_color_balance_set(PointerRNA *ptr, int value)
|
||||
{
|
||||
Sequence *seq = (Sequence *)ptr->data;
|
||||
int c;
|
||||
|
||||
if (value) {
|
||||
seq->flag |= SEQ_USE_COLOR_BALANCE;
|
||||
if (seq->strip->color_balance == NULL) {
|
||||
seq->strip->color_balance = MEM_callocN(sizeof(struct StripColorBalance), "StripColorBalance");
|
||||
for (c = 0; c < 3; c++) {
|
||||
seq->strip->color_balance->lift[c] = 1.0f;
|
||||
seq->strip->color_balance->gamma[c] = 1.0f;
|
||||
seq->strip->color_balance->gain[c] = 1.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
seq->flag ^= SEQ_USE_COLOR_BALANCE;
|
||||
}
|
||||
}
|
||||
|
||||
static void rna_Sequence_use_proxy_set(PointerRNA *ptr, int value)
|
||||
{
|
||||
Sequence *seq = (Sequence *)ptr->data;
|
||||
@@ -1631,16 +1609,6 @@ static void rna_def_filter_video(StructRNA *srna)
|
||||
RNA_def_property_ui_text(prop, "Strobe", "Only display every nth frame");
|
||||
RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
|
||||
|
||||
prop = RNA_def_property(srna, "use_color_balance", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_USE_COLOR_BALANCE);
|
||||
RNA_def_property_ui_text(prop, "Use Color Balance", "(3-Way color correction) on input");
|
||||
RNA_def_property_boolean_funcs(prop, NULL, "rna_Sequence_use_color_balance_set");
|
||||
RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
|
||||
|
||||
prop = RNA_def_property(srna, "color_balance", PROP_POINTER, PROP_NONE);
|
||||
RNA_def_property_pointer_sdna(prop, NULL, "strip->color_balance");
|
||||
RNA_def_property_ui_text(prop, "Color Balance", "");
|
||||
|
||||
prop = RNA_def_property(srna, "use_translation", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_USE_TRANSFORM);
|
||||
RNA_def_property_ui_text(prop, "Use Translation", "Translate image before processing");
|
||||
|
||||
Reference in New Issue
Block a user