Camera trackign integration
authorSergey Sharybin <sergey.vfx@gmail.com>
Thu, 14 Jul 2011 15:52:00 +0000 (15:52 +0000)
committerSergey Sharybin <sergey.vfx@gmail.com>
Thu, 14 Jul 2011 15:52:00 +0000 (15:52 +0000)
===========================

- Fixed compilation error with OpenCOLLADA
- Added sample preset for tracking camera.
- Fixed bug with wrong order of preset properties loading/saving.

release/scripts/presets/tracking_camera/Blender.py [new file with mode: 0644]
release/scripts/startup/bl_operators/presets.py
source/blender/collada/DocumentImporter.cpp

diff --git a/release/scripts/presets/tracking_camera/Blender.py b/release/scripts/presets/tracking_camera/Blender.py
new file mode 100644 (file)
index 0000000..cbc15e8
--- /dev/null
@@ -0,0 +1,10 @@
+import bpy
+camera = bpy.context.edit_movieclip.tracking.camera
+
+camera.sensor_width = 32.0
+camera.sensor_height = 18.0
+camera.units = 'MILLIMETERS'
+camera.focal_length = 35.0
+camera.k1 = 0.0
+camera.k2 = 0.0
+camera.k3 = 0.0
index 75dfafc663fcc4359c65c839f87b8e2014798857..d6607f58d32f97bf9cd6142e5006cdfedcc41b89 100644 (file)
@@ -306,10 +306,10 @@ class AddPresetTrackingCamera(AddPresetBase, bpy.types.Operator):
     ]
 
     preset_values = [
-        "camera.focal_length",
         "camera.sensor_width",
         "camera.sensor_height",
         "camera.units",
+        "camera.focal_length",
         "camera.k1",
         "camera.k2",
         "camera.k3"
index 28bf9af8e17c83d5a06009f90f1d3d717afb3602..e0e292dd960c61aa2170d0a4f67d4d74a6355519 100644 (file)
@@ -834,7 +834,7 @@ bool DocumentImporter::writeCamera( const COLLADAFW::Camera* camera )
                                        {
                                        double yfov = camera->getYFov().getValue();
                                        // yfov is in degrees, cam->lens is in millimiters
-                                       cam->lens = hfov_to_focallength((float)x*(M_PI/180.0f), cam->sensor_x);
+                                       cam->lens = hfov_to_focallength((float)yfov*(M_PI/180.0f), cam->sensor_x);
                                        }
                                        break;
                        }