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 c53871cabd200b25c9961acc24df7745b697d482..33bff1cd6a7c684f49233acd415fa5025f6117ce 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 98a982824ba4490e0fede3846db258ebe6dd3c59..67d79709c4f53ab22b2724013db12ac04ba65da0 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 12d1327da68c3d1c4b0a159603a0e319505b3265..9b5f1546898e09591116b230484db16cd629f99d 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 bd094211270a2f05f62e72dd3bfda1248a8e008f..ec84d7f830f12e93e62a2146b0a557a86daa6df2 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 1cbd7e82b959ff18f4f590e0f221227497de6001..d47e02dc63cc52b96758042ed0e9088b404a8daf 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 f630b05d8f2de0f8edbdb3c67694e6c4d58e6a84..c5fbc41902fee36d2ccf0f2207f4e7fe42f5b0c9 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 39def19aa1789c9b5beeb66015306e660d3e1767..857a36c3029d8fc782b6816ae3b36e41bb8f0d5d 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 0a98178a8908b6b289dda52d569d01dbfaf97371..b3aa9349da84f1ff8bd53d61e31d3173b37aed83 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 1bb6e6f6edb2866b70af261a28f467db9ee62377..962cadba1f3e03174f8ed9279b58c3a5c2c8aa67 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 d9cd11b751f52d8bd7fe366ff4bcfe0c37d2aff1..d058ea746b6ab299a7df3c2b6db0888433b2b014 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 48bdcb8861883ed418c2c2dfba95ee2aab7cb6b2..048581e207ed6cbc472dc2e4084d4d55aa0cb157 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 9a78a05dba9e43e421af5c8a7b1b61ded7d63677..4edaabb9508c3bd933f2db00c00fc40ae5003475 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 e1e58572c32cca4a0d06586d192793d09a152c97..0bda47b4c7cf46c09c516119116dbab7866bc48e 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[];