fix [#26713] Video Sequencer: Audio mute after making meta strip copy/paste
authorCampbell Barton <ideasman42@gmail.com>
Fri, 1 Apr 2011 08:51:12 +0000 (08:51 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Fri, 1 Apr 2011 08:51:12 +0000 (08:51 +0000)
was not recursively restoring sound strips on paste.

also found many duplicate functions were defining the transform mode as in int but getting as an enum, use enum for both now.

13 files changed:
source/blender/blenkernel/BKE_sequencer.h
source/blender/blenkernel/intern/sequencer.c
source/blender/editors/curve/editcurve.c
source/blender/editors/mesh/editmesh_add.c
source/blender/editors/metaball/mball_edit.c
source/blender/editors/object/object_add.c
source/blender/editors/render/render_internal.c
source/blender/editors/space_action/action_edit.c
source/blender/editors/space_graph/graph_edit.c
source/blender/editors/space_nla/nla_edit.c
source/blender/editors/space_sequencer/sequencer_edit.c
source/blender/editors/transform/transform_ops.c
source/blender/makesrna/RNA_enum_types.h

index c53871c..33bff1c 100644 (file)
@@ -258,6 +258,7 @@ int seq_single_check(struct Sequence *seq);
 void seq_single_fix(struct Sequence *seq);
 int seq_test_overlap(struct ListBase * seqbasep, struct Sequence *test);
 void seq_translate(struct Scene *scene, struct Sequence *seq, int delta);
+void seq_sound_init(struct Scene *scene, struct Sequence *seq);
 struct Sequence *seq_foreground_frame_get(struct Scene *scene, int frame);
 struct ListBase *seq_seqbase(struct ListBase *seqbase, struct Sequence *seq);
 void seq_offset_animdata(struct Scene *scene, struct Sequence *seq, int ofs);
index 98a9828..67d7970 100644 (file)
@@ -2974,6 +2974,24 @@ void seq_translate(Scene *evil_scene, Sequence *seq, int delta)
        calc_sequence_disp(evil_scene, seq);
 }
 
+void seq_sound_init(Scene *scene, Sequence *seq)
+{
+       if(seq->type==SEQ_META) {
+               Sequence *seq_child;
+               for(seq_child= seq->seqbase.first; seq_child; seq_child= seq_child->next) {
+                       seq_sound_init(scene, seq_child);
+               }
+       }
+       else {
+               if(seq->sound) {
+                       seq->scene_sound = sound_add_scene_sound(scene, seq, seq->startdisp, seq->enddisp, seq->startofs + seq->anim_startofs);
+               }
+               if(seq->scene) {
+                       sound_scene_add_scene_sound(scene, seq, seq->startdisp, seq->enddisp, seq->startofs + seq->anim_startofs);
+               }
+       }
+}
+
 Sequence *seq_foreground_frame_get(Scene *scene, int frame)
 {
        Editing *ed= seq_give_editing(scene, FALSE);
index 12d1327..9b5f154 100644 (file)
@@ -87,6 +87,7 @@
 
 #include "RNA_access.h"
 #include "RNA_define.h"
+#include "RNA_enum_types.h"
 
 /* Undo stuff */
 typedef struct {
@@ -4755,7 +4756,7 @@ void CURVE_OT_extrude(wmOperatorType *ot)
        ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
 
        /* to give to transform */
-       RNA_def_int(ot->srna, "mode", TFM_TRANSLATION, 0, INT_MAX, "Mode", "", 0, INT_MAX);
+       RNA_def_enum(ot->srna, "mode", transform_mode_types, TFM_TRANSLATION, "Mode", "");
 }
 
 /***************** make cyclic operator **********************/
@@ -5629,7 +5630,7 @@ void CURVE_OT_duplicate(wmOperatorType *ot)
        ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
 
        /* to give to transform */
-       RNA_def_int(ot->srna, "mode", TFM_TRANSLATION, 0, INT_MAX, "Mode", "", 0, INT_MAX);
+       RNA_def_enum(ot->srna, "mode", transform_mode_types, TFM_TRANSLATION, "Mode", "");
 }
 
 /********************** delete operator *********************/
index bd09421..ec84d7f 100644 (file)
@@ -45,6 +45,7 @@
 
 #include "RNA_define.h"
 #include "RNA_access.h"
+#include "RNA_enum_types.h"
 
 #include "BLI_blenlib.h"
 #include "BLI_math.h"
@@ -1768,6 +1769,6 @@ void MESH_OT_duplicate(wmOperatorType *ot)
        ot->poll= ED_operator_editmesh;
        
        /* to give to transform */
-       RNA_def_int(ot->srna, "mode", TFM_TRANSLATION, 0, INT_MAX, "Mode", "", 0, INT_MAX);
+       RNA_def_enum(ot->srna, "mode", transform_mode_types, TFM_TRANSLATION, "Mode", "");
 }
 
