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

Sergey Sharybin g.ulairi at gmail.com
Fri Sep 23 21:42:35 CEST 2011


Revision: 40511
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=40511
Author:   nazgul
Date:     2011-09-23 19:42:35 +0000 (Fri, 23 Sep 2011)
Log Message:
-----------
Camera tracking integration
==========================

- Added building undstorted proxies.
- Move render proxy settings outside from movie clip to
  clip user, so now different users can use different proxies.
  For example, clip editor displays original footage, 3d viewport
  displays 75% undistorted proxy.
- Unified paths used for sequence and movie clips.
  Please, rebuild proxies if they would fail to load.
- Added experimental operator "Delete Proxy". Use with care.
- Moved clip operators outside of space_clip.

Modified Paths:
--------------
    branches/soc-2011-tomato/release/scripts/startup/bl_operators/__init__.py
    branches/soc-2011-tomato/release/scripts/startup/bl_ui/space_clip.py
    branches/soc-2011-tomato/release/scripts/startup/bl_ui/space_view3d.py
    branches/soc-2011-tomato/source/blender/blenkernel/BKE_movieclip.h
    branches/soc-2011-tomato/source/blender/blenkernel/intern/movieclip.c
    branches/soc-2011-tomato/source/blender/blenloader/intern/readfile.c
    branches/soc-2011-tomato/source/blender/editors/space_clip/clip_draw.c
    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/makesdna/DNA_movieclip_types.h
    branches/soc-2011-tomato/source/blender/makesrna/intern/rna_main.c
    branches/soc-2011-tomato/source/blender/makesrna/intern/rna_main_api.c
    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_tracking.c
    branches/soc-2011-tomato/source/blender/makesrna/intern/rna_ui_api.c

Added Paths:
-----------
    branches/soc-2011-tomato/release/scripts/startup/bl_operators/clip.py

Modified: branches/soc-2011-tomato/release/scripts/startup/bl_operators/__init__.py
===================================================================
--- branches/soc-2011-tomato/release/scripts/startup/bl_operators/__init__.py	2011-09-23 19:39:45 UTC (rev 40510)
+++ branches/soc-2011-tomato/release/scripts/startup/bl_operators/__init__.py	2011-09-23 19:42:35 UTC (rev 40511)
@@ -25,6 +25,7 @@
 _modules = (
     "add_mesh_torus",
     "anim",
+    "clip",
     "console",
     "image",
     "mesh",

Added: branches/soc-2011-tomato/release/scripts/startup/bl_operators/clip.py
===================================================================
--- branches/soc-2011-tomato/release/scripts/startup/bl_operators/clip.py	                        (rev 0)
+++ branches/soc-2011-tomato/release/scripts/startup/bl_operators/clip.py	2011-09-23 19:42:35 UTC (rev 40511)
@@ -0,0 +1,141 @@
+# ##### 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.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+# <pep8 compliant>
+import bpy
+import os
+import shutil
+from bpy.types import Operator
+
+
+class CLIP_OT_track_to_empty(Operator):
+    bl_idname = "clip.track_to_empty"
+    bl_label = "2D Track to Empty"
+    bl_options = {'UNDO', 'REGISTER'}
+
+    @classmethod
+    def poll(cls, context):
+        if context.space_data.type != 'CLIP_EDITOR':
+            return False
+
+        sc = context.space_data
+        clip = sc.clip
+
+        return clip and clip.tracking.active_track
+
+    def execute(self, context):
+        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
+                break
+
+        if constraint is None:
+            constraint = ob.constraints.new(type='FOLLOW_TRACK')
+
+        constraint.clip = sc.clip
+        constraint.track = track.name
+        constraint.reference = 'TRACK'
+
+        return {'FINISHED'}
+
+
+class CLIP_OT_bundles_to_mesh(Operator):
+    bl_idname = "clip.bundles_to_mesh"
+    bl_label = "Bundles to Mesh"
+    bl_options = {'UNDO', 'REGISTER'}
+
+    @classmethod
+    def poll(cls, context):
+        if context.space_data.type != 'CLIP_EDITOR':
+            return False
+
+        sc = context.space_data
+        clip = sc.clip
+
+        return clip
+
+    def execute(self, context):
+        sc = context.space_data
+        clip = sc.clip
+
+        mesh = bpy.data.meshes.new(name="Bundles")
+        for track in clip.tracking.tracks:
+            if track.has_bundle:
+                mesh.vertices.add(1)
+                mesh.vertices[-1].co = track.bundle
+
+        ob = bpy.data.objects.new(name="Bundles", object_data=mesh)
+
+        bpy.context.scene.objects.link(ob)
+
+        return {'FINISHED'}
+
+
+class CLIP_OT_delete_proxy(Operator):
+    bl_idname = "clip.delete_proxy"
+    bl_label = "Delete Proxy"
+    bl_options = {'UNDO', 'REGISTER'}
+
+    def invoke(self, context, event):
+        wm = context.window_manager
+
+        return wm.invoke_confirm(self, event)
+
+    def execute(self, context):
+        sc = context.space_data
+        clip = sc.clip
+
+        if clip.use_proxy_custom_directory:
+            proxydir = clip.proxy.directory
+        else:
+            clipdir = os.path.dirname(clip.filepath)
+            proxydir = os.path.join(clipdir, 'BL_proxy')
+
+        clipfile = os.path.basename(clip.filepath)
+        proxy = os.path.join(proxydir, clipfile)
+        absproxy = bpy.path.abspath(proxy)
+
+        if os.path.exists(absproxy):
+            shutil.rmtree(absproxy)
+        else:
+            return {'CANCELLED'}
+
+        # remove [custom] proxy directory if empty
+        try:
+            absdir = bpy.path.abspath(proxydir)
+            os.rmdir(absdir)
+        except OSError:
+            pass
+
+        return {'FINISHED'}

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-09-23 19:39:45 UTC (rev 40510)
+++ branches/soc-2011-tomato/release/scripts/startup/bl_ui/space_clip.py	2011-09-23 19:42:35 UTC (rev 40511)
@@ -18,88 +18,9 @@
 
 # <pep8 compliant>
 import bpy
-from bpy.types import Operator, Panel, Header, Menu
+from bpy.types import Panel, Header, Menu
 
 
-class CLIP_OT_track_to_empty(Operator):
-    bl_idname = "clip.track_to_empty"
-    bl_label = "2D Track to Empty"
-    bl_options = {'UNDO', 'REGISTER'}
-
-    @classmethod
-    def poll(cls, context):
-        if context.space_data.type != 'CLIP_EDITOR':
-            return False
-
-        sc = context.space_data
-        clip = sc.clip
-
-        return clip and clip.tracking.active_track
-
-    def execute(self, context):
-        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
-                break
-
-        if constraint is None:
-            constraint = ob.constraints.new(type='FOLLOW_TRACK')
-
-        constraint.clip = sc.clip
-        constraint.track = track.name
-        constraint.reference = 'TRACK'
-
-        return {'FINISHED'}
-
-
-class CLIP_OT_bundles_to_mesh(Operator):
-    bl_idname = "clip.bundles_to_mesh"
-    bl_label = "Bundles to Mesh"
-    bl_options = {'UNDO', 'REGISTER'}
-
-    @classmethod
-    def poll(cls, context):
-        if context.space_data.type != 'CLIP_EDITOR':
-            return False
-
-        sc = context.space_data
-        clip = sc.clip
-
-        return clip
-
-    def execute(self, context):
-        sc = context.space_data
-        clip = sc.clip
-
-        mesh = bpy.data.meshes.new(name="Bundles")
-        for track in clip.tracking.tracks:
-            if track.has_bundle:
-                mesh.vertices.add(1)
-                mesh.vertices[-1].co = track.bundle
-
-        ob = bpy.data.objects.new(name="Bundles", object_data=mesh)
-
-        bpy.context.scene.objects.link(ob)
-
-        return {'FINISHED'}
-
-
 class CLIP_HT_header(Header):
     bl_space_type = 'CLIP_EDITOR'
 
@@ -120,6 +41,7 @@
             if clip:
                 sub.menu("CLIP_MT_select")
                 sub.menu("CLIP_MT_track")
+                sub.menu("CLIP_MT_reconstruction")
 
         if clip:
             layout.prop(sc, "mode", text="")
@@ -641,11 +563,17 @@
         layout.active = clip.use_proxy
 
         layout.label(text="Build Sizes:")
+
         row = layout.row()
         row.prop(clip.proxy, "build_25")
         row.prop(clip.proxy, "build_50")
+
+        row = layout.row()
         row.prop(clip.proxy, "build_75")
+        row.prop(clip.proxy, "build_100")
 
+        layout.prop(clip.proxy, "build_undistorted")
+
         layout.prop(clip.proxy, "quality")
 
         layout.prop(clip, 'use_proxy_custom_directory')
@@ -662,9 +590,13 @@
 
         col = layout.column()
         col.label(text="Proxy render size:")
-        col.prop(clip, "proxy_render_size", text="")
 
+        col.prop(sc.clip_user, "proxy_render_size", text="")
+        row = col.row()
+        row.active = sc.clip_user.proxy_render_size != 'FULL'
+        row.prop(sc.clip_user, "use_render_undistorted")
 
+
 class CLIP_PT_footage(Panel):
     bl_space_type = 'CLIP_EDITOR'
     bl_region_type = 'UI'
@@ -728,38 +660,53 @@
         sc = context.space_data
         clip = sc.clip
 
+        layout.menu("CLIP_MT_proxy")
+
         if clip:
             layout.operator("clip.reload")
 
         layout.operator("clip.open")
 
 
+class CLIP_MT_proxy(Menu):
+    bl_label = "Proxy"
+
+    def draw(self, context):
+        layout = self.layout
+
+        sc = context.space_data
+        clip = sc.clip
+
+        layout.operator("clip.rebuild_proxy")
+        layout.operator("clip.delete_proxy")
+
+
 class CLIP_MT_track(Menu):
     bl_label = "Track"
 
     def draw(self, context):
         layout = self.layout
 
-        layout.operator("clip.set_origin")
-
-        layout.separator()
-        layout.operator("clip.clear_reconstruction")
+        layout.operator("clip.clear_solution")
         layout.operator("clip.solve_camera")
 
         layout.separator()
-        op = layout.operator("clip.clear_track_path", \
-             text="Clear Remained Path")
+        op = layout.operator("clip.clear_track_path", text="Clear After")
         op.action = 'REMAINED'
 
-        op = layout.operator("clip.clear_track_path", \
-             text="Clear Path Up To")
+        op = layout.operator("clip.clear_track_path", text="Clear Before")
         op.action = 'UPTO'
 
-        op = layout.operator("clip.clear_track_path", \
-             text="Clear Track Path")
+        op = layout.operator("clip.clear_track_path", text="Clear Track Path")
         op.action = 'ALL'
 
         layout.separator()
+        layout.operator("clip.join_tracks")

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list