color balance can now be animated in the sequencer.

This commit is contained in:
Campbell Barton
2010-07-06 16:44:05 +00:00
parent 577cd54c8e
commit 2a95a246ed
4 changed files with 52 additions and 10 deletions

View File

@@ -136,8 +136,8 @@ struct SeqEffectHandle {
void printf_strip(struct Sequence *seq);
/* apply functions recursively */
void seqbase_recursive_apply(struct ListBase *seqbase, int (*apply_func)(struct Sequence *seq, void *), void *arg);
void seq_recursive_apply(struct Sequence *seq, int (*apply_func)(struct Sequence *, void *), void *arg);
int seqbase_recursive_apply(struct ListBase *seqbase, int (*apply_func)(struct Sequence *seq, void *), void *arg);
int seq_recursive_apply(struct Sequence *seq, int (*apply_func)(struct Sequence *, void *), void *arg);
// extern
void seq_free_sequence(struct Scene *scene, struct Sequence *seq);

View File

@@ -87,18 +87,27 @@ void printf_strip(Sequence *seq)
fprintf(stderr, "\tseq_tx_set_final_left: %d %d\n\n", seq_tx_get_final_left(seq, 0), seq_tx_get_final_right(seq, 0));
}
void seqbase_recursive_apply(ListBase *seqbase, int (*apply_func)(Sequence *seq, void *), void *arg)
int seqbase_recursive_apply(ListBase *seqbase, int (*apply_func)(Sequence *seq, void *), void *arg)
{
Sequence *iseq;
for(iseq= seqbase->first; iseq; iseq= iseq->next) {
seq_recursive_apply(iseq, apply_func, arg);
if(seq_recursive_apply(iseq, apply_func, arg) == -1)
return -1; /* bail out */
}
return 1;
}
void seq_recursive_apply(Sequence *seq, int (*apply_func)(Sequence *, void *), void *arg)
int seq_recursive_apply(Sequence *seq, int (*apply_func)(Sequence *, void *), void *arg)
{
if(apply_func(seq, arg) && seq->seqbase.first)
seqbase_recursive_apply(&seq->seqbase, apply_func, arg);
int ret= apply_func(seq, arg);
if(ret == -1)
return -1; /* bail out */
if(ret && seq->seqbase.first)
ret = seqbase_recursive_apply(&seq->seqbase, apply_func, arg);
return ret;
}
/* **********************************************************************

View File

@@ -483,6 +483,37 @@ static void rna_Sequence_opacity_set(PointerRNA *ptr, float value) {
((Sequence*)(ptr->data))->blend_opacity = value * 100.0f;
}
static int colbalance_seq_cmp_cb(Sequence *seq, void *arg_pt)
{
struct { Sequence *seq; void *color_balance; } *data= arg_pt;
if(seq->strip && seq->strip->color_balance == data->color_balance) {
data->seq= seq;
return -1; /* done so bail out */
}
return 1;
}
static char *rna_SequenceColorBalance_path(PointerRNA *ptr)
{
Scene *scene= ptr->id.data;
Editing *ed= seq_give_editing(scene, FALSE);
Sequence *seq;
struct { Sequence *seq; void *color_balance; } data;
data.seq= NULL;
data.color_balance= ptr->data;
/* irritating we need to search for our sequence! */
seqbase_recursive_apply(&ed->seqbase, colbalance_seq_cmp_cb, &data);
seq= data.seq;
if (seq && seq->name+2)
return BLI_sprintfN("sequence_editor.sequences_all[\"%s\"].color_balance", seq->name+2);
else
return BLI_strdup("");
}
#else
static void rna_def_strip_element(BlenderRNA *brna)
@@ -613,7 +644,9 @@ static void rna_def_strip_color_balance(BlenderRNA *brna)
RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_COLOR_BALANCE_INVERSE_LIFT);
RNA_def_property_ui_text(prop, "Inverse Lift", "");
RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
RNA_def_struct_path_func(srna, "rna_SequenceColorBalance_path");
/* not yet used
prop= RNA_def_property(srna, "exposure", PROP_FLOAT, PROP_NONE);
RNA_def_property_range(prop, 0.0f, 1.0f);
@@ -1320,7 +1353,7 @@ static void rna_def_solid_color(BlenderRNA *brna)
PropertyRNA *prop;
srna = RNA_def_struct(brna, "ColorSequence", "EffectSequence");
RNA_def_struct_ui_text(srna, "Color Sequence", "Sequence strip creating an image filled with a single color");
RNA_def_struct_ui_text(srna, "Color Sequence", "Sequence strip creating an image filled with a single g");
RNA_def_struct_sdna_from(srna, "SolidColorVars", "effectdata");
prop= RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR);

View File

@@ -1,4 +1,4 @@
#! /usr/bin/env python3
#! /usr/bin/env python3.1
"""
This script is used to help cleaning RNA api.