== Sequencer ==

This fixes Orig Dimension display (mostly).
* orx, ory both didn't get calculated, if dimension already matched
* putting them into Strip instead of StripData ment, that using images
  of different dimensions in one strip could lead to incorrect results

Still TODO: on file open, timeline display happens before preview 
display which means: orig_width and height are calculated after the 
first draw of N-keys dialog. You have to hit refresh (or scrub one 
frame) to get the right values displayed.
This commit is contained in:
Peter Schlaile
2010-11-28 18:23:21 +00:00
parent 3f6eb67b77
commit 510920a299
5 changed files with 52 additions and 40 deletions

View File

@@ -384,8 +384,16 @@ class SEQUENCER_PT_edit(SequencerButtonsPanel, bpy.types.Panel):
col.label(text="Frame Offset %d:%d" % (strip.frame_offset_start, strip.frame_offset_end))
col.label(text="Frame Still %d:%d" % (strip.frame_still_start, strip.frame_still_end))
if strip.type in ('MOVIE', 'IMAGE'):
col.label(text="Orig Dim: %dx%d" % (strip.orig_width, strip.orig_height))
elem = False
if strip.type == 'IMAGE':
elem = strip.getStripElem(frame_current)
elif strip.type == 'MOVIE':
elem = strip.elements[0]
if elem and elem.orig_width > 0 and elem.orig_height > 0:
col.label(text="Orig Dim: %dx%d" % (elem.orig_width, elem.orig_height))
class SEQUENCER_PT_effect(SequencerButtonsPanel, bpy.types.Panel):

View File

@@ -1558,9 +1558,6 @@ static ImBuf * input_preprocess(
{
float mul;
seq->strip->orx= ibuf->x;
seq->strip->ory= ibuf->y;
if((seq->flag & SEQ_FILTERY) && seq->type != SEQ_MOVIE) {
IMB_filtery(ibuf);
}
@@ -2054,6 +2051,9 @@ static ImBuf * seq_render_strip(SeqRenderData context, Sequence * seq, float cfr
IMB_convert_profile(ibuf, IB_PROFILE_NONE);
copy_to_ibuf_still(context, seq, nr, ibuf);
s_elem->orig_width = ibuf->x;
s_elem->orig_height = ibuf->y;
}
break;
}
@@ -2073,7 +2073,10 @@ static ImBuf * seq_render_strip(SeqRenderData context, Sequence * seq, float cfr
/* we don't need both (speed reasons)! */
if (ibuf && ibuf->rect_float && ibuf->rect)
imb_freerectImBuf(ibuf);
if (ibuf) {
seq->strip->stripdata->orig_width = ibuf->x;
seq->strip->stripdata->orig_height = ibuf->y;
}
}
copy_to_ibuf_still(context, seq, nr, ibuf);
break;

View File

@@ -2561,18 +2561,15 @@ static int sequencer_rendersize_exec(bContext *C, wmOperator *UNUSED(op))
if(active_seq==NULL)
return OPERATOR_CANCELLED;
switch (active_seq->type) {
StripElem * se = 0;
if (active_seq->strip) {
switch (active_seq->type) {
case SEQ_IMAGE:
se = give_stripelem(active_seq, scene->r.cfra);
break;
case SEQ_MOVIE:
if (active_seq->strip) {
// prevent setting the render size if sequence values aren't initialized
if ( (active_seq->strip->orx>0) && (active_seq->strip->ory>0) ) {
scene->r.xsch= active_seq->strip->orx;
scene->r.ysch= active_seq->strip->ory;
WM_event_add_notifier(C, NC_SCENE|ND_RENDER_OPTIONS, scene);
retval = OPERATOR_FINISHED;
}
}
se = active_seq->strip->stripdata;
break;
case SEQ_SCENE:
case SEQ_META:
@@ -2580,7 +2577,19 @@ static int sequencer_rendersize_exec(bContext *C, wmOperator *UNUSED(op))
case SEQ_HD_SOUND:
default:
break;
}
}
if (se) {
// prevent setting the render size if sequence values aren't initialized
if ( (se->orig_width > 0) && (se->orig_height > 0) ) {
scene->r.xsch= se->orig_width;
scene->r.ysch= se->orig_height;
WM_event_add_notifier(C, NC_SCENE|ND_RENDER_OPTIONS, scene);
retval = OPERATOR_FINISHED;
}
}
return retval;
}

View File

@@ -42,6 +42,7 @@ struct bSound;
typedef struct StripElem {
char name[80];
int orig_width, orig_height;
} StripElem;
typedef struct StripCrop {
@@ -81,7 +82,6 @@ typedef struct Strip {
int startstill, endstill;
StripElem *stripdata;
char dir[160];
int orx, ory;
StripProxy *proxy;
StripCrop *crop;
StripTransform *transform;

View File

@@ -180,19 +180,6 @@ static int rna_Sequence_frame_length_get(PointerRNA *ptr)
return seq_tx_get_final_right(seq, 0)-seq_tx_get_final_left(seq, 0);
}
static int rna_Sequence_orx_get(PointerRNA *ptr)
{
Sequence *seq= (Sequence*)ptr->data;
return seq->strip->orx;
}
static int rna_Sequence_ory_get(PointerRNA *ptr)
{
Sequence *seq= (Sequence*)ptr->data;
return seq->strip->ory;
}
static void rna_Sequence_channel_set(PointerRNA *ptr, int value)
{
Sequence *seq= (Sequence*)ptr->data;
@@ -679,6 +666,16 @@ static void rna_def_strip_element(BlenderRNA *brna)
RNA_def_property_string_sdna(prop, NULL, "name");
RNA_def_property_ui_text(prop, "Filename", "");
RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
prop= RNA_def_property(srna, "orig_width", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "orig_width");
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Orig Width", "Original image width");
prop= RNA_def_property(srna, "orig_height", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "orig_height");
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Orig Height", "Original image height");
}
static void rna_def_strip_crop(BlenderRNA *brna)
@@ -1200,16 +1197,6 @@ static void rna_def_input(StructRNA *srna)
RNA_def_property_int_funcs(prop, NULL, "rna_Sequence_anim_endofs_final_set", NULL); // overlap tests
RNA_def_property_ui_text(prop, "Animation End Offset", "Animation end offset (trim end)");
RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
prop= RNA_def_property(srna, "orig_width", PROP_INT, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Orig Width", "Original image width");
RNA_def_property_int_funcs(prop, "rna_Sequence_orx_get", NULL,NULL);
prop= RNA_def_property(srna, "orig_height", PROP_INT, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Orig Height", "Original image height");
RNA_def_property_int_funcs(prop, "rna_Sequence_ory_get", NULL,NULL);
}
static void rna_def_image(BlenderRNA *brna)
@@ -1295,6 +1282,11 @@ 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, "elements", PROP_COLLECTION, PROP_NONE);
RNA_def_property_collection_sdna(prop, NULL, "strip->stripdata", "strip->len");
RNA_def_property_struct_type(prop, "SequenceElement");
RNA_def_property_ui_text(prop, "Elements", "");
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",