[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [39436] branches/soc-2011-tomato: Camera tracking integration

Sergey Sharybin g.ulairi at gmail.com
Tue Aug 16 10:01:24 CEST 2011


Revision: 39436
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=39436
Author:   nazgul
Date:     2011-08-16 08:01:23 +0000 (Tue, 16 Aug 2011)
Log Message:
-----------
Camera tracking integration
===========================

initial re-design commit:
- Added Mode to Clip Editor. Currently the following modes are present:
  * Tracking/Solving mode (default)
	* Reconstruction mode
	* Distortion mode
- Hide all tools/properties which doesn't make sense in current mode.
- Keep a look at new template template_marker. It's needed to control
  marker's properties, changing of which should produce new keyframe.
  Currently only "Enabled" property can be control. Probably all
	properties from "Marker" panel could go there so this template
	wouldn't be so specific.
- No operators are disabled for non-their mode. It means they
  can be triggered from Space menu or hotkey.
	Need clear map operators into mode to prevent mess of poll function.

Modified Paths:
--------------
    branches/soc-2011-tomato/release/scripts/startup/bl_ui/space_clip.py
    branches/soc-2011-tomato/source/blender/blenkernel/intern/movieclip.c
    branches/soc-2011-tomato/source/blender/editors/include/UI_interface.h
    branches/soc-2011-tomato/source/blender/editors/space_clip/clip_buttons.c
    branches/soc-2011-tomato/source/blender/editors/space_clip/clip_draw.c
    branches/soc-2011-tomato/source/blender/editors/space_clip/clip_intern.h
    branches/soc-2011-tomato/source/blender/editors/space_clip/space_clip.c
    branches/soc-2011-tomato/source/blender/editors/space_clip/tracking_ops.c
    branches/soc-2011-tomato/source/blender/makesdna/DNA_space_types.h
    branches/soc-2011-tomato/source/blender/makesdna/DNA_tracking_types.h
    branches/soc-2011-tomato/source/blender/makesrna/intern/rna_space.c
    branches/soc-2011-tomato/source/blender/makesrna/intern/rna_tracking.c
    branches/soc-2011-tomato/source/blender/makesrna/intern/rna_ui_api.c
    branches/soc-2011-tomato/source/blenderplayer/bad_level_call_stubs/stubs.c

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-08-16 07:56:44 UTC (rev 39435)
+++ branches/soc-2011-tomato/release/scripts/startup/bl_ui/space_clip.py	2011-08-16 08:01:23 UTC (rev 39436)
@@ -21,9 +21,9 @@
 from bpy.types import Operator, Panel, Header, Menu
 
 
-class CLIP_OT_apply_follow_track(Operator):
-    bl_idname = "clip.apply_follow_track"
-    bl_label = "Apply Follow Track"
+class CLIP_OT_track_to_empty(Operator):
+    bl_idname = "clip.track_to_empty"
+    bl_label = "2D Track to Emppty"
     bl_options = {'UNDO', 'REGISTER'}
 
     @classmethod
@@ -34,15 +34,25 @@
         sc = context.space_data
         clip = sc.clip
 
-        return clip and clip.tracking.active_track and context.active_object
+        return clip and clip.tracking.active_track
 
     def execute(self, context):
-        ob = context.active_object
         sc = context.space_data
         clip = sc.clip
         track = clip.tracking.active_track
         constraint = None
+        ob = None
 
+        if track.name in bpy.data.objects:
+            if bpy.data.objects[track.name].type == 'Empty':
+                ob = bpy.data.objects[track.name]
+
+        if  not ob:
+            ob = bpy.data.objects.new(name=track.name, object_data=None)
+            ob.select = True
+            bpy.context.scene.objects.link(ob)
+            bpy.context.scene.objects.active = ob
+
         for con in ob.constraints:
             if con.type == 'FOLLOW_TRACK':
                 constraint = con
@@ -111,111 +121,232 @@
                 sub.menu("CLIP_MT_select")
                 sub.menu("CLIP_MT_track")
 
-        layout.template_ID(sc, "clip")
-        layout.template_running_jobs()
+        if clip:
+            layout.prop(sc, "mode", text="")
 
+        row = layout.row()
+        row.template_ID(sc, "clip", open='clip.open')
+
         if clip:
             r = clip.tracking.reconstruction
 
             if r.is_reconstructed:
-                layout.label(text="Average solve error: %.4f"  % (r.average_error))
+                layout.label(text="Average solve error: %.4f" % \
+                    (r.average_error))
 
+        layout.template_running_jobs()
 
+
 class CLIP_PT_tools(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 not clip and sc.mode == 'TRACKING'
+
     def draw(self, context):
         layout = self.layout
+        layout.operator('clip.open')
+
+
+class CLIP_PT_tools_marker(Panel):
+    bl_space_type = 'CLIP_EDITOR'
+    bl_region_type = 'TOOLS'
+    bl_label = "Marker"
+
+    @classmethod
+    def poll(cls, context):
+        sc = context.space_data
+        clip = sc.clip
+
+        return clip and sc.mode == 'TRACKING'
+
+    def draw(self, context):
+        layout = self.layout
+
+        col = layout.column(align=True)
+        col.operator("clip.add_marker_move")
+        col.operator("clip.detect_features")
+        col.operator("clip.delete_track")
+
+
+class CLIP_PT_tools_tracking(Panel):
+    bl_space_type = 'CLIP_EDITOR'
+    bl_region_type = 'TOOLS'
+    bl_label = "Track"
+
+    @classmethod
+    def poll(cls, context):
+        sc = context.space_data
+        clip = sc.clip
+
+        return clip and sc.mode == 'TRACKING'
+
+    def draw(self, context):
+        layout = self.layout
         clip = context.space_data.clip
+        settings = clip.tracking.settings
 
-        if clip:
-            settings = clip.tracking.settings
+        row = layout.row(align=True)
 
-            col = layout.column(align=True)
-            col.label(text="Marker:")
-            col.operator("clip.add_marker_move")
-            col.operator("clip.delete_track")
-            col.operator("clip.delete_marker")
+        op = row.operator("clip.track_markers", text="", icon='FRAME_PREV')
+        op.backwards = True
+        op = row.operator("clip.track_markers", text="", \
+             icon='PLAY_REVERSE')
+        op.backwards = True
+        op.sequence = True
+        op = row.operator("clip.track_markers", text="", icon='PLAY')
+        op.sequence = True
+        row.operator("clip.track_markers", text="", icon='FRAME_NEXT')
 
-            col = layout.column(align=True)
-            col.label(text="2D tracking:")
-            row = col.row(align=True)
+        col = layout.column(align=True)
+        op = col.operator("clip.clear_track_path", \
+             text="Clear Remained Path")
+        op.action = 'REMAINED'
 
-            op = row.operator("clip.track_markers", text="", icon='FRAME_PREV')
-            op.backwards = True
-            op = row.operator("clip.track_markers", text="", \
-                 icon='PLAY_REVERSE')
-            op.backwards = True
-            op.sequence = True
-            op = row.operator("clip.track_markers", text="", icon='PLAY')
-            op.sequence = True
-            row.operator("clip.track_markers", text="", icon='FRAME_NEXT')
+        op = col.operator("clip.clear_track_path", text="Clear Path Up To")
+        op.action = 'UPTO'
 
-            col = layout.column(align=True)
-            op = col.operator("clip.clear_track_path", \
-                 text="Clear Remained Path")
-            op.action = 'REMAINED'
+        op = col.operator("clip.clear_track_path", text="Clear Track Path")
+        op.action = 'ALL'
 
-            op = col.operator("clip.clear_track_path", text="Clear Path Up To")
-            op.action = 'UPTO'
+        layout.operator("clip.join_tracks")
 
-            op = col.operator("clip.clear_track_path", text="Clear Track Path")
-            op.action = 'ALL'
 
-            layout.operator("clip.join_tracks")
-            layout.operator("clip.detect_features")
-            layout.operator("clip.apply_follow_track")
+class CLIP_PT_tools_solving(Panel):
+    bl_space_type = 'CLIP_EDITOR'
+    bl_region_type = 'TOOLS'
+    bl_label = "Solving"
 
-            col = layout.column(align=True)
-            col.label(text="Reconstruction:")
+    @classmethod
+    def poll(cls, context):
+        sc = context.space_data
+        clip = sc.clip
 
-            col.prop(settings, "keyframe1")
-            col.prop(settings, "keyframe2")
+        return clip and sc.mode == 'TRACKING'
 
-            col = layout.column(align=True)
-            col.operator("clip.solve_camera")
-            col.operator("clip.clear_reconstruction")
+    def draw(self, context):
+        layout = self.layout
+        clip = context.space_data.clip
+        settings = clip.tracking.settings
 
-            col = layout.column(align=True)
-            col.operator("clip.bundles_to_mesh")
+        col = layout.column(align=True)
+        col.prop(settings, "keyframe1")
+        col.prop(settings, "keyframe2")
 
-            col = layout.column(align=True)
-            col.label(text="Scene Orientation:")
-            col.operator("clip.set_floor")
-            col.operator("clip.set_origin")
+        col = layout.column(align=True)
+        col.operator("clip.solve_camera")
+        col.operator("clip.clear_solution")
 
-            row = col.row()
-            row.operator("clip.set_axis", text="Set X Axis").axis = 'X'
-            row.operator("clip.set_axis", text="Set Y Axis").axis = 'Y'
 
-            col = layout.column()
-            col.prop(settings, "distance")
-            col.operator("clip.set_scale")
+class CLIP_PT_tools_cleanup(Panel):
+    bl_space_type = 'CLIP_EDITOR'
+    bl_region_type = 'TOOLS'
+    bl_label = "Clean up"
 
-            col = layout.column(align=True)
-            col.label(text="Clean-up:")
-            col.operator("clip.clean_tracks")
+    @classmethod
+    def poll(cls, context):
+        sc = context.space_data
+        clip = sc.clip
 
-            col = layout.column(align=True)
-            col.label(text="Grease Pencil:")
+        return clip and sc.mode == 'TRACKING'
 
-            row = col.row()
-            row.operator("gpencil.draw", text="Draw").mode = 'DRAW'
-            row.operator("gpencil.draw", text="Line").mode = 'DRAW_STRAIGHT'
+    def draw(self, context):
+        layout = self.layout
+        clip = context.space_data.clip
+        settings = clip.tracking.settings
 
-            row = col.row()
-            row.operator("gpencil.draw", text="Poly").mode = 'DRAW_POLY'
-            row.operator("gpencil.draw", text="Erase").mode = 'ERASER'
+        layout.prop(settings, 'clean_frames', text="Frames")
+        layout.prop(settings, 'clean_error', text="Error")
+        layout.prop(settings, 'clean_action', text="")
 
-            row = col.row()
-            row.prop(context.tool_settings, "use_grease_pencil_sessions")
+        layout.operator("clip.clean_tracks")
 
-        else:
-            layout.operator('clip.open')
 
+class CLIP_PT_tools_geometry(Panel):
+    bl_space_type = 'CLIP_EDITOR'
+    bl_region_type = 'TOOLS'
+    bl_label = "Geometry"
 
+    @classmethod
+    def poll(cls, context):
+        sc = context.space_data
+        clip = sc.clip
+
+        return clip and sc.mode == 'RECONSTRUCTION'
+
+    def draw(self, context):
+        layout = self.layout
+
+        layout.operator("clip.bundles_to_mesh")
+        layout.operator("clip.track_to_empty")
+
+
+class CLIP_PT_tools_orientation(Panel):
+    bl_space_type = 'CLIP_EDITOR'
+    bl_region_type = 'TOOLS'
+    bl_label = "Orientation"
+
+    @classmethod
+    def poll(cls, context):
+        sc = context.space_data
+        clip = sc.clip
+
+        return clip and sc.mode == 'RECONSTRUCTION'
+
+    def draw(self, context):
+        sc = context.space_data
+        layout = self.layout
+        settings = sc.clip.tracking.settings
+
+        col = layout.column(align=True)
+        col.label(text="Scene Orientation:")
+        col.operator("clip.set_floor")
+        col.operator("clip.set_origin")
+
+        row = col.row()
+        row.operator("clip.set_axis", text="Set X Axis").axis = 'X'
+        row.operator("clip.set_axis", text="Set Y Axis").axis = 'Y'
+
+        col = layout.column()
+        col.prop(settings, "distance")
+        col.operator("clip.set_scale")
+
+
+class CLIP_PT_tools_grease_pencil(Panel):
+    bl_space_type = 'CLIP_EDITOR'
+    bl_region_type = 'TOOLS'
+    bl_label = "Grease Pencil"
+
+    @classmethod

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list