== Sequencer ==

This adds MULTICAM-editing support for blender. (Well, the beginning of.)

There is now a new effect track, named MULTICAM, which just selects
one of the lower tracks.

Doesn't sound that exciting, but if you combine this with A/B-Trim (moving
split points of two directly connected tracks around, while magically
resizing both strips, something to be added), you just do:

* add several tracks for your camera angles
* (optionally) sync those tracks
* add one multicam track on top

Use that multicam-track to edit your movie. (Either using fcurves on the
multicam source selector or using knife-tool and A/B-Trim.)

Compare that to:

* add several tracks
* add cross fades between them
* do some python scripting to add several fcurves to make that beast
  somewhat work.
* cry out loud, using it, if you have to move cut points around

Alternatively, even harder:

* just edit the old way and put strip after strip

You might think, that this isn't really helpfull for animators, but
consider using scene-strips (in OpenGL-mode) for input, that are set for
different camera angles and can now be intercut a lot more easily...

Also: small fix on the way: the speed effect can now be used in cascade.
(Don't know, if anyone used it that way, but now it works.)
This commit is contained in:
2010-04-25 12:53:39 +00:00
parent 3f12beb4d0
commit a92b8b7ff6
8 changed files with 201 additions and 61 deletions

View File

@@ -125,7 +125,7 @@ struct SeqEffectHandle {
void (*execute)(struct Scene *scene, struct Sequence *seq, int cfra,
float facf0, float facf1,
int x, int y,
int x, int y, int preview_render_size,
struct ImBuf *ibuf1, struct ImBuf *ibuf2,
struct ImBuf *ibuf3, struct ImBuf *out);
};
@@ -149,6 +149,7 @@ char *give_seqname(struct Sequence *seq);
struct ImBuf *give_ibuf_seq(struct Scene *scene, int rectx, int recty, int cfra, int chanshown, int render_size);
struct ImBuf *give_ibuf_seq_threaded(struct Scene *scene, int rectx, int recty, int cfra, int chanshown, int render_size);
struct ImBuf *give_ibuf_seq_direct(struct Scene *scene, int rectx, int recty, int cfra, int render_size, struct Sequence *seq);
struct ImBuf *give_ibuf_seqbase(struct Scene *scene, int rectx, int recty, int cfra, int chan_shown, int render_size, struct ListBase *seqbasep);
void give_ibuf_prefetch_request(int rectx, int recty, int cfra, int chanshown, int render_size);
void calc_sequence(struct Scene *scene, struct Sequence *seq);
void calc_sequence_disp(struct Scene *scene, struct Sequence *seq);

View File

@@ -231,6 +231,7 @@ static ImBuf * IMB_cast_away_list(ImBuf * i)
static void do_plugin_effect(Scene *scene, Sequence *seq, int cfra,
float facf0, float facf1, int x, int y,
int preview_render_size,
struct ImBuf *ibuf1, struct ImBuf *ibuf2,
struct ImBuf *ibuf3, struct ImBuf *out)
{
@@ -477,6 +478,7 @@ static void do_alphaover_effect_float(float facf0, float facf1, int x, int y,
static void do_alphaover_effect(Scene *scene, Sequence *seq, int cfra,
float facf0, float facf1, int x, int y,
int preview_render_size,
struct ImBuf *ibuf1, struct ImBuf *ibuf2,
struct ImBuf *ibuf3, struct ImBuf *out)
{
@@ -644,6 +646,7 @@ static void do_alphaunder_effect_float(float facf0, float facf1, int x, int y,
static void do_alphaunder_effect(Scene *scene, Sequence *seq, int cfra,
float facf0, float facf1, int x, int y,
int preview_render_size,
struct ImBuf *ibuf1, struct ImBuf *ibuf2,
struct ImBuf *ibuf3, struct ImBuf *out)
{
@@ -764,6 +767,7 @@ void do_cross_effect_float(float facf0, float facf1, int x, int y,
static void do_cross_effect(Scene *scene, Sequence *seq, int cfra,
float facf0, float facf1, int x, int y,
int preview_render_size,
struct ImBuf *ibuf1, struct ImBuf *ibuf2,
struct ImBuf *ibuf3, struct ImBuf *out)
{
@@ -1026,6 +1030,7 @@ static void do_gammacross_effect_float(float facf0, float facf1,
static void do_gammacross_effect(Scene *scene, Sequence *seq, int cfra,
float facf0, float facf1, int x, int y,
int preview_render_size,
struct ImBuf *ibuf1, struct ImBuf *ibuf2,
struct ImBuf *ibuf3, struct ImBuf *out)
{
@@ -1140,6 +1145,7 @@ static void do_add_effect_float(float facf0, float facf1, int x, int y,
static void do_add_effect(Scene *scene, Sequence *seq, int cfra,
float facf0, float facf1, int x, int y,
int preview_render_size,
struct ImBuf *ibuf1, struct ImBuf *ibuf2,
struct ImBuf *ibuf3, struct ImBuf *out)
{
@@ -1252,6 +1258,7 @@ static void do_sub_effect_float(float facf0, float facf1, int x, int y,
static void do_sub_effect(Scene *scene, Sequence *seq, int cfra,
float facf0, float facf1, int x, int y,
int preview_render_size,
struct ImBuf *ibuf1, struct ImBuf *ibuf2,
struct ImBuf *ibuf3, struct ImBuf *out)
{
@@ -1360,6 +1367,7 @@ static void do_drop_effect_float(float facf0, float facf1, int x, int y,
static void do_drop_effect(Scene *scene, Sequence *seq, int cfra,
float facf0, float facf1, int x, int y,
int preview_render_size,
struct ImBuf *ibuf1, struct ImBuf *ibuf2,
struct ImBuf * ibuf3,
struct ImBuf *out)
@@ -1481,6 +1489,7 @@ static void do_mul_effect_float(float facf0, float facf1, int x, int y,
static void do_mul_effect(Scene *scene, Sequence *seq, int cfra,
float facf0, float facf1, int x, int y,
int preview_render_size,
struct ImBuf *ibuf1, struct ImBuf *ibuf2,
struct ImBuf *ibuf3, struct ImBuf *out)
{
@@ -1931,6 +1940,7 @@ static void do_wipe_effect_float(Sequence *seq, float facf0, float facf1,
static void do_wipe_effect(Scene *scene, Sequence *seq, int cfra,
float facf0, float facf1, int x, int y,
int preview_render_size,
struct ImBuf *ibuf1, struct ImBuf *ibuf2,
struct ImBuf *ibuf3, struct ImBuf *out)
{
@@ -2076,6 +2086,7 @@ static void do_transform(Scene *scene, Sequence *seq, float facf0, int x, int y,
static void do_transform_effect(Scene *scene, Sequence *seq,int cfra,
float facf0, float facf1, int x, int y,
int preview_render_size,
struct ImBuf *ibuf1, struct ImBuf *ibuf2,
struct ImBuf *ibuf3, struct ImBuf *out)
{
@@ -2588,6 +2599,7 @@ static void do_glow_effect_float(Sequence *seq, float facf0, float facf1,
static void do_glow_effect(Scene *scene, Sequence *seq, int cfra,
float facf0, float facf1, int x, int y,
int preview_render_size,
struct ImBuf *ibuf1, struct ImBuf *ibuf2,
struct ImBuf *ibuf3, struct ImBuf *out)
{
@@ -2643,6 +2655,7 @@ static int early_out_color(struct Sequence *seq,
static void do_solid_color(Scene *scene, Sequence *seq, int cfra,
float facf0, float facf1, int x, int y,
int preview_render_size,
struct ImBuf *ibuf1, struct ImBuf *ibuf2,
struct ImBuf *ibuf3, struct ImBuf *out)
{
@@ -2717,6 +2730,64 @@ static void do_solid_color(Scene *scene, Sequence *seq, int cfra,
}
}
/* **********************************************************************
MULTICAM
********************************************************************** */
/* no effect inputs for multicam, we use give_ibuf_seq */
static int num_inputs_multicam()
{
return 0;
}
static int early_out_multicam(struct Sequence *seq, float facf0, float facf1)
{
return -1;
}
static void do_multicam(Scene *scene, Sequence *seq, int cfra,
float facf0, float facf1, int x, int y,
int preview_render_size,
struct ImBuf *ibuf1, struct ImBuf *ibuf2,
struct ImBuf *ibuf3, struct ImBuf *out)
{
struct ImBuf * i;
Editing * ed;
ListBase * seqbasep;
if (seq->multicam_source == 0 || seq->multicam_source >= seq->machine) {
return;
}
ed = scene->ed;
if (!ed) {
return;
}
seqbasep = seq_seqbase(&ed->seqbase, seq);
if (!seqbasep) {
return;
}
i = give_ibuf_seqbase(scene,
out->x, out->y, cfra, seq->multicam_source,
preview_render_size, seqbasep);
if (!i) {
return;
}
if (out->rect && i->rect) {
memcpy(out->rect, i->rect, out->x * out->y * 4);
} else if (out->rect_float && i->rect_float) {
memcpy(out->rect_float, i->rect_float, out->x * out->y *4*sizeof(float));
} else if (out->rect && i->rect_float) {
IMB_rect_from_float(i);
memcpy(out->rect, i->rect, out->x * out->y * 4);
} else if (out->rect_float && i->rect) {
IMB_float_from_rect(i);
memcpy(out->rect_float, i->rect_float, out->x * out->y *4*sizeof(float));
}
}
/* **********************************************************************
SPEED
********************************************************************** */
@@ -3006,14 +3077,18 @@ static void get_default_fac_fade(struct Sequence *seq, int cfra,
static void do_overdrop_effect(Scene *scene, Sequence *seq, int cfra,
float fac, float facf,
int x, int y, struct ImBuf * ibuf1,
int x, int y,
int preview_render_size,
struct ImBuf * ibuf1,
struct ImBuf * ibuf2,
struct ImBuf * ibuf3,
struct ImBuf * out)
{
do_drop_effect(scene, seq, cfra, fac, facf, x, y,
preview_render_size,
ibuf1, ibuf2, ibuf3, out);
do_alphaover_effect(scene, seq, cfra, fac, facf, x, y,
preview_render_size,
ibuf1, ibuf2, ibuf3, out);
}
@@ -3121,6 +3196,11 @@ static struct SeqEffectHandle get_sequence_effect_impl(int seq_type)
rval.early_out = do_plugin_early_out;
rval.get_default_fac = get_default_fac_fade;
break;
case SEQ_MULTICAM:
rval.num_inputs = num_inputs_multicam;
rval.early_out = early_out_multicam;
rval.execute = do_multicam;
break;
}
return rval;

View File

@@ -886,7 +886,8 @@ static void multibuf(ImBuf *ibuf, float fmul)
}
}
static void do_effect(Scene *scene, int cfra, Sequence *seq, TStripElem * se)
static void do_effect(Scene *scene, int cfra, Sequence *seq, TStripElem * se,
int render_size)
{
TStripElem *se1, *se2, *se3;
float fac, facf;
@@ -920,7 +921,7 @@ static void do_effect(Scene *scene, int cfra, Sequence *seq, TStripElem * se)
if (early_out == -1) { /* no input needed */
sh.execute(scene, seq, cfra, fac, facf,
se->ibuf->x, se->ibuf->y,
se->ibuf->x, se->ibuf->y, render_size,
0, 0, 0, se->ibuf);
return;
}
@@ -1008,7 +1009,8 @@ static void do_effect(Scene *scene, int cfra, Sequence *seq, TStripElem * se)
IMB_rect_from_float(se3->ibuf);
}
sh.execute(scene, seq, cfra, fac, facf, x, y, se1->ibuf, se2->ibuf, se3->ibuf,
sh.execute(scene, seq, cfra, fac, facf, x, y, render_size,
se1->ibuf, se2->ibuf, se3->ibuf,
se->ibuf);
}
@@ -2023,7 +2025,7 @@ static void do_build_seq_ibuf(Scene *scene, Sequence * seq, TStripElem *se, int
else
se->ibuf= IMB_allocImBuf((short)seqrectx, (short)seqrecty, 32, IB_rect, 0);
do_effect(scene, cfra, seq, se);
do_effect(scene, cfra, seq, se, render_size);
if (input_have_to_preprocess(scene, seq, se, cfra,
seqrectx, seqrecty) &&
!build_proxy_run) {
@@ -2362,7 +2364,7 @@ static TStripElem* do_handle_speed_effect(Scene *scene, Sequence * seq, int cfra
test_and_auto_discard_ibuf(se, seqrectx, seqrecty);
if (se->ibuf == NULL) {
se1 = do_build_seq_recursively_impl(scene, seq->seq1, cfra_left, render_size, seqrectx, seqrecty);
se1 = do_build_seq_recursively(scene, seq->seq1, cfra_left, render_size, seqrectx, seqrecty);
if((se1 && se1->ibuf && se1->ibuf->rect_float))
se->ibuf= IMB_allocImBuf((short)seqrectx, (short)seqrecty, 32, IB_rectfloat, 0);
@@ -2394,8 +2396,8 @@ static TStripElem* do_handle_speed_effect(Scene *scene, Sequence * seq, int cfra
}
if (se->ibuf == NULL) {
se1 = do_build_seq_recursively_impl(scene, seq->seq1, cfra_left, render_size, seqrectx, seqrecty);
se2 = do_build_seq_recursively_impl(scene, seq->seq1, cfra_right, render_size, seqrectx, seqrecty);
se1 = do_build_seq_recursively(scene, seq->seq1, cfra_left, render_size, seqrectx, seqrecty);
se2 = do_build_seq_recursively(scene, seq->seq1, cfra_right, render_size, seqrectx, seqrecty);
if((se1 && se1->ibuf && se1->ibuf->rect_float))
se->ibuf= IMB_allocImBuf((short)seqrectx, (short)seqrecty, 32, IB_rectfloat, 0);
@@ -2411,6 +2413,7 @@ static TStripElem* do_handle_speed_effect(Scene *scene, Sequence * seq, int cfra
f_cfra - (float) cfra_left,
f_cfra - (float) cfra_left,
se->ibuf->x, se->ibuf->y,
render_size,
se1->ibuf, se2->ibuf, 0, se->ibuf);
}
}
@@ -2450,6 +2453,11 @@ static TStripElem* do_handle_speed_effect(Scene *scene, Sequence * seq, int cfra
static TStripElem* do_build_seq_recursively(Scene *scene, Sequence * seq, int cfra, int render_size, int seqrectx, int seqrecty)
{
TStripElem *se;
/* BAD HACK! Seperate handling for speed effects needed, since
a) you can't just fetch a different cfra within an effect strip
b) we have to blend two frames, and CFRA is not float...
*/
if (seq->type == SEQ_SPEED) {
se = do_handle_speed_effect(scene, seq, cfra, render_size, seqrectx, seqrecty);
} else {
@@ -2679,12 +2687,12 @@ static TStripElem* do_build_seq_array_recursively(
if (swap_input) {
sh.execute(scene, seq, cfra,
facf, facf, x, y,
facf, facf, x, y, render_size,
se2->ibuf, se1->ibuf_comp, 0,
se2->ibuf_comp);
} else {
sh.execute(scene, seq, cfra,
facf, facf, x, y,
facf, facf, x, y, render_size,
se1->ibuf_comp, se2->ibuf, 0,
se2->ibuf_comp);
}
@@ -2746,6 +2754,26 @@ static ImBuf *give_ibuf_seq_impl(Scene *scene, int rectx, int recty, int cfra, i
return se->ibuf_comp;
}
ImBuf *give_ibuf_seqbase(struct Scene *scene, int rectx, int recty, int cfra, int chanshown, int render_size, ListBase *seqbasep)
{
TStripElem *se;
se = do_build_seq_array_recursively(scene, seqbasep, cfra, chanshown, render_size, rectx, recty);
if(!se) {
return 0;
}
check_limiter_refcount_comp("give_ibuf_seqbase", se);
if (se->ibuf_comp) {
IMB_cache_limiter_unref(se->ibuf_comp);
}
return se->ibuf_comp;
}
ImBuf *give_ibuf_seq_direct(Scene *scene, int rectx, int recty, int cfra, int render_size, Sequence *seq)
{
TStripElem* se;

View File

@@ -126,6 +126,7 @@ static void get_seq_color3ubv(Scene *curscene, Sequence *seq, char *col)
case SEQ_ALPHAUNDER:
case SEQ_OVERDROP:
case SEQ_GLOW:
case SEQ_MULTICAM:
/* slightly offset hue to distinguish different effects */
UI_GetThemeColor3ubv(TH_SEQ_EFFECT, col);
@@ -451,7 +452,9 @@ static void draw_seq_text(View2D *v2d, Sequence *seq, float x1, float x2, float
else {
sprintf(str, "%d | %s", seq->len, name);
}
}
else if(seq->type == SEQ_MULTICAM) {
sprintf(str, "Cam: %d", seq->multicam_source);
}
else if(seq->type == SEQ_IMAGE) {
sprintf(str, "%d | %s%s", seq->len, seq->strip->dir, seq->strip->stripdata->name);

View File

@@ -103,6 +103,7 @@ EnumPropertyItem sequencer_prop_effect_types[] = {
{SEQ_TRANSFORM, "TRANSFORM", 0, "Transform", "Transform effect strip type"},
{SEQ_COLOR, "COLOR", 0, "Color", "Color effect strip type"},
{SEQ_SPEED, "SPEED", 0, "Speed", "Color effect strip type"},
{SEQ_MULTICAM, "MULTICAM", 0, "Multicam Selector", ""},
{0, NULL, 0, NULL, NULL}
};

View File

@@ -164,10 +164,11 @@ typedef struct Sequence {
struct bSound *sound; /* the linked "bSound" object */
void *scene_sound;
float volume, pad;
float volume;
float level, pan; /* level in dB (0=full), pan -1..1 */
int scenenr; /* for scene selection */
int multicam_source; /* for multicam source selection */
float strobe;
void *effectdata; /* Struct pointer for effect settings */
@@ -306,7 +307,8 @@ typedef struct SpeedControlVars {
#define SEQ_TRANSFORM 27
#define SEQ_COLOR 28
#define SEQ_SPEED 29
#define SEQ_EFFECT_MAX 29
#define SEQ_MULTICAM 30
#define SEQ_EFFECT_MAX 30
#define STRIPELEM_FAILED 0
#define STRIPELEM_OK 1

View File

@@ -316,6 +316,7 @@ extern StructRNA RNA_MotionPath;
extern StructRNA RNA_MotionPathVert;
extern StructRNA RNA_MouseSensor;
extern StructRNA RNA_MovieSequence;
extern StructRNA RNA_MulticamSequence;
extern StructRNA RNA_MultiresModifier;
extern StructRNA RNA_MusgraveTexture;
extern StructRNA RNA_NandController;

View File

@@ -297,6 +297,8 @@ static StructRNA* rna_Sequence_refine(struct PointerRNA *ptr)
case SEQ_MUL:
case SEQ_OVERDROP:
return &RNA_EffectSequence;
case SEQ_MULTICAM:
return &RNA_MulticamSequence;
case SEQ_PLUGIN:
return &RNA_PluginSequence;
case SEQ_WIPE:
@@ -603,6 +605,7 @@ static void rna_def_sequence(BlenderRNA *brna)
{SEQ_TRANSFORM, "TRANSFORM", 0, "Transform", ""},
{SEQ_COLOR, "COLOR", 0, "Color", ""},
{SEQ_SPEED, "SPEED", 0, "Speed", ""},
{SEQ_MULTICAM, "MULTICAM", 0, "Multicam Selector", ""},
{0, NULL, 0, NULL, NULL}};
static const EnumPropertyItem blend_mode_items[]= {
@@ -1057,6 +1060,26 @@ static void rna_def_effect(BlenderRNA *brna)
rna_def_proxy(srna);
}
static void rna_def_multicam(BlenderRNA *brna)
{
StructRNA *srna;
PropertyRNA *prop;
srna = RNA_def_struct(brna, "MulticamSequence", "Sequence");
RNA_def_struct_ui_text(srna, "Multicam Select Sequence", "Sequence strip to perform multicam editing: select channel from below");
RNA_def_struct_sdna(srna, "Sequence");
prop= RNA_def_property(srna, "multicam_source", PROP_INT, PROP_UNSIGNED);
RNA_def_property_int_sdna(prop, NULL, "multicam_source");
RNA_def_property_range(prop, 0, MAXSEQ-1);
RNA_def_property_ui_text(prop, "Multicam Source Channel", "");
RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
rna_def_filter_video(srna);
rna_def_proxy(srna);
rna_def_input(srna);
}
static void rna_def_plugin(BlenderRNA *brna)
{
StructRNA *srna;
@@ -1305,6 +1328,7 @@ void RNA_def_sequencer(BlenderRNA *brna)
rna_def_movie(brna);
rna_def_sound(brna);
rna_def_effect(brna);
rna_def_multicam(brna);
rna_def_plugin(brna);
rna_def_wipe(brna);
rna_def_glow(brna);