diff options
author | Matt Ebb <matt@mke3.net> | 2009-11-19 06:21:37 +0300 |
---|---|---|
committer | Matt Ebb <matt@mke3.net> | 2009-11-19 06:21:37 +0300 |
commit | 2c08e182c76a6dfddfe3c0e36f6d1317857bf64e (patch) | |
tree | 9e65879de9d9a47a1b899182935dfc2f3ca5b69d /source/blender | |
parent | bb3afc81fcce276f9f4a41893116394ac87a966a (diff) |
* Added control and animation of sound volume of sequence sound strips (found in properties pane)
To insert keys, use I key while hovering over the button for now, rmb clicking on the property to insert a key doesn't work (general bug for all regions except property editor - will investigate).
Doesn't convert over from old fac0 ipos on opening old files though for the time being.
* Made sequence strip names unique while I was at it, to allow strip properties to be animated properly.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenkernel/BKE_sequence.h | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/sequence.c | 27 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/sound.c | 6 | ||||
-rw-r--r-- | source/blender/blenloader/intern/readfile.c | 12 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_sequence_types.h | 3 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_sequence.c | 23 |
6 files changed, 55 insertions, 18 deletions
diff --git a/source/blender/blenkernel/BKE_sequence.h b/source/blender/blenkernel/BKE_sequence.h index 713d2dcad43..2f7526d524c 100644 --- a/source/blender/blenkernel/BKE_sequence.h +++ b/source/blender/blenkernel/BKE_sequence.h @@ -218,6 +218,8 @@ struct Sequence *alloc_sequence(ListBase *lb, int cfra, int machine); void seq_load_apply(struct Scene *scene, struct Sequence *seq, struct SeqLoadInfo *seq_load); +void seqUniqueName(ListBase *seqbasep, struct Sequence *seq); + struct Sequence *sequencer_add_image_strip(struct bContext *C, ListBase *seqbasep, struct SeqLoadInfo *seq_load); struct Sequence *sequencer_add_sound_strip(struct bContext *C, ListBase *seqbasep, struct SeqLoadInfo *seq_load); struct Sequence *sequencer_add_movie_strip(struct bContext *C, ListBase *seqbasep, struct SeqLoadInfo *seq_load); diff --git a/source/blender/blenkernel/intern/sequence.c b/source/blender/blenkernel/intern/sequence.c index f892c7b0057..e3e1debfa96 100644 --- a/source/blender/blenkernel/intern/sequence.c +++ b/source/blender/blenkernel/intern/sequence.c @@ -27,6 +27,7 @@ * ***** END GPL LICENSE BLOCK ***** */ +#include <stddef.h> #include <stdlib.h> #include <string.h> #include <math.h> @@ -45,6 +46,7 @@ #include "BKE_utildefines.h" #include "BLI_blenlib.h" +#include "BLI_util.h" #include "IMB_imbuf.h" #include "IMB_imbuf_types.h" @@ -602,9 +604,9 @@ void reload_sequence_new_file(Scene *scene, Sequence * seq) sce = seq->scene; } - strncpy(seq->name + 2, sce->id.name + 2, - sizeof(seq->name) - 2); - + BLI_strncpy(seq->name+2, sce->id.name + 2, SEQ_NAME_MAXSTR-2); + seqUniqueName(scene->ed->seqbasep, seq); + seq->len= seq->scene->r.efra - seq->scene->r.sfra + 1; seq->len -= seq->anim_startofs; seq->len -= seq->anim_endofs; @@ -2413,9 +2415,10 @@ static TStripElem* do_build_seq_array_recursively(Scene *scene, sh = get_sequence_blend(seq); +#if 0 // XXX old animation system seq->facf0 = seq->facf1 = 1.0; -#if 0 // XXX old animation system + if(seq->ipo && seq->ipo->curve.first) { do_seq_ipo(scene, seq, cfra); } @@ -3532,6 +3535,7 @@ void seq_load_apply(Scene *scene, Sequence *seq, SeqLoadInfo *seq_load) { if(seq) { strcpy(seq->name, seq_load->name); + seqUniqueName(scene->ed->seqbasep, seq); if(seq_load->flag & SEQ_LOAD_FRAME_ADVANCE) { seq_load->start_frame += (seq->enddisp - seq->startdisp); @@ -3573,6 +3577,11 @@ Sequence *alloc_sequence(ListBase *lb, int cfra, int machine) return seq; } +void seqUniqueName(ListBase *seqbasep, Sequence *seq) +{ + BLI_uniquename(seqbasep, seq, "Sequence", '.', offsetof(Sequence, name), SEQ_NAME_MAXSTR); +} + /* NOTE: this function doesn't fill in iamge names */ Sequence *sequencer_add_image_strip(bContext *C, ListBase *seqbasep, SeqLoadInfo *seq_load) { @@ -3583,7 +3592,9 @@ Sequence *sequencer_add_image_strip(bContext *C, ListBase *seqbasep, SeqLoadInfo seq = alloc_sequence(seqbasep, seq_load->start_frame, seq_load->channel); seq->type= SEQ_IMAGE; - + BLI_strncpy(seq->name+2, "Image", SEQ_NAME_MAXSTR-2); + seqUniqueName(seqbasep, seq); + /* basic defaults */ seq->strip= strip= MEM_callocN(sizeof(Strip), "strip"); @@ -3591,7 +3602,7 @@ Sequence *sequencer_add_image_strip(bContext *C, ListBase *seqbasep, SeqLoadInfo strip->us= 1; strip->stripdata= se= MEM_callocN(seq->len*sizeof(StripElem), "stripelem"); BLI_split_dirfile_basic(seq_load->path, strip->dir, se->name); - + seq_load_apply(scene, seq, seq_load); return seq; @@ -3630,6 +3641,8 @@ Sequence *sequencer_add_sound_strip(bContext *C, ListBase *seqbasep, SeqLoadInfo seq->type= SEQ_SOUND; seq->sound= sound; + BLI_strncpy(seq->name+2, "Sound", SEQ_NAME_MAXSTR-2); + seqUniqueName(seqbasep, seq); /* basic defaults */ seq->strip= strip= MEM_callocN(sizeof(Strip), "strip"); @@ -3672,6 +3685,8 @@ Sequence *sequencer_add_movie_strip(bContext *C, ListBase *seqbasep, SeqLoadInfo seq->type= SEQ_MOVIE; seq->anim= an; seq->anim_preseek = IMB_anim_get_preseek(an); + BLI_strncpy(seq->name+2, "Movie", SEQ_NAME_MAXSTR-2); + seqUniqueName(seqbasep, seq); /* basic defaults */ seq->strip= strip= MEM_callocN(sizeof(Strip), "strip"); diff --git a/source/blender/blenkernel/intern/sound.c b/source/blender/blenkernel/intern/sound.c index 6ac9b020f21..d8950c7dace 100644 --- a/source/blender/blenkernel/intern/sound.c +++ b/source/blender/blenkernel/intern/sound.c @@ -384,6 +384,8 @@ void sound_update_playing(struct bContext *C) } } + AUD_setSoundVolume(handle->handle, handle->volume); + if(action & 1) { if(handle->state == AUD_STATUS_INVALID) @@ -468,7 +470,9 @@ AUD_Device* sound_mixdown(struct Scene *scene, AUD_Specs specs, int start, int e frameskip -= s; s = 0; } - + + AUD_setSoundVolume(handle->handle, handle->volume); + limiter = AUD_limitSound(handle->source->handle, frameskip / fps, e / fps); delayer = AUD_delaySound(limiter, s / fps); diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index f146d7f6166..414dd75d627 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -10055,8 +10055,20 @@ static void do_versions(FileData *fd, Library *lib, Main *main) { Scene *sce= main->scene.first; while(sce) { + Sequence *seq; + if(sce->r.frame_step==0) sce->r.frame_step= 1; + + if(sce->ed && sce->ed->seqbasep) + { + seq=sce->ed->seqbasep->first; + while(seq) { + seqUniqueName(sce->ed->seqbasep, seq); + seq=seq->next; + } + } + sce= sce->id.next; } } diff --git a/source/blender/makesdna/DNA_sequence_types.h b/source/blender/makesdna/DNA_sequence_types.h index 6d455d20f59..69096e5d2cf 100644 --- a/source/blender/makesdna/DNA_sequence_types.h +++ b/source/blender/makesdna/DNA_sequence_types.h @@ -132,7 +132,7 @@ typedef struct Sequence { struct Sequence *next, *prev; void *tmp; /* tmp var for copying, and tagging for linked selection */ void *lib; /* needed (to be like ipo), else it will raise libdata warnings, this should never be used */ - char name[24]; /* name, not set by default and dosnt need to be unique as with ID's */ + char name[24]; /* SEQ_NAME_MAXSTR - name, set by default and needs to be unique, for RNA paths */ int flag, type; /*flags bitmap (see below) and the type of sequence*/ int len; /* the length of the contense of this strip - before handles are applied */ @@ -244,6 +244,7 @@ typedef struct SpeedControlVars { #define SEQ_SPEED_COMPRESS_IPO_Y 4 /* ***************** SEQUENCE ****************** */ +#define SEQ_NAME_MAXSTR 24 /* seq->flag */ #define SEQ_LEFTSEL 2 diff --git a/source/blender/makesrna/intern/rna_sequence.c b/source/blender/makesrna/intern/rna_sequence.c index 101c6969311..99696513142 100644 --- a/source/blender/makesrna/intern/rna_sequence.c +++ b/source/blender/makesrna/intern/rna_sequence.c @@ -176,8 +176,10 @@ static int rna_Sequence_name_length(PointerRNA *ptr) static void rna_Sequence_name_set(PointerRNA *ptr, const char *value) { + Scene *sce= (Scene*)ptr->id.data; Sequence *seq= (Sequence*)ptr->data; BLI_strncpy(seq->name+2, value, sizeof(seq->name)-2); + seqUniqueName(&sce->ed->seqbase, seq); } static StructRNA* rna_Sequence_refine(struct PointerRNA *ptr) @@ -230,16 +232,9 @@ static char *rna_Sequence_path(PointerRNA *ptr) */ if (seq->name+2) return BLI_sprintfN("sequence_editor.sequences[\"%s\"]", seq->name+2); - else { - /* compromise for the frequent sitation when strips don't have names... */ - Scene *sce= (Scene*)ptr->id.data; - Editing *ed= seq_give_editing(sce, FALSE); - - return BLI_sprintfN("sequence_editor.sequences[%d]", BLI_findindex(&ed->seqbase, seq)); - } } -static PointerRNA rna_SequenceEdtior_meta_stack_get(CollectionPropertyIterator *iter) +static PointerRNA rna_SequenceEditor_meta_stack_get(CollectionPropertyIterator *iter) { ListBaseIterator *internal= iter->internal; MetaStack *ms= (MetaStack*)internal->link; @@ -589,7 +584,7 @@ static void rna_def_editor(BlenderRNA *brna) RNA_def_property_collection_sdna(prop, NULL, "metastack", NULL); RNA_def_property_struct_type(prop, "Sequence"); RNA_def_property_ui_text(prop, "Meta Stack", "Meta strip stack, last is currently edited meta strip."); - RNA_def_property_collection_funcs(prop, 0, 0, 0, "rna_SequenceEdtior_meta_stack_get", 0, 0, 0); + RNA_def_property_collection_funcs(prop, 0, 0, 0, "rna_SequenceEditor_meta_stack_get", 0, 0, 0); prop= RNA_def_property(srna, "active_strip", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "act_seq"); @@ -818,8 +813,16 @@ static void rna_def_sound(BlenderRNA *brna) prop= RNA_def_property(srna, "directory", PROP_STRING, PROP_DIRPATH); RNA_def_property_string_sdna(prop, NULL, "strip->dir"); RNA_def_property_ui_text(prop, "Directory", ""); - + rna_def_input(srna); + + RNA_def_struct_sdna_from(srna, "SoundHandle", "sound_handle"); + + prop= RNA_def_property(srna, "volume", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "volume"); + RNA_def_property_range(prop, 0.0f, 1.0f); + RNA_def_property_ui_text(prop, "Volume", "Playback volume of the sound"); + RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, NULL); } static void rna_def_effect(BlenderRNA *brna) |