[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [27184] trunk/blender: Partial Fix: [ #21085] Sequencer file selector for movies is strange
Andrea Weikert
elubie at gmx.net
Sun Feb 28 12:17:56 CET 2010
Revision: 27184
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=27184
Author: elubie
Date: 2010-02-28 12:17:55 +0100 (Sun, 28 Feb 2010)
Log Message:
-----------
Partial Fix: [#21085] Sequencer file selector for movies is strange
* joined filename and directory to single rna entry for movie and sound sequence
* PROP_FILENAME was missing in makesrna
* made seq->strip->data->name PROP_FILENAME rather than PROP_FILEPATH for the complete path
* also made seq->strip->data->name read only
Missing still: update of sequence length, start end frame etc..
Modified Paths:
--------------
trunk/blender/release/scripts/ui/space_sequencer.py
trunk/blender/source/blender/makesrna/intern/makesrna.c
trunk/blender/source/blender/makesrna/intern/rna_sequencer.c
Modified: trunk/blender/release/scripts/ui/space_sequencer.py
===================================================================
--- trunk/blender/release/scripts/ui/space_sequencer.py 2010-02-28 11:02:06 UTC (rev 27183)
+++ trunk/blender/release/scripts/ui/space_sequencer.py 2010-02-28 11:17:55 UTC (rev 27184)
@@ -471,28 +471,17 @@
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="")
+ self.draw_filename(context)
- # 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
-
layout.prop(strip, "use_translation", text="Image Offset:")
if strip.transform:
col = layout.column(align=True)
@@ -513,8 +502,66 @@
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):
bl_label = "Sound"
@@ -536,7 +583,7 @@
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 @@
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,
Modified: trunk/blender/source/blender/makesrna/intern/makesrna.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/makesrna.c 2010-02-28 11:02:06 UTC (rev 27183)
+++ trunk/blender/source/blender/makesrna/intern/makesrna.c 2010-02-28 11:17:55 UTC (rev 27184)
@@ -1547,6 +1547,7 @@
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";
Modified: trunk/blender/source/blender/makesrna/intern/rna_sequencer.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_sequencer.c 2010-02-28 11:02:06 UTC (rev 27183)
+++ trunk/blender/source/blender/makesrna/intern/rna_sequencer.c 2010-02-28 11:17:55 UTC (rev 27184)
@@ -303,7 +303,7 @@
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 @@
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 @@
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,17 +930,12 @@
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");
+ 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");
- 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_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
-
rna_def_filter_video(srna);
rna_def_proxy(srna);
rna_def_input(srna);
@@ -947,16 +961,11 @@
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");
+ 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");
-
- 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_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
rna_def_input(srna);
}
More information about the Bf-blender-cvs
mailing list