diff options
-rw-r--r-- | release/scripts/ui/space_sequencer.py | 84 | ||||
-rw-r--r-- | source/blender/makesrna/intern/makesrna.c | 1 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_sequencer.c | 49 |
3 files changed, 96 insertions, 38 deletions
diff --git a/release/scripts/ui/space_sequencer.py b/release/scripts/ui/space_sequencer.py index 4cbabc71235..8930a04e11c 100644 --- a/release/scripts/ui/space_sequencer.py +++ b/release/scripts/ui/space_sequencer.py @@ -471,27 +471,16 @@ class SEQUENCER_PT_input(SequencerButtonsPanel): return False return strip.type in ('MOVIE', 'IMAGE') - + + def draw_filename(self, context): + pass + def draw(self, context): layout = self.layout strip = act_strip(context) - split = layout.split(percentage=0.2) - col = split.column() - col.label(text="Path:") - col = split.column() - col.prop(strip, "directory", text="") - - # Current element for the filename - - elem = strip.getStripElem(context.scene.current_frame) - if elem: - split = layout.split(percentage=0.2) - col = split.column() - col.label(text="File:") - col = split.column() - col.prop(elem, "filename", text="") # strip.elements[0] could be a fallback + self.draw_filename(context) layout.prop(strip, "use_translation", text="Image Offset:") if strip.transform: @@ -513,6 +502,64 @@ class SEQUENCER_PT_input(SequencerButtonsPanel): col.label(text="Trim Duration:") col.prop(strip, "animation_start_offset", text="Start") col.prop(strip, "animation_end_offset", text="End") + +class SEQUENCER_PT_input_movie(SEQUENCER_PT_input): + bl_label = "Strip Input" + + def poll(self, context): + if not self.has_sequencer(context): + return False + + strip = act_strip(context) + if not strip: + return False + + return strip.type == 'MOVIE' + + def draw_filename(self, context): + layout = self.layout + + strip = act_strip(context) + + split = layout.split(percentage=0.2) + col = split.column() + col.label(text="Path:") + col = split.column() + col.prop(strip, "filepath", text="") + +class SEQUENCER_PT_input_image(SEQUENCER_PT_input): + bl_label = "Strip Input" + + def poll(self, context): + if not self.has_sequencer(context): + return False + + strip = act_strip(context) + if not strip: + return False + + return strip.type == 'IMAGE' + + def draw_filename(self, context): + layout = self.layout + + strip = act_strip(context) + + split = layout.split(percentage=0.2) + col = split.column() + col.label(text="Path:") + col = split.column() + col.prop(strip, "directory", text="") + + # Current element for the filename + + elem = strip.getStripElem(context.scene.current_frame) + if elem: + split = layout.split(percentage=0.2) + col = split.column() + col.label(text="File:") + col = split.column() + col.prop(elem, "filename", text="") # strip.elements[0] could be a fallback class SEQUENCER_PT_sound(SequencerButtonsPanel): @@ -536,7 +583,7 @@ class SEQUENCER_PT_sound(SequencerButtonsPanel): layout.template_ID(strip, "sound", open="sound.open") layout.separator() - layout.prop(strip.sound, "filename", text="") + layout.prop(strip.sound, "filepath", text="") row = layout.row() if strip.sound.packed_file: @@ -678,7 +725,8 @@ classes = [ SEQUENCER_PT_edit, # sequencer panels SEQUENCER_PT_effect, - SEQUENCER_PT_input, + SEQUENCER_PT_input_movie, + SEQUENCER_PT_input_image, SEQUENCER_PT_sound, SEQUENCER_PT_scene, SEQUENCER_PT_filter, diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c index 2abddb0860a..15d5658160d 100644 --- a/source/blender/makesrna/intern/makesrna.c +++ b/source/blender/makesrna/intern/makesrna.c @@ -1547,6 +1547,7 @@ static const char *rna_property_subtypename(PropertyType type) switch(type) { case PROP_NONE: return "PROP_NONE"; case PROP_FILEPATH: return "PROP_FILEPATH"; + case PROP_FILENAME: return "PROP_FILENAME"; case PROP_DIRPATH: return "PROP_DIRPATH"; case PROP_UNSIGNED: return "PROP_UNSIGNED"; case PROP_PERCENTAGE: return "PROP_PERCENTAGE"; diff --git a/source/blender/makesrna/intern/rna_sequencer.c b/source/blender/makesrna/intern/rna_sequencer.c index 17dbbbf9d05..771751277c8 100644 --- a/source/blender/makesrna/intern/rna_sequencer.c +++ b/source/blender/makesrna/intern/rna_sequencer.c @@ -303,7 +303,7 @@ static PointerRNA rna_SequenceEditor_meta_stack_get(CollectionPropertyIterator * return rna_pointer_inherit_refine(&iter->parent, &RNA_Sequence, ms->parseq); } -static void rna_MovieSequence_filename_set(PointerRNA *ptr, const char *value) +static void rna_Sequence_filepath_set(PointerRNA *ptr, const char *value) { Sequence *seq= (Sequence*)(ptr->data); char dir[FILE_MAX], name[FILE_MAX]; @@ -313,6 +313,24 @@ static void rna_MovieSequence_filename_set(PointerRNA *ptr, const char *value) BLI_strncpy(seq->strip->stripdata->name, name, sizeof(seq->strip->stripdata->name)); } +static void rna_Sequence_filepath_get(PointerRNA *ptr, char *value) +{ + Sequence *seq= (Sequence*)(ptr->data); + char path[FILE_MAX]; + + BLI_join_dirfile(path, seq->strip->dir, seq->strip->stripdata->name); + BLI_strncpy(value, path, strlen(path)+1); +} + +static int rna_Sequence_filepath_length(PointerRNA *ptr) +{ + Sequence *seq= (Sequence*)(ptr->data); + char path[FILE_MAX]; + + BLI_join_dirfile(path, seq->strip->dir, seq->strip->stripdata->name); + return strlen(path)+1; +} + static void rna_SoundSequence_filename_set(PointerRNA *ptr, const char *value) { Sequence *seq= (Sequence*)(ptr->data); @@ -369,8 +387,9 @@ static void rna_def_strip_element(BlenderRNA *brna) RNA_def_struct_ui_text(srna, "Sequence Element", "Sequence strip data for a single frame"); RNA_def_struct_sdna(srna, "StripElem"); - prop= RNA_def_property(srna, "filename", PROP_STRING, PROP_FILEPATH); + prop= RNA_def_property(srna, "filename", PROP_STRING, PROP_FILENAME); RNA_def_property_string_sdna(prop, NULL, "name"); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Filename", ""); RNA_def_property_string_funcs(prop, NULL, NULL, "rna_SequenceElement_filename_set"); RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update"); @@ -911,15 +930,10 @@ static void rna_def_movie(BlenderRNA *brna) RNA_def_property_ui_text(prop, "MPEG Preseek", "For MPEG movies, preseek this many frames"); RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update"); - prop= RNA_def_property(srna, "filename", PROP_STRING, PROP_FILEPATH); - RNA_def_property_string_sdna(prop, NULL, "strip->stripdata->name"); - RNA_def_property_ui_text(prop, "Filename", ""); - RNA_def_property_string_funcs(prop, NULL, NULL, "rna_MovieSequence_filename_set"); - RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update"); - - 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", ""); + prop= RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH); + RNA_def_property_ui_text(prop, "File", ""); + RNA_def_property_string_funcs(prop, "rna_Sequence_filepath_get", "rna_Sequence_filepath_length", + "rna_Sequence_filepath_set"); RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update"); rna_def_filter_video(srna); @@ -947,15 +961,10 @@ static void rna_def_sound(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Volume", "Playback volume of the sound"); RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update"); - prop= RNA_def_property(srna, "filename", PROP_STRING, PROP_FILEPATH); - RNA_def_property_string_sdna(prop, NULL, "strip->stripdata->name"); - RNA_def_property_ui_text(prop, "Filename", ""); - RNA_def_property_string_funcs(prop, NULL, NULL, "rna_SoundSequence_filename_set"); - RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update"); - - 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", ""); + prop= RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH); + RNA_def_property_ui_text(prop, "File", ""); + RNA_def_property_string_funcs(prop, "rna_Sequence_filepath_get", "rna_Sequence_filepath_length", + "rna_Sequence_filepath_set"); RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update"); rna_def_input(srna); |