index 1cbd7e8..d47e02d 100644 (file)
@@ -48,6 +48,7 @@
 
 #include "RNA_define.h"
 #include "RNA_access.h"
+#include "RNA_enum_types.h"
 
 #include "BKE_depsgraph.h"
 #include "BKE_context.h"
@@ -326,7 +327,7 @@ void MBALL_OT_duplicate_metaelems(wmOperatorType *ot)
        ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
        
        /* to give to transform */
-       RNA_def_int(ot->srna, "mode", TFM_TRANSLATION, 0, INT_MAX, "Mode", "", 0, INT_MAX);
+       RNA_def_enum(ot->srna, "mode", transform_mode_types, TFM_TRANSLATION, "Mode", "");
 }
 
 /***************************** Delete operator *****************************/
index f630b05..c5fbc41 100644 (file)
@@ -1703,7 +1703,7 @@ void OBJECT_OT_duplicate(wmOperatorType *ot)
        
        /* to give to transform */
        RNA_def_boolean(ot->srna, "linked", 0, "Linked", "Duplicate object but not object data, linking to the original data.");
-       prop= RNA_def_int(ot->srna, "mode", TFM_TRANSLATION, 0, INT_MAX, "Mode", "", 0, INT_MAX);
+       prop= RNA_def_enum(ot->srna, "mode", transform_mode_types, TFM_TRANSLATION, "Mode", "");
        RNA_def_property_flag(prop, PROP_HIDDEN);
 }
 
index 39def19..857a36c 100644 (file)
@@ -171,7 +171,7 @@ void image_buffer_rect_update(Scene *scene, RenderResult *rr, ImBuf *ibuf, volat
                        float *rf= rectf;
                        char *rc= rectc;
                        float rgb[3];
-                       const float dither = ibuf->dither / 255.0;
+                       const float dither = ibuf->dither / 255.0f;
 
                        /* XXX temp. because crop offset */
                        if( rectc >= (char *)(ibuf->rect)) {
index 0a98178..b3aa934 100644 (file)
@@ -711,7 +711,7 @@ void ACTION_OT_duplicate (wmOperatorType *ot)
        ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
        
        /* to give to transform */
-       RNA_def_int(ot->srna, "mode", TFM_TIME_TRANSLATE, 0, INT_MAX, "Mode", "", 0, INT_MAX);
+       RNA_def_enum(ot->srna, "mode", transform_mode_types, TFM_TRANSLATION, "Mode", "");
 }
 
 /* ******************** Delete Keyframes Operator ************************* */
index 1bb6e6f..962cadb 100644 (file)
@@ -830,7 +830,7 @@ void GRAPH_OT_duplicate (wmOperatorType *ot)
        ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
        
        /* to give to transform */
-       RNA_def_int(ot->srna, "mode", TFM_TRANSLATION, 0, INT_MAX, "Mode", "", 0, INT_MAX);
+       RNA_def_enum(ot->srna, "mode", transform_mode_types, TFM_TRANSLATION, "Mode", "");
 }
 
 /* ******************** Delete Keyframes Operator ************************* */
index d9cd11b..d058ea7 100644 (file)
@@ -678,7 +678,7 @@ void NLA_OT_duplicate (wmOperatorType *ot)
        ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
        
        /* to give to transform */
-       RNA_def_int(ot->srna, "mode", TFM_TRANSLATION, 0, INT_MAX, "Mode", "", 0, INT_MAX);
+       RNA_def_enum(ot->srna, "mode", transform_mode_types, TFM_TRANSLATION, "Mode", "");
 }
 
 /* ******************** Delete Strips Operator ***************************** */
index 48bdcb8..048581e 100644 (file)
@@ -62,6 +62,7 @@
 #include "WM_types.h"
 
 #include "RNA_define.h"
+#include "RNA_enum_types.h"
 
 /* for menu/popup icons etc etc*/
 
