[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [38398] branches/soc-2011-tomato: Camera tracking integration
Sergey Sharybin
g.ulairi at gmail.com
Thu Jul 14 17:21:55 CEST 2011
Revision: 38398
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=38398
Author: nazgul
Date: 2011-07-14 15:21:55 +0000 (Thu, 14 Jul 2011)
Log Message:
-----------
Camera tracking integration
===========================
Changes to tracking camers settings, so they could
be copied to Blender camera on reconstruction.
Sensor height doesn't make any sense yet for tracking camera.
Modified Paths:
--------------
branches/soc-2011-tomato/release/scripts/startup/bl_operators/presets.py
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/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
Modified: branches/soc-2011-tomato/release/scripts/startup/bl_operators/presets.py
===================================================================
--- branches/soc-2011-tomato/release/scripts/startup/bl_operators/presets.py 2011-07-14 15:21:45 UTC (rev 38397)
+++ branches/soc-2011-tomato/release/scripts/startup/bl_operators/presets.py 2011-07-14 15:21:55 UTC (rev 38398)
@@ -308,6 +308,7 @@
preset_values = [
"camera.focal_length",
"camera.sensor_width",
+ "camera.sensor_height",
"camera.units",
"camera.k1",
"camera.k2",
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-14 15:21:45 UTC (rev 38397)
+++ branches/soc-2011-tomato/release/scripts/startup/bl_ui/space_clip.py 2011-07-14 15:21:55 UTC (rev 38398)
@@ -273,7 +273,10 @@
op = row.operator("clip.camera_preset_add", text="", icon="ZOOMOUT")
op.remove_active = True
- layout.prop(clip.tracking.camera, "sensor_width")
+ layout.label(text="Sensor:")
+ row = layout.row(align=True)
+ row.prop(clip.tracking.camera, "sensor_width", text="X")
+ row.prop(clip.tracking.camera, "sensor_height", text="Y")
row = layout.row(align=True)
sub = row.split(percentage=0.65)
Modified: branches/soc-2011-tomato/source/blender/blenkernel/intern/movieclip.c
===================================================================
--- branches/soc-2011-tomato/source/blender/blenkernel/intern/movieclip.c 2011-07-14 15:21:45 UTC (rev 38397)
+++ branches/soc-2011-tomato/source/blender/blenkernel/intern/movieclip.c 2011-07-14 15:21:55 UTC (rev 38398)
@@ -215,6 +215,7 @@
clip= alloc_libblock(&G.main->movieclip, ID_MC, name);
clip->tracking.camera.sensor_width= 35.0f;
+ clip->tracking.camera.sensor_height= 18.0f;
clip->tracking.camera.units= CAMERA_UNITS_MM;
clip->tracking.settings.frames_limit= 20;
Modified: branches/soc-2011-tomato/source/blender/editors/space_clip/tracking_ops.c
===================================================================
--- branches/soc-2011-tomato/source/blender/editors/space_clip/tracking_ops.c 2011-07-14 15:21:45 UTC (rev 38397)
+++ branches/soc-2011-tomato/source/blender/editors/space_clip/tracking_ops.c 2011-07-14 15:21:55 UTC (rev 38398)
@@ -1023,15 +1023,20 @@
scene->camera= scene_find_camera(scene);
if(scene->camera) {
- float focal= clip->tracking.camera.focal;
+ MovieTracking *tracking= &clip->tracking;
+ float focal= tracking->camera.focal;
/* set blender camera focal length so result would look fine there */
if(focal) {
Camera *camera= (Camera*)scene->camera->data;
- if(clip->lastsize[0])
- camera->lens= focal*32.0f/(float)clip->lastsize[0];
+ if(clip->lastsize[0]) {
+ camera->sensor_x= tracking->camera.sensor_width;
+ camera->sensor_y= tracking->camera.sensor_height;
+ camera->lens= focal*camera->sensor_x/(float)clip->lastsize[0];
+ }
+
WM_event_add_notifier(C, NC_OBJECT, camera);
}
}
Modified: branches/soc-2011-tomato/source/blender/makesdna/DNA_tracking_types.h
===================================================================
--- branches/soc-2011-tomato/source/blender/makesdna/DNA_tracking_types.h 2011-07-14 15:21:45 UTC (rev 38397)
+++ branches/soc-2011-tomato/source/blender/makesdna/DNA_tracking_types.h 2011-07-14 15:21:55 UTC (rev 38398)
@@ -54,7 +54,9 @@
} MovieReconstructedCamera;
typedef struct MovieTrackingCamera {
- float sensor_width; /* width of CCD sensor */
+ float sensor_width; /* width of CCD sensor */
+ float sensor_height; /* height of CCD sensor */
+ float pad2;
float focal; /* focal length */
short units; /* units of focal length user is working with */
short pad;
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-14 15:21:45 UTC (rev 38397)
+++ branches/soc-2011-tomato/source/blender/makesrna/intern/rna_tracking.c 2011-07-14 15:21:55 UTC (rev 38398)
@@ -218,6 +218,13 @@
RNA_def_property_ui_text(prop, "Sensor Width", "Width of CCD sensor in millimeters");
RNA_def_property_update(prop, NC_MOVIECLIP|NA_EDITED, NULL);
+ /* Sensor height */
+ prop= RNA_def_property(srna, "sensor_height", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "sensor_height");
+ RNA_def_property_range(prop, 0.0f, 500.0f);
+ RNA_def_property_ui_text(prop, "Sensor Height", "Height of CCD sensor in millimeters");
+ RNA_def_property_update(prop, NC_MOVIECLIP|NA_EDITED, NULL);
+
/* Focal Length */
prop= RNA_def_property(srna, "focal_length", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "focal");
More information about the Bf-blender-cvs
mailing list