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

Sergey Sharybin g.ulairi at gmail.com
Tue Jul 12 20:04:30 CEST 2011


Revision: 38338
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=38338
Author:   nazgul
Date:     2011-07-12 18:04:29 +0000 (Tue, 12 Jul 2011)
Log Message:
-----------
Camera tracking integration
===========================

- Fixed typo in RNA api for has_bundle.
- Added operator "Bundles To Mesh".
  It was a request from Sebastian and this operator creates mesh
  with vertices using bundles coords for vertices coordinates.
  A bit limited atm -- new object can't be parented to camera,
  so changing camera orientation would requite mesh re-creation.

Modified Paths:
--------------
    branches/soc-2011-tomato/release/scripts/startup/bl_ui/space_clip.py
    branches/soc-2011-tomato/source/blender/makesrna/intern/rna_tracking.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-07-12 15:32:07 UTC (rev 38337)
+++ branches/soc-2011-tomato/release/scripts/startup/bl_ui/space_clip.py	2011-07-12 18:04:29 UTC (rev 38338)
@@ -57,6 +57,44 @@
         return {'FINISHED'}
 
 
+class CLIP_OT_bundles_to_mesh(bpy.types.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)
+
+        camera = bpy.context.scene.camera
+        if camera:
+            ob.location = camera.location
+            ob.rotation_quaternion = camera.rotation_quaternion
+            ob.rotation_euler = camera.rotation_euler
+
+        bpy.context.scene.objects.link(ob)
+
+        return {'FINISHED'}
+
+
 class CLIP_HT_header(bpy.types.Header):
     bl_space_type = 'CLIP_EDITOR'
 
@@ -141,6 +179,9 @@
             col.operator("clip.clear_reconstruction")
 
             col = layout.column(align=True)
+            col.operator("clip.bundles_to_mesh")
+
+            col = layout.column(align=True)
             col.label(text="Scene Orientation:")
             col.operator("clip.set_origin")
         else:

Modified: branches/soc-2011-tomato/source/blender/makesrna/intern/rna_tracking.c
===================================================================
--- branches/soc-2011-tomato/source/blender/makesrna/intern/rna_tracking.c	2011-07-12 15:32:07 UTC (rev 38337)
+++ branches/soc-2011-tomato/source/blender/makesrna/intern/rna_tracking.c	2011-07-12 18:04:29 UTC (rev 38338)
@@ -346,7 +346,7 @@
 	RNA_def_property_ui_text(prop, "Use Blue Channel", "Use blue channel from footage for tracking");
 
 	/* has bundle */
-	prop= RNA_def_property(srna, "bas_bundle", PROP_BOOLEAN, PROP_NONE);
+	prop= RNA_def_property(srna, "has_bundle", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", TRACK_HAS_BUNDLE);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Has Bundle", "True if track has a valid bundle");




More information about the Bf-blender-cvs mailing list