[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [41121] branches/soc-2011-tomato: Camera tracking integration
Sergey Sharybin
g.ulairi at gmail.com
Wed Oct 19 23:42:38 CEST 2011
Revision: 41121
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=41121
Author: nazgul
Date: 2011-10-19 21:42:37 +0000 (Wed, 19 Oct 2011)
Log Message:
-----------
Camera tracking integration
===========================
Fixes for codereview issues pointed by Brecht:
- Replace use_default_clip with use_active_clip setting for
motion-tracking constraints.
- Removed unneeded Clip panel from toolshelf when no clip is opened.
- Put options in Display panel in one column.
Don't want properties region be wider and it should also be
a bit easier to find option you need. Maybe additional re-shuffle
would be good here.
- Reversed order of items in Clip menu
- Re-ordered selection operators in clip editor Select menu to
match 3d viewport order.
- Share common part of sensor/shift and so detection between
object_camera_matrix and Follow Track constraint.
- Fixed typos in translate mode caused by copying files.
- Movie clip angle output is now in radians. Transform node now
accepts rotation in radians too.
- Use scale-rotate-translate order for transformation node and
stabilization data.
Also makes sense when using transform node for non-tracking goals:
image would stay centered when applying only rotation and scale.
Think it's nicer.
- Fixed compilation error caused by recent node-update commit.
Modified Paths:
--------------
branches/soc-2011-tomato/release/scripts/startup/bl_operators/clip.py
branches/soc-2011-tomato/release/scripts/startup/bl_ui/properties_object_constraint.py
branches/soc-2011-tomato/release/scripts/startup/bl_ui/space_clip.py
branches/soc-2011-tomato/source/blender/blenkernel/BKE_object.h
branches/soc-2011-tomato/source/blender/blenkernel/intern/constraint.c
branches/soc-2011-tomato/source/blender/blenkernel/intern/depsgraph.c
branches/soc-2011-tomato/source/blender/blenkernel/intern/object.c
branches/soc-2011-tomato/source/blender/blenkernel/intern/tracking.c
branches/soc-2011-tomato/source/blender/editors/object/object_constraint.c
branches/soc-2011-tomato/source/blender/editors/transform/transform_conversions.c
branches/soc-2011-tomato/source/blender/makesdna/DNA_constraint_types.h
branches/soc-2011-tomato/source/blender/makesrna/intern/rna_camera.c
branches/soc-2011-tomato/source/blender/makesrna/intern/rna_constraint.c
branches/soc-2011-tomato/source/blender/makesrna/intern/rna_tracking.c
branches/soc-2011-tomato/source/blender/nodes/composite/node_composite_tree.c
branches/soc-2011-tomato/source/blender/nodes/composite/nodes/node_composite_movieclip.c
branches/soc-2011-tomato/source/blender/nodes/composite/nodes/node_composite_transform.c
Modified: branches/soc-2011-tomato/release/scripts/startup/bl_operators/clip.py
===================================================================
--- branches/soc-2011-tomato/release/scripts/startup/bl_operators/clip.py 2011-10-19 21:37:07 UTC (rev 41120)
+++ branches/soc-2011-tomato/release/scripts/startup/bl_operators/clip.py 2011-10-19 21:42:37 UTC (rev 41121)
@@ -107,6 +107,12 @@
bl_label = "Delete Proxy"
bl_options = {'UNDO', 'REGISTER'}
+ @classmethod
+ def poll(cls, context):
+ sc = context.space_data
+
+ return sc.clip
+
def invoke(self, context, event):
wm = context.window_manager
Modified: branches/soc-2011-tomato/release/scripts/startup/bl_ui/properties_object_constraint.py
===================================================================
--- branches/soc-2011-tomato/release/scripts/startup/bl_ui/properties_object_constraint.py 2011-10-19 21:37:07 UTC (rev 41120)
+++ branches/soc-2011-tomato/release/scripts/startup/bl_ui/properties_object_constraint.py 2011-10-19 21:42:37 UTC (rev 41121)
@@ -754,9 +754,9 @@
col.prop(con, "rotation_range", text="Pivot When")
def FOLLOW_TRACK(self, context, layout, con):
- layout.prop(con, "use_default_clip")
+ layout.prop(con, "use_active_clip")
- if not con.use_default_clip:
+ if not con.use_active_clip:
layout.prop(con, "clip")
layout.prop(con, "track")
@@ -767,9 +767,9 @@
layout.operator("clip.constraint_to_fcurve")
def CAMERA_SOLVER(self, context, layout, con):
- layout.prop(con, "use_default_clip")
+ layout.prop(con, "use_active_clip")
- if not con.use_default_clip:
+ if not con.use_active_clip:
layout.prop(con, "clip")
layout.operator("clip.constraint_to_fcurve")
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-10-19 21:37:07 UTC (rev 41120)
+++ branches/soc-2011-tomato/release/scripts/startup/bl_ui/space_clip.py 2011-10-19 21:42:37 UTC (rev 41121)
@@ -36,10 +36,13 @@
if context.area.show_menus:
sub = row.row(align=True)
sub.menu("CLIP_MT_view")
- sub.menu("CLIP_MT_clip")
if clip:
sub.menu("CLIP_MT_select")
+
+ sub.menu("CLIP_MT_clip")
+
+ if clip:
sub.menu("CLIP_MT_track")
sub.menu("CLIP_MT_reconstruction")
@@ -70,23 +73,6 @@
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'
@@ -397,27 +383,22 @@
layout = self.layout
sc = context.space_data
- row = layout.row()
- row.prop(sc, "show_marker_pattern", text="Pattern")
- row.prop(sc, "show_marker_search", text="Search")
+ layout.prop(sc, "show_marker_pattern", text="Pattern")
+ layout.prop(sc, "show_marker_search", text="Search")
- row = layout.row()
- row.prop(sc, "show_track_path", text="Path")
- sub = row.column()
- sub.active = sc.show_track_path
- sub.prop(sc, "path_length", text="Length")
+ layout.prop(sc, "show_track_path", text="Path")
+ row = layout.column()
+ row.active = sc.show_track_path
+ row.prop(sc, "path_length", text="Length")
- row = layout.row()
- row.prop(sc, "show_disabled", text="Disabled")
- row.prop(sc, "show_bundles", text="Bundles")
+ layout.prop(sc, "show_disabled", text="Disabled")
+ layout.prop(sc, "show_bundles", text="Bundles")
- row = layout.row()
- row.prop(sc, "show_names", text="Names")
- row.prop(sc, "show_tiny_markers", text="Tiny Markers")
+ layout.prop(sc, "show_names", text="Names")
+ layout.prop(sc, "show_tiny_markers", text="Tiny Markers")
- row = layout.row()
- row.prop(sc, "show_grease_pencil", text="Grease Pencil")
- row.prop(sc, "use_mute_footage", text="Mute")
+ layout.prop(sc, "show_grease_pencil", text="Grease Pencil")
+ layout.prop(sc, "use_mute_footage", text="Mute")
if sc.mode == 'DISTORTION':
layout.prop(sc, "show_grid", text="Grid")
@@ -635,6 +616,12 @@
bl_region_type = 'TOOLS'
bl_label = "Clip"
+ @classmethod
+ def poll(cls, context):
+ sc = context.space_data
+
+ return sc.clip
+
def draw(self, context):
layout = self.layout
clip = context.space_data.clip
@@ -681,14 +668,13 @@
sc = context.space_data
clip = sc.clip
- layout.menu("CLIP_MT_proxy")
+ layout.operator("clip.open")
if clip:
layout.operator("clip.reload")
+ layout.menu("CLIP_MT_proxy")
- layout.operator("clip.open")
-
class CLIP_MT_proxy(Menu):
bl_label = "Proxy"
@@ -803,13 +789,17 @@
sc = context.space_data
- layout.menu("CLIP_MT_select_grouped")
layout.operator("clip.select_border")
layout.operator("clip.select_circle")
+
+ layout.separator()
+
layout.operator("clip.select_all", text="Select/Deselect all")
layout.operator("clip.select_all", text="Inverse").action = 'INVERT'
+ layout.menu("CLIP_MT_select_grouped")
+
class CLIP_MT_select_grouped(Menu):
bl_label = "Select Grouped"
Modified: branches/soc-2011-tomato/source/blender/blenkernel/BKE_object.h
===================================================================
--- branches/soc-2011-tomato/source/blender/blenkernel/BKE_object.h 2011-10-19 21:37:07 UTC (rev 41120)
+++ branches/soc-2011-tomato/source/blender/blenkernel/BKE_object.h 2011-10-19 21:42:37 UTC (rev 41121)
@@ -143,6 +143,8 @@
int object_is_modified(struct Scene *scene, struct Object *ob);
void object_camera_mode(struct RenderData *rd, struct Object *camera);
+void object_camera_intrinsics(struct Object *camera, struct Camera **cam_r, short *is_ortho, float *shiftx, float *shifty,
+ float *clipsta, float *clipend, float *lens, float *sensor_x);
void object_camera_matrix(
struct RenderData *rd, struct Object *camera, int winx, int winy, short field_second,
float winmat[][4], struct rctf *viewplane, float *clipsta, float *clipend, float *lens, float *sensor_x, float *ycor,
Modified: branches/soc-2011-tomato/source/blender/blenkernel/intern/constraint.c
===================================================================
--- branches/soc-2011-tomato/source/blender/blenkernel/intern/constraint.c 2011-10-19 21:37:07 UTC (rev 41120)
+++ branches/soc-2011-tomato/source/blender/blenkernel/intern/constraint.c 2011-10-19 21:42:37 UTC (rev 41121)
@@ -3942,7 +3942,7 @@
bFollowTrackConstraint *data= (bFollowTrackConstraint *)cdata;
data->clip= NULL;
- data->flag|= FOLLOWTRACK_DEFAULTCLIP;
+ data->flag|= FOLLOWTRACK_ACTIVECLIP;
data->reference= FOLLOWTRACK_TRACK;
}
@@ -3960,7 +3960,7 @@
MovieClip *clip= data->clip;
MovieTrackingTrack *track;
- if(data->flag&FOLLOWTRACK_DEFAULTCLIP)
+ if(data->flag&FOLLOWTRACK_ACTIVECLIP)
clip= scene->clip;
if(!clip || !data->track[0])
@@ -3992,7 +3992,7 @@
MovieTrackingMarker *marker;
float vec[3], disp[3], axis[3], mat[4][4];
float aspect= (scene->r.xsch*scene->r.xasp) / (scene->r.ysch*scene->r.yasp);
- float sensor_x, lens, len, d, ortho_scale;
+ float sensor_x, lens, len, d, ortho_scale= 1.f;
where_is_object_mat(scene, camob, mat);
@@ -4010,39 +4010,23 @@
len= len_v3(disp);
if(len>FLT_EPSILON) {
- float pos[2], rmat[4][4];
- int is_ortho= 0;
+ float pos[2], rmat[4][4], shiftx= 0.0f, shifty= 0.0f, clipsta= 0.0f, clipend= 0.0f;
+ short is_ortho= 0;
+ Camera *cam= NULL;
user.framenr= scene->r.cfra;
marker= BKE_tracking_get_marker(track, user.framenr);
add_v2_v2v2(pos, marker->pos, track->offset);
- /* calculate lens and sensor size depends on object type */
- if(camob->type==OB_CAMERA) {
- Camera *camera= (Camera *)camob->data;
+ object_camera_intrinsics(camob, &cam, &is_ortho, &shiftx, &shifty, &clipsta, &clipend, &lens, &sensor_x);
- sensor_x= camera->sensor_x;
- lens= camera->lens;
- is_ortho= camera->type == CAM_ORTHO;
- ortho_scale= camera->ortho_scale;
- } else if (camob->type==OB_LAMP) {
- Lamp *la= camob->data;
- float fac= cosf((float)M_PI*la->spotsize/360.0f);
- float phi= acos(fac);
-
- lens= 16.0f*fac/sinf(phi);
- sensor_x= 32.f;
- ortho_scale= 0.f;
- } else {
- lens= 16.f;
- sensor_x= 32.f;
- ortho_scale= 0.f;
- }
-
if(is_ortho) {
- vec[0]= ortho_scale * (pos[0]-0.5f);
- vec[1]= ortho_scale * (pos[1]-0.5f);
+ if(cam)
+ ortho_scale= cam->ortho_scale;
+
+ vec[0]= ortho_scale * (pos[0]-0.5f+shiftx);
+ vec[1]= ortho_scale * (pos[1]-0.5f+shifty);
vec[2]= -len;
if(aspect>1.f) vec[1]/= aspect;
@@ -4059,8 +4043,8 @@
else {
d= (len*sensor_x) / (2.f*lens);
- vec[0]= d*(2.f*pos[0]-1.f);
- vec[1]= d*(2.f*pos[1]-1.f);
+ vec[0]= d*(2.f*(pos[0]+shiftx)-1.f);
+ vec[1]= d*(2.f*(pos[1]+shifty)-1.f);
vec[2]= -len;
if(aspect>1.f) vec[1]/= aspect;
@@ -4103,7 +4087,7 @@
bCameraSolverConstraint *data= (bCameraSolverConstraint *)cdata;
data->clip= NULL;
- data->flag|= CAMERASOLVER_DEFAULTCLIP;
+ data->flag|= CAMERASOLVER_ACTIVECLIP;
}
static void camerasolver_id_looper (bConstraint *con, ConstraintIDFunc func, void *userdata)
@@ -4119,7 +4103,7 @@
bCameraSolverConstraint *data= con->data;
MovieClip *clip= data->clip;
- if(data->flag&CAMERASOLVER_DEFAULTCLIP)
+ if(data->flag&CAMERASOLVER_ACTIVECLIP)
clip= scene->clip;
if(clip) {
Modified: branches/soc-2011-tomato/source/blender/blenkernel/intern/depsgraph.c
===================================================================
--- branches/soc-2011-tomato/source/blender/blenkernel/intern/depsgraph.c 2011-10-19 21:37:07 UTC (rev 41120)
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list