forked from bartvdbraak/blender
Added frame offset slider to clip datablocks
In contrast to start_frame (which affects on where footage actually starts to play and also affects on all data associated with a clip such as motion tracking, reconstruction and so on) this slider only affects on a way how frame number is mapping to a filename, without touching any kind of tracking data. The formula is: file_name = clip_file_name + frame_offset - (start_frame - 1)
This commit is contained in:
parent
92d9483075
commit
5dc0b35a01
@ -1013,6 +1013,7 @@ class CLIP_PT_footage(CLIP_PT_clip_view_panel, Panel):
|
||||
col = layout.column()
|
||||
col.template_movieclip(sc, "clip", compact=True)
|
||||
col.prop(clip, "start_frame")
|
||||
col.prop(clip, "frame_offset")
|
||||
|
||||
|
||||
class CLIP_PT_tools_clip(CLIP_PT_clip_view_panel, Panel):
|
||||
|
@ -159,7 +159,7 @@ static void get_sequence_fname(MovieClip *clip, int framenr, char *name)
|
||||
offset = sequence_guess_offset(clip->name, strlen(head), numlen);
|
||||
|
||||
if (numlen)
|
||||
BLI_stringenc(name, head, tail, numlen, offset + framenr - clip->start_frame);
|
||||
BLI_stringenc(name, head, tail, numlen, offset + framenr - clip->start_frame + clip->frame_offset);
|
||||
else
|
||||
BLI_strncpy(name, clip->name, sizeof(clip->name));
|
||||
|
||||
@ -171,7 +171,7 @@ static void get_proxy_fname(MovieClip *clip, int proxy_render_size, int undistor
|
||||
{
|
||||
int size = rendersize_to_number(proxy_render_size);
|
||||
char dir[FILE_MAX], clipdir[FILE_MAX], clipfile[FILE_MAX];
|
||||
int proxynr = framenr - clip->start_frame + 1;
|
||||
int proxynr = framenr - clip->start_frame + 1 + clip->frame_offset;
|
||||
|
||||
BLI_split_dirfile(clip->name, clipdir, clipfile, FILE_MAX, FILE_MAX);
|
||||
|
||||
@ -250,7 +250,7 @@ static ImBuf *movieclip_load_movie_file(MovieClip *clip, MovieClipUser *user, in
|
||||
int fra;
|
||||
|
||||
dur = IMB_anim_get_duration(clip->anim, tc);
|
||||
fra = framenr - clip->start_frame;
|
||||
fra = framenr - clip->start_frame + clip->frame_offset;
|
||||
|
||||
if (fra < 0)
|
||||
fra = 0;
|
||||
@ -446,6 +446,7 @@ static MovieClip *movieclip_alloc(const char *name)
|
||||
clip->proxy.quality = 90;
|
||||
|
||||
clip->start_frame = 1;
|
||||
clip->frame_offset = 1;
|
||||
|
||||
return clip;
|
||||
}
|
||||
|
@ -523,7 +523,7 @@ typedef struct SpaceClipDrawContext {
|
||||
unsigned last_texture; /* ID of previously used texture, so it'll be restored after clip drawing */
|
||||
|
||||
/* fields to check if cache is still valid */
|
||||
int framenr, start_frame;
|
||||
int framenr, start_frame, frame_offset;
|
||||
short render_size, render_flag;
|
||||
} SpaceClipDrawContext;
|
||||
|
||||
@ -565,6 +565,7 @@ int ED_space_clip_load_movieclip_buffer(SpaceClip *sc, ImBuf *ibuf)
|
||||
need_rebind |= context->render_size != sc->user.render_size;
|
||||
need_rebind |= context->render_flag != sc->user.render_flag;
|
||||
need_rebind |= context->start_frame != clip->start_frame;
|
||||
need_rebind |= context->frame_offset != clip->frame_offset;
|
||||
|
||||
if (need_rebind) {
|
||||
int width = ibuf->x, height = ibuf->y;
|
||||
@ -622,6 +623,7 @@ int ED_space_clip_load_movieclip_buffer(SpaceClip *sc, ImBuf *ibuf)
|
||||
context->render_size = sc->user.render_size;
|
||||
context->render_flag = sc->user.render_flag;
|
||||
context->start_frame = clip->start_frame;
|
||||
context->frame_offset = clip->frame_offset;
|
||||
}
|
||||
else {
|
||||
/* displaying exactly the same image which was loaded t oa texture,
|
||||
|
@ -86,7 +86,14 @@ typedef struct MovieClip {
|
||||
|
||||
int len; /* length of movie */
|
||||
|
||||
int start_frame, pad;
|
||||
int start_frame; /* scene frame number footage starts playing at */
|
||||
/* affects all data which is associated with a clip */
|
||||
/* such as motion tracking, camera reconstruciton and so */
|
||||
|
||||
int frame_offset; /* offset which is adding to a file number when reading frame */
|
||||
/* from a file. affects only a way how scene frame is mapping */
|
||||
/* to a file name and not touches other data associated with */
|
||||
/* a clip */
|
||||
} MovieClip;
|
||||
|
||||
typedef struct MovieClipScopes {
|
||||
|
@ -286,10 +286,16 @@ static void rna_def_movieclip(BlenderRNA *brna)
|
||||
RNA_def_property_ui_text(prop, "Grease Pencil", "Grease pencil data for this movie clip");
|
||||
RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, NULL);
|
||||
|
||||
/* frame offset */
|
||||
/* start_frame */
|
||||
prop = RNA_def_property(srna, "start_frame", PROP_INT, PROP_NONE);
|
||||
RNA_def_property_int_sdna(prop, NULL, "start_frame");
|
||||
RNA_def_property_ui_text(prop, "Start Frame", "Global scene frame number at which this movie starts playing");
|
||||
RNA_def_property_ui_text(prop, "Start Frame", "Global scene frame number at which this movie starts playing. Affects all data associated with a clip");
|
||||
RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, "rna_MovieClip_reload_update");
|
||||
|
||||
/* frame_offset */
|
||||
prop = RNA_def_property(srna, "frame_offset", PROP_INT, PROP_NONE);
|
||||
RNA_def_property_int_sdna(prop, NULL, "frame_offset");
|
||||
RNA_def_property_ui_text(prop, "Frame Offset", "Offset of footage first frame relative to it's file name. Affects only how footage is loaing, not changes data associated with a clip");
|
||||
RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, "rna_MovieClip_reload_update");
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user