@@ -1678,7 +1679,7 @@ void SEQUENCER_OT_duplicate(wmOperatorType *ot)
        ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
        
        /* to give to transform */
-       RNA_def_int(ot->srna, "mode", TFM_TRANSLATION, 0, INT_MAX, "Mode", "", 0, INT_MAX);
+       RNA_def_enum(ot->srna, "mode", transform_mode_types, TFM_TRANSLATION, "Mode", "");
 }
 
 /* delete operator */
@@ -2671,21 +2672,6 @@ void SEQUENCER_OT_copy(wmOperatorType *ot)
        /* properties */
 }
 
-static void seq_offset(Scene *scene, Sequence *seq, int ofs)
-{
-       if(seq->type == SEQ_META) {
-               Sequence *iseq;
-               for(iseq= seq->seqbase.first; iseq; iseq= iseq->next) {
-                       seq_offset(scene, iseq, ofs);
-               }
-       }
-       else {
-               seq->start += ofs;
-       }
-
-       calc_sequence_disp(scene, seq);
-}
-
 static int sequencer_paste_exec(bContext *C, wmOperator *UNUSED(op))
 {
        Scene *scene= CTX_data_scene(C);
@@ -2702,14 +2688,8 @@ static int sequencer_paste_exec(bContext *C, wmOperator *UNUSED(op))
        /* transform pasted strips before adding */
        if(ofs) {
                for(iseq= nseqbase.first; iseq; iseq= iseq->next) {
-                       seq_offset(scene, iseq, ofs);
-                       /* XXX, ffmpeg too? */
-                       if(iseq->sound) {
-                               iseq->scene_sound = sound_add_scene_sound(scene, iseq, iseq->startdisp, iseq->enddisp, iseq->startofs + iseq->anim_startofs);
-                       }
-                       if(iseq->scene) {
-                               sound_scene_add_scene_sound(scene, iseq, iseq->startdisp, iseq->enddisp, iseq->startofs + iseq->anim_startofs);
-                       }
+                       seq_translate(scene, iseq, ofs);
+                       seq_sound_init(scene, iseq);
                }
        }
 
index 9a78a05..4edaabb 100644 (file)
@@ -110,6 +110,39 @@ static TransformModeItem transform_modes[] =
        {NULL, 0}
 };
 
+EnumPropertyItem transform_mode_types[] =
+{
+       {TFM_INIT, "INIT", 0, "Init", ""},
+       {TFM_DUMMY, "DUMMY", 0, "Dummy", ""},
+       {TFM_TRANSLATION, "TRANSLATION", 0, "Translation", ""},
+       {TFM_ROTATION, "ROTATION", 0, "Rotation", ""},
+       {TFM_RESIZE, "RESIZE", 0, "Resize", ""},
+       {TFM_TOSPHERE, "TOSPHERE", 0, "Tosphere", ""},
+       {TFM_SHEAR, "SHEAR", 0, "Shear", ""},
+       {TFM_WARP, "WARP", 0, "Warp", ""},
+       {TFM_SHRINKFATTEN, "SHRINKFATTEN", 0, "Shrinkfatten", ""},
+       {TFM_TILT, "TILT", 0, "Tilt", ""},
+       {TFM_TRACKBALL, "TRACKBALL", 0, "Trackball", ""},
+       {TFM_PUSHPULL, "PUSHPULL", 0, "Pushpull", ""},
+       {TFM_CREASE, "CREASE", 0, "Crease", ""},
+       {TFM_MIRROR, "MIRROR", 0, "Mirror", ""},
+       {TFM_BONESIZE, "BONE_SIZE", 0, "Bonesize", ""},
+       {TFM_BONE_ENVELOPE, "BONE_ENVELOPE", 0, "Bone_Envelope", ""},
+       {TFM_CURVE_SHRINKFATTEN, "CURVE_SHRINKFATTEN", 0, "Curve_Shrinkfatten", ""},
+       {TFM_BONE_ROLL, "BONE_ROLL", 0, "Bone_Roll", ""},
+       {TFM_TIME_TRANSLATE, "TIME_TRANSLATE", 0, "Time_Translate", ""},
+       {TFM_TIME_SLIDE, "TIME_SLIDE", 0, "Time_Slide", ""},
+       {TFM_TIME_SCALE, "TIME_SCALE", 0, "Time_Scale", ""},
+       {TFM_TIME_EXTEND, "TIME_EXTEND", 0, "Time_Extend", ""},
+       {TFM_BAKE_TIME, "BAKE_TIME", 0, "Bake_Time", ""},
+       {TFM_BEVEL, "BEVEL", 0, "Bevel", ""},
+       {TFM_BWEIGHT, "BWEIGHT", 0, "Bweight", ""},
+       {TFM_ALIGN, "ALIGN", 0, "Align", ""},
+       {TFM_EDGE_SLIDE, "EDGESLIDE", 0, "Edge Slide", ""},
+       {TFM_SEQ_SLIDE, "SEQSLIDE", 0, "Sequence Slide", ""},
+       {0, NULL, 0, NULL, NULL}
+};
+
 static int snap_type_exec(bContext *C, wmOperator *op)
 {
        ToolSettings *ts= CTX_data_tool_settings(C);
@@ -757,38 +790,6 @@ void TRANSFORM_OT_transform(struct wmOperatorType *ot)
 {
        PropertyRNA *prop;
 
-       static EnumPropertyItem transform_mode_types[] = {
-                       {TFM_INIT, "INIT", 0, "Init", ""},
-                       {TFM_DUMMY, "DUMMY", 0, "Dummy", ""},
-                       {TFM_TRANSLATION, "TRANSLATION", 0, "Translation", ""},
-                       {TFM_ROTATION, "ROTATION", 0, "Rotation", ""},
-                       {TFM_RESIZE, "RESIZE", 0, "Resize", ""},
-                       {TFM_TOSPHERE, "TOSPHERE", 0, "Tosphere", ""},
-                       {TFM_SHEAR, "SHEAR", 0, "Shear", ""},
-                       {TFM_WARP, "WARP", 0, "Warp", ""},
-                       {TFM_SHRINKFATTEN, "SHRINKFATTEN", 0, "Shrinkfatten", ""},
-                       {TFM_TILT, "TILT", 0, "Tilt", ""},
-                       {TFM_TRACKBALL, "TRACKBALL", 0, "Trackball", ""},
-                       {TFM_PUSHPULL, "PUSHPULL", 0, "Pushpull", ""},
-                       {TFM_CREASE, "CREASE", 0, "Crease", ""},
-                       {TFM_MIRROR, "MIRROR", 0, "Mirror", ""},
-                       {TFM_BONESIZE, "BONE_SIZE", 0, "Bonesize", ""},
-                       {TFM_BONE_ENVELOPE, "BONE_ENVELOPE", 0, "Bone_Envelope", ""},
-                       {TFM_CURVE_SHRINKFATTEN, "CURVE_SHRINKFATTEN", 0, "Curve_Shrinkfatten", ""},
-                       {TFM_BONE_ROLL, "BONE_ROLL", 0, "Bone_Roll", ""},
-                       {TFM_TIME_TRANSLATE, "TIME_TRANSLATE", 0, "Time_Translate", ""},
-                       {TFM_TIME_SLIDE, "TIME_SLIDE", 0, "Time_Slide", ""},
-                       {TFM_TIME_SCALE, "TIME_SCALE", 0, "Time_Scale", ""},
-                       {TFM_TIME_EXTEND, "TIME_EXTEND", 0, "Time_Extend", ""},
-                       {TFM_BAKE_TIME, "BAKE_TIME", 0, "Bake_Time", ""},
-                       {TFM_BEVEL, "BEVEL", 0, "Bevel", ""},
-                       {TFM_BWEIGHT, "BWEIGHT", 0, "Bweight", ""},
-                       {TFM_ALIGN, "ALIGN", 0, "Align", ""},
-                       {TFM_EDGE_SLIDE, "EDGESLIDE", 0, "Edge Slide", ""},
-                       {TFM_SEQ_SLIDE, "SEQSLIDE", 0, "Sequence Slide", ""},
-                       {0, NULL, 0, NULL, NULL}
-       };
-
        /* identifiers */
        ot->name   = "Transform";
        ot->description= "Transform selected items by mode type";
index e1e5857..0bda47b 100644 (file)
@@ -95,6 +95,8 @@ extern EnumPropertyItem operator_context_items[];
 
 extern EnumPropertyItem wm_report_items[];
 
+extern EnumPropertyItem transform_mode_types[];
+
 extern EnumPropertyItem property_type_items[];
 extern EnumPropertyItem property_unit_items[];