Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2012-06-13 01:25:23 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2012-06-13 01:25:23 +0400
commit5dc0b35a019651e052c7770330aafc7f2d7fb690 (patch)
tree6902f7e9e431868947bd0c5bcbb15696959fa99a
parent92d948307549ce1d69ec4e41e42b442360b9bade (diff)
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)
-rw-r--r--release/scripts/startup/bl_ui/space_clip.py1
-rw-r--r--source/blender/blenkernel/intern/movieclip.c7
-rw-r--r--source/blender/editors/space_clip/clip_editor.c4
-rw-r--r--source/blender/makesdna/DNA_movieclip_types.h9
-rw-r--r--source/blender/makesrna/intern/rna_movieclip.c10
5 files changed, 24 insertions, 7 deletions
diff --git a/release/scripts/startup/bl_ui/space_clip.py b/release/scripts/startup/bl_ui/space_clip.py
index e9997d43c04..55922da3892 100644
--- a/release/scripts/startup/bl_ui/space_clip.py
+++ b/release/scripts/startup/bl_ui/space_clip.py
@@ -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):
diff --git a/source/blender/blenkernel/intern/movieclip.c b/source/blender/blenkernel/intern/movieclip.c
index 92184a38695..d6fa39fd789 100644
--- a/source/blender/blenkernel/intern/movieclip.c
+++ b/source/blender/blenkernel/intern/movieclip.c
@@ -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;
}
diff --git a/source/blender/editors/space_clip/clip_editor.c b/source/blender/editors/space_clip/clip_editor.c
index b24ff58e590..30965362d37 100644
--- a/source/blender/editors/space_clip/clip_editor.c
+++ b/source/blender/editors/space_clip/clip_editor.c
@@ -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,
diff --git a/source/blender/makesdna/DNA_movieclip_types.h b/source/blender/makesdna/DNA_movieclip_types.h
index 19004dbc8b8..d8bba4a3bf5 100644
--- a/source/blender/makesdna/DNA_movieclip_types.h
+++ b/source/blender/makesdna/DNA_movieclip_types.h
@@ -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 {
diff --git a/source/blender/makesrna/intern/rna_movieclip.c b/source/blender/makesrna/intern/rna_movieclip.c
index a4b7516a930..2a12fa8b116 100644
--- a/source/blender/makesrna/intern/rna_movieclip.c
+++ b/source/blender/makesrna/intern/rna_movieclip.c
@@ -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");
}