Revision: 37135 http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=37135 Author: nazgul Date: 2011-06-03 15:39:53 +0000 (Fri, 03 Jun 2011) Log Message: ----------- Camera tracking integration ===========================
Implemented basic structures and operators for markers manipulaiton. Markers contains: - Position of marker at frame in unified 0..1 coordinates - Relative positions of left-bottom and right-top corners of pattern area - Relative positions of left-bottom and right-top corners of search area - Selection flags New operators: - Create new maerker. It's a modal operator which creates markers at mouse position when LMB is clicking. - Delete selected markers. - Select marker using RMB. Some parts of marker (point, patter, search) could be deselected. - Select markers using rectangular selection. - Select markers using circle selection. - Marker translation (G-key). - Marker scaling (S-key). UI changes: - Added mode to space clip. Currently supported modes are: * View mode * Tracking mode This was intended to separate different categories of tools, so interface shouldn't be overheaded with plenty of tools which aren't actually using in the same time. - Created new panel when actiev tool is 'MARKER' and there's active marker where positions could be adjusted in pixel space. Internal changes: - Splitted DNA/RNA movieclip files to make separation of tracking data and movie data more clear. This could be useful in the future when we'll want to support multiplie moies for single camera tracking (to make tracking more accurate). - Added new file in blenkernel, where all tracking-related function would be stored. Not very much function here at this moment, but in the future all stuff related on converting DNA to external tracking data would be stored here. Modified Paths: -------------- branches/soc-2011-tomato/release/datafiles/blenderbuttons branches/soc-2011-tomato/release/scripts/startup/bl_ui/space_clip.py branches/soc-2011-tomato/source/blender/CMakeLists.txt branches/soc-2011-tomato/source/blender/blenkernel/BKE_movieclip.h branches/soc-2011-tomato/source/blender/blenkernel/CMakeLists.txt branches/soc-2011-tomato/source/blender/blenkernel/intern/movieclip.c branches/soc-2011-tomato/source/blender/blenlib/BLI_math_vector.h branches/soc-2011-tomato/source/blender/blenlib/intern/math_vector_inline.c branches/soc-2011-tomato/source/blender/blenloader/intern/readfile.c branches/soc-2011-tomato/source/blender/blenloader/intern/writefile.c branches/soc-2011-tomato/source/blender/editors/datafiles/blenderbuttons.c branches/soc-2011-tomato/source/blender/editors/datafiles/startup.blend.c branches/soc-2011-tomato/source/blender/editors/include/UI_icons.h branches/soc-2011-tomato/source/blender/editors/include/UI_resources.h branches/soc-2011-tomato/source/blender/editors/interface/resources.c branches/soc-2011-tomato/source/blender/editors/screen/screen_edit.c branches/soc-2011-tomato/source/blender/editors/space_clip/CMakeLists.txt branches/soc-2011-tomato/source/blender/editors/space_clip/clip_draw.c branches/soc-2011-tomato/source/blender/editors/space_clip/clip_editor.c branches/soc-2011-tomato/source/blender/editors/space_clip/clip_intern.h branches/soc-2011-tomato/source/blender/editors/space_clip/clip_ops.c branches/soc-2011-tomato/source/blender/editors/space_clip/space_clip.c branches/soc-2011-tomato/source/blender/editors/transform/transform.c branches/soc-2011-tomato/source/blender/editors/transform/transform.h branches/soc-2011-tomato/source/blender/editors/transform/transform_conversions.c branches/soc-2011-tomato/source/blender/editors/transform/transform_generics.c branches/soc-2011-tomato/source/blender/editors/transform/transform_ops.c branches/soc-2011-tomato/source/blender/editors/util/CMakeLists.txt branches/soc-2011-tomato/source/blender/makesdna/DNA_movieclip_types.h branches/soc-2011-tomato/source/blender/makesdna/DNA_scene_types.h branches/soc-2011-tomato/source/blender/makesdna/DNA_space_types.h branches/soc-2011-tomato/source/blender/makesdna/DNA_userdef_types.h branches/soc-2011-tomato/source/blender/makesdna/intern/makesdna.c branches/soc-2011-tomato/source/blender/makesrna/intern/CMakeLists.txt branches/soc-2011-tomato/source/blender/makesrna/intern/makesrna.c branches/soc-2011-tomato/source/blender/makesrna/intern/rna_internal.h branches/soc-2011-tomato/source/blender/makesrna/intern/rna_movieclip.c branches/soc-2011-tomato/source/blender/makesrna/intern/rna_space.c branches/soc-2011-tomato/source/blender/makesrna/intern/rna_userdef.c branches/soc-2011-tomato/source/blender/windowmanager/intern/wm_operators.c Added Paths: ----------- branches/soc-2011-tomato/source/blender/blenkernel/BKE_tracking.h branches/soc-2011-tomato/source/blender/blenkernel/intern/tracking.c branches/soc-2011-tomato/source/blender/editors/include/ED_clip.h branches/soc-2011-tomato/source/blender/editors/space_clip/clip_buttons.c branches/soc-2011-tomato/source/blender/editors/space_clip/tracking_ops.c branches/soc-2011-tomato/source/blender/makesdna/DNA_tracking_types.h branches/soc-2011-tomato/source/blender/makesrna/intern/rna_tracking.c Removed Paths: ------------- branches/soc-2011-tomato/source/blender/editors/include/ED_movieclip.h Modified: branches/soc-2011-tomato/release/datafiles/blenderbuttons =================================================================== (Binary files differ) Modified: branches/soc-2011-tomato/release/scripts/startup/bl_ui/space_clip.py =================================================================== --- branches/soc-2011-tomato/release/scripts/startup/bl_ui/space_clip.py 2011-06-03 15:25:58 UTC (rev 37134) +++ branches/soc-2011-tomato/release/scripts/startup/bl_ui/space_clip.py 2011-06-03 15:39:53 UTC (rev 37135) @@ -27,6 +27,7 @@ layout = self.layout sc = context.space_data + clip = sc.clip row = layout.row(align=True) row.template_header() @@ -36,14 +37,28 @@ sub.menu("CLIP_MT_view") sub.menu("CLIP_MT_clip") + if clip and sc.mode == 'TRACKING': + sub.menu("CLIP_MT_select") + sub.menu("CLIP_MT_edit") + layout.template_ID(sc, "clip") + if clip: + layout.prop(sc, "mode", text="") + class CLIP_PT_tools(bpy.types.Panel): bl_space_type = 'CLIP_EDITOR' bl_region_type = 'TOOLS' bl_label = "Tools" + @classmethod + def poll(cls, context): + sc = context.space_data + clip = sc.clip + + return (sc.mode == 'TRACKING' and clip) + def draw(self, context): layout = self.layout clip = context.space_data.clip @@ -52,30 +67,35 @@ ts = context.tool_settings col = layout.column() col.prop(ts.movieclip, 'tool', expand=True) - else: - layout.operator('clip.open', icon='FILESEL') -class CLIP_PT_footage_camera(bpy.types.Panel): +class CLIP_PT_footage(bpy.types.Panel): bl_space_type = 'CLIP_EDITOR' bl_region_type = 'TOOLS' bl_label = "Footage Settings" @classmethod def poll(cls, context): - clip = context.space_data.clip + sc = context.space_data + clip = sc.clip ts = context.tool_settings tool = ts.movieclip.tool - return (clip and tool == 'FOOTAGE') + if sc.mode == 'TRACKING': + return clip and tool == 'FOOTAGE' + return True + def draw(self, context): layout = self.layout sc = context.space_data clip = sc.clip - layout.label(text="File Path:") - layout.prop(clip, "filepath", text="") + if clip: + layout.label(text="File Path:") + layout.prop(clip, "filepath", text="") + else: + layout.operator('clip.open', icon='FILESEL') class CLIP_PT_tracking_camera(bpy.types.Panel): @@ -85,11 +105,12 @@ @classmethod def poll(cls, context): - clip = context.space_data.clip + sc = context.space_data + clip = sc.clip ts = context.tool_settings tool = ts.movieclip.tool - return (clip and tool == 'CAMERA') + return (sc.mode == 'TRACKING' and clip and tool == 'CAMERA') def draw(self, context): layout = self.layout @@ -100,6 +121,49 @@ layout.prop(clip.tracking.camera, "focal_length") +class CLIP_PT_tracking_marker(bpy.types.Panel): + bl_space_type = 'CLIP_EDITOR' + bl_region_type = 'TOOLS' + bl_label = 'Marker Tools' + + @classmethod + def poll(cls, context): + sc = context.space_data + clip = sc.clip + ts = context.tool_settings + tool = ts.movieclip.tool + + return (sc.mode == 'TRACKING' and clip and tool == 'MARKER') + + def draw(self, context): + layout = self.layout + clip = context.space_data.clip + + layout.operator('clip.add_marker', icon='ZOOMIN') + layout.operator('clip.delete', icon='X') + + +class CLIP_PT_display(bpy.types.Panel): + bl_space_type = 'CLIP_EDITOR' + bl_region_type = 'TOOLS' + bl_label = "Display" + bl_options = {'DEFAULT_CLOSED'} + + @classmethod + def poll(cls, context): + sc = context.space_data + clip = sc.clip + + return sc.mode == 'TRACKING' and clip + + def draw(self, context): + layout = self.layout + sc = context.space_data + + layout.prop(sc, "show_marker_pattern") + layout.prop(sc, "show_marker_search") + + class CLIP_PT_debug(bpy.types.Panel): bl_space_type = 'CLIP_EDITOR' bl_region_type = 'TOOLS' @@ -130,12 +194,54 @@ class CLIP_MT_clip(bpy.types.Menu): bl_label = "Clip" + def draw(self, context): layout = self.layout sc = context.space_data + clip = sc.clip + if clip: + layout.operator('clip.reload') + layout.operator('clip.open') + +class CLIP_MT_edit(bpy.types.Menu): + bl_label = "Edit" + + def draw(self, context): + layout = self.layout + + sc = context.space_data + + layout.operator('clip.delete') + layout.menu("CLIP_MT_marker") + + +class CLIP_MT_marker(bpy.types.Menu): + bl_label = "Marker" + + def draw(self, context): + layout = self.layout + + sc = context.space_data + + layout.operator('clip.add_marker') + + +class CLIP_MT_select(bpy.types.Menu): + bl_label = "Select" + + def draw(self, context): + layout = self.layout + + sc = context.space_data + + layout.operator('clip.select_border') + layout.operator('clip.select_circle') + layout.operator('clip.select_all', text="Select/Deselect all") + layout.operator('clip.select_all', text="Inverse").action = 'INVERT' + if __name__ == "__main__": # only for live edit. bpy.utils.register_module(__name__) Modified: branches/soc-2011-tomato/source/blender/CMakeLists.txt =================================================================== --- branches/soc-2011-tomato/source/blender/CMakeLists.txt 2011-06-03 15:25:58 UTC (rev 37134) +++ branches/soc-2011-tomato/source/blender/CMakeLists.txt 2011-06-03 15:39:53 UTC (rev 37135) @@ -83,6 +83,7 @@ ${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_windowmanager_types.h ${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_world_types.h ${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_movieclip_types.h + ${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_tracking_types.h ) add_subdirectory(editors) Modified: branches/soc-2011-tomato/source/blender/blenkernel/BKE_movieclip.h =================================================================== --- branches/soc-2011-tomato/source/blender/blenkernel/BKE_movieclip.h 2011-06-03 15:25:58 UTC (rev 37134) +++ branches/soc-2011-tomato/source/blender/blenkernel/BKE_movieclip.h 2011-06-03 15:39:53 UTC (rev 37135) @@ -38,14 +38,23 @@ struct Main; struct MovieClip; struct MovieClipUser; +struct MovieTrackingMarker; void free_movieclip(struct MovieClip *clip); void unlink_movieclip(struct Main *bmain, struct MovieClip *clip); struct MovieClip *BKE_add_movieclip_file(const char *name); +void BKE_movieclip_reload(struct MovieClip *clip); + struct ImBuf *BKE_movieclip_acquire_ibuf(struct MovieClip *clip, struct MovieClipUser *user); -void BKE_movieclip_user_set_frame(struct MovieClipUser *iuser, int framenr); -void BKE_movieclip_reload(struct MovieClip *clip); +int BKE_movieclip_has_frame(struct MovieClip *clip, struct MovieClipUser *user); +void BKE_movieclip_user_set_frame(struct MovieClipUser *user, int framenr); + +void BKE_movieclip_select_marker(struct MovieClip *clip, struct MovieTrackingMarker *marker, int area, int extend); +void BKE_movieclip_deselect_marker(struct MovieClip *clip, struct MovieTrackingMarker *marker, int area); +void BKE_movieclip_set_selection(struct MovieClip *clip, int type, void *sel); +void BKE_movieclip_last_selection(struct MovieClip *clip, int *type, void **sel); + void BKE_movieclip_get_cache_segments(struct MovieClip *clip, int *totseg_r, int **points_r); #endif Copied: branches/soc-2011-tomato/source/blender/blenkernel/BKE_tracking.h (from rev 37130, branches/soc-2011-tomato/source/blender/blenkernel/BKE_movieclip.h) =================================================================== --- branches/soc-2011-tomato/source/blender/blenkernel/BKE_tracking.h (rev 0) +++ branches/soc-2011-tomato/source/blender/blenkernel/BKE_tracking.h 2011-06-03 15:39:53 UTC (rev 37135) @@ -0,0 +1,56 @@ +/* + * $Id$ + * + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) Blender Foundation. + * All rights reserved. + * + * Contributor(s): Blender Foundation, + * Sergey Sharybin + * + * ***** END GPL LICENSE BLOCK ***** + */ + +#ifndef BKE_TRACKING_H +#define BKE_TRACKING_H + +/** \file BKE_trackingp.h + * \ingroup bke + * \author Sergey Sharybin + */ + +struct MovieTrackingMarker; + +void BKE_tracking_clamp_marker(struct MovieTrackingMarker *marker, int event); +void BKE_tracking_marker_flag(struct MovieTrackingMarker *marker, int area, int flag, int clear); + +#define MARKER_SELECTED(marker) ((marker)->flag&SELECT || (marker)->pat_flag&SELECT || (marker)->search_flag&SELECT) +#define MARKER_AREA_SELECTED(marker, area) ((area)==MARKER_AREA_POINT?(marker)->flag&SELECT : ((area)==MARKER_AREA_PAT?(marker)->pat_flag&SELECT:(marker)->search_flag&SELECT)) + +#define CLAMP_PAT_DIM 1 +#define CLAMP_PAT_POS 2 +#define CLAMP_SEARCH_DIM 3 +#define CLAMP_SEARCH_POS 4 + +#define MARKER_AREA_NONE -1 +#define MARKER_AREA_ALL 0 +#define MARKER_AREA_POINT 1 +#define MARKER_AREA_PAT 2 +#define MARKER_AREA_SEARCH 3 + +#endif Modified: branches/soc-2011-tomato/source/blender/blenkernel/CMakeLists.txt =================================================================== --- branches/soc-2011-tomato/source/blender/blenkernel/CMakeLists.txt 2011-06-03 15:25:58 UTC (rev 37134) @@ Diff output truncated at 10240 characters. @@ _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org http://lists.blender.org/mailman/listinfo/bf-blender-cvs