From 14423219c993d0c735fd8e54744742dc81ac09b7 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Sat, 31 Dec 2011 09:29:49 +0000 Subject: [PATCH 01/32] Sync changes from trunk --- extern/libmv/libmv/numeric/tinyvector.cc | 0 extern/libmv/libmv/tracking/brute_region_tracker.cc | 9 +++++++++ 2 files changed, 9 insertions(+) delete mode 100644 extern/libmv/libmv/numeric/tinyvector.cc diff --git a/extern/libmv/libmv/numeric/tinyvector.cc b/extern/libmv/libmv/numeric/tinyvector.cc deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/extern/libmv/libmv/tracking/brute_region_tracker.cc b/extern/libmv/libmv/tracking/brute_region_tracker.cc index 2c7f613ee4a..a416710ad2b 100644 --- a/extern/libmv/libmv/tracking/brute_region_tracker.cc +++ b/extern/libmv/libmv/tracking/brute_region_tracker.cc @@ -26,6 +26,15 @@ #if !defined(__APPLE__) && !defined(__FreeBSD__) // Needed for memalign on Linux and _aligned_alloc on Windows. +#ifdef FREE_WINDOWS +/* make sure _aligned_malloc is included */ +#ifdef __MSVCRT_VERSION__ +#undef __MSVCRT_VERSION__ +#endif + +#define __MSVCRT_VERSION__ 0x0700 +#endif + #include #else // Apple's malloc is 16-byte aligned, and does not have malloc.h, so include From c354a6a02c6588ab8c8b966ab30dd16b33a1fb44 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Fri, 3 Feb 2012 19:13:08 +0000 Subject: [PATCH 02/32] Movie Clip Editor: cleanup of display panels - Split display options into two panels: * Display, which contains all general display options related on editor itself * Marker Display, which contains options which makes sense for markers themselves and not used so often. - Remove Show GPencil option which doesn't actually make sense because strokes might be disabled from GPencil panel - Removed Show Pyramid option and show pyramid for KLT tracker as default. - Added hotkey to toggle Show Disabled (Alt-D) - Added hotkey to toggle Show Pattern (Alt-S) Changes in interface and hotkeys are done by Sebastian Koenig. Thanks for the patch! Own changes in interface were related on Aspect Ratio. It doesn't make much sense for tracking (camera pixel aspect is what you'll want to use, but for masking it would make much more sense because when you just want to create a mask for footage you don't actually have camera). Just removing from interface seems not so nice for now. --- release/scripts/startup/bl_ui/space_clip.py | 49 ++++++++++++------- .../blender/editors/gpencil/gpencil_paint.c | 8 --- source/blender/editors/space_clip/clip_draw.c | 4 +- .../blender/editors/space_clip/space_clip.c | 8 ++- source/blender/makesdna/DNA_space_types.h | 4 +- source/blender/makesrna/intern/rna_space.c | 12 ----- 6 files changed, 41 insertions(+), 44 deletions(-) diff --git a/release/scripts/startup/bl_ui/space_clip.py b/release/scripts/startup/bl_ui/space_clip.py index c879609de95..3499249a8f9 100644 --- a/release/scripts/startup/bl_ui/space_clip.py +++ b/release/scripts/startup/bl_ui/space_clip.py @@ -543,23 +543,15 @@ class CLIP_PT_display(Panel): col = layout.column(align=True) - col.prop(sc, "show_marker_pattern", text="Pattern") - col.prop(sc, "show_marker_search", text="Search") - col.prop(sc, "show_pyramid_levels", text="Pyramid") - - col.prop(sc, "show_track_path", text="Path") - row = col.row() - row.active = sc.show_track_path - row.prop(sc, "path_length", text="Length") - col.prop(sc, "show_disabled", "Disabled Tracks") + col.prop(sc, "show_names", text="Names and Status") col.prop(sc, "show_bundles", text="3D Markers") - col.prop(sc, "show_names", text="Names and Status") - col.prop(sc, "show_tiny_markers", text="Compact Markers") + col.prop(sc, "use_mute_footage", text="Mute Footage") + col.prop(sc, "lock_selection") - col.prop(sc, "show_grease_pencil", text="Grease Pencil") - col.prop(sc, "use_mute_footage", text="Mute") + if sc.view == 'GRAPH': + col.prop(sc, "lock_time_cursor") if sc.mode == 'DISTORTION': col.prop(sc, "show_grid", text="Grid") @@ -567,15 +559,34 @@ class CLIP_PT_display(Panel): elif sc.mode == 'RECONSTRUCTION': col.prop(sc, "show_stable", text="Stable") - col.prop(sc, "lock_selection") - - if sc.view == 'GRAPH': - col.prop(sc, "lock_time_cursor") - clip = sc.clip if clip: col.label(text="Display Aspect Ratio:") - col.prop(clip, "display_aspect", text="") + row = col.row() + row.prop(clip, "display_aspect", text="") + + +class CLIP_PT_marker_display(Panel): + bl_space_type = 'CLIP_EDITOR' + bl_region_type = 'UI' + bl_label = "Marker Display" + + def draw(self, context): + layout = self.layout + sc = context.space_data + + col = layout.column(align=True) + + row = col.row() + row.prop(sc, "show_marker_pattern", text="Pattern") + row.prop(sc, "show_marker_search", text="Search") + + col.prop(sc, "show_tiny_markers", text="Thin Markers") + col.prop(sc, "show_track_path", text="Path") + + row = col.row() + row.active = sc.show_track_path + row.prop(sc, "path_length", text="Length") class CLIP_PT_track_settings(Panel): diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c index 6c93727bf55..99572345c96 100644 --- a/source/blender/editors/gpencil/gpencil_paint.c +++ b/source/blender/editors/gpencil/gpencil_paint.c @@ -1117,14 +1117,6 @@ static int gp_session_initdata (bContext *C, tGPsdata *p) p->custom_color[1]= 0.0f; p->custom_color[2]= 0.5f; p->custom_color[3]= 0.9f; - - /* check that gpencil data is allowed to be drawn */ - if ((sc->flag & SC_SHOW_GPENCIL)==0) { - p->status= GP_STATUS_ERROR; - if (G.f & G_DEBUG) - printf("Error: In active view, Grease Pencil not shown \n"); - return 0; - } } break; diff --git a/source/blender/editors/space_clip/clip_draw.c b/source/blender/editors/space_clip/clip_draw.c index a331703690b..de43b30d4f4 100644 --- a/source/blender/editors/space_clip/clip_draw.c +++ b/source/blender/editors/space_clip/clip_draw.c @@ -586,7 +586,7 @@ static void draw_marker_areas(SpaceClip *sc, MovieTrackingTrack *track, MovieTra } /* pyramid */ - if(sel && TRACK_SELECTED(track) && (sc->flag&SC_SHOW_PYRAMID_LEVELS) && (track->tracker==TRACKER_KLT) && (marker->flag&MARKER_DISABLED)==0) { + if(sel && TRACK_SELECTED(track) && (track->tracker==TRACKER_KLT) && (marker->flag&MARKER_DISABLED)==0) { if(track->flag&TRACK_LOCKED) { if(act) UI_ThemeColor(TH_ACT_MARKER); else if(track->pat_flag&SELECT) UI_ThemeColorShade(TH_LOCK_MARKER, 64); @@ -1307,7 +1307,7 @@ void clip_draw_grease_pencil(bContext *C, int onlyv2d) MovieClip *clip= ED_space_clip(sc); ImBuf *ibuf; - if((sc->flag&SC_SHOW_GPENCIL)==0 || !clip) + if(!clip) return; if(onlyv2d) { diff --git a/source/blender/editors/space_clip/space_clip.c b/source/blender/editors/space_clip/space_clip.c index 0d34cc2cfbf..5abdafbfffc 100644 --- a/source/blender/editors/space_clip/space_clip.c +++ b/source/blender/editors/space_clip/space_clip.c @@ -157,7 +157,7 @@ static SpaceLink *clip_new(const bContext *C) sc= MEM_callocN(sizeof(SpaceClip), "initclip"); sc->spacetype= SPACE_CLIP; - sc->flag= SC_SHOW_MARKER_PATTERN|SC_SHOW_TRACK_PATH|SC_SHOW_GPENCIL|SC_MANUAL_CALIBRATION|SC_SHOW_GRAPH_TRACKS|SC_SHOW_GRAPH_FRAMES; + sc->flag= SC_SHOW_MARKER_PATTERN|SC_SHOW_TRACK_PATH|SC_MANUAL_CALIBRATION|SC_SHOW_GRAPH_TRACKS|SC_SHOW_GRAPH_FRAMES; sc->zoom= 1.0f; sc->path_length= 20; sc->scopes.track_preview_height= 120; @@ -530,6 +530,12 @@ static void clip_keymap(struct wmKeyConfig *keyconf) kmi= WM_keymap_add_item(keymap, "WM_OT_context_toggle", LKEY, KM_PRESS, 0, 0); RNA_string_set(kmi->ptr, "data_path", "space_data.lock_selection"); + kmi= WM_keymap_add_item(keymap, "WM_OT_context_toggle", DKEY, KM_PRESS, KM_ALT, 0); + RNA_string_set(kmi->ptr, "data_path", "space_data.show_disabled"); + + kmi= WM_keymap_add_item(keymap, "WM_OT_context_toggle", SKEY, KM_PRESS, KM_ALT, 0); + RNA_string_set(kmi->ptr, "data_path", "space_data.show_marker_search"); + kmi= WM_keymap_add_item(keymap, "WM_OT_context_toggle", MKEY, KM_PRESS, 0, 0); RNA_string_set(kmi->ptr, "data_path", "space_data.use_mute_footage"); diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h index 06138bc0757..64d858bbcee 100644 --- a/source/blender/makesdna/DNA_space_types.h +++ b/source/blender/makesdna/DNA_space_types.h @@ -896,11 +896,11 @@ enum { #define SC_SHOW_GRID (1<<9) #define SC_SHOW_STABLE (1<<10) #define SC_MANUAL_CALIBRATION (1<<11) -#define SC_SHOW_GPENCIL (1<<12) +/*#define SC_SHOW_GPENCIL (1<<12)*/ /* UNUSED */ #define SC_SHOW_FILTERS (1<<13) #define SC_SHOW_GRAPH_FRAMES (1<<14) #define SC_SHOW_GRAPH_TRACKS (1<<15) -#define SC_SHOW_PYRAMID_LEVELS (1<<16) +/*#define SC_SHOW_PYRAMID_LEVELS (1<<16) */ /* UNUSED */ #define SC_LOCK_TIMECURSOR (1<<17) /* SpaceClip->mode */ diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index 799366a5234..8499e2fa111 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -2888,12 +2888,6 @@ static void rna_def_space_clip(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "flag", SC_SHOW_MARKER_SEARCH); RNA_def_property_update(prop, NC_SPACE|ND_SPACE_CLIP, NULL); - /* show pyramid */ - prop= RNA_def_property(srna, "show_pyramid_levels", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_ui_text(prop, "Show Pyramid ", "Show patterns for each pyramid level for markers (KLT only)"); - RNA_def_property_boolean_sdna(prop, NULL, "flag", SC_SHOW_PYRAMID_LEVELS); - RNA_def_property_update(prop, NC_SPACE|ND_SPACE_CLIP, NULL); - /* lock to selection */ prop= RNA_def_property(srna, "lock_selection", PROP_BOOLEAN, PROP_NONE); RNA_def_property_ui_text(prop, "Lock to Selection", "Lock viewport to selected markers during playback"); @@ -2973,12 +2967,6 @@ static void rna_def_space_clip(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Manual Calibration", "Use manual calibration helpers"); RNA_def_property_update(prop, NC_SPACE|ND_SPACE_CLIP, NULL); - /* show stable */ - prop= RNA_def_property(srna, "show_grease_pencil", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", SC_SHOW_GPENCIL); - RNA_def_property_ui_text(prop, "Show Grease Pencil", "Show grease pencil strokes over the footage"); - RNA_def_property_update(prop, NC_SPACE|ND_SPACE_CLIP, NULL); - /* show filters */ prop= RNA_def_property(srna, "show_filters", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", SC_SHOW_FILTERS); From c8f5dac11bb67aa005502d62855292e41252bbb4 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Fri, 3 Feb 2012 19:13:31 +0000 Subject: [PATCH 03/32] Movie Clip Editor: implemented option to display frame using OpenGL textures Initial idea was to perform bilinear filtering for displaying proxied frame to make it looking a bit smoother. It was done but it was also discovered that using such kind of texture buffers helps on some crappy videocards when playing $k footage. Currently check for NPOT support is disabled, so use this option with care. --- release/scripts/startup/bl_ui/space_clip.py | 2 + source/blender/blenloader/intern/readfile.c | 1 + source/blender/editors/include/ED_clip.h | 4 + .../blender/editors/space_clip/CMakeLists.txt | 1 + source/blender/editors/space_clip/SConscript | 2 +- source/blender/editors/space_clip/clip_draw.c | 39 +++-- .../blender/editors/space_clip/clip_editor.c | 147 ++++++++++++++++++ .../blender/editors/space_clip/space_clip.c | 3 + source/blender/makesdna/DNA_space_types.h | 3 + source/blender/makesrna/intern/rna_space.c | 5 + 10 files changed, 197 insertions(+), 10 deletions(-) diff --git a/release/scripts/startup/bl_ui/space_clip.py b/release/scripts/startup/bl_ui/space_clip.py index 3499249a8f9..3799361d3de 100644 --- a/release/scripts/startup/bl_ui/space_clip.py +++ b/release/scripts/startup/bl_ui/space_clip.py @@ -559,6 +559,8 @@ class CLIP_PT_display(Panel): elif sc.mode == 'RECONSTRUCTION': col.prop(sc, "show_stable", text="Stable") + col.prop(sc, "use_texture_buffer") + clip = sc.clip if clip: col.label(text="Display Aspect Ratio:") diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 6bd12e8d3f6..b30d04b31cc 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -5273,6 +5273,7 @@ static void lib_link_screen(FileData *fd, Main *main) sclip->clip= newlibadr_us(fd, sc->id.lib, sclip->clip); sclip->scopes.track_preview = NULL; + sclip->draw_context = NULL; sclip->scopes.ok = 0; } } diff --git a/source/blender/editors/include/ED_clip.h b/source/blender/editors/include/ED_clip.h index 7d36159f47e..004fd7ceef7 100644 --- a/source/blender/editors/include/ED_clip.h +++ b/source/blender/editors/include/ED_clip.h @@ -58,6 +58,10 @@ void ED_clip_point_undistorted_pos(SpaceClip *sc, float co[2], float nco[2]); void ED_clip_point_stable_pos(struct bContext *C, float x, float y, float *xr, float *yr); void ED_clip_mouse_pos(struct bContext *C, struct wmEvent *event, float co[2]); +void ED_space_clip_load_movieclip_buffer(struct SpaceClip *sc, struct ImBuf *ibuf); +void ED_space_clip_unload_movieclip_buffer(struct SpaceClip *sc); +void ED_space_clip_free_texture_buffer(struct SpaceClip *sc); + /* clip_ops.c */ void ED_operatormacros_clip(void); diff --git a/source/blender/editors/space_clip/CMakeLists.txt b/source/blender/editors/space_clip/CMakeLists.txt index 4f9819e8e77..30d2fe57c10 100644 --- a/source/blender/editors/space_clip/CMakeLists.txt +++ b/source/blender/editors/space_clip/CMakeLists.txt @@ -31,6 +31,7 @@ set(INC ../../makesdna ../../makesrna ../../windowmanager + ../../gpu ../../../../intern/guardedalloc ${GLEW_INCLUDE_PATH} ) diff --git a/source/blender/editors/space_clip/SConscript b/source/blender/editors/space_clip/SConscript index 70331b0ec4a..c9c82aea68e 100644 --- a/source/blender/editors/space_clip/SConscript +++ b/source/blender/editors/space_clip/SConscript @@ -4,6 +4,6 @@ Import ('env') sources = env.Glob('*.c') defs = [] incs = '../include ../../blenkernel ../../blenloader ../../blenfont ../../blenlib ../../imbuf ../../makesdna' -incs += ' ../../makesrna ../../windowmanager #/intern/guardedalloc #/extern/glew/include' +incs += ' ../../makesrna ../../windowmanager #/intern/guardedalloc #/extern/glew/include ../../gpu' env.BlenderLib ( 'bf_editors_space_clip', sources, Split(incs), defs, libtype=['core'], priority=[95] ) diff --git a/source/blender/editors/space_clip/clip_draw.c b/source/blender/editors/space_clip/clip_draw.c index de43b30d4f4..2533629c4fb 100644 --- a/source/blender/editors/space_clip/clip_draw.c +++ b/source/blender/editors/space_clip/clip_draw.c @@ -216,9 +216,6 @@ static void draw_movieclip_buffer(SpaceClip *sc, ARegion *ar, ImBuf *ibuf, int x, y; MovieClip *clip= ED_space_clip(sc); - /* set zoom */ - glPixelZoom(zoomx*width/ibuf->x, zoomy*height/ibuf->y); - /* find window pixel coordinates of origin */ UI_view2d_to_region_no_clip(&ar->v2d, 0.0f, 0.0f, &x, &y); @@ -230,8 +227,36 @@ static void draw_movieclip_buffer(SpaceClip *sc, ARegion *ar, ImBuf *ibuf, IMB_rect_from_float(ibuf); } - if(ibuf->rect) - glaDrawPixelsSafe(x, y, ibuf->x, ibuf->y, ibuf->x, GL_RGBA, GL_UNSIGNED_BYTE, ibuf->rect); + if(ibuf->rect) { + if(sc->flag & SC_TEXTURE_BUFFER) { + ED_space_clip_load_movieclip_buffer(sc, ibuf); + + glPushMatrix(); + glTranslatef(x, y, 0); + glScalef(zoomx, zoomy, 1.0f); + glMultMatrixf(sc->stabmat); + + glBegin(GL_QUADS); + glTexCoord2f(0.0f, 0.0f); glVertex2f(0.0f, 0.0f); + glTexCoord2f(1.0f, 0.0f); glVertex2f(width, 0.0f); + glTexCoord2f(1.0f, 1.0f); glVertex2f(width, height); + glTexCoord2f(0.0f, 1.0f); glVertex2f(0.0f, height); + glEnd(); + + glPopMatrix(); + + ED_space_clip_unload_movieclip_buffer(sc); + } + else { + /* set zoom */ + glPixelZoom(zoomx*width/ibuf->x, zoomy*height/ibuf->y); + + glaDrawPixelsSafe(x, y, ibuf->x, ibuf->y, ibuf->x, GL_RGBA, GL_UNSIGNED_BYTE, ibuf->rect); + + /* reset zoom */ + glPixelZoom(1.0f, 1.0f); + } + } } /* draw boundary border for frame if stabilization is enabled */ @@ -260,10 +285,6 @@ static void draw_movieclip_buffer(SpaceClip *sc, ARegion *ar, ImBuf *ibuf, glDisable(GL_COLOR_LOGIC_OP); glDisable(GL_LINE_STIPPLE); } - - - /* reset zoom */ - glPixelZoom(1.0f, 1.0f); } static void draw_track_path(SpaceClip *sc, MovieClip *UNUSED(clip), MovieTrackingTrack *track) diff --git a/source/blender/editors/space_clip/clip_editor.c b/source/blender/editors/space_clip/clip_editor.c index 35d870022a4..9835a1cf43b 100644 --- a/source/blender/editors/space_clip/clip_editor.c +++ b/source/blender/editors/space_clip/clip_editor.c @@ -31,6 +31,8 @@ #include +#include "MEM_guardedalloc.h" + #include "BKE_main.h" #include "BKE_movieclip.h" #include "BKE_context.h" @@ -40,6 +42,8 @@ #include "BLI_utildefines.h" #include "BLI_math.h" +#include "GPU_extensions.h" + #include "IMB_imbuf_types.h" #include "IMB_imbuf.h" @@ -47,6 +51,7 @@ #include "ED_clip.h" #include "BIF_gl.h" +#include "BIF_glutil.h" #include "WM_api.h" #include "WM_types.h" @@ -309,3 +314,145 @@ void ED_clip_mouse_pos(bContext *C, wmEvent *event, float co[2]) { ED_clip_point_stable_pos(C, event->mval[0], event->mval[1], &co[0], &co[1]); } + +/* OpenGL draw context */ + +typedef struct SpaceClipDrawContext { + GLuint texture; /* OGL texture ID */ + short texture_allocated; /* flag if texture was allocated by glGenTextures */ + struct ImBuf *texture_ibuf; /* image buffer for which texture was created */ + int image_width, image_height; /* image width and height for which texture was created */ + unsigned last_texture; /* ID of previously used texture, so it'll be restored after clip drawing */ +} SpaceClipDrawContext; + +void ED_space_clip_load_movieclip_buffer(SpaceClip *sc, ImBuf *ibuf) +{ + SpaceClipDrawContext *context = sc->draw_context; + MovieClip *clip = ED_space_clip(sc); + int need_rebind = 0; + + if (!context) { + context = MEM_callocN(sizeof(SpaceClipDrawContext), "SpaceClipDrawContext"); + sc->draw_context = context; + } + + context->last_texture = glaGetOneInteger(GL_TEXTURE_2D); + + /* image texture need to be rebinded if displaying another image buffer + * assuming displaying happens of footage frames only on which painting doesn't heppen. + * so not changed image buffer pointer means unchanged image content */ + need_rebind |= context->texture_ibuf != ibuf; + + if (need_rebind) { + int width = ibuf->x, height = ibuf->y; + float *frect = NULL, *fscalerect = NULL; + unsigned int *rect = NULL, *scalerect = NULL; + int need_recreate = 0; + + rect = ibuf->rect; + frect = ibuf->rect_float; + + /* if image resolution changed (e.g. switched to proxy display) texture need to be recreated */ + need_recreate = context->image_width != ibuf->x || context->image_height != ibuf->y; + + if (context->texture_ibuf && need_recreate) { + glDeleteTextures(1, &context->texture); + context->texture_allocated = 0; + } + +#if 0 + /* disabled for now because current tracking users have got NPOT textures + * working smoothly on their computers and forcing re-scaling during playback + * slows down playback a lot */ + + /* if videocard doesn't support NPOT textures, need to do rescaling */ + if (!GPU_non_power_of_two_support()) { + if (!is_power_of_2_i(width) || !is_power_of_2_i(height)) { + width = power_of_2_max_i(width); + height = power_of_2_max_i(height); + + if (ibuf->x != width || ibuf->y != height) { + if (frect) { + fscalerect= MEM_mallocN(width*width*sizeof(*fscalerect)*4, "fscalerect"); + gluScaleImage(GL_RGBA, ibuf->x, ibuf->y, GL_FLOAT, ibuf->rect_float, width, height, GL_FLOAT, fscalerect); + + frect = fscalerect; + } + else { + scalerect= MEM_mallocN(width*height*sizeof(*scalerect), "scalerect"); + gluScaleImage(GL_RGBA, ibuf->x, ibuf->y, GL_UNSIGNED_BYTE, ibuf->rect, width, height, GL_UNSIGNED_BYTE, scalerect); + + rect = scalerect; + } + } + } + } +#endif + + if (need_recreate || !context->texture_allocated) { + /* texture doesn't exist yet or need to be re-allocated because of changed dimensions */ + int filter = GL_LINEAR; + + /* non-scaled proxy shouldn;t use diltering */ + if ((clip->flag & MCLIP_USE_PROXY) == 0 || + ELEM(sc->user.render_size, MCLIP_PROXY_RENDER_SIZE_FULL, MCLIP_PROXY_RENDER_SIZE_100)) + { + filter = GL_NEAREST; + } + + glGenTextures(1, &context->texture); + glBindTexture(GL_TEXTURE_2D, context->texture); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, filter); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, filter); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP); + } + else { + /* if texture doesn't need to be reallocated itself, just bind it so + * loading of image will happen to a proper texture */ + glBindTexture(GL_TEXTURE_2D, context->texture); + } + + if (frect) + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA16, width, height, 0, GL_RGBA, GL_FLOAT, frect); + else + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, rect); + + /* store settings */ + context->texture_allocated = 1; + context->texture_ibuf = ibuf; + context->image_width = ibuf->x; + context->image_height = ibuf->y; + + if (fscalerect) + MEM_freeN(fscalerect); + if (scalerect) + MEM_freeN(scalerect); + } + else { + /* displaying exactly the same image which was loaded t oa texture, + * just bint texture in this case */ + glBindTexture(GL_TEXTURE_2D, context->texture); + } + + glEnable(GL_TEXTURE_2D); +} + +void ED_space_clip_unload_movieclip_buffer(SpaceClip *sc) +{ + SpaceClipDrawContext *context = sc->draw_context; + + glBindTexture(GL_TEXTURE_2D, context->last_texture); + glDisable(GL_TEXTURE_2D); +} + +void ED_space_clip_free_texture_buffer(SpaceClip *sc) +{ + SpaceClipDrawContext *context = sc->draw_context; + + if (context) { + glDeleteTextures(1, &context->texture); + + MEM_freeN(context); + } +} diff --git a/source/blender/editors/space_clip/space_clip.c b/source/blender/editors/space_clip/space_clip.c index 5abdafbfffc..7cd7060e1d4 100644 --- a/source/blender/editors/space_clip/space_clip.c +++ b/source/blender/editors/space_clip/space_clip.c @@ -214,6 +214,8 @@ static void clip_free(SpaceLink *sl) if(sc->scopes.track_preview) IMB_freeImBuf(sc->scopes.track_preview); + + ED_space_clip_free_texture_buffer(sc); } /* spacetype; init callback */ @@ -229,6 +231,7 @@ static SpaceLink *clip_duplicate(SpaceLink *sl) /* clear or remove stuff from old */ scn->scopes.track_preview= NULL; scn->scopes.ok= 0; + scn->draw_context= NULL; return (SpaceLink *)scn; } diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h index 64d858bbcee..f5ca88d9391 100644 --- a/source/blender/makesdna/DNA_space_types.h +++ b/source/blender/makesdna/DNA_space_types.h @@ -521,6 +521,8 @@ typedef struct SpaceClip { /* movie postprocessing */ int postproc_flag, pad2; + + void *draw_context; } SpaceClip; /* view3d Now in DNA_view3d_types.h */ @@ -902,6 +904,7 @@ enum { #define SC_SHOW_GRAPH_TRACKS (1<<15) /*#define SC_SHOW_PYRAMID_LEVELS (1<<16) */ /* UNUSED */ #define SC_LOCK_TIMECURSOR (1<<17) +#define SC_TEXTURE_BUFFER (1<<18) /* SpaceClip->mode */ #define SC_MODE_TRACKING 0 diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index 8499e2fa111..cb4151d8aee 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -2985,6 +2985,11 @@ static void rna_def_space_clip(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Show Tracks", "Display the speed curves (in \"x\" direction red, in \"y\" direction green) for the selected tracks"); RNA_def_property_update(prop, NC_SPACE|ND_SPACE_CLIP, NULL); + prop= RNA_def_property(srna, "use_texture_buffer", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_ui_text(prop, "Use Texture Buffer", "Use texture buffer to display o,age frames frame on screen"); + RNA_def_property_boolean_sdna(prop, NULL, "flag", SC_TEXTURE_BUFFER); + RNA_def_property_update(prop, NC_WINDOW, NULL); + /* ** channels ** */ /* show_red_channel */ From bd249c3bffed10a7634ed83fcd5cd07729182689 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Wed, 15 Feb 2012 16:06:48 +0000 Subject: [PATCH 04/32] Camera tracking: animation datablock for MovieClip Added AnimData block to MovieClip datablock which allows to animate different properties in clip. Currently supports animation of stabilization influence only. --- source/blender/blenkernel/intern/anim_sys.c | 4 ++ source/blender/blenkernel/intern/movieclip.c | 3 + source/blender/blenloader/intern/readfile.c | 5 ++ source/blender/blenloader/intern/writefile.c | 3 + source/blender/makesdna/DNA_movieclip_types.h | 2 + .../blender/makesrna/intern/rna_movieclip.c | 16 ++++++ source/blender/makesrna/intern/rna_tracking.c | 56 +++++++++++++++++++ 7 files changed, 89 insertions(+) diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c index b32421a6b3d..9ae3ad95d5c 100644 --- a/source/blender/blenkernel/intern/anim_sys.c +++ b/source/blender/blenkernel/intern/anim_sys.c @@ -88,6 +88,7 @@ short id_type_can_have_animdata (ID *id) case ID_LA: case ID_CA: case ID_WO: case ID_SPK: case ID_SCE: + case ID_MC: { return 1; } @@ -2335,6 +2336,9 @@ void BKE_animsys_evaluate_all_animation (Main *main, Scene *scene, float ctime) /* speakers */ EVAL_ANIM_IDS(main->speaker.first, ADT_RECALC_ANIM); + /* movie clips */ + EVAL_ANIM_IDS(main->movieclip.first, ADT_RECALC_ANIM); + /* objects */ /* ADT_RECALC_ANIM doesn't need to be supplied here, since object AnimData gets * this tagged by Depsgraph on framechange. This optimisation means that objects diff --git a/source/blender/blenkernel/intern/movieclip.c b/source/blender/blenkernel/intern/movieclip.c index c90faa7e0ca..03fe18e4bd8 100644 --- a/source/blender/blenkernel/intern/movieclip.c +++ b/source/blender/blenkernel/intern/movieclip.c @@ -64,6 +64,7 @@ #include "BLI_mempool.h" #include "BLI_threads.h" +#include "BKE_animsys.h" #include "BKE_constraint.h" #include "BKE_library.h" #include "BKE_global.h" @@ -889,6 +890,8 @@ static void free_buffers(MovieClip *clip) IMB_free_anim(clip->anim); clip->anim= FALSE; } + + BKE_free_animdata((ID *) clip); } void BKE_movieclip_reload(MovieClip *clip) diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index cff4f3965fa..377c438f874 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -6051,6 +6051,8 @@ static void direct_link_movieclip(FileData *fd, MovieClip *clip) MovieTracking *tracking= &clip->tracking; MovieTrackingObject *object; + clip->adt= newdataadr(fd, clip->adt); + if(fd->movieclipmap) clip->cache= newmclipadr(fd, clip->cache); else clip->cache= NULL; @@ -6088,6 +6090,9 @@ static void lib_link_movieclip(FileData *fd, Main *main) clip= main->movieclip.first; while(clip) { if(clip->id.flag & LIB_NEEDLINK) { + if (clip->adt) + lib_link_animdata(fd, &clip->id, clip->adt); + clip->gpd= newlibadr_us(fd, clip->id.lib, clip->gpd); clip->id.flag -= LIB_NEEDLINK; diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c index ae4bc936193..e221f261d55 100644 --- a/source/blender/blenloader/intern/writefile.c +++ b/source/blender/blenloader/intern/writefile.c @@ -2564,6 +2564,9 @@ static void write_movieclips(WriteData *wd, ListBase *idbase) MovieTrackingObject *object; writestruct(wd, ID_MC, "MovieClip", 1, clip); + if(clip->adt) + write_animdata(wd, clip->adt); + write_movieTracks(wd, &tracking->tracks); write_movieReconstruction(wd, &tracking->reconstruction); diff --git a/source/blender/makesdna/DNA_movieclip_types.h b/source/blender/makesdna/DNA_movieclip_types.h index 80728cd9817..71029293d09 100644 --- a/source/blender/makesdna/DNA_movieclip_types.h +++ b/source/blender/makesdna/DNA_movieclip_types.h @@ -39,6 +39,7 @@ #include "DNA_tracking_types.h" struct anim; +struct AnimData; struct bGPdata; struct ImBuf; struct MovieClipProxy; @@ -61,6 +62,7 @@ typedef struct MovieClipProxy { typedef struct MovieClip { ID id; + struct AnimData *adt; /* animation data (must be immediately after id for utilities to use it) */ char name[1024]; /* file path, 1024 = FILE_MAX */ diff --git a/source/blender/makesrna/intern/rna_movieclip.c b/source/blender/makesrna/intern/rna_movieclip.c index 1d79040c4eb..a640f996b1a 100644 --- a/source/blender/makesrna/intern/rna_movieclip.c +++ b/source/blender/makesrna/intern/rna_movieclip.c @@ -88,57 +88,70 @@ static void rna_def_movieclip_proxy(BlenderRNA *brna) /* build proxy sized */ prop= RNA_def_property(srna, "build_25", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "build_size_flag", MCLIP_PROXY_SIZE_25); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_ui_text(prop, "25%", "Build proxy resolution 25% of the original footage dimension"); prop= RNA_def_property(srna, "build_50", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "build_size_flag", MCLIP_PROXY_SIZE_50); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_ui_text(prop, "50%", "Build proxy resolution 50% of the original footage dimension"); prop= RNA_def_property(srna, "build_75", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "build_size_flag", MCLIP_PROXY_SIZE_75); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_ui_text(prop, "75%", "Build proxy resolution 75% of the original footage dimension"); prop= RNA_def_property(srna, "build_100", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "build_size_flag", MCLIP_PROXY_SIZE_100); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_ui_text(prop, "100%", "Build proxy resolution 100% of the original footage dimension"); prop= RNA_def_property(srna, "build_undistorted_25", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "build_size_flag", MCLIP_PROXY_UNDISTORTED_SIZE_25); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_ui_text(prop, "25%", "Build proxy resolution 25% of the original undistorted footage dimension"); prop= RNA_def_property(srna, "build_undistorted_50", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "build_size_flag", MCLIP_PROXY_UNDISTORTED_SIZE_50); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_ui_text(prop, "50%", "Build proxy resolution 50% of the original undistorted footage dimension"); prop= RNA_def_property(srna, "build_undistorted_75", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "build_size_flag", MCLIP_PROXY_UNDISTORTED_SIZE_75); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_ui_text(prop, "75%", "Build proxy resolution 75% of the original undistorted footage dimension"); prop= RNA_def_property(srna, "build_undistorted_100", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "build_size_flag", MCLIP_PROXY_UNDISTORTED_SIZE_100); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_ui_text(prop, "100%", "Build proxy resolution 100% of the original undistorted footage dimension"); /* build timecodes */ prop= RNA_def_property(srna, "build_record_run", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "build_tc_flag", IMB_TC_RECORD_RUN); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_ui_text(prop, "Rec Run", "Build record run time code index"); prop= RNA_def_property(srna, "build_free_run", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "build_tc_flag", IMB_TC_FREE_RUN); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_ui_text(prop, "Free Run", "Build free run time code index"); prop= RNA_def_property(srna, "build_free_run_rec_date", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "build_tc_flag", IMB_TC_INTERPOLATED_REC_DATE_FREE_RUN); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_ui_text(prop, "Free Run (Rec Date)", "Build free run time code index using Record Date/Time"); /* quality of proxied image */ prop= RNA_def_property(srna, "quality", PROP_INT, PROP_UNSIGNED); RNA_def_property_int_sdna(prop, NULL, "quality"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_ui_text(prop, "Quality", "JPEG quality of proxy images"); RNA_def_property_ui_range(prop, 1, 100, 1, 0); prop= RNA_def_property(srna, "timecode", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "tc"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_enum_items(prop, clip_tc_items); RNA_def_property_ui_text(prop, "Timecode", ""); RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, NULL); @@ -146,6 +159,7 @@ static void rna_def_movieclip_proxy(BlenderRNA *brna) /* directory */ prop= RNA_def_property(srna, "directory", PROP_STRING, PROP_DIRPATH); RNA_def_property_string_sdna(prop, NULL, "dir"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_ui_text(prop, "Directory", "Location to store the proxy files"); RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, "rna_MovieClip_reload_update"); } @@ -223,6 +237,7 @@ static void rna_def_movieclip(BlenderRNA *brna) /* use proxy */ prop= RNA_def_property(srna, "use_proxy", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", MCLIP_USE_PROXY); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_ui_text(prop, "Use Proxy / Timecode", "Use a preview proxy and/or timecode index for this clip"); RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, NULL); @@ -247,6 +262,7 @@ static void rna_def_movieclip(BlenderRNA *brna) /* custom proxy directory */ prop= RNA_def_property(srna, "use_proxy_custom_directory", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", MCLIP_USE_PROXY_CUSTOM_DIR); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_ui_text(prop, "Proxy Custom Directory", "Create proxy images in a custom directory (default is movie location)"); RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, "rna_MovieClip_reload_update"); diff --git a/source/blender/makesrna/intern/rna_tracking.c b/source/blender/makesrna/intern/rna_tracking.c index aff8a85dd26..ba4e5199f73 100644 --- a/source/blender/makesrna/intern/rna_tracking.c +++ b/source/blender/makesrna/intern/rna_tracking.c @@ -54,6 +54,11 @@ #include "WM_api.h" +static char *rna_tracking_path(PointerRNA *UNUSED(ptr)) +{ + return BLI_sprintfN("tracking"); +} + static void rna_tracking_defaultSettings_levelsUpdate(Main *UNUSED(bmain), Scene *scene, PointerRNA *ptr) { MovieClip *clip= (MovieClip*)ptr->id.data; @@ -88,6 +93,13 @@ static void rna_tracking_defaultSettings_searchUpdate(Main *UNUSED(bmain), Scene settings->default_pattern_size= settings->default_search_size; } +static char *rna_trackingTrack_path(PointerRNA *ptr) +{ + MovieTrackingTrack *track = (MovieTrackingTrack *) ptr->data; + + return BLI_sprintfN("tracking.tracks[\"%s\"]", track->name); +} + static void rna_trackingTracks_begin(CollectionPropertyIterator *iter, PointerRNA *ptr) { MovieClip *clip= (MovieClip*)ptr->id.data; @@ -228,6 +240,11 @@ static void rna_tracking_trackerPyramid_update(Main *UNUSED(bmain), Scene *UNUSE BKE_tracking_clamp_track(track, CLAMP_PYRAMID_LEVELS); } +static char *rna_trackingCamera_path(PointerRNA *UNUSED(ptr)) +{ + return BLI_sprintfN("tracking.camera"); +} + static float rna_trackingCamera_focal_mm_get(PointerRNA *ptr) { MovieClip *clip= (MovieClip*)ptr->id.data; @@ -252,6 +269,11 @@ static void rna_trackingCamera_focal_mm_set(PointerRNA *ptr, float value) camera->focal= value; } +static char *rna_trackingStabilization_path(PointerRNA *UNUSED(ptr)) +{ + return BLI_sprintfN("tracking.stabilization"); +} + static int rna_track_2d_stabilization(CollectionPropertyIterator *UNUSED(iter), void *data) { MovieTrackingTrack *track= (MovieTrackingTrack*)data; @@ -681,11 +703,13 @@ static void rna_def_trackingCamera(BlenderRNA *brna) {0, NULL, 0, NULL, NULL}}; srna= RNA_def_struct(brna, "MovieTrackingCamera", NULL); + RNA_def_struct_path_func(srna, "rna_trackingCamera_path"); RNA_def_struct_ui_text(srna, "Movie tracking camera data", "Match-moving camera data for tracking"); /* Sensor */ prop= RNA_def_property(srna, "sensor_width", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "sensor_width"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_range(prop, 0.0f, 500.0f); RNA_def_property_ui_text(prop, "Sensor", "Width of CCD sensor in millimeters"); RNA_def_property_update(prop, NC_MOVIECLIP|NA_EDITED, NULL); @@ -693,6 +717,7 @@ static void rna_def_trackingCamera(BlenderRNA *brna) /* Focal Length */ prop= RNA_def_property(srna, "focal_length", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "focal"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_range(prop, 0.0001f, 5000.0f); RNA_def_property_float_funcs(prop, "rna_trackingCamera_focal_mm_get", "rna_trackingCamera_focal_mm_set", NULL); RNA_def_property_ui_text(prop, "Focal Length", "Camera's focal length"); @@ -701,6 +726,7 @@ static void rna_def_trackingCamera(BlenderRNA *brna) /* Focal Length in pixels */ prop= RNA_def_property(srna, "focal_length_pixels", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "focal"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_range(prop, 0.0f, 5000.0f); RNA_def_property_ui_text(prop, "Focal Length", "Camera's focal length"); RNA_def_property_update(prop, NC_MOVIECLIP|NA_EDITED, NULL); @@ -709,6 +735,7 @@ static void rna_def_trackingCamera(BlenderRNA *brna) prop= RNA_def_property(srna, "units", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "units"); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_enum_items(prop, camera_units_items); RNA_def_property_ui_text(prop, "Units", "Units used for camera focal length"); @@ -716,24 +743,28 @@ static void rna_def_trackingCamera(BlenderRNA *brna) prop= RNA_def_property(srna, "principal", PROP_FLOAT, PROP_NONE); RNA_def_property_array(prop, 2); RNA_def_property_float_sdna(prop, NULL, "principal"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_ui_text(prop, "Principal Point", "Optical center of lens"); RNA_def_property_update(prop, NC_MOVIECLIP|NA_EDITED, NULL); /* Radial distortion parameters */ prop= RNA_def_property(srna, "k1", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "k1"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_ui_range(prop, -10, 10, .1, 3); RNA_def_property_ui_text(prop, "K1", "First coefficient of third order polynomial radial distortion"); RNA_def_property_update(prop, NC_MOVIECLIP|NA_EDITED, "rna_tracking_flushUpdate"); prop= RNA_def_property(srna, "k2", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "k2"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_ui_range(prop, -10, 10, .1, 3); RNA_def_property_ui_text(prop, "K2", "Second coefficient of third order polynomial radial distortion"); RNA_def_property_update(prop, NC_MOVIECLIP|NA_EDITED, "rna_tracking_flushUpdate"); prop= RNA_def_property(srna, "k3", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "k3"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_ui_range(prop, -10, 10, .1, 3); RNA_def_property_ui_text(prop, "K3", "Third coefficient of third order polynomial radial distortion"); RNA_def_property_update(prop, NC_MOVIECLIP|NA_EDITED, "rna_tracking_flushUpdate"); @@ -741,6 +772,7 @@ static void rna_def_trackingCamera(BlenderRNA *brna) /* pixel aspect */ prop= RNA_def_property(srna, "pixel_aspect", PROP_FLOAT, PROP_XYZ); RNA_def_property_float_sdna(prop, NULL, "pixel_aspect"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_range(prop, 0.1f, 5000.0f); RNA_def_property_ui_range(prop, 0.1f, 5000.0f, 1, 2); RNA_def_property_ui_text(prop, "Pixel Aspect Ratio", "Pixel aspect ratio"); @@ -822,6 +854,7 @@ static void rna_def_trackingTrack(BlenderRNA *brna) rna_def_trackingMarker(brna); srna= RNA_def_struct(brna, "MovieTrackingTrack", NULL); + RNA_def_struct_path_func(srna, "rna_trackingTrack_path"); RNA_def_struct_ui_text(srna, "Movie tracking track data", "Match-moving track data for tracking"); RNA_def_struct_ui_icon(srna, ICON_ANIM_DATA); @@ -838,6 +871,7 @@ static void rna_def_trackingTrack(BlenderRNA *brna) RNA_def_property_array(prop, 2); RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, 5); RNA_def_property_float_sdna(prop, NULL, "pat_min"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_ui_text(prop, "Pattern Min", "Left-bottom corner of pattern area in normalized coordinates relative to marker position"); RNA_def_property_update(prop, NC_MOVIECLIP|NA_EDITED, "rna_tracking_trackerPattern_update"); @@ -845,6 +879,7 @@ static void rna_def_trackingTrack(BlenderRNA *brna) RNA_def_property_array(prop, 2); RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, 5); RNA_def_property_float_sdna(prop, NULL, "pat_max"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_ui_text(prop, "Pattern Max", "Right-bottom corner of pattern area in normalized coordinates relative to marker position"); RNA_def_property_update(prop, NC_MOVIECLIP|NA_EDITED, "rna_tracking_trackerPattern_update"); @@ -853,6 +888,7 @@ static void rna_def_trackingTrack(BlenderRNA *brna) RNA_def_property_array(prop, 2); RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, 5); RNA_def_property_float_sdna(prop, NULL, "search_min"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_ui_text(prop, "Search Min", "Left-bottom corner of search area in normalized coordinates relative to marker position"); RNA_def_property_update(prop, NC_MOVIECLIP|NA_EDITED, "rna_tracking_trackerSearch_update"); @@ -860,6 +896,7 @@ static void rna_def_trackingTrack(BlenderRNA *brna) RNA_def_property_array(prop, 2); RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, 5); RNA_def_property_float_sdna(prop, NULL, "search_max"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_ui_text(prop, "Search Max", "Right-bottom corner of search area in normalized coordinates relative to marker position"); RNA_def_property_update(prop, NC_MOVIECLIP|NA_EDITED, "rna_tracking_trackerSearch_update"); @@ -867,6 +904,7 @@ static void rna_def_trackingTrack(BlenderRNA *brna) prop= RNA_def_property(srna, "frames_limit", PROP_INT, PROP_NONE); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_int_sdna(prop, NULL, "frames_limit"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_range(prop, 0, SHRT_MAX); RNA_def_property_ui_text(prop, "Frames Limit", "Every tracking cycle, this number of frames are tracked"); @@ -874,6 +912,7 @@ static void rna_def_trackingTrack(BlenderRNA *brna) prop= RNA_def_property(srna, "pattern_match", PROP_ENUM, PROP_NONE); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_enum_sdna(prop, NULL, "pattern_match"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_enum_items(prop, pattern_match_items); RNA_def_property_ui_text(prop, "Pattern Match", "Track pattern from given frame when tracking marker to next frame"); @@ -881,6 +920,7 @@ static void rna_def_trackingTrack(BlenderRNA *brna) prop= RNA_def_property(srna, "margin", PROP_INT, PROP_NONE); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_int_sdna(prop, NULL, "margin"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_range(prop, 0, 300); RNA_def_property_ui_text(prop, "Margin", "Distance from image boudary at which marker stops tracking"); @@ -888,6 +928,7 @@ static void rna_def_trackingTrack(BlenderRNA *brna) prop= RNA_def_property(srna, "tracker", PROP_ENUM, PROP_NONE); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_enum_items(prop, tracker_items); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_ui_text(prop, "Tracker", "Tracking algorithm to use"); RNA_def_property_update(prop, NC_MOVIECLIP|NA_EDITED, "rna_tracking_trackerAlgorithm_update"); @@ -895,6 +936,7 @@ static void rna_def_trackingTrack(BlenderRNA *brna) prop= RNA_def_property(srna, "pyramid_levels", PROP_INT, PROP_NONE); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_int_sdna(prop, NULL, "pyramid_levels"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_range(prop, 1, 16); RNA_def_property_ui_text(prop, "Pyramid levels", "Number of pyramid levels (increase on blurry footage)"); RNA_def_property_update(prop, NC_MOVIECLIP|NA_EDITED, "rna_tracking_trackerPyramid_update"); @@ -919,24 +961,28 @@ static void rna_def_trackingTrack(BlenderRNA *brna) /* use_red_channel */ prop= RNA_def_property(srna, "use_red_channel", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", TRACK_DISABLE_RED); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_ui_text(prop, "Use Red Channel", "Use red channel from footage for tracking"); RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, NULL); /* use_green_channel */ prop= RNA_def_property(srna, "use_green_channel", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", TRACK_DISABLE_GREEN); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_ui_text(prop, "Use Green Channel", "Use green channel from footage for tracking"); RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, NULL); /* use_blue_channel */ prop= RNA_def_property(srna, "use_blue_channel", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", TRACK_DISABLE_BLUE); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_ui_text(prop, "Use Blue Channel", "Use blue channel from footage for tracking"); RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, NULL); /* preview_grayscale */ prop= RNA_def_property(srna, "use_grayscale_preview", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", TRACK_PREVIEW_GRAYSCALE); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_ui_text(prop, "Grayscale", "Display what the tracking algorithm sees in the preview"); RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, NULL); @@ -956,6 +1002,7 @@ static void rna_def_trackingTrack(BlenderRNA *brna) /* hide */ prop= RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", TRACK_HIDDEN); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_ui_text(prop, "Hide", "Track is hidden"); RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, NULL); @@ -986,12 +1033,14 @@ static void rna_def_trackingTrack(BlenderRNA *brna) /* locked */ prop= RNA_def_property(srna, "lock", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", TRACK_LOCKED); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_ui_text(prop, "Lock", "Track is locked and all changes to it are disabled"); RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, NULL); /* custom color */ prop= RNA_def_property(srna, "use_custom_color", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", TRACK_CUSTOMCOLOR); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_ui_text(prop, "Custom Color", "Use custom color instead of theme-defined"); RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, NULL); @@ -1015,11 +1064,13 @@ static void rna_def_trackingStabilization(BlenderRNA *brna) PropertyRNA *prop; srna= RNA_def_struct(brna, "MovieTrackingStabilization", NULL); + RNA_def_struct_path_func(srna, "rna_trackingStabilization_path"); RNA_def_struct_ui_text(srna, "Movie tracking stabilization data", "Match-moving stabilization data for tracking"); /* 2d stabilization */ prop= RNA_def_property(srna, "use_2d_stabilization", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", TRACKING_2D_STABILIZATION); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_ui_text(prop, "Use 2D stabilization", "Use 2D stabilization for footage"); RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, "rna_tracking_flushUpdate"); @@ -1040,12 +1091,14 @@ static void rna_def_trackingStabilization(BlenderRNA *brna) /* active track index */ prop= RNA_def_property(srna, "active_track_index", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "act_track"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_int_funcs(prop, "rna_tracking_stabTracks_active_index_get", "rna_tracking_stabTracks_active_index_set", "rna_tracking_stabTracks_active_index_range"); RNA_def_property_ui_text(prop, "Active Track Index", "Index of active track in stabilization tracks list"); /* autoscale */ prop= RNA_def_property(srna, "use_autoscale", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", TRACKING_AUTOSCALE); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_ui_text(prop, "Autoscale", "Automatically scale footage to cover unfilled areas when stabilizating"); RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, "rna_tracking_flushUpdate"); @@ -1072,6 +1125,7 @@ static void rna_def_trackingStabilization(BlenderRNA *brna) /* use_stabilize_rotation */ prop= RNA_def_property(srna, "use_stabilize_rotation", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_boolean_sdna(prop, NULL, "flag", TRACKING_STABILIZE_ROTATION); RNA_def_property_ui_text(prop, "Stabilize Rotation", "Stabilize horizon line on the shot"); RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, "rna_tracking_flushUpdate"); @@ -1280,6 +1334,7 @@ static void rna_def_tracking(BlenderRNA *brna) rna_def_trackingObject(brna); srna= RNA_def_struct(brna, "MovieTracking", NULL); + RNA_def_struct_path_func(srna, "rna_tracking_path"); RNA_def_struct_ui_text(srna, "Movie tracking data", "Match-moving data for tracking"); /* settings */ @@ -1315,6 +1370,7 @@ static void rna_def_tracking(BlenderRNA *brna) /* active object index */ prop= RNA_def_property(srna, "active_object_index", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "objectnr"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_int_funcs(prop, "rna_tracking_active_object_index_get", "rna_tracking_active_object_index_set", "rna_tracking_active_object_index_range"); RNA_def_property_ui_text(prop, "Active Object Index", "Index of active object"); RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, NULL); From 9251d64e2b6bbcdbe051f4c99cdb2e5a2071509a Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Wed, 15 Feb 2012 18:11:10 +0000 Subject: [PATCH 05/32] Tomato: fixed incorrect behavior of textures buffer used in MCE together with 2d stabilization. --- source/blender/editors/space_clip/clip_draw.c | 7 +++---- source/blender/editors/space_clip/clip_editor.c | 3 +++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/source/blender/editors/space_clip/clip_draw.c b/source/blender/editors/space_clip/clip_draw.c index afc0d84ed9a..43068c38116 100644 --- a/source/blender/editors/space_clip/clip_draw.c +++ b/source/blender/editors/space_clip/clip_draw.c @@ -232,9 +232,8 @@ static void draw_movieclip_buffer(SpaceClip *sc, ARegion *ar, ImBuf *ibuf, ED_space_clip_load_movieclip_buffer(sc, ibuf); glPushMatrix(); - glTranslatef(x, y, 0); + glTranslatef(x, y, 0.0f); glScalef(zoomx, zoomy, 1.0f); - glMultMatrixf(sc->stabmat); glBegin(GL_QUADS); glTexCoord2f(0.0f, 0.0f); glVertex2f(0.0f, 0.0f); @@ -268,9 +267,9 @@ static void draw_movieclip_buffer(SpaceClip *sc, ARegion *ar, ImBuf *ibuf, glLogicOp(GL_NOR); glPushMatrix(); - glTranslatef(x, y, 0); + glTranslatef(x, y, 0.0f); - glScalef(zoomx, zoomy, 0); + glScalef(zoomx, zoomy, 1.0f); glMultMatrixf(sc->stabmat); glBegin(GL_LINE_LOOP); diff --git a/source/blender/editors/space_clip/clip_editor.c b/source/blender/editors/space_clip/clip_editor.c index 9835a1cf43b..5f042e6a2be 100644 --- a/source/blender/editors/space_clip/clip_editor.c +++ b/source/blender/editors/space_clip/clip_editor.c @@ -323,6 +323,7 @@ typedef struct SpaceClipDrawContext { struct ImBuf *texture_ibuf; /* image buffer for which texture was created */ int image_width, image_height; /* image width and height for which texture was created */ unsigned last_texture; /* ID of previously used texture, so it'll be restored after clip drawing */ + int framenr; } SpaceClipDrawContext; void ED_space_clip_load_movieclip_buffer(SpaceClip *sc, ImBuf *ibuf) @@ -342,6 +343,7 @@ void ED_space_clip_load_movieclip_buffer(SpaceClip *sc, ImBuf *ibuf) * assuming displaying happens of footage frames only on which painting doesn't heppen. * so not changed image buffer pointer means unchanged image content */ need_rebind |= context->texture_ibuf != ibuf; + need_rebind |= context->framenr != sc->user.framenr; if (need_rebind) { int width = ibuf->x, height = ibuf->y; @@ -423,6 +425,7 @@ void ED_space_clip_load_movieclip_buffer(SpaceClip *sc, ImBuf *ibuf) context->texture_ibuf = ibuf; context->image_width = ibuf->x; context->image_height = ibuf->y; + context->framenr = sc->user.framenr; if (fscalerect) MEM_freeN(fscalerect); From a0feea1fc07fb228c792d5bd20106508fbdb62e7 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 16 Feb 2012 04:08:52 +0000 Subject: [PATCH 06/32] fix [#30201] bpy_extras.image_utils.load_image always returns placeholder in existing addons this only effects OBJ import. interestingly even though this is a bug (in that its returning a placeholder when it should load the image), since the placeholder points to the correct path, the image will load correctly when refreshed, so the bug's not too bad. --- release/scripts/modules/bpy_extras/image_utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release/scripts/modules/bpy_extras/image_utils.py b/release/scripts/modules/bpy_extras/image_utils.py index 7d409510c85..c21b750fd1f 100644 --- a/release/scripts/modules/bpy_extras/image_utils.py +++ b/release/scripts/modules/bpy_extras/image_utils.py @@ -97,7 +97,7 @@ def load_image(imagepath, # image path has been checked so the path could not be read for some # reason, so be sure to return a placeholder - if place_holder: + if place_holder and image is None: image = _image_load_placeholder(path) return image From 30dddb9840e1566e50c5aacc70bd4b2865c7fa56 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 16 Feb 2012 04:21:40 +0000 Subject: [PATCH 07/32] fix for replacing a generated image with a file, the image would stay generated. not a show-stopper but confusing. --- source/blender/editors/space_image/image_ops.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index e1fe3788d05..3b7992e0468 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -886,6 +886,11 @@ static int image_replace_exec(bContext *C, wmOperator *op) /* we cant do much if the str is longer then FILE_MAX :/ */ BLI_strncpy(sima->image->name, str, sizeof(sima->image->name)); + if (BLI_testextensie_array(str, imb_ext_movie)) + sima->image->source= IMA_SRC_MOVIE; + else + sima->image->source= IMA_SRC_FILE; + /* XXX unpackImage frees image buffers */ ED_preview_kill_jobs(C); From da69173269b73209a484fde69c9ddbb6d42a287d Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Thu, 16 Feb 2012 07:45:01 +0000 Subject: [PATCH 08/32] Tomato: fix for missing cache invalidation when disabling/enabling channels for stabilized shot --- source/blender/blenkernel/intern/movieclip.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/source/blender/blenkernel/intern/movieclip.c b/source/blender/blenkernel/intern/movieclip.c index 03fe18e4bd8..c93c03a4424 100644 --- a/source/blender/blenkernel/intern/movieclip.c +++ b/source/blender/blenkernel/intern/movieclip.c @@ -277,6 +277,7 @@ typedef struct MovieClipCache { struct { ImBuf *ibuf; int framenr; + int postprocess_flag; float loc[2], scale, angle; int proxy; @@ -702,7 +703,7 @@ ImBuf *BKE_movieclip_get_postprocessed_ibuf(MovieClip *clip, MovieClipUser *user return movieclip_get_postprocessed_ibuf(clip, user, clip->flag, postprocess_flag, 0); } -static ImBuf *get_stable_cached_frame(MovieClip *clip, MovieClipUser *user, int framenr) +static ImBuf *get_stable_cached_frame(MovieClip *clip, MovieClipUser *user, int framenr, int postprocess_flag) { MovieClipCache *cache = clip->cache; ImBuf *stableibuf; @@ -723,6 +724,9 @@ static ImBuf *get_stable_cached_frame(MovieClip *clip, MovieClipUser *user, int if(cache->stabilized.render_flag!=render_flag || cache->stabilized.proxy!=proxy) return NULL; + if(cache->stabilized.postprocess_flag != postprocess_flag) + return NULL; + stableibuf = cache->stabilized.ibuf; BKE_tracking_stabilization_data(&clip->tracking, framenr, stableibuf->x, stableibuf->y, tloc, &tscale, &tangle); @@ -740,7 +744,8 @@ static ImBuf *get_stable_cached_frame(MovieClip *clip, MovieClipUser *user, int return stableibuf; } -static ImBuf *put_stabilized_frame_to_cache(MovieClip *clip, MovieClipUser *user, ImBuf *ibuf, int framenr) +static ImBuf *put_stabilized_frame_to_cache(MovieClip *clip, MovieClipUser *user, ImBuf *ibuf, + int framenr, int postprocess_flag) { MovieClipCache *cache = clip->cache; ImBuf *stableibuf; @@ -768,6 +773,8 @@ static ImBuf *put_stabilized_frame_to_cache(MovieClip *clip, MovieClipUser *user cache->stabilized.render_flag = 0; } + cache->stabilized.postprocess_flag = postprocess_flag; + IMB_refImBuf(stableibuf); return stableibuf; @@ -786,10 +793,10 @@ ImBuf *BKE_movieclip_get_stable_ibuf(MovieClip *clip, MovieClipUser *user, float if(clip->tracking.stabilization.flag&TRACKING_2D_STABILIZATION) { MovieClipCache *cache= clip->cache; - stableibuf= get_stable_cached_frame(clip, user, framenr); + stableibuf= get_stable_cached_frame(clip, user, framenr, postprocess_flag); if(!stableibuf) - stableibuf= put_stabilized_frame_to_cache(clip, user, ibuf, framenr); + stableibuf= put_stabilized_frame_to_cache(clip, user, ibuf, framenr, postprocess_flag); if(loc) copy_v2_v2(loc, cache->stabilized.loc); if(scale) *scale= cache->stabilized.scale; From f047d90a0e10068e1a44ea59300288218093e79c Mon Sep 17 00:00:00 2001 From: Jens Verwiebe Date: Thu, 16 Feb 2012 08:48:28 +0000 Subject: [PATCH 09/32] ffmpeg: only suppress loopfilter for .mov ( compatibility ), but keep for .avi (quality ) --- source/blender/blenkernel/intern/writeffmpeg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/blenkernel/intern/writeffmpeg.c b/source/blender/blenkernel/intern/writeffmpeg.c index c4c3eb4a8b2..9413b96a103 100644 --- a/source/blender/blenkernel/intern/writeffmpeg.c +++ b/source/blender/blenkernel/intern/writeffmpeg.c @@ -1244,7 +1244,7 @@ static void ffmpeg_set_expert_options(RenderData *rd) * The other options were taken from the libx264-default.preset * included in the ffmpeg distribution. */ -// ffmpeg_property_add_string(rd, "video", "flags:loop"); // this breakes compatibility for QT + if(!FFMPEG_MOV) ffmpeg_property_add_string(rd, "video", "flags:loop"); // this preserves compatibility for QT ffmpeg_property_add_string(rd, "video", "cmp:chroma"); ffmpeg_property_add_string(rd, "video", "partitions:parti4x4"); ffmpeg_property_add_string(rd, "video", "partitions:partp8x8"); From 42e50719df8827135b95ae9226d0f84766eb6d45 Mon Sep 17 00:00:00 2001 From: Jens Verwiebe Date: Thu, 16 Feb 2012 11:52:02 +0000 Subject: [PATCH 10/32] ffmpeg: take back 44142, conditional was wrong --- source/blender/blenkernel/intern/writeffmpeg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/blenkernel/intern/writeffmpeg.c b/source/blender/blenkernel/intern/writeffmpeg.c index 9413b96a103..e9f7823dfe8 100644 --- a/source/blender/blenkernel/intern/writeffmpeg.c +++ b/source/blender/blenkernel/intern/writeffmpeg.c @@ -1244,7 +1244,7 @@ static void ffmpeg_set_expert_options(RenderData *rd) * The other options were taken from the libx264-default.preset * included in the ffmpeg distribution. */ - if(!FFMPEG_MOV) ffmpeg_property_add_string(rd, "video", "flags:loop"); // this preserves compatibility for QT +// ffmpeg_property_add_string(rd, "video", "flags:loop"); // this breaks compatibility for QT ffmpeg_property_add_string(rd, "video", "cmp:chroma"); ffmpeg_property_add_string(rd, "video", "partitions:parti4x4"); ffmpeg_property_add_string(rd, "video", "partitions:partp8x8"); From fedb95da234ea30adab246606533caa6a5e38e4f Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Thu, 16 Feb 2012 13:14:28 +0000 Subject: [PATCH 11/32] Tomato: fixed incorrect auto-scale calculation for 2d stabilization --- source/blender/blenkernel/intern/tracking.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/blender/blenkernel/intern/tracking.c b/source/blender/blenkernel/intern/tracking.c index 695ea1dc07a..f089aae578b 100644 --- a/source/blender/blenkernel/intern/tracking.c +++ b/source/blender/blenkernel/intern/tracking.c @@ -2445,8 +2445,8 @@ static void calculate_stabdata(MovieTracking *tracking, int framenr, float width *scale= (stab->scale-1.0f)*stab->scaleinf+1.0f; *angle= 0.0f; - loc[0]= (firstmedian[0]-median[0])*width*(*scale); - loc[1]= (firstmedian[1]-median[1])*height*(*scale); + loc[0]= (firstmedian[0]-median[0])*width; + loc[1]= (firstmedian[1]-median[1])*height; mul_v2_fl(loc, stab->locinf); @@ -2725,7 +2725,7 @@ void BKE_tracking_stabdata_to_mat4(int width, int height, float loc[2], float sc invert_m4_m4(icmat, cmat); size_to_mat4(smat, svec); /* scale matrix */ - add_v2_v2(lmat[3], loc); /* tranlation matrix */ + add_v2_v2(lmat[3], loc); /* translation matrix */ rotate_m4(rmat, 'Z', angle); /* rotation matrix */ /* compose transformation matrix */ From 7274bea74de095e4eb4d7a2bf410f22e1c81654b Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Thu, 16 Feb 2012 13:14:49 +0000 Subject: [PATCH 12/32] Tomato: fixed default value for pixel aspect. --- source/blender/makesrna/intern/rna_tracking.c | 1 + 1 file changed, 1 insertion(+) diff --git a/source/blender/makesrna/intern/rna_tracking.c b/source/blender/makesrna/intern/rna_tracking.c index ba4e5199f73..2d6a568c79d 100644 --- a/source/blender/makesrna/intern/rna_tracking.c +++ b/source/blender/makesrna/intern/rna_tracking.c @@ -775,6 +775,7 @@ static void rna_def_trackingCamera(BlenderRNA *brna) RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_range(prop, 0.1f, 5000.0f); RNA_def_property_ui_range(prop, 0.1f, 5000.0f, 1, 2); + RNA_def_property_float_default(prop, 1.0f); RNA_def_property_ui_text(prop, "Pixel Aspect Ratio", "Pixel aspect ratio"); RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, "rna_tracking_flushUpdate"); } From aa747f588936899bf56fa7142a936eafcd7d822d Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Thu, 16 Feb 2012 13:15:01 +0000 Subject: [PATCH 13/32] Tomato: fixed issue when track used for rotation stabilization points to a freed memory after re-tracking this track. --- source/blender/blenkernel/intern/tracking.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/source/blender/blenkernel/intern/tracking.c b/source/blender/blenkernel/intern/tracking.c index f089aae578b..c9e6ecf6394 100644 --- a/source/blender/blenkernel/intern/tracking.c +++ b/source/blender/blenkernel/intern/tracking.c @@ -726,6 +726,7 @@ static void tracks_map_merge(TracksMap *map, MovieTracking *tracking) { MovieTrackingTrack *track; MovieTrackingTrack *act_track= BKE_tracking_active_track(tracking); + MovieTrackingTrack *rot_track= tracking->stabilization.rot_track; ListBase tracks= {NULL, NULL}, new_tracks= {NULL, NULL}; ListBase *old_tracks; int a; @@ -747,7 +748,7 @@ static void tracks_map_merge(TracksMap *map, MovieTracking *tracking) this is needed to keep names in unique state and it's faster to change names of currently operating tracks (if needed) */ for(a= 0; anum_tracks; a++) { - int replace_sel= 0; + int replace_sel= 0, replace_rot= 0; MovieTrackingTrack *new_track, *old; track= &map->tracks[a]; @@ -766,8 +767,10 @@ static void tracks_map_merge(TracksMap *map, MovieTracking *tracking) /* original track was found, re-use flags and remove this track */ if(cur) { - if(act_track) + if(cur==act_track) replace_sel= 1; + if(cur==rot_track) + replace_rot= 1; track->flag= cur->flag; track->pat_flag= cur->pat_flag; @@ -786,6 +789,9 @@ static void tracks_map_merge(TracksMap *map, MovieTracking *tracking) if(replace_sel) /* update current selection in clip */ tracking->act_track= new_track; + if(replace_rot) /* update track used for rotation stabilization */ + tracking->stabilization.rot_track= new_track; + BLI_addtail(&tracks, new_track); } From 14a92fc3a24735900693617cb1b89bf9918893df Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Thu, 16 Feb 2012 15:03:18 +0000 Subject: [PATCH 14/32] Tomato: run aspect correction before stabilizing shot. --- source/blender/blenkernel/BKE_tracking.h | 2 +- source/blender/blenkernel/intern/movieclip.c | 7 ++++++- source/blender/blenkernel/intern/tracking.c | 17 ++++++++++++----- source/blender/editors/space_clip/clip_draw.c | 3 ++- 4 files changed, 21 insertions(+), 8 deletions(-) diff --git a/source/blender/blenkernel/BKE_tracking.h b/source/blender/blenkernel/BKE_tracking.h index f720050f59c..ebbba7de7c7 100644 --- a/source/blender/blenkernel/BKE_tracking.h +++ b/source/blender/blenkernel/BKE_tracking.h @@ -138,7 +138,7 @@ void BKE_tracking_detect_fast(struct MovieTracking *tracking, struct ListBase *t /* 2D stabilization */ void BKE_tracking_stabilization_data(struct MovieTracking *tracking, int framenr, int width, int height, float loc[2], float *scale, float *angle); struct ImBuf *BKE_tracking_stabilize(struct MovieTracking *tracking, int framenr, struct ImBuf *ibuf, float loc[2], float *scale, float *angle); -void BKE_tracking_stabdata_to_mat4(int width, int height, float loc[2], float scale, float angle, float mat[4][4]); +void BKE_tracking_stabdata_to_mat4(int width, int height, float aspect, float loc[2], float scale, float angle, float mat[4][4]); /* Distortion/Undistortion */ void BKE_tracking_apply_intrinsics(struct MovieTracking *tracking, float co[2], float nco[2]); diff --git a/source/blender/blenkernel/intern/movieclip.c b/source/blender/blenkernel/intern/movieclip.c index c93c03a4424..ce0d169557d 100644 --- a/source/blender/blenkernel/intern/movieclip.c +++ b/source/blender/blenkernel/intern/movieclip.c @@ -279,7 +279,7 @@ typedef struct MovieClipCache { int framenr; int postprocess_flag; - float loc[2], scale, angle; + float loc[2], scale, angle, aspect; int proxy; short render_flag; } stabilized; @@ -727,6 +727,10 @@ static ImBuf *get_stable_cached_frame(MovieClip *clip, MovieClipUser *user, int if(cache->stabilized.postprocess_flag != postprocess_flag) return NULL; + /* stabilization also depends on pixel aspect ratio */ + if(cache->stabilized.aspect != clip->tracking.camera.pixel_aspect) + return NULL; + stableibuf = cache->stabilized.ibuf; BKE_tracking_stabilization_data(&clip->tracking, framenr, stableibuf->x, stableibuf->y, tloc, &tscale, &tangle); @@ -763,6 +767,7 @@ static ImBuf *put_stabilized_frame_to_cache(MovieClip *clip, MovieClipUser *user cache->stabilized.scale = tscale; cache->stabilized.angle = tangle; cache->stabilized.framenr = framenr; + cache->stabilized.aspect = clip->tracking.camera.pixel_aspect; if(clip->flag&MCLIP_USE_PROXY) { cache->stabilized.proxy= rendersize_to_proxy(user, clip->flag); diff --git a/source/blender/blenkernel/intern/tracking.c b/source/blender/blenkernel/intern/tracking.c index c9e6ecf6394..04766910df6 100644 --- a/source/blender/blenkernel/intern/tracking.c +++ b/source/blender/blenkernel/intern/tracking.c @@ -2485,6 +2485,7 @@ static float stabilization_auto_scale_factor(MovieTracking *tracking, int width, { float firstmedian[2]; MovieTrackingStabilization *stab= &tracking->stabilization; + float aspect= tracking->camera.pixel_aspect; if(stab->ok) return stab->scale; @@ -2535,7 +2536,7 @@ static float stabilization_auto_scale_factor(MovieTracking *tracking, int width, float mat[4][4]; float points[4][2]={{0.0f, 0.0f}, {0.0f, height}, {width, height}, {width, 0.0f}}; - BKE_tracking_stabdata_to_mat4(width, height, loc, scale, angle, mat); + BKE_tracking_stabdata_to_mat4(width, height, aspect, loc, scale, angle, mat); for(i= 0; i<4; i++) { int j; @@ -2650,6 +2651,7 @@ ImBuf *BKE_tracking_stabilize(MovieTracking *tracking, int framenr, ImBuf *ibuf, MovieTrackingStabilization *stab= &tracking->stabilization; ImBuf *tmpibuf; float width= ibuf->x, height= ibuf->y; + float aspect= tracking->camera.pixel_aspect; if(loc) copy_v2_v2(tloc, loc); if(scale) tscale= *scale; @@ -2688,7 +2690,7 @@ ImBuf *BKE_tracking_stabilize(MovieTracking *tracking, int framenr, ImBuf *ibuf, float mat[4][4]; int i, j; - BKE_tracking_stabdata_to_mat4(ibuf->x, ibuf->y, tloc, tscale, tangle, mat); + BKE_tracking_stabdata_to_mat4(ibuf->x, ibuf->y, aspect, tloc, tscale, tangle, mat); invert_m4(mat); for(j=0; jy; j++) { @@ -2715,15 +2717,20 @@ ImBuf *BKE_tracking_stabilize(MovieTracking *tracking, int framenr, ImBuf *ibuf, return tmpibuf; } -void BKE_tracking_stabdata_to_mat4(int width, int height, float loc[2], float scale, float angle, float mat[4][4]) +void BKE_tracking_stabdata_to_mat4(int width, int height, float aspect, float loc[2], float scale, float angle, float mat[4][4]) { - float lmat[4][4], rmat[4][4], smat[4][4], cmat[4][4], icmat[4][4]; + float lmat[4][4], rmat[4][4], smat[4][4], cmat[4][4], icmat[4][4], amat[4][4], iamat[4][4]; float svec[3]= {scale, scale, scale}; unit_m4(rmat); unit_m4(lmat); unit_m4(smat); unit_m4(cmat); + unit_m4(amat); + + /* aspect ratio correction matrix */ + amat[0][0] = 1.0f / aspect; + invert_m4_m4(iamat, amat); /* image center as rotation center */ cmat[3][0]= (float)width/2.0f; @@ -2735,7 +2742,7 @@ void BKE_tracking_stabdata_to_mat4(int width, int height, float loc[2], float sc rotate_m4(rmat, 'Z', angle); /* rotation matrix */ /* compose transformation matrix */ - mul_serie_m4(mat, lmat, cmat, rmat, smat, icmat, NULL, NULL, NULL); + mul_serie_m4(mat, amat, lmat, cmat, rmat, smat, icmat, iamat, NULL); } MovieDistortion *BKE_tracking_distortion_create(void) diff --git a/source/blender/editors/space_clip/clip_draw.c b/source/blender/editors/space_clip/clip_draw.c index 43068c38116..d010ca879fb 100644 --- a/source/blender/editors/space_clip/clip_draw.c +++ b/source/blender/editors/space_clip/clip_draw.c @@ -1289,13 +1289,14 @@ void clip_draw_main(SpaceClip *sc, ARegion *ar, Scene *scene) if(ibuf) { float loc[2]; + float aspect= clip->tracking.camera.pixel_aspect; if(width != ibuf->x) mul_v2_v2fl(loc, sc->loc, (float)width / ibuf->x); else copy_v2_v2(loc, sc->loc); - BKE_tracking_stabdata_to_mat4(width, height, loc, sc->scale, sc->angle, sc->stabmat); + BKE_tracking_stabdata_to_mat4(width, height, aspect, loc, sc->scale, sc->angle, sc->stabmat); unit_m4(smat); smat[0][0]= 1.0f/width; From 62d09c9103f07c86c484d2a044a8884c337a92a3 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Thu, 16 Feb 2012 15:03:37 +0000 Subject: [PATCH 15/32] Tomato: configurable filter type for 2d stabilization --- release/scripts/startup/bl_ui/space_clip.py | 2 ++ source/blender/blenkernel/intern/movieclip.c | 12 +++++++++--- source/blender/blenkernel/intern/tracking.c | 13 ++++++++++--- source/blender/makesdna/DNA_tracking_types.h | 9 ++++++++- source/blender/makesrna/intern/rna_tracking.c | 13 +++++++++++++ 5 files changed, 42 insertions(+), 7 deletions(-) diff --git a/release/scripts/startup/bl_ui/space_clip.py b/release/scripts/startup/bl_ui/space_clip.py index bb5c60fb1bf..d9116165a0f 100644 --- a/release/scripts/startup/bl_ui/space_clip.py +++ b/release/scripts/startup/bl_ui/space_clip.py @@ -686,6 +686,8 @@ class CLIP_PT_stabilization(Panel): row.active = stab.rotation_track is not None row.prop(stab, "influence_rotation") + layout.prop(stab, "filter_type") + class CLIP_PT_marker(Panel): bl_space_type = 'CLIP_EDITOR' diff --git a/source/blender/blenkernel/intern/movieclip.c b/source/blender/blenkernel/intern/movieclip.c index ce0d169557d..69b32ce46f8 100644 --- a/source/blender/blenkernel/intern/movieclip.c +++ b/source/blender/blenkernel/intern/movieclip.c @@ -280,7 +280,7 @@ typedef struct MovieClipCache { int postprocess_flag; float loc[2], scale, angle, aspect; - int proxy; + int proxy, filter; short render_flag; } stabilized; } MovieClipCache; @@ -706,6 +706,7 @@ ImBuf *BKE_movieclip_get_postprocessed_ibuf(MovieClip *clip, MovieClipUser *user static ImBuf *get_stable_cached_frame(MovieClip *clip, MovieClipUser *user, int framenr, int postprocess_flag) { MovieClipCache *cache = clip->cache; + MovieTracking *tracking = &clip->tracking; ImBuf *stableibuf; float tloc[2], tscale, tangle; short proxy = IMB_PROXY_NONE; @@ -728,7 +729,10 @@ static ImBuf *get_stable_cached_frame(MovieClip *clip, MovieClipUser *user, int return NULL; /* stabilization also depends on pixel aspect ratio */ - if(cache->stabilized.aspect != clip->tracking.camera.pixel_aspect) + if(cache->stabilized.aspect != tracking->camera.pixel_aspect) + return NULL; + + if(cache->stabilized.filter != tracking->stabilization.filter) return NULL; stableibuf = cache->stabilized.ibuf; @@ -752,6 +756,7 @@ static ImBuf *put_stabilized_frame_to_cache(MovieClip *clip, MovieClipUser *user int framenr, int postprocess_flag) { MovieClipCache *cache = clip->cache; + MovieTracking *tracking = &clip->tracking; ImBuf *stableibuf; float tloc[2], tscale, tangle; @@ -767,7 +772,8 @@ static ImBuf *put_stabilized_frame_to_cache(MovieClip *clip, MovieClipUser *user cache->stabilized.scale = tscale; cache->stabilized.angle = tangle; cache->stabilized.framenr = framenr; - cache->stabilized.aspect = clip->tracking.camera.pixel_aspect; + cache->stabilized.aspect = tracking->camera.pixel_aspect; + cache->stabilized.filter = tracking->stabilization.filter; if(clip->flag&MCLIP_USE_PROXY) { cache->stabilized.proxy= rendersize_to_proxy(user, clip->flag); diff --git a/source/blender/blenkernel/intern/tracking.c b/source/blender/blenkernel/intern/tracking.c index 04766910df6..7461e057df5 100644 --- a/source/blender/blenkernel/intern/tracking.c +++ b/source/blender/blenkernel/intern/tracking.c @@ -2688,19 +2688,26 @@ ImBuf *BKE_tracking_stabilize(MovieTracking *tracking, int framenr, ImBuf *ibuf, IMB_rectcpy(tmpibuf, ibuf, tloc[0]-(tscale-1.0f)*width/2.0f, tloc[1]-(tscale-1.0f)*height/2.0f, 0, 0, ibuf->x, ibuf->y); } else { float mat[4][4]; - int i, j; + int i, j, filter= tracking->stabilization.filter; + void (*interpolation) (struct ImBuf*, struct ImBuf*, float, float, int, int) = NULL; BKE_tracking_stabdata_to_mat4(ibuf->x, ibuf->y, aspect, tloc, tscale, tangle, mat); invert_m4(mat); + if(filter == TRACKING_FILTER_NEAREAST) + interpolation = neareast_interpolation; + else if(filter == TRACKING_FILTER_BILINEAR) + interpolation = bilinear_interpolation; + else if(filter == TRACKING_FILTER_BICUBIC) + interpolation = bicubic_interpolation; + for(j=0; jy; j++) { for(i=0; ix;i++) { float vec[3]= {i, j, 0}; mul_v3_m4v3(vec, mat, vec); - /* TODO: add selector for interpolation method */ - neareast_interpolation(ibuf, tmpibuf, vec[0], vec[1], i, j); + interpolation(ibuf, tmpibuf, vec[0], vec[1], i, j); } } } diff --git a/source/blender/makesdna/DNA_tracking_types.h b/source/blender/makesdna/DNA_tracking_types.h index 1b41131c07d..e81344d7d51 100644 --- a/source/blender/makesdna/DNA_tracking_types.h +++ b/source/blender/makesdna/DNA_tracking_types.h @@ -159,8 +159,10 @@ typedef struct MovieTrackingStabilization { float locinf, scaleinf, rotinf; /* influence on location, scale and rotation */ + int filter; /* filter used for pixel interpolation */ + /* some pre-computing run-time variables */ - int ok, pad; /* are precomputed values and scaled buf relevant? */ + int ok; /* are precomputed values and scaled buf relevant? */ float scale; /* autoscale factor */ struct ImBuf *scaleibuf; /* currently scaled ibuf */ @@ -258,6 +260,11 @@ enum { #define TRACKING_AUTOSCALE (1<<1) #define TRACKING_STABILIZE_ROTATION (1<<2) +/* MovieTrackingStrabilization->filter */ +#define TRACKING_FILTER_NEAREAST 0 +#define TRACKING_FILTER_BILINEAR 1 +#define TRACKING_FILTER_BICUBIC 2 + /* MovieTrackingReconstruction->flag */ #define TRACKING_RECONSTRUCTED (1<<0) diff --git a/source/blender/makesrna/intern/rna_tracking.c b/source/blender/makesrna/intern/rna_tracking.c index 2d6a568c79d..e4ce7304577 100644 --- a/source/blender/makesrna/intern/rna_tracking.c +++ b/source/blender/makesrna/intern/rna_tracking.c @@ -1064,6 +1064,12 @@ static void rna_def_trackingStabilization(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; + static EnumPropertyItem filter_items[] = { + {TRACKING_FILTER_NEAREAST, "NEAREST", 0, "Nearest", ""}, + {TRACKING_FILTER_BILINEAR, "BILINEAR", 0, "Bilinear", ""}, + {TRACKING_FILTER_BICUBIC, "BICUBIC", 0, "Bicubic", ""}, + {0, NULL, 0, NULL, NULL}}; + srna= RNA_def_struct(brna, "MovieTrackingStabilization", NULL); RNA_def_struct_path_func(srna, "rna_trackingStabilization_path"); RNA_def_struct_ui_text(srna, "Movie tracking stabilization data", "Match-moving stabilization data for tracking"); @@ -1137,6 +1143,13 @@ static void rna_def_trackingStabilization(BlenderRNA *brna) RNA_def_property_range(prop, 0.0f, 1.0f); RNA_def_property_ui_text(prop, "Rotation Influence", "Influence of stabilization algorithm on footage rotation"); RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, "rna_tracking_flushUpdate"); + + /* filter */ + prop = RNA_def_property(srna, "filter_type", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "filter"); + RNA_def_property_enum_items(prop, filter_items); + RNA_def_property_ui_text(prop, "Filter", "Method to use to filter stabilization"); + RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, "rna_tracking_flushUpdate"); } static void rna_def_reconstructedCamera(BlenderRNA *brna) From ec7498ce0bbaab14db49d1b45efbd528d443c0fb Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Thu, 16 Feb 2012 15:53:30 +0000 Subject: [PATCH 16/32] Reverting changes in commit r43458. That was intended change to clear PROP_TRANSLATE flag from bl_label property of operators, panels and menus (see rev40570) If this flag leads to another issues it should be fixed in another way. This fixes #30210: International Font Problem --- source/blender/makesrna/intern/rna_ui.c | 10 ++++++++-- source/blender/makesrna/intern/rna_wm.c | 3 +++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/source/blender/makesrna/intern/rna_ui.c b/source/blender/makesrna/intern/rna_ui.c index 8e3178a6298..1bfed372626 100644 --- a/source/blender/makesrna/intern/rna_ui.c +++ b/source/blender/makesrna/intern/rna_ui.c @@ -698,7 +698,10 @@ static void rna_def_panel(BlenderRNA *brna) "name of the class used to define the panel. For example, if the " "class name is \"OBJECT_PT_hello\", and bl_idname is not set by the " "script, then bl_idname = \"OBJECT_PT_hello\""); - + + /* panel's label indeed doesn't need PROP_TRANSLATE flag: translation of label happens in runtime + * when drawing panel and having this flag set will make runtime switching of language much more tricky + * because label will be stored translated */ prop= RNA_def_property(srna, "bl_label", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "type->label"); RNA_def_property_flag(prop, PROP_REGISTER); @@ -823,7 +826,10 @@ static void rna_def_menu(BlenderRNA *brna) "class name is \"OBJECT_MT_hello\", and bl_idname is not set by the " "script, then bl_idname = \"OBJECT_MT_hello\")"); - prop= RNA_def_property(srna, "bl_label", PROP_STRING, PROP_TRANSLATE); + /* menu's label indeed doesn't need PROP_TRANSLATE flag: translation of label happens in runtime + * when drawing panel and having this flag set will make runtime switching of language much more tricky + * because label will be stored translated */ + prop= RNA_def_property(srna, "bl_label", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "type->label"); RNA_def_property_flag(prop, PROP_REGISTER); RNA_def_property_ui_text(prop, "Label", "The menu label"); diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c index 4f8f301dcbd..41941334e4c 100644 --- a/source/blender/makesrna/intern/rna_wm.c +++ b/source/blender/makesrna/intern/rna_wm.c @@ -1245,6 +1245,9 @@ static void rna_def_operator(BlenderRNA *brna) RNA_def_property_flag(prop, PROP_REGISTER|PROP_NEVER_CLAMP); RNA_def_struct_name_property(srna, prop); + /* operator's label indeed doesn't need PROP_TRANSLATE flag: translation of label happens in runtime + * when drawing panel and having this flag set will make runtime switching of language much more tricky + * because label will be stored translated */ prop= RNA_def_property(srna, "bl_label", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "type->name"); RNA_def_property_string_maxlength(prop, RNA_DYN_DESCR_MAX); /* else it uses the pointer size! */ From 251822126c5217e238a84818d10cde1da227c5ca Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Thu, 16 Feb 2012 15:53:44 +0000 Subject: [PATCH 17/32] Clear PROP_TRANSLATE flag for Macro Operator's bl_label as well. --- source/blender/makesrna/intern/rna_wm.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c index 41941334e4c..7e71d138513 100644 --- a/source/blender/makesrna/intern/rna_wm.c +++ b/source/blender/makesrna/intern/rna_wm.c @@ -1309,7 +1309,10 @@ static void rna_def_macro_operator(BlenderRNA *brna) RNA_def_property_flag(prop, PROP_REGISTER|PROP_NEVER_CLAMP); RNA_def_struct_name_property(srna, prop); - prop= RNA_def_property(srna, "bl_label", PROP_STRING, PROP_TRANSLATE); + /* menu's label indeed doesn't need PROP_TRANSLATE flag: translation of label happens in runtime + * when drawing panel and having this flag set will make runtime switching of language much more tricky + * because label will be stored translated */ + prop= RNA_def_property(srna, "bl_label", PROP_STRING, PROP_PROP); RNA_def_property_string_sdna(prop, NULL, "type->name"); RNA_def_property_string_maxlength(prop, RNA_DYN_DESCR_MAX); /* else it uses the pointer size! */ RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Operator_bl_label_set"); From eb44d1d0e85eaf8914694c53bedc177e096e55dc Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Thu, 16 Feb 2012 15:55:23 +0000 Subject: [PATCH 18/32] Typo in previous own commit. --- source/blender/makesrna/intern/rna_wm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c index 7e71d138513..07c8552008a 100644 --- a/source/blender/makesrna/intern/rna_wm.c +++ b/source/blender/makesrna/intern/rna_wm.c @@ -1312,7 +1312,7 @@ static void rna_def_macro_operator(BlenderRNA *brna) /* menu's label indeed doesn't need PROP_TRANSLATE flag: translation of label happens in runtime * when drawing panel and having this flag set will make runtime switching of language much more tricky * because label will be stored translated */ - prop= RNA_def_property(srna, "bl_label", PROP_STRING, PROP_PROP); + prop= RNA_def_property(srna, "bl_label", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "type->name"); RNA_def_property_string_maxlength(prop, RNA_DYN_DESCR_MAX); /* else it uses the pointer size! */ RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Operator_bl_label_set"); From c8fe53871cedf854bebba0a3baa8cdd5b7bff843 Mon Sep 17 00:00:00 2001 From: Nicholas Bishop Date: Thu, 16 Feb 2012 16:33:50 +0000 Subject: [PATCH 19/32] Bugfix: update the sculpt menu to use the correct path to the unified paint settings. --- release/scripts/startup/bl_ui/space_view3d.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py index 93cec3326db..c5cf5bd1df3 100644 --- a/release/scripts/startup/bl_ui/space_view3d.py +++ b/release/scripts/startup/bl_ui/space_view3d.py @@ -1152,8 +1152,9 @@ class VIEW3D_MT_sculpt(Menu): layout.prop(sculpt, "show_brush") # TODO, make available from paint menu! - layout.prop(toolsettings, "sculpt_paint_use_unified_size", text="Unify Size") - layout.prop(toolsettings, "sculpt_paint_use_unified_strength", text="Unify Strength") + ups = context.tool_settings.unified_paint_settings + layout.prop(ups, "use_unified_size") + layout.prop(ups, "use_unified_strength") # ********** Particle menu ********** From cbe14f3400d77fa75e8383789e9d4254f74c24bc Mon Sep 17 00:00:00 2001 From: Nicholas Bishop Date: Thu, 16 Feb 2012 16:38:05 +0000 Subject: [PATCH 20/32] Sculpt UI: add missing sculpt options to menu --- release/scripts/startup/bl_ui/space_view3d.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py index c5cf5bd1df3..05d6ca7b337 100644 --- a/release/scripts/startup/bl_ui/space_view3d.py +++ b/release/scripts/startup/bl_ui/space_view3d.py @@ -1149,10 +1149,13 @@ class VIEW3D_MT_sculpt(Menu): layout.separator() layout.prop(sculpt, "use_threaded", text="Threaded Sculpt") + layout.prop(sculpt, "show_low_resolution") layout.prop(sculpt, "show_brush") + layout.prop(sculpt, "use_deform_only") # TODO, make available from paint menu! ups = context.tool_settings.unified_paint_settings + layout.separator() layout.prop(ups, "use_unified_size") layout.prop(ups, "use_unified_strength") From 7cbd4d3576da49bbee71afac4214730bf164d848 Mon Sep 17 00:00:00 2001 From: Nicholas Bishop Date: Thu, 16 Feb 2012 18:06:38 +0000 Subject: [PATCH 21/32] Sculpt/Paint UI: Add a new menu for brush options. For vertex/weight/texture paint, this has only the flags for using unified size/strength. (Addresses TODO in code, before only sculpt menu had these settings.) For sculpt, moved the brush-related settings from the sculpt menu to the brush menu. Note that these menus are still very out of date (missing lots of options), will address that in a different commit. --- release/scripts/startup/bl_ui/space_view3d.py | 64 ++++++++++++------- 1 file changed, 42 insertions(+), 22 deletions(-) diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py index 05d6ca7b337..4627a4ed6a2 100644 --- a/release/scripts/startup/bl_ui/space_view3d.py +++ b/release/scripts/startup/bl_ui/space_view3d.py @@ -19,6 +19,7 @@ # import bpy from bpy.types import Header, Menu, Panel +from .properties_paint_common import UnifiedPaintPanel class VIEW3D_HT_header(Header): @@ -51,6 +52,8 @@ class VIEW3D_HT_header(Header): elif obj: if mode_string not in {'PAINT_TEXTURE'}: sub.menu("VIEW3D_MT_%s" % mode_string.lower()) + if mode_string in {'SCULPT', 'PAINT_VERTEX', 'PAINT_WEIGHT', 'PAINT_TEXTURE'}: + sub.menu("VIEW3D_MT_brush") else: sub.menu("VIEW3D_MT_object") @@ -1013,6 +1016,45 @@ class VIEW3D_MT_object_game(Menu): layout.operator("object.game_property_clear") + +# ********** Brush menu ********** +class VIEW3D_MT_brush(Menu): + bl_label = "Brush" + + def draw(self, context): + layout = self.layout + + settings = UnifiedPaintPanel.paint_settings(context) + brush = settings.brush + + ups = context.tool_settings.unified_paint_settings + layout.prop(ups, "use_unified_size", text="Unified Size") + layout.prop(ups, "use_unified_strength", text="Unified Strength") + + # skip if no active brush + if not brush: + return + + # TODO: still missing a lot of brush options here + + # sculpt options + if context.sculpt_object: + + sculpt_tool = brush.sculpt_tool + + layout.separator() + layout.operator_menu_enum("brush.curve_preset", "shape", text='Curve Preset') + layout.separator() + + if sculpt_tool != 'GRAB': + layout.prop_menu_enum(brush, "stroke_method") + + if sculpt_tool in {'DRAW', 'PINCH', 'INFLATE', 'LAYER', 'CLAY'}: + layout.prop_menu_enum(brush, "direction") + + if sculpt_tool == 'LAYER': + layout.prop(brush, "use_persistent") + layout.operator("sculpt.set_persistent_base") # ********** Vertex paint menu ********** @@ -1116,7 +1158,6 @@ class VIEW3D_MT_sculpt(Menu): toolsettings = context.tool_settings sculpt = toolsettings.sculpt - brush = toolsettings.sculpt.brush layout.operator("ed.undo") layout.operator("ed.redo") @@ -1130,22 +1171,6 @@ class VIEW3D_MT_sculpt(Menu): layout.prop(sculpt, "lock_x") layout.prop(sculpt, "lock_y") layout.prop(sculpt, "lock_z") - layout.separator() - layout.operator_menu_enum("brush.curve_preset", "shape") - layout.separator() - - if brush is not None: # unlikely but can happen - sculpt_tool = brush.sculpt_tool - - if sculpt_tool != 'GRAB': - layout.prop_menu_enum(brush, "stroke_method") - - if sculpt_tool in {'DRAW', 'PINCH', 'INFLATE', 'LAYER', 'CLAY'}: - layout.prop_menu_enum(brush, "direction") - - if sculpt_tool == 'LAYER': - layout.prop(brush, "use_persistent") - layout.operator("sculpt.set_persistent_base") layout.separator() layout.prop(sculpt, "use_threaded", text="Threaded Sculpt") @@ -1153,11 +1178,6 @@ class VIEW3D_MT_sculpt(Menu): layout.prop(sculpt, "show_brush") layout.prop(sculpt, "use_deform_only") - # TODO, make available from paint menu! - ups = context.tool_settings.unified_paint_settings - layout.separator() - layout.prop(ups, "use_unified_size") - layout.prop(ups, "use_unified_strength") # ********** Particle menu ********** From a56eeb70247e55ac15239c70b8ade4c3567b798f Mon Sep 17 00:00:00 2001 From: Thomas Dinges Date: Thu, 16 Feb 2012 20:04:33 +0000 Subject: [PATCH 22/32] Release Cycle for 2.63: * BCon1, alpha. --- source/blender/blenkernel/BKE_blender.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/blenkernel/BKE_blender.h b/source/blender/blenkernel/BKE_blender.h index c5a5c134cdf..f735af8b24c 100644 --- a/source/blender/blenkernel/BKE_blender.h +++ b/source/blender/blenkernel/BKE_blender.h @@ -51,7 +51,7 @@ extern "C" { /* can be left blank, otherwise a,b,c... etc with no quotes */ #define BLENDER_VERSION_CHAR /* alpha/beta/rc/release, docs use this */ -#define BLENDER_VERSION_CYCLE release +#define BLENDER_VERSION_CYCLE alpha extern char versionstr[]; /* from blender.c */ From 283ab431a50e89643eb496c934584e29e118b812 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Fri, 17 Feb 2012 06:59:32 +0000 Subject: [PATCH 23/32] Cleanup of 3D viewport header in painting modes: - Hide Manipulate center points in sculpt and particle edit modes - Hide 3D manipulators and orientation from sculpt mode - Hide snap buttons in sculpt, weight, texture, vertex and particle painting modes All this options weren't make sense in this modes and might only confuse user. This will resolve issue #30180: 3D View header buttons and modes --- release/scripts/startup/bl_ui/space_view3d.py | 31 ++++++++++--------- .../editors/space_view3d/view3d_header.c | 30 ++++++++++-------- 2 files changed, 33 insertions(+), 28 deletions(-) diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py index 4627a4ed6a2..f5ce73ff9bd 100644 --- a/release/scripts/startup/bl_ui/space_view3d.py +++ b/release/scripts/startup/bl_ui/space_view3d.py @@ -83,22 +83,23 @@ class VIEW3D_HT_header(Header): row.prop(toolsettings, "proportional_edit_falloff", text="", icon_only=True) # Snap - snap_element = toolsettings.snap_element - row = layout.row(align=True) - row.prop(toolsettings, "use_snap", text="") - row.prop(toolsettings, "snap_element", text="", icon_only=True) - if snap_element != 'INCREMENT': - row.prop(toolsettings, "snap_target", text="") - if obj: - if obj.mode == 'OBJECT': - row.prop(toolsettings, "use_snap_align_rotation", text="") - elif obj.mode == 'EDIT': - row.prop(toolsettings, "use_snap_self", text="") + if obj.mode not in {'SCULPT', 'VERTEX_PAINT', 'WEIGHT_PAINT', 'TEXTURE_PAINT', 'PARTICLE_EDIT'}: + snap_element = toolsettings.snap_element + row = layout.row(align=True) + row.prop(toolsettings, "use_snap", text="") + row.prop(toolsettings, "snap_element", text="", icon_only=True) + if snap_element != 'INCREMENT': + row.prop(toolsettings, "snap_target", text="") + if obj: + if obj.mode == 'OBJECT': + row.prop(toolsettings, "use_snap_align_rotation", text="") + elif obj.mode == 'EDIT': + row.prop(toolsettings, "use_snap_self", text="") - if snap_element == 'VOLUME': - row.prop(toolsettings, "use_snap_peel_object", text="") - elif snap_element == 'FACE': - row.prop(toolsettings, "use_snap_project", text="") + if snap_element == 'VOLUME': + row.prop(toolsettings, "use_snap_peel_object", text="") + elif snap_element == 'FACE': + row.prop(toolsettings, "use_snap_project", text="") # OpenGL render row = layout.row(align=True) diff --git a/source/blender/editors/space_view3d/view3d_header.c b/source/blender/editors/space_view3d/view3d_header.c index e9b339c0baf..8acfd43f3ed 100644 --- a/source/blender/editors/space_view3d/view3d_header.c +++ b/source/blender/editors/space_view3d/view3d_header.c @@ -478,6 +478,7 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C) uiBut *but; uiLayout *row; const float dpi_fac= UI_DPI_FAC; + int is_paint = 0; RNA_pointer_create(&screen->id, &RNA_SpaceView3D, v3d, &v3dptr); RNA_pointer_create(&scene->id, &RNA_ToolSettings, ts, &toolsptr); @@ -492,6 +493,8 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C) /* mode */ if(ob) { v3d->modeselect = ob->mode; + is_paint = ELEM5(ob->mode, OB_MODE_SCULPT, OB_MODE_VERTEX_PAINT, OB_MODE_WEIGHT_PAINT, + OB_MODE_TEXTURE_PAINT, OB_MODE_PARTICLE_EDIT); } else { v3d->modeselect = OB_MODE_OBJECT; @@ -504,20 +507,21 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C) /* Draw type */ uiItemR(layout, &v3dptr, "viewport_shade", UI_ITEM_R_ICON_ONLY, "", ICON_NONE); - if (obedit==NULL && ((ob && ob->mode & (OB_MODE_VERTEX_PAINT|OB_MODE_WEIGHT_PAINT|OB_MODE_TEXTURE_PAINT)))) { - /* Manipulators aren't used in weight paint mode */ - - PointerRNA meshptr; + if (obedit==NULL && is_paint) { + /* Manipulators aren't used in paint modes */ + if (!ELEM(ob->mode, OB_MODE_SCULPT, OB_MODE_PARTICLE_EDIT)) { + /* masks aren't used for sculpt and particle painting */ + PointerRNA meshptr; - RNA_pointer_create(&ob->id, &RNA_Mesh, ob->data, &meshptr); - if(ob->mode & (OB_MODE_TEXTURE_PAINT|OB_MODE_VERTEX_PAINT)) { - uiItemR(layout, &meshptr, "use_paint_mask", UI_ITEM_R_ICON_ONLY, "", ICON_NONE); - } - else { - - row= uiLayoutRow(layout, 1); - uiItemR(row, &meshptr, "use_paint_mask", UI_ITEM_R_ICON_ONLY, "", ICON_NONE); - uiItemR(row, &meshptr, "use_paint_mask_vertex", UI_ITEM_R_ICON_ONLY, "", ICON_NONE); + RNA_pointer_create(&ob->id, &RNA_Mesh, ob->data, &meshptr); + if(ob->mode & (OB_MODE_TEXTURE_PAINT|OB_MODE_VERTEX_PAINT)) { + uiItemR(layout, &meshptr, "use_paint_mask", UI_ITEM_R_ICON_ONLY, "", ICON_NONE); + } + else { + row= uiLayoutRow(layout, 1); + uiItemR(row, &meshptr, "use_paint_mask", UI_ITEM_R_ICON_ONLY, "", ICON_NONE); + uiItemR(row, &meshptr, "use_paint_mask_vertex", UI_ITEM_R_ICON_ONLY, "", ICON_NONE); + } } } else { const char *str_menu; From 5fd24dc3f2f4ad440a7032325fad999b32726c4e Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Fri, 17 Feb 2012 07:32:18 +0000 Subject: [PATCH 24/32] Build proxy from meta and image strips used resolution used for display, not set by building job which leads to unusable proxies. This change should resolve issues reported in #30229: Sequencer Meta strip Proxy Fails and probably #30196 will work nicer too. --- source/blender/blenkernel/intern/sequencer.c | 24 ++++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index 0790896da0d..b2188754503 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -1192,11 +1192,10 @@ static void seq_open_anim_file(Sequence * seq) } -static int seq_proxy_get_fname(SeqRenderData context, Sequence * seq, int cfra, char * name) +static int seq_proxy_get_fname(Sequence * seq, int cfra, int render_size, char * name) { int frameno; char dir[PROXY_MAXFILE]; - int render_size = context.preview_render_size; if (!seq->strip->proxy) { return FALSE; @@ -1226,22 +1225,17 @@ static int seq_proxy_get_fname(SeqRenderData context, Sequence * seq, int cfra, return TRUE; } - /* dirty hack to distinguish 100% render size from PROXY_100 */ - if (render_size == 99) { - render_size = 100; - } - /* generate a separate proxy directory for each preview size */ if (seq->type == SEQ_IMAGE) { BLI_snprintf(name, PROXY_MAXFILE, "%s/images/%d/%s_proxy", dir, - context.preview_render_size, + render_size, give_stripelem(seq, cfra)->name); frameno = 1; } else { frameno = (int) give_stripelem_index(seq, cfra) + seq->anim_startofs; BLI_snprintf(name, PROXY_MAXFILE, "%s/proxy_misc/%d/####", dir, - context.preview_render_size); + render_size); } BLI_path_abs(name, G.main->name); @@ -1258,6 +1252,12 @@ static struct ImBuf * seq_proxy_fetch(SeqRenderData context, Sequence * seq, int IMB_Proxy_Size psize = seq_rendersize_to_proxysize( context.preview_render_size); int size_flags; + int render_size = context.preview_render_size; + + /* dirty hack to distinguish 100% render size from PROXY_100 */ + if (render_size == 99) { + render_size = 100; + } if (!(seq->flag & SEQ_USE_PROXY)) { return NULL; @@ -1273,7 +1273,7 @@ static struct ImBuf * seq_proxy_fetch(SeqRenderData context, Sequence * seq, int if (seq->flag & SEQ_USE_PROXY_CUSTOM_FILE) { int frameno = (int) give_stripelem_index(seq, cfra) + seq->anim_startofs; if (seq->strip->proxy->anim == NULL) { - if (seq_proxy_get_fname(context, seq, cfra, name)==0) { + if (seq_proxy_get_fname(seq, cfra, render_size, name)==0) { return NULL; } @@ -1292,7 +1292,7 @@ static struct ImBuf * seq_proxy_fetch(SeqRenderData context, Sequence * seq, int IMB_TC_NONE, IMB_PROXY_NONE); } - if (seq_proxy_get_fname(context, seq, cfra, name) == 0) { + if (seq_proxy_get_fname(seq, cfra, render_size, name) == 0) { return NULL; } @@ -1313,7 +1313,7 @@ static void seq_proxy_build_frame(SeqRenderData context, int ok; struct ImBuf * ibuf; - if (!seq_proxy_get_fname(context, seq, cfra, name)) { + if (!seq_proxy_get_fname(seq, cfra, proxy_render_size, name)) { return; } From 9d0b7b168fdd69108f095cefed6c3feb0e327ea2 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Fri, 17 Feb 2012 08:13:45 +0000 Subject: [PATCH 25/32] Camera tracking: animation datablock for MovieClip Added AnimData block to MovieClip datablock which allows to animate different properties in clip. Currently supports animation of stabilization influence only. -- svn merge -r44129:44130 ^/branches/soc-2011-tomato --- source/blender/blenkernel/intern/anim_sys.c | 4 ++ source/blender/blenkernel/intern/movieclip.c | 3 + source/blender/blenloader/intern/readfile.c | 5 ++ source/blender/blenloader/intern/writefile.c | 3 + source/blender/makesdna/DNA_movieclip_types.h | 2 + .../blender/makesrna/intern/rna_movieclip.c | 16 ++++++ source/blender/makesrna/intern/rna_tracking.c | 56 +++++++++++++++++++ 7 files changed, 89 insertions(+) diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c index b32421a6b3d..9ae3ad95d5c 100644 --- a/source/blender/blenkernel/intern/anim_sys.c +++ b/source/blender/blenkernel/intern/anim_sys.c @@ -88,6 +88,7 @@ short id_type_can_have_animdata (ID *id) case ID_LA: case ID_CA: case ID_WO: case ID_SPK: case ID_SCE: + case ID_MC: { return 1; } @@ -2335,6 +2336,9 @@ void BKE_animsys_evaluate_all_animation (Main *main, Scene *scene, float ctime) /* speakers */ EVAL_ANIM_IDS(main->speaker.first, ADT_RECALC_ANIM); + /* movie clips */ + EVAL_ANIM_IDS(main->movieclip.first, ADT_RECALC_ANIM); + /* objects */ /* ADT_RECALC_ANIM doesn't need to be supplied here, since object AnimData gets * this tagged by Depsgraph on framechange. This optimisation means that objects diff --git a/source/blender/blenkernel/intern/movieclip.c b/source/blender/blenkernel/intern/movieclip.c index c90faa7e0ca..03fe18e4bd8 100644 --- a/source/blender/blenkernel/intern/movieclip.c +++ b/source/blender/blenkernel/intern/movieclip.c @@ -64,6 +64,7 @@ #include "BLI_mempool.h" #include "BLI_threads.h" +#include "BKE_animsys.h" #include "BKE_constraint.h" #include "BKE_library.h" #include "BKE_global.h" @@ -889,6 +890,8 @@ static void free_buffers(MovieClip *clip) IMB_free_anim(clip->anim); clip->anim= FALSE; } + + BKE_free_animdata((ID *) clip); } void BKE_movieclip_reload(MovieClip *clip) diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index ff737339835..fe80dd7bd90 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -6050,6 +6050,8 @@ static void direct_link_movieclip(FileData *fd, MovieClip *clip) MovieTracking *tracking= &clip->tracking; MovieTrackingObject *object; + clip->adt= newdataadr(fd, clip->adt); + if(fd->movieclipmap) clip->cache= newmclipadr(fd, clip->cache); else clip->cache= NULL; @@ -6087,6 +6089,9 @@ static void lib_link_movieclip(FileData *fd, Main *main) clip= main->movieclip.first; while(clip) { if(clip->id.flag & LIB_NEEDLINK) { + if (clip->adt) + lib_link_animdata(fd, &clip->id, clip->adt); + clip->gpd= newlibadr_us(fd, clip->id.lib, clip->gpd); clip->id.flag -= LIB_NEEDLINK; diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c index ae4bc936193..e221f261d55 100644 --- a/source/blender/blenloader/intern/writefile.c +++ b/source/blender/blenloader/intern/writefile.c @@ -2564,6 +2564,9 @@ static void write_movieclips(WriteData *wd, ListBase *idbase) MovieTrackingObject *object; writestruct(wd, ID_MC, "MovieClip", 1, clip); + if(clip->adt) + write_animdata(wd, clip->adt); + write_movieTracks(wd, &tracking->tracks); write_movieReconstruction(wd, &tracking->reconstruction); diff --git a/source/blender/makesdna/DNA_movieclip_types.h b/source/blender/makesdna/DNA_movieclip_types.h index 80728cd9817..71029293d09 100644 --- a/source/blender/makesdna/DNA_movieclip_types.h +++ b/source/blender/makesdna/DNA_movieclip_types.h @@ -39,6 +39,7 @@ #include "DNA_tracking_types.h" struct anim; +struct AnimData; struct bGPdata; struct ImBuf; struct MovieClipProxy; @@ -61,6 +62,7 @@ typedef struct MovieClipProxy { typedef struct MovieClip { ID id; + struct AnimData *adt; /* animation data (must be immediately after id for utilities to use it) */ char name[1024]; /* file path, 1024 = FILE_MAX */ diff --git a/source/blender/makesrna/intern/rna_movieclip.c b/source/blender/makesrna/intern/rna_movieclip.c index 1d79040c4eb..a640f996b1a 100644 --- a/source/blender/makesrna/intern/rna_movieclip.c +++ b/source/blender/makesrna/intern/rna_movieclip.c @@ -88,57 +88,70 @@ static void rna_def_movieclip_proxy(BlenderRNA *brna) /* build proxy sized */ prop= RNA_def_property(srna, "build_25", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "build_size_flag", MCLIP_PROXY_SIZE_25); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_ui_text(prop, "25%", "Build proxy resolution 25% of the original footage dimension"); prop= RNA_def_property(srna, "build_50", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "build_size_flag", MCLIP_PROXY_SIZE_50); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_ui_text(prop, "50%", "Build proxy resolution 50% of the original footage dimension"); prop= RNA_def_property(srna, "build_75", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "build_size_flag", MCLIP_PROXY_SIZE_75); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_ui_text(prop, "75%", "Build proxy resolution 75% of the original footage dimension"); prop= RNA_def_property(srna, "build_100", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "build_size_flag", MCLIP_PROXY_SIZE_100); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_ui_text(prop, "100%", "Build proxy resolution 100% of the original footage dimension"); prop= RNA_def_property(srna, "build_undistorted_25", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "build_size_flag", MCLIP_PROXY_UNDISTORTED_SIZE_25); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_ui_text(prop, "25%", "Build proxy resolution 25% of the original undistorted footage dimension"); prop= RNA_def_property(srna, "build_undistorted_50", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "build_size_flag", MCLIP_PROXY_UNDISTORTED_SIZE_50); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_ui_text(prop, "50%", "Build proxy resolution 50% of the original undistorted footage dimension"); prop= RNA_def_property(srna, "build_undistorted_75", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "build_size_flag", MCLIP_PROXY_UNDISTORTED_SIZE_75); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_ui_text(prop, "75%", "Build proxy resolution 75% of the original undistorted footage dimension"); prop= RNA_def_property(srna, "build_undistorted_100", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "build_size_flag", MCLIP_PROXY_UNDISTORTED_SIZE_100); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_ui_text(prop, "100%", "Build proxy resolution 100% of the original undistorted footage dimension"); /* build timecodes */ prop= RNA_def_property(srna, "build_record_run", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "build_tc_flag", IMB_TC_RECORD_RUN); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_ui_text(prop, "Rec Run", "Build record run time code index"); prop= RNA_def_property(srna, "build_free_run", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "build_tc_flag", IMB_TC_FREE_RUN); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_ui_text(prop, "Free Run", "Build free run time code index"); prop= RNA_def_property(srna, "build_free_run_rec_date", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "build_tc_flag", IMB_TC_INTERPOLATED_REC_DATE_FREE_RUN); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_ui_text(prop, "Free Run (Rec Date)", "Build free run time code index using Record Date/Time"); /* quality of proxied image */ prop= RNA_def_property(srna, "quality", PROP_INT, PROP_UNSIGNED); RNA_def_property_int_sdna(prop, NULL, "quality"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_ui_text(prop, "Quality", "JPEG quality of proxy images"); RNA_def_property_ui_range(prop, 1, 100, 1, 0); prop= RNA_def_property(srna, "timecode", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "tc"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_enum_items(prop, clip_tc_items); RNA_def_property_ui_text(prop, "Timecode", ""); RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, NULL); @@ -146,6 +159,7 @@ static void rna_def_movieclip_proxy(BlenderRNA *brna) /* directory */ prop= RNA_def_property(srna, "directory", PROP_STRING, PROP_DIRPATH); RNA_def_property_string_sdna(prop, NULL, "dir"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_ui_text(prop, "Directory", "Location to store the proxy files"); RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, "rna_MovieClip_reload_update"); } @@ -223,6 +237,7 @@ static void rna_def_movieclip(BlenderRNA *brna) /* use proxy */ prop= RNA_def_property(srna, "use_proxy", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", MCLIP_USE_PROXY); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_ui_text(prop, "Use Proxy / Timecode", "Use a preview proxy and/or timecode index for this clip"); RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, NULL); @@ -247,6 +262,7 @@ static void rna_def_movieclip(BlenderRNA *brna) /* custom proxy directory */ prop= RNA_def_property(srna, "use_proxy_custom_directory", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", MCLIP_USE_PROXY_CUSTOM_DIR); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_ui_text(prop, "Proxy Custom Directory", "Create proxy images in a custom directory (default is movie location)"); RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, "rna_MovieClip_reload_update"); diff --git a/source/blender/makesrna/intern/rna_tracking.c b/source/blender/makesrna/intern/rna_tracking.c index aff8a85dd26..ba4e5199f73 100644 --- a/source/blender/makesrna/intern/rna_tracking.c +++ b/source/blender/makesrna/intern/rna_tracking.c @@ -54,6 +54,11 @@ #include "WM_api.h" +static char *rna_tracking_path(PointerRNA *UNUSED(ptr)) +{ + return BLI_sprintfN("tracking"); +} + static void rna_tracking_defaultSettings_levelsUpdate(Main *UNUSED(bmain), Scene *scene, PointerRNA *ptr) { MovieClip *clip= (MovieClip*)ptr->id.data; @@ -88,6 +93,13 @@ static void rna_tracking_defaultSettings_searchUpdate(Main *UNUSED(bmain), Scene settings->default_pattern_size= settings->default_search_size; } +static char *rna_trackingTrack_path(PointerRNA *ptr) +{ + MovieTrackingTrack *track = (MovieTrackingTrack *) ptr->data; + + return BLI_sprintfN("tracking.tracks[\"%s\"]", track->name); +} + static void rna_trackingTracks_begin(CollectionPropertyIterator *iter, PointerRNA *ptr) { MovieClip *clip= (MovieClip*)ptr->id.data; @@ -228,6 +240,11 @@ static void rna_tracking_trackerPyramid_update(Main *UNUSED(bmain), Scene *UNUSE BKE_tracking_clamp_track(track, CLAMP_PYRAMID_LEVELS); } +static char *rna_trackingCamera_path(PointerRNA *UNUSED(ptr)) +{ + return BLI_sprintfN("tracking.camera"); +} + static float rna_trackingCamera_focal_mm_get(PointerRNA *ptr) { MovieClip *clip= (MovieClip*)ptr->id.data; @@ -252,6 +269,11 @@ static void rna_trackingCamera_focal_mm_set(PointerRNA *ptr, float value) camera->focal= value; } +static char *rna_trackingStabilization_path(PointerRNA *UNUSED(ptr)) +{ + return BLI_sprintfN("tracking.stabilization"); +} + static int rna_track_2d_stabilization(CollectionPropertyIterator *UNUSED(iter), void *data) { MovieTrackingTrack *track= (MovieTrackingTrack*)data; @@ -681,11 +703,13 @@ static void rna_def_trackingCamera(BlenderRNA *brna) {0, NULL, 0, NULL, NULL}}; srna= RNA_def_struct(brna, "MovieTrackingCamera", NULL); + RNA_def_struct_path_func(srna, "rna_trackingCamera_path"); RNA_def_struct_ui_text(srna, "Movie tracking camera data", "Match-moving camera data for tracking"); /* Sensor */ prop= RNA_def_property(srna, "sensor_width", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "sensor_width"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_range(prop, 0.0f, 500.0f); RNA_def_property_ui_text(prop, "Sensor", "Width of CCD sensor in millimeters"); RNA_def_property_update(prop, NC_MOVIECLIP|NA_EDITED, NULL); @@ -693,6 +717,7 @@ static void rna_def_trackingCamera(BlenderRNA *brna) /* Focal Length */ prop= RNA_def_property(srna, "focal_length", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "focal"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_range(prop, 0.0001f, 5000.0f); RNA_def_property_float_funcs(prop, "rna_trackingCamera_focal_mm_get", "rna_trackingCamera_focal_mm_set", NULL); RNA_def_property_ui_text(prop, "Focal Length", "Camera's focal length"); @@ -701,6 +726,7 @@ static void rna_def_trackingCamera(BlenderRNA *brna) /* Focal Length in pixels */ prop= RNA_def_property(srna, "focal_length_pixels", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "focal"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_range(prop, 0.0f, 5000.0f); RNA_def_property_ui_text(prop, "Focal Length", "Camera's focal length"); RNA_def_property_update(prop, NC_MOVIECLIP|NA_EDITED, NULL); @@ -709,6 +735,7 @@ static void rna_def_trackingCamera(BlenderRNA *brna) prop= RNA_def_property(srna, "units", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "units"); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_enum_items(prop, camera_units_items); RNA_def_property_ui_text(prop, "Units", "Units used for camera focal length"); @@ -716,24 +743,28 @@ static void rna_def_trackingCamera(BlenderRNA *brna) prop= RNA_def_property(srna, "principal", PROP_FLOAT, PROP_NONE); RNA_def_property_array(prop, 2); RNA_def_property_float_sdna(prop, NULL, "principal"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_ui_text(prop, "Principal Point", "Optical center of lens"); RNA_def_property_update(prop, NC_MOVIECLIP|NA_EDITED, NULL); /* Radial distortion parameters */ prop= RNA_def_property(srna, "k1", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "k1"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_ui_range(prop, -10, 10, .1, 3); RNA_def_property_ui_text(prop, "K1", "First coefficient of third order polynomial radial distortion"); RNA_def_property_update(prop, NC_MOVIECLIP|NA_EDITED, "rna_tracking_flushUpdate"); prop= RNA_def_property(srna, "k2", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "k2"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_ui_range(prop, -10, 10, .1, 3); RNA_def_property_ui_text(prop, "K2", "Second coefficient of third order polynomial radial distortion"); RNA_def_property_update(prop, NC_MOVIECLIP|NA_EDITED, "rna_tracking_flushUpdate"); prop= RNA_def_property(srna, "k3", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "k3"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_ui_range(prop, -10, 10, .1, 3); RNA_def_property_ui_text(prop, "K3", "Third coefficient of third order polynomial radial distortion"); RNA_def_property_update(prop, NC_MOVIECLIP|NA_EDITED, "rna_tracking_flushUpdate"); @@ -741,6 +772,7 @@ static void rna_def_trackingCamera(BlenderRNA *brna) /* pixel aspect */ prop= RNA_def_property(srna, "pixel_aspect", PROP_FLOAT, PROP_XYZ); RNA_def_property_float_sdna(prop, NULL, "pixel_aspect"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_range(prop, 0.1f, 5000.0f); RNA_def_property_ui_range(prop, 0.1f, 5000.0f, 1, 2); RNA_def_property_ui_text(prop, "Pixel Aspect Ratio", "Pixel aspect ratio"); @@ -822,6 +854,7 @@ static void rna_def_trackingTrack(BlenderRNA *brna) rna_def_trackingMarker(brna); srna= RNA_def_struct(brna, "MovieTrackingTrack", NULL); + RNA_def_struct_path_func(srna, "rna_trackingTrack_path"); RNA_def_struct_ui_text(srna, "Movie tracking track data", "Match-moving track data for tracking"); RNA_def_struct_ui_icon(srna, ICON_ANIM_DATA); @@ -838,6 +871,7 @@ static void rna_def_trackingTrack(BlenderRNA *brna) RNA_def_property_array(prop, 2); RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, 5); RNA_def_property_float_sdna(prop, NULL, "pat_min"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_ui_text(prop, "Pattern Min", "Left-bottom corner of pattern area in normalized coordinates relative to marker position"); RNA_def_property_update(prop, NC_MOVIECLIP|NA_EDITED, "rna_tracking_trackerPattern_update"); @@ -845,6 +879,7 @@ static void rna_def_trackingTrack(BlenderRNA *brna) RNA_def_property_array(prop, 2); RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, 5); RNA_def_property_float_sdna(prop, NULL, "pat_max"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_ui_text(prop, "Pattern Max", "Right-bottom corner of pattern area in normalized coordinates relative to marker position"); RNA_def_property_update(prop, NC_MOVIECLIP|NA_EDITED, "rna_tracking_trackerPattern_update"); @@ -853,6 +888,7 @@ static void rna_def_trackingTrack(BlenderRNA *brna) RNA_def_property_array(prop, 2); RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, 5); RNA_def_property_float_sdna(prop, NULL, "search_min"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_ui_text(prop, "Search Min", "Left-bottom corner of search area in normalized coordinates relative to marker position"); RNA_def_property_update(prop, NC_MOVIECLIP|NA_EDITED, "rna_tracking_trackerSearch_update"); @@ -860,6 +896,7 @@ static void rna_def_trackingTrack(BlenderRNA *brna) RNA_def_property_array(prop, 2); RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, 5); RNA_def_property_float_sdna(prop, NULL, "search_max"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_ui_text(prop, "Search Max", "Right-bottom corner of search area in normalized coordinates relative to marker position"); RNA_def_property_update(prop, NC_MOVIECLIP|NA_EDITED, "rna_tracking_trackerSearch_update"); @@ -867,6 +904,7 @@ static void rna_def_trackingTrack(BlenderRNA *brna) prop= RNA_def_property(srna, "frames_limit", PROP_INT, PROP_NONE); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_int_sdna(prop, NULL, "frames_limit"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_range(prop, 0, SHRT_MAX); RNA_def_property_ui_text(prop, "Frames Limit", "Every tracking cycle, this number of frames are tracked"); @@ -874,6 +912,7 @@ static void rna_def_trackingTrack(BlenderRNA *brna) prop= RNA_def_property(srna, "pattern_match", PROP_ENUM, PROP_NONE); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_enum_sdna(prop, NULL, "pattern_match"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_enum_items(prop, pattern_match_items); RNA_def_property_ui_text(prop, "Pattern Match", "Track pattern from given frame when tracking marker to next frame"); @@ -881,6 +920,7 @@ static void rna_def_trackingTrack(BlenderRNA *brna) prop= RNA_def_property(srna, "margin", PROP_INT, PROP_NONE); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_int_sdna(prop, NULL, "margin"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_range(prop, 0, 300); RNA_def_property_ui_text(prop, "Margin", "Distance from image boudary at which marker stops tracking"); @@ -888,6 +928,7 @@ static void rna_def_trackingTrack(BlenderRNA *brna) prop= RNA_def_property(srna, "tracker", PROP_ENUM, PROP_NONE); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_enum_items(prop, tracker_items); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_ui_text(prop, "Tracker", "Tracking algorithm to use"); RNA_def_property_update(prop, NC_MOVIECLIP|NA_EDITED, "rna_tracking_trackerAlgorithm_update"); @@ -895,6 +936,7 @@ static void rna_def_trackingTrack(BlenderRNA *brna) prop= RNA_def_property(srna, "pyramid_levels", PROP_INT, PROP_NONE); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_int_sdna(prop, NULL, "pyramid_levels"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_range(prop, 1, 16); RNA_def_property_ui_text(prop, "Pyramid levels", "Number of pyramid levels (increase on blurry footage)"); RNA_def_property_update(prop, NC_MOVIECLIP|NA_EDITED, "rna_tracking_trackerPyramid_update"); @@ -919,24 +961,28 @@ static void rna_def_trackingTrack(BlenderRNA *brna) /* use_red_channel */ prop= RNA_def_property(srna, "use_red_channel", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", TRACK_DISABLE_RED); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_ui_text(prop, "Use Red Channel", "Use red channel from footage for tracking"); RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, NULL); /* use_green_channel */ prop= RNA_def_property(srna, "use_green_channel", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", TRACK_DISABLE_GREEN); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_ui_text(prop, "Use Green Channel", "Use green channel from footage for tracking"); RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, NULL); /* use_blue_channel */ prop= RNA_def_property(srna, "use_blue_channel", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", TRACK_DISABLE_BLUE); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_ui_text(prop, "Use Blue Channel", "Use blue channel from footage for tracking"); RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, NULL); /* preview_grayscale */ prop= RNA_def_property(srna, "use_grayscale_preview", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", TRACK_PREVIEW_GRAYSCALE); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_ui_text(prop, "Grayscale", "Display what the tracking algorithm sees in the preview"); RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, NULL); @@ -956,6 +1002,7 @@ static void rna_def_trackingTrack(BlenderRNA *brna) /* hide */ prop= RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", TRACK_HIDDEN); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_ui_text(prop, "Hide", "Track is hidden"); RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, NULL); @@ -986,12 +1033,14 @@ static void rna_def_trackingTrack(BlenderRNA *brna) /* locked */ prop= RNA_def_property(srna, "lock", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", TRACK_LOCKED); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_ui_text(prop, "Lock", "Track is locked and all changes to it are disabled"); RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, NULL); /* custom color */ prop= RNA_def_property(srna, "use_custom_color", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", TRACK_CUSTOMCOLOR); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_ui_text(prop, "Custom Color", "Use custom color instead of theme-defined"); RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, NULL); @@ -1015,11 +1064,13 @@ static void rna_def_trackingStabilization(BlenderRNA *brna) PropertyRNA *prop; srna= RNA_def_struct(brna, "MovieTrackingStabilization", NULL); + RNA_def_struct_path_func(srna, "rna_trackingStabilization_path"); RNA_def_struct_ui_text(srna, "Movie tracking stabilization data", "Match-moving stabilization data for tracking"); /* 2d stabilization */ prop= RNA_def_property(srna, "use_2d_stabilization", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", TRACKING_2D_STABILIZATION); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_ui_text(prop, "Use 2D stabilization", "Use 2D stabilization for footage"); RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, "rna_tracking_flushUpdate"); @@ -1040,12 +1091,14 @@ static void rna_def_trackingStabilization(BlenderRNA *brna) /* active track index */ prop= RNA_def_property(srna, "active_track_index", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "act_track"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_int_funcs(prop, "rna_tracking_stabTracks_active_index_get", "rna_tracking_stabTracks_active_index_set", "rna_tracking_stabTracks_active_index_range"); RNA_def_property_ui_text(prop, "Active Track Index", "Index of active track in stabilization tracks list"); /* autoscale */ prop= RNA_def_property(srna, "use_autoscale", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", TRACKING_AUTOSCALE); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_ui_text(prop, "Autoscale", "Automatically scale footage to cover unfilled areas when stabilizating"); RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, "rna_tracking_flushUpdate"); @@ -1072,6 +1125,7 @@ static void rna_def_trackingStabilization(BlenderRNA *brna) /* use_stabilize_rotation */ prop= RNA_def_property(srna, "use_stabilize_rotation", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_boolean_sdna(prop, NULL, "flag", TRACKING_STABILIZE_ROTATION); RNA_def_property_ui_text(prop, "Stabilize Rotation", "Stabilize horizon line on the shot"); RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, "rna_tracking_flushUpdate"); @@ -1280,6 +1334,7 @@ static void rna_def_tracking(BlenderRNA *brna) rna_def_trackingObject(brna); srna= RNA_def_struct(brna, "MovieTracking", NULL); + RNA_def_struct_path_func(srna, "rna_tracking_path"); RNA_def_struct_ui_text(srna, "Movie tracking data", "Match-moving data for tracking"); /* settings */ @@ -1315,6 +1370,7 @@ static void rna_def_tracking(BlenderRNA *brna) /* active object index */ prop= RNA_def_property(srna, "active_object_index", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "objectnr"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_int_funcs(prop, "rna_tracking_active_object_index_get", "rna_tracking_active_object_index_set", "rna_tracking_active_object_index_range"); RNA_def_property_ui_text(prop, "Active Object Index", "Index of active object"); RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, NULL); From b83577aaec35270552e392b8d299e659b147fda3 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Fri, 17 Feb 2012 08:16:29 +0000 Subject: [PATCH 26/32] Camera tracking: fix for missing cache invalidation when disabling/enabling channels for stabilized shot -- svn merge -r44140:44141 ^/branches/soc-2011-tomato --- source/blender/blenkernel/intern/movieclip.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/source/blender/blenkernel/intern/movieclip.c b/source/blender/blenkernel/intern/movieclip.c index 03fe18e4bd8..c93c03a4424 100644 --- a/source/blender/blenkernel/intern/movieclip.c +++ b/source/blender/blenkernel/intern/movieclip.c @@ -277,6 +277,7 @@ typedef struct MovieClipCache { struct { ImBuf *ibuf; int framenr; + int postprocess_flag; float loc[2], scale, angle; int proxy; @@ -702,7 +703,7 @@ ImBuf *BKE_movieclip_get_postprocessed_ibuf(MovieClip *clip, MovieClipUser *user return movieclip_get_postprocessed_ibuf(clip, user, clip->flag, postprocess_flag, 0); } -static ImBuf *get_stable_cached_frame(MovieClip *clip, MovieClipUser *user, int framenr) +static ImBuf *get_stable_cached_frame(MovieClip *clip, MovieClipUser *user, int framenr, int postprocess_flag) { MovieClipCache *cache = clip->cache; ImBuf *stableibuf; @@ -723,6 +724,9 @@ static ImBuf *get_stable_cached_frame(MovieClip *clip, MovieClipUser *user, int if(cache->stabilized.render_flag!=render_flag || cache->stabilized.proxy!=proxy) return NULL; + if(cache->stabilized.postprocess_flag != postprocess_flag) + return NULL; + stableibuf = cache->stabilized.ibuf; BKE_tracking_stabilization_data(&clip->tracking, framenr, stableibuf->x, stableibuf->y, tloc, &tscale, &tangle); @@ -740,7 +744,8 @@ static ImBuf *get_stable_cached_frame(MovieClip *clip, MovieClipUser *user, int return stableibuf; } -static ImBuf *put_stabilized_frame_to_cache(MovieClip *clip, MovieClipUser *user, ImBuf *ibuf, int framenr) +static ImBuf *put_stabilized_frame_to_cache(MovieClip *clip, MovieClipUser *user, ImBuf *ibuf, + int framenr, int postprocess_flag) { MovieClipCache *cache = clip->cache; ImBuf *stableibuf; @@ -768,6 +773,8 @@ static ImBuf *put_stabilized_frame_to_cache(MovieClip *clip, MovieClipUser *user cache->stabilized.render_flag = 0; } + cache->stabilized.postprocess_flag = postprocess_flag; + IMB_refImBuf(stableibuf); return stableibuf; @@ -786,10 +793,10 @@ ImBuf *BKE_movieclip_get_stable_ibuf(MovieClip *clip, MovieClipUser *user, float if(clip->tracking.stabilization.flag&TRACKING_2D_STABILIZATION) { MovieClipCache *cache= clip->cache; - stableibuf= get_stable_cached_frame(clip, user, framenr); + stableibuf= get_stable_cached_frame(clip, user, framenr, postprocess_flag); if(!stableibuf) - stableibuf= put_stabilized_frame_to_cache(clip, user, ibuf, framenr); + stableibuf= put_stabilized_frame_to_cache(clip, user, ibuf, framenr, postprocess_flag); if(loc) copy_v2_v2(loc, cache->stabilized.loc); if(scale) *scale= cache->stabilized.scale; From 781b4cafbd22101eb7ced4e2db1c485eafb53e81 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Fri, 17 Feb 2012 08:17:46 +0000 Subject: [PATCH 27/32] Camera tracking: fixed incorrect auto-scale calculation for 2d stabilization -- svn merge -r44146:44147 ^/branches/soc-2011-tomato --- source/blender/blenkernel/intern/tracking.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/blender/blenkernel/intern/tracking.c b/source/blender/blenkernel/intern/tracking.c index 695ea1dc07a..f089aae578b 100644 --- a/source/blender/blenkernel/intern/tracking.c +++ b/source/blender/blenkernel/intern/tracking.c @@ -2445,8 +2445,8 @@ static void calculate_stabdata(MovieTracking *tracking, int framenr, float width *scale= (stab->scale-1.0f)*stab->scaleinf+1.0f; *angle= 0.0f; - loc[0]= (firstmedian[0]-median[0])*width*(*scale); - loc[1]= (firstmedian[1]-median[1])*height*(*scale); + loc[0]= (firstmedian[0]-median[0])*width; + loc[1]= (firstmedian[1]-median[1])*height; mul_v2_fl(loc, stab->locinf); @@ -2725,7 +2725,7 @@ void BKE_tracking_stabdata_to_mat4(int width, int height, float loc[2], float sc invert_m4_m4(icmat, cmat); size_to_mat4(smat, svec); /* scale matrix */ - add_v2_v2(lmat[3], loc); /* tranlation matrix */ + add_v2_v2(lmat[3], loc); /* translation matrix */ rotate_m4(rmat, 'Z', angle); /* rotation matrix */ /* compose transformation matrix */ From fdeca277fdfab889279c0a4a3b7b1935ff0121fa Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Fri, 17 Feb 2012 08:23:42 +0000 Subject: [PATCH 28/32] Camera tracking: run aspect correction before stabilizing shot This commit fixes image stopped being an orthogonal rectangle because of horizontal scaling caused by pixel aspect ratio happening after rotating image which used to make orthogonal angles from footage not actually orthogonal. -- svn merge -r44150:44151 ^/branches/soc-2011-tomato --- source/blender/blenkernel/BKE_tracking.h | 2 +- source/blender/blenkernel/intern/movieclip.c | 7 ++++++- source/blender/blenkernel/intern/tracking.c | 17 ++++++++++++----- source/blender/editors/space_clip/clip_draw.c | 3 ++- 4 files changed, 21 insertions(+), 8 deletions(-) diff --git a/source/blender/blenkernel/BKE_tracking.h b/source/blender/blenkernel/BKE_tracking.h index f720050f59c..ebbba7de7c7 100644 --- a/source/blender/blenkernel/BKE_tracking.h +++ b/source/blender/blenkernel/BKE_tracking.h @@ -138,7 +138,7 @@ void BKE_tracking_detect_fast(struct MovieTracking *tracking, struct ListBase *t /* 2D stabilization */ void BKE_tracking_stabilization_data(struct MovieTracking *tracking, int framenr, int width, int height, float loc[2], float *scale, float *angle); struct ImBuf *BKE_tracking_stabilize(struct MovieTracking *tracking, int framenr, struct ImBuf *ibuf, float loc[2], float *scale, float *angle); -void BKE_tracking_stabdata_to_mat4(int width, int height, float loc[2], float scale, float angle, float mat[4][4]); +void BKE_tracking_stabdata_to_mat4(int width, int height, float aspect, float loc[2], float scale, float angle, float mat[4][4]); /* Distortion/Undistortion */ void BKE_tracking_apply_intrinsics(struct MovieTracking *tracking, float co[2], float nco[2]); diff --git a/source/blender/blenkernel/intern/movieclip.c b/source/blender/blenkernel/intern/movieclip.c index c93c03a4424..ce0d169557d 100644 --- a/source/blender/blenkernel/intern/movieclip.c +++ b/source/blender/blenkernel/intern/movieclip.c @@ -279,7 +279,7 @@ typedef struct MovieClipCache { int framenr; int postprocess_flag; - float loc[2], scale, angle; + float loc[2], scale, angle, aspect; int proxy; short render_flag; } stabilized; @@ -727,6 +727,10 @@ static ImBuf *get_stable_cached_frame(MovieClip *clip, MovieClipUser *user, int if(cache->stabilized.postprocess_flag != postprocess_flag) return NULL; + /* stabilization also depends on pixel aspect ratio */ + if(cache->stabilized.aspect != clip->tracking.camera.pixel_aspect) + return NULL; + stableibuf = cache->stabilized.ibuf; BKE_tracking_stabilization_data(&clip->tracking, framenr, stableibuf->x, stableibuf->y, tloc, &tscale, &tangle); @@ -763,6 +767,7 @@ static ImBuf *put_stabilized_frame_to_cache(MovieClip *clip, MovieClipUser *user cache->stabilized.scale = tscale; cache->stabilized.angle = tangle; cache->stabilized.framenr = framenr; + cache->stabilized.aspect = clip->tracking.camera.pixel_aspect; if(clip->flag&MCLIP_USE_PROXY) { cache->stabilized.proxy= rendersize_to_proxy(user, clip->flag); diff --git a/source/blender/blenkernel/intern/tracking.c b/source/blender/blenkernel/intern/tracking.c index c9e6ecf6394..04766910df6 100644 --- a/source/blender/blenkernel/intern/tracking.c +++ b/source/blender/blenkernel/intern/tracking.c @@ -2485,6 +2485,7 @@ static float stabilization_auto_scale_factor(MovieTracking *tracking, int width, { float firstmedian[2]; MovieTrackingStabilization *stab= &tracking->stabilization; + float aspect= tracking->camera.pixel_aspect; if(stab->ok) return stab->scale; @@ -2535,7 +2536,7 @@ static float stabilization_auto_scale_factor(MovieTracking *tracking, int width, float mat[4][4]; float points[4][2]={{0.0f, 0.0f}, {0.0f, height}, {width, height}, {width, 0.0f}}; - BKE_tracking_stabdata_to_mat4(width, height, loc, scale, angle, mat); + BKE_tracking_stabdata_to_mat4(width, height, aspect, loc, scale, angle, mat); for(i= 0; i<4; i++) { int j; @@ -2650,6 +2651,7 @@ ImBuf *BKE_tracking_stabilize(MovieTracking *tracking, int framenr, ImBuf *ibuf, MovieTrackingStabilization *stab= &tracking->stabilization; ImBuf *tmpibuf; float width= ibuf->x, height= ibuf->y; + float aspect= tracking->camera.pixel_aspect; if(loc) copy_v2_v2(tloc, loc); if(scale) tscale= *scale; @@ -2688,7 +2690,7 @@ ImBuf *BKE_tracking_stabilize(MovieTracking *tracking, int framenr, ImBuf *ibuf, float mat[4][4]; int i, j; - BKE_tracking_stabdata_to_mat4(ibuf->x, ibuf->y, tloc, tscale, tangle, mat); + BKE_tracking_stabdata_to_mat4(ibuf->x, ibuf->y, aspect, tloc, tscale, tangle, mat); invert_m4(mat); for(j=0; jy; j++) { @@ -2715,15 +2717,20 @@ ImBuf *BKE_tracking_stabilize(MovieTracking *tracking, int framenr, ImBuf *ibuf, return tmpibuf; } -void BKE_tracking_stabdata_to_mat4(int width, int height, float loc[2], float scale, float angle, float mat[4][4]) +void BKE_tracking_stabdata_to_mat4(int width, int height, float aspect, float loc[2], float scale, float angle, float mat[4][4]) { - float lmat[4][4], rmat[4][4], smat[4][4], cmat[4][4], icmat[4][4]; + float lmat[4][4], rmat[4][4], smat[4][4], cmat[4][4], icmat[4][4], amat[4][4], iamat[4][4]; float svec[3]= {scale, scale, scale}; unit_m4(rmat); unit_m4(lmat); unit_m4(smat); unit_m4(cmat); + unit_m4(amat); + + /* aspect ratio correction matrix */ + amat[0][0] = 1.0f / aspect; + invert_m4_m4(iamat, amat); /* image center as rotation center */ cmat[3][0]= (float)width/2.0f; @@ -2735,7 +2742,7 @@ void BKE_tracking_stabdata_to_mat4(int width, int height, float loc[2], float sc rotate_m4(rmat, 'Z', angle); /* rotation matrix */ /* compose transformation matrix */ - mul_serie_m4(mat, lmat, cmat, rmat, smat, icmat, NULL, NULL, NULL); + mul_serie_m4(mat, amat, lmat, cmat, rmat, smat, icmat, iamat, NULL); } MovieDistortion *BKE_tracking_distortion_create(void) diff --git a/source/blender/editors/space_clip/clip_draw.c b/source/blender/editors/space_clip/clip_draw.c index 49fa7837de6..6dda09a1451 100644 --- a/source/blender/editors/space_clip/clip_draw.c +++ b/source/blender/editors/space_clip/clip_draw.c @@ -1269,13 +1269,14 @@ void clip_draw_main(SpaceClip *sc, ARegion *ar, Scene *scene) if(ibuf) { float loc[2]; + float aspect= clip->tracking.camera.pixel_aspect; if(width != ibuf->x) mul_v2_v2fl(loc, sc->loc, (float)width / ibuf->x); else copy_v2_v2(loc, sc->loc); - BKE_tracking_stabdata_to_mat4(width, height, loc, sc->scale, sc->angle, sc->stabmat); + BKE_tracking_stabdata_to_mat4(width, height, aspect, loc, sc->scale, sc->angle, sc->stabmat); unit_m4(smat); smat[0][0]= 1.0f/width; From c9d8af6cff44aad40d224d59430307d6cbc807b0 Mon Sep 17 00:00:00 2001 From: Jens Verwiebe Date: Fri, 17 Feb 2012 10:44:21 +0000 Subject: [PATCH 29/32] OSX: since XCode 4.3 the developer directory is inside XCode.app bundle, so we handle path according XCODE_VERSION now --- build_files/scons/config/darwin-config.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/build_files/scons/config/darwin-config.py b/build_files/scons/config/darwin-config.py index 8082c1e6986..17882342a86 100644 --- a/build_files/scons/config/darwin-config.py +++ b/build_files/scons/config/darwin-config.py @@ -86,6 +86,9 @@ else : LIBDIR = '${LCGDIR}' +if XCODE_CUR_VER >= '4.3': ## since version 4.3, XCode and developer dir are bundled ## + MACOSX_SDK = '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform' + MACOSX_SDK + ############################################################################# ################### Dependency settings ################## ############################################################################# From 071706e48f720744c82b98409f199b7561cb404c Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Fri, 17 Feb 2012 10:54:21 +0000 Subject: [PATCH 30/32] Missed this changes needed to fully support animation data in movie clips. Thanks to Joshua pointed into missed changes! --- source/blender/blenkernel/intern/anim_sys.c | 6 ++++++ source/blender/blenloader/intern/readfile.c | 9 +++++++++ 2 files changed, 15 insertions(+) diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c index 9ae3ad95d5c..c3d2425f280 100644 --- a/source/blender/blenkernel/intern/anim_sys.c +++ b/source/blender/blenkernel/intern/anim_sys.c @@ -794,6 +794,9 @@ void BKE_animdata_main_cb (Main *mainptr, ID_AnimData_Edit_Callback func, void * /* speakers */ ANIMDATA_IDS_CB(mainptr->speaker.first); + /* movie clips */ + ANIMDATA_IDS_CB(mainptr->movieclip.first); + /* objects */ ANIMDATA_IDS_CB(mainptr->object.first); @@ -875,6 +878,9 @@ void BKE_all_animdata_fix_paths_rename (const char *prefix, const char *oldName, /* speakers */ RENAMEFIX_ANIM_IDS(mainptr->speaker.first); + /* movie clips */ + RENAMEFIX_ANIM_IDS(mainptr->movieclip.first); + /* objects */ RENAMEFIX_ANIM_IDS(mainptr->object.first); diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index fe80dd7bd90..fc8f8e2e2e1 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -14085,6 +14085,11 @@ static void expand_sound(FileData *fd, Main *mainvar, bSound *snd) expand_doit(fd, mainvar, snd->ipo); // XXX depreceated - old animation system } +static void expand_movieclip(FileData *fd, Main *mainvar, MovieClip *clip) +{ + if (clip->adt) + expand_animdata(fd, mainvar, clip->adt); +} static void expand_main(FileData *fd, Main *mainvar) { @@ -14168,6 +14173,10 @@ static void expand_main(FileData *fd, Main *mainvar) break; case ID_PA: expand_particlesettings(fd, mainvar, (ParticleSettings *)id); + break; + case ID_MC: + expand_movieclip(fd, mainvar, (MovieClip *)id); + break; } doit= 1; From 5ca057f755d74a463ccc4339154823a0f39c08c3 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Fri, 17 Feb 2012 11:46:28 +0000 Subject: [PATCH 31/32] Fix for recent changes in 3D viewport header: object might be missed and in this case check for current mode isn't needed --- release/scripts/startup/bl_ui/space_view3d.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py index f5ce73ff9bd..ceeecf5fbcb 100644 --- a/release/scripts/startup/bl_ui/space_view3d.py +++ b/release/scripts/startup/bl_ui/space_view3d.py @@ -83,7 +83,7 @@ class VIEW3D_HT_header(Header): row.prop(toolsettings, "proportional_edit_falloff", text="", icon_only=True) # Snap - if obj.mode not in {'SCULPT', 'VERTEX_PAINT', 'WEIGHT_PAINT', 'TEXTURE_PAINT', 'PARTICLE_EDIT'}: + if not obj or obj.mode not in {'SCULPT', 'VERTEX_PAINT', 'WEIGHT_PAINT', 'TEXTURE_PAINT', 'PARTICLE_EDIT'}: snap_element = toolsettings.snap_element row = layout.row(align=True) row.prop(toolsettings, "use_snap", text="") From b7f3887a3a8a66aeba3a16ae5d76b934af3ccc7c Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Fri, 17 Feb 2012 12:27:58 +0000 Subject: [PATCH 32/32] fa_PE is no valid language code (how comes no one noted that yet?), fa_IR seems the right one! Else, persian was just unavailable on Linux (at least, on Debian...). --- source/blender/blenfont/intern/blf_lang.c | 2 +- source/blender/makesrna/intern/rna_userdef.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/source/blender/blenfont/intern/blf_lang.c b/source/blender/blenfont/intern/blf_lang.c index d96011f0f1e..95203c2b1c0 100644 --- a/source/blender/blenfont/intern/blf_lang.c +++ b/source/blender/blenfont/intern/blf_lang.c @@ -101,7 +101,7 @@ static const char *locales[] = { "greek", "el_GR", "korean", "ko_KR", "nepali", "ne_NP", - "persian", "fa_PE", + "persian", "fa_IR", "indonesian", "id_ID", "serbian (latin)", "sr_RS@latin", "kyrgyz", "ky", diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index f7c85583150..919ee215f29 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -2827,7 +2827,7 @@ static void rna_def_userdef_system(BlenderRNA *brna) {24, "KOREAN", 0, "Korean (한국 언어)", "ko_KR"}, {25, "NEPALI", 0, "Nepali (नेपाली)", "ne_NP"}, /* using the utf8 flipped form of Persian (فارسی) */ - {26, "PERSIAN", 0, "Persian (ﯽﺳﺭﺎﻓ)", "fa_PE"}, + {26, "PERSIAN", 0, "Persian (ﯽﺳﺭﺎﻓ)", "fa_IR"}, {19, "POLISH", 0, "Polish (Polski)", "pl_PL"}, {20, "ROMANIAN", 0, "Romanian (Român)", "ro_RO"}, {17, "SERBIAN", 0, "Serbian (Српски)", "sr_RS"},