[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [47802] trunk/blender: Added frame offset slider to clip datablocks
Sergey Sharybin
sergey.vfx at gmail.com
Tue Jun 12 23:25:25 CEST 2012
Revision: 47802
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=47802
Author: nazgul
Date: 2012-06-12 21:25:23 +0000 (Tue, 12 Jun 2012)
Log Message:
-----------
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)
Modified Paths:
--------------
trunk/blender/release/scripts/startup/bl_ui/space_clip.py
trunk/blender/source/blender/blenkernel/intern/movieclip.c
trunk/blender/source/blender/editors/space_clip/clip_editor.c
trunk/blender/source/blender/makesdna/DNA_movieclip_types.h
trunk/blender/source/blender/makesrna/intern/rna_movieclip.c
Modified: trunk/blender/release/scripts/startup/bl_ui/space_clip.py
===================================================================
--- trunk/blender/release/scripts/startup/bl_ui/space_clip.py 2012-06-12 21:23:51 UTC (rev 47801)
+++ trunk/blender/release/scripts/startup/bl_ui/space_clip.py 2012-06-12 21:25:23 UTC (rev 47802)
@@ -1013,6 +1013,7 @@
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):
Modified: trunk/blender/source/blender/blenkernel/intern/movieclip.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/movieclip.c 2012-06-12 21:23:51 UTC (rev 47801)
+++ trunk/blender/source/blender/blenkernel/intern/movieclip.c 2012-06-12 21:25:23 UTC (rev 47802)
@@ -159,7 +159,7 @@
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 @@
{
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 @@
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 @@
clip->proxy.quality = 90;
clip->start_frame = 1;
+ clip->frame_offset = 1;
return clip;
}
Modified: trunk/blender/source/blender/editors/space_clip/clip_editor.c
===================================================================
--- trunk/blender/source/blender/editors/space_clip/clip_editor.c 2012-06-12 21:23:51 UTC (rev 47801)
+++ trunk/blender/source/blender/editors/space_clip/clip_editor.c 2012-06-12 21:25:23 UTC (rev 47802)
@@ -523,7 +523,7 @@
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 @@
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 @@
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,
Modified: trunk/blender/source/blender/makesdna/DNA_movieclip_types.h
===================================================================
--- trunk/blender/source/blender/makesdna/DNA_movieclip_types.h 2012-06-12 21:23:51 UTC (rev 47801)
+++ trunk/blender/source/blender/makesdna/DNA_movieclip_types.h 2012-06-12 21:25:23 UTC (rev 47802)
@@ -86,7 +86,14 @@
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 {
Modified: trunk/blender/source/blender/makesrna/intern/rna_movieclip.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_movieclip.c 2012-06-12 21:23:51 UTC (rev 47801)
+++ trunk/blender/source/blender/makesrna/intern/rna_movieclip.c 2012-06-12 21:25:23 UTC (rev 47802)
@@ -286,11 +286,17 @@
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");
}
void RNA_def_movieclip(BlenderRNA *brna)
More information about the Bf-blender-cvs
mailing list