Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJanne Karhu <jhkarh@gmail.com>2010-09-29 17:38:43 +0400
committerJanne Karhu <jhkarh@gmail.com>2010-09-29 17:38:43 +0400
commitc5157cda88938177685225bc8f264a4a46883250 (patch)
treeb386fa59df5301e68c8dc84861b2e27e74c4dcb9
parent3dcc68e52949a1db122673c13545705a319e8902 (diff)
Cleanup of code and ui of sequencer speed effect.
* Sequence speed effect was functional in theory, but very difficult to actually use. * Now the effect works as follows: - "Speed Factor" (formerly "speed fade") controls the current speed of the sequence (can be animated). - "Use as speed" (formerly "f-curve velocity") is now the default behavior so that the "speed effect" by default changes the "speed" of the sequence. - "Multiply Speed" (formerly "global speed") is a scale factor that's applied to the calculated frame (can't be animated). - Without animation "Speed Factor" and "Multiply Speed" work exactly the same (in this case "multiply speed" could perhaps be disabled in ui, but currently there's no easy way to check this). - If "Use as speed" is not checked the effect simply remaps the current frame to the given "Frame Number" (can be animated). - "Scale to length" (formerly "f-curve compress y")scales "Frame numbers" from 0.0-1.0 to the length of the target strip to allow easy animation. * Tooltips added for all values and options. * Code for frame blending was nowhere to be seen, so I commented the option out from ui. * This should fix at least bugs #20979 and #21309.
-rw-r--r--release/scripts/ui/space_sequencer.py15
-rw-r--r--source/blender/blenkernel/intern/seqeffects.c42
-rw-r--r--source/blender/makesrna/intern/rna_sequencer.c16
3 files changed, 32 insertions, 41 deletions
diff --git a/release/scripts/ui/space_sequencer.py b/release/scripts/ui/space_sequencer.py
index a9dd0663592..f1d07fbdef7 100644
--- a/release/scripts/ui/space_sequencer.py
+++ b/release/scripts/ui/space_sequencer.py
@@ -435,12 +435,15 @@ class SEQUENCER_PT_effect(SequencerButtonsPanel, bpy.types.Panel):
row.prop(strip, "use_only_boost")
elif strip.type == 'SPEED':
- layout.prop(strip, "global_speed")
+ layout.prop(strip, "use_as_speed")
+ if strip.use_as_speed:
+ layout.prop(strip, "speed_factor")
+ else:
+ layout.prop(strip, "speed_factor", text="Frame number")
+ layout.prop(strip, "scale_to_length")
- flow = layout.column_flow()
- flow.prop(strip, "use_curve_velocity")
- flow.prop(strip, "use_curve_compress_y")
- flow.prop(strip, "use_frame_blend")
+ #doesn't work currently
+ #layout.prop(strip, "use_frame_blend")
elif strip.type == 'TRANSFORM':
self.draw_panel_transform(strip)
@@ -460,7 +463,7 @@ class SEQUENCER_PT_effect(SequencerButtonsPanel, bpy.types.Panel):
col = layout.column(align=True)
if strip.type == 'SPEED':
- col.prop(strip, "speed_fader", text="Speed fader")
+ col.prop(strip, "multiply_speed")
elif strip.type in ('CROSS', 'GAMMA_CROSS', 'PLUGIN', 'WIPE'):
col.prop(strip, "use_default_fade", "Default fade")
if not strip.use_default_fade:
diff --git a/source/blender/blenkernel/intern/seqeffects.c b/source/blender/blenkernel/intern/seqeffects.c
index 461cb075bb0..4a00922f1d2 100644
--- a/source/blender/blenkernel/intern/seqeffects.c
+++ b/source/blender/blenkernel/intern/seqeffects.c
@@ -2873,7 +2873,7 @@ static void init_speed_effect(Sequence *seq)
v = (SpeedControlVars *)seq->effectdata;
v->globalSpeed = 1.0;
v->frameMap = 0;
- v->flags = 0;
+ v->flags |= SEQ_SPEED_INTEGRATE; /* should be default behavior */
v->length = 0;
}
@@ -2936,9 +2936,8 @@ static void store_icu_yrange_speed(struct Sequence * seq,
}
void sequence_effect_speed_rebuild_map(Scene *scene, Sequence * seq, int force)
{
- float ctime, div;
int cfra;
- float fallback_fac;
+ float fallback_fac = 1.0f;
SpeedControlVars * v = (SpeedControlVars *)seq->effectdata;
FCurve *fcu= NULL;
@@ -2955,7 +2954,7 @@ void sequence_effect_speed_rebuild_map(Scene *scene, Sequence * seq, int force)
/* XXX - new in 2.5x. should we use the animation system this way?
* The fcurve is needed because many frames need evaluating at once - campbell */
- fcu= id_data_find_fcurve(&scene->id, seq, &RNA_Sequence, "speed_fader", 0);
+ fcu= id_data_find_fcurve(&scene->id, seq, &RNA_Sequence, "speed_factor", 0);
if (!v->frameMap || v->length != seq->len) {
@@ -2966,17 +2965,12 @@ void sequence_effect_speed_rebuild_map(Scene *scene, Sequence * seq, int force)
v->frameMap = MEM_callocN(sizeof(float) * v->length,
"speedcontrol frameMap");
}
-
- fallback_fac = 1.0;
- /* if there is no fcurve, try to make retiming easy by stretching the
- strip */
- if (!fcu && seq->seq1->enddisp != seq->seq1->start && seq->seq1->len != 0) {
- fallback_fac = (float) seq->seq1->len /
- (float) (seq->seq1->enddisp - seq->seq1->start);
- }
+ /* if there is no fcurve, use value as simple multiplier */
+ if (!fcu)
+ fallback_fac = seq->speed_fader; /* same as speed_factor in rna*/
- if ((v->flags & SEQ_SPEED_INTEGRATE) != 0) {
+ if (v->flags & SEQ_SPEED_INTEGRATE) {
float cursor = 0;
float facf;
@@ -2985,10 +2979,7 @@ void sequence_effect_speed_rebuild_map(Scene *scene, Sequence * seq, int force)
for (cfra = 1; cfra < v->length; cfra++) {
if(fcu) {
- ctime = seq->startdisp + cfra;
- div = 1.0;
-
- facf = evaluate_fcurve(fcu, ctime/div);
+ facf = evaluate_fcurve(fcu, seq->startdisp + cfra);
} else {
facf = fallback_fac;
}
@@ -3010,19 +3001,16 @@ void sequence_effect_speed_rebuild_map(Scene *scene, Sequence * seq, int force)
for (cfra = 0; cfra < v->length; cfra++) {
if(fcu) {
- ctime = seq->startdisp + cfra;
- div = 1.0;
-
- facf = evaluate_fcurve(fcu, ctime / div);
- if (v->flags & SEQ_SPEED_COMPRESS_IPO_Y) {
- facf *= v->length;
- }
+ facf = evaluate_fcurve(fcu, seq->startdisp + cfra);
+ } else {
+ facf = fallback_fac;
}
-
- if (!fcu) {
- facf = (float) cfra * fallback_fac;
+
+ if (v->flags & SEQ_SPEED_COMPRESS_IPO_Y) {
+ facf *= v->length;
}
facf *= v->globalSpeed;
+
if (facf >= seq->seq1->len) {
facf = seq->seq1->len - 1;
} else {
diff --git a/source/blender/makesrna/intern/rna_sequencer.c b/source/blender/makesrna/intern/rna_sequencer.c
index 3593efaa743..b6a09b9c217 100644
--- a/source/blender/makesrna/intern/rna_sequencer.c
+++ b/source/blender/makesrna/intern/rna_sequencer.c
@@ -980,9 +980,9 @@ static void rna_def_sequence(BlenderRNA *brna)
RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
- prop= RNA_def_property(srna, "speed_fader", PROP_FLOAT, PROP_NONE);
+ prop= RNA_def_property(srna, "speed_factor", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "speed_fader");
- RNA_def_property_ui_text(prop, "Speed effect fader position", "");
+ RNA_def_property_ui_text(prop, "Speed factor", "Multiply the current speed of the sequence with this number or remap current frame to this frame");
RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
RNA_api_sequence_strip(srna);
@@ -1535,16 +1535,16 @@ static void rna_def_speed_control(BlenderRNA *brna)
RNA_def_struct_ui_text(srna, "SpeedControl Sequence", "Sequence strip to control the speed of other strips");
RNA_def_struct_sdna_from(srna, "SpeedControlVars", "effectdata");
- prop= RNA_def_property(srna, "global_speed", PROP_FLOAT, PROP_UNSIGNED);
+ prop= RNA_def_property(srna, "multiply_speed", PROP_FLOAT, PROP_UNSIGNED);
RNA_def_property_float_sdna(prop, NULL, "globalSpeed");
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); /* seq->facf0 is used to animate this */
- RNA_def_property_ui_text(prop, "Global Speed", "");
+ RNA_def_property_ui_text(prop, "Multiply Speed", "Multiply the resulting speed after the speed factor");
RNA_def_property_ui_range(prop, 0.0f, 100.0f, 1, 0);
RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
- prop= RNA_def_property(srna, "use_curve_velocity", PROP_BOOLEAN, PROP_NONE);
+ prop= RNA_def_property(srna, "use_as_speed", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flags", SEQ_SPEED_INTEGRATE);
- RNA_def_property_ui_text(prop, "F-Curve Velocity", "Interpret the F-Curve value as a velocity instead of a frame number");
+ RNA_def_property_ui_text(prop, "Use as speed", "Interpret the value as speed instead of a frame number");
RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
prop= RNA_def_property(srna, "use_frame_blend", PROP_BOOLEAN, PROP_NONE);
@@ -1552,9 +1552,9 @@ static void rna_def_speed_control(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Frame Blending", "Blend two frames into the target for a smoother result");
RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
- prop= RNA_def_property(srna, "use_curve_compress_y", PROP_BOOLEAN, PROP_NONE);
+ prop= RNA_def_property(srna, "scale_to_length", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flags", SEQ_SPEED_COMPRESS_IPO_Y);
- RNA_def_property_ui_text(prop, "F-Curve Compress Y", "Scale F-Curve value to get the target frame number, F-Curve value runs from 0.0 to 1.0");
+ RNA_def_property_ui_text(prop, "Scale to length", "Scale values from 0.0 to 1.0 to target sequence length");
RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
}