Camera tracking: interface cleanup and small buttons renaming

- Move tracking-related constraints to own section in list
  Currently there are only two constraints, so can look a bit odd,
  but it'll be other constraints like "Object Solver" and so.
- Move motion-tracking parameters from 3D viewport Display panel
  to it's own panel.
- Get rid of "Bundle" in 3d viewport. It's quite obvious that it's
  a 3D representation of tracks is used in 3D viewport and it shouldn't
  be so confusing for artists now.
- Also get rid of "Bundle" in Follow Track constraint.
  Old files can change a bit because of changes in DNA.
- Also get rid of "Bundles" in operator which creates vertices cloud
  from 3D position of tracks.
- Rename "Principal Point" to "Optical Center" in the interface.
This commit is contained in:
Sergey Sharybin 2011-11-14 06:41:42 +00:00
parent 0f82384fd0
commit f474576351
9 changed files with 66 additions and 56 deletions

@ -63,16 +63,16 @@ class CLIP_OT_track_to_empty(Operator):
constraint.clip = sc.clip
constraint.track = track.name
constraint.reference = 'TRACK'
constraint.use_3d_position = False
return {'FINISHED'}
class CLIP_OT_bundles_to_mesh(Operator):
"""Create vertex cloud using coordinates of bundles"""
class CLIP_OT_tracks_to_mesh(Operator):
"""Create vertex cloud using coordinates of tracks"""
bl_idname = "clip.bundles_to_mesh"
bl_label = "Bundles to Mesh"
bl_idname = "clip.tracks_to_mesh"
bl_label = "Tracks to Mesh"
bl_options = {'UNDO', 'REGISTER'}
@classmethod
@ -91,7 +91,7 @@ class CLIP_OT_bundles_to_mesh(Operator):
new_verts = []
mesh = bpy.data.meshes.new(name="Bundles")
mesh = bpy.data.meshes.new(name="Tracks")
for track in clip.tracking.tracks:
if track.has_bundle:
new_verts.append(track.bundle)
@ -100,7 +100,7 @@ class CLIP_OT_bundles_to_mesh(Operator):
mesh.vertices.add(len(new_verts))
mesh.vertices.foreach_set("co", unpack_list(new_verts))
ob = bpy.data.objects.new(name="Bundles", object_data=mesh)
ob = bpy.data.objects.new(name="Tracks", object_data=mesh)
bpy.context.scene.objects.link(ob)
@ -252,7 +252,7 @@ class CLIP_OT_constraint_to_fcurve(Operator):
if not con:
return
if con.type == 'FOLLOW_TRACK' and con.reference == 'BUNDLE':
if con.type == 'FOLLOW_TRACK' and con.use_3d_position:
mat = ob.matrix_world.copy()
ob.constraints.remove(con)
ob.matrix_world = mat

@ -754,14 +754,15 @@ class ConstraintButtonsPanel():
col.prop(con, "rotation_range", text="Pivot When")
def FOLLOW_TRACK(self, context, layout, con):
layout.prop(con, "use_active_clip")
row = layout.row()
row.prop(con, "use_active_clip")
row.prop(con, "use_3d_position")
if not con.use_active_clip:
layout.prop(con, "clip")
layout.prop(con, "track")
layout.row().prop(con, "reference", expand=True)
layout.operator("clip.constraint_to_fcurve")

@ -205,7 +205,7 @@ class CLIP_PT_tools_geometry(Panel):
def draw(self, context):
layout = self.layout
layout.operator("clip.bundles_to_mesh")
layout.operator("clip.tracks_to_mesh")
layout.operator("clip.track_to_empty")
@ -227,7 +227,6 @@ class CLIP_PT_tools_orientation(Panel):
settings = sc.clip.tracking.settings
col = layout.column(align=True)
col.label(text="Scene Orientation:")
col.operator("clip.set_floor")
col.operator("clip.set_origin")
@ -371,7 +370,7 @@ class CLIP_PT_tracking_camera(Panel):
col.prop(clip.tracking.camera, "pixel_aspect")
col = layout.column()
col.label(text="Principal Point")
col.label(text="Optical Center:")
row = col.row()
row.prop(clip.tracking.camera, "principal", text="")
col.operator("clip.set_center_principal", text="Center")
@ -769,7 +768,7 @@ class CLIP_MT_reconstruction(Menu):
layout.separator()
layout.operator("clip.track_to_empty")
layout.operator("clip.bundles_to_mesh")
layout.operator("clip.tracks_to_mesh")
class CLIP_MT_track_visibility(Menu):

@ -2165,16 +2165,6 @@ class VIEW3D_PT_view3d_display(Panel):
layout.separator()
layout.prop(view, "show_reconstruction")
if view.show_reconstruction:
layout.label(text="Bundle type:")
layout.prop(view, "bundle_draw_type", text="")
layout.prop(view, "bundle_draw_size")
layout.prop(view, "show_bundle_name")
layout.prop(view, "show_camera_path")
layout.separator()
region = view.region_quadview
layout.operator("screen.region_quadview", text="Toggle Quad View")
@ -2190,6 +2180,37 @@ class VIEW3D_PT_view3d_display(Panel):
row.prop(region, "use_box_clip")
class VIEW3D_PT_view3d_motion_tracking(Panel):
bl_space_type = 'VIEW_3D'
bl_region_type = 'UI'
bl_label = "Motion Tracking"
bl_options = {'DEFAULT_CLOSED'}
@classmethod
def poll(cls, context):
view = context.space_data
return (view)
def draw_header(self, context):
layout = self.layout
view = context.space_data
layout.prop(view, "show_reconstruction", text="")
def draw(self, context):
layout = self.layout
view = context.space_data
col = layout.column()
col.active = view.show_reconstruction
col.prop(view, "show_tracks_name", text="Show Names")
col.prop(view, "show_camera_path")
col.label(text="Tracks:")
col.prop(view, "tracks_draw_type", text="")
col.prop(view, "tracks_draw_size", text="Size")
class VIEW3D_PT_view3d_meshdisplay(Panel):
bl_space_type = 'VIEW_3D'
bl_region_type = 'UI'

@ -3939,7 +3939,6 @@ static void followtrack_new_data (void *cdata)
data->clip= NULL;
data->flag|= FOLLOWTRACK_ACTIVECLIP;
data->reference= FOLLOWTRACK_TRACK;
}
static void followtrack_id_looper (bConstraint *con, ConstraintIDFunc func, void *userdata)
@ -3967,7 +3966,7 @@ static void followtrack_evaluate (bConstraint *con, bConstraintOb *cob, ListBase
if(!track)
return;
if(data->reference==FOLLOWTRACK_BUNDLE) {
if(data->flag&FOLLOWTRACK_USE_3D_POSITION) {
if(track->flag&TRACK_HAS_BUNDLE) {
float pos[3], mat[4][4], obmat[4][4];

@ -410,7 +410,7 @@ typedef struct bShrinkwrapConstraint {
typedef struct bFollowTrackConstraint {
struct MovieClip *clip;
char track[24];
int flag, reference;
int flag, pad;
} bFollowTrackConstraint;
/* Camera Solver constraints */
@ -751,14 +751,9 @@ typedef enum ePivotConstraint_Flag {
PIVOTCON_FLAG_ROTACT_NEG = (1<<1)
} ePivotConstraint_Flag;
/* FollowTrack Constraint -> flag */
typedef enum eFollowTrack_Reference {
FOLLOWTRACK_TRACK = (1<<0),
FOLLOWTRACK_BUNDLE = (1<<1)
} FollowTrack_Reference;
typedef enum eFollowTrack_Flags {
FOLLOWTRACK_ACTIVECLIP = (1<<0)
FOLLOWTRACK_ACTIVECLIP = (1<<0),
FOLLOWTRACK_USE_3D_POSITION = (1<<1)
} eFollowTrack_Flags;
/* CameraSolver Constraint -> flag */

@ -43,6 +43,9 @@
#include "WM_types.h"
EnumPropertyItem constraint_type_items[] ={
{0, "", 0, "Motion Tracking", ""},
{CONSTRAINT_TYPE_CAMERASOLVER, "CAMERA_SOLVER", ICON_CONSTRAINT_DATA, "Camera Solver", ""},
{CONSTRAINT_TYPE_FOLLOWTRACK, "FOLLOW_TRACK", ICON_CONSTRAINT_DATA, "Follow Track", ""},
{0, "", 0, "Transform", ""},
{CONSTRAINT_TYPE_LOCLIKE, "COPY_LOCATION", ICON_CONSTRAINT_DATA, "Copy Location", ""},
{CONSTRAINT_TYPE_ROTLIKE, "COPY_ROTATION", ICON_CONSTRAINT_DATA, "Copy Rotation", ""},
@ -64,11 +67,9 @@ EnumPropertyItem constraint_type_items[] ={
{CONSTRAINT_TYPE_TRACKTO, "TRACK_TO", ICON_CONSTRAINT_DATA, "Track To", "Legacy tracking constraint prone to twisting artifacts"},
{0, "", 0, "Relationship", ""},
{CONSTRAINT_TYPE_ACTION, "ACTION", ICON_CONSTRAINT_DATA, "Action", ""},
{CONSTRAINT_TYPE_CAMERASOLVER, "CAMERA_SOLVER", ICON_CONSTRAINT_DATA, "Camera Solver", ""},
{CONSTRAINT_TYPE_CHILDOF, "CHILD_OF", ICON_CONSTRAINT_DATA, "Child Of", ""},
{CONSTRAINT_TYPE_MINMAX, "FLOOR", ICON_CONSTRAINT_DATA, "Floor", ""},
{CONSTRAINT_TYPE_FOLLOWPATH, "FOLLOW_PATH", ICON_CONSTRAINT_DATA, "Follow Path", ""},
{CONSTRAINT_TYPE_FOLLOWTRACK, "FOLLOW_TRACK", ICON_CONSTRAINT_DATA, "Follow Track", ""},
{CONSTRAINT_TYPE_PIVOT, "PIVOT", ICON_CONSTRAINT_DATA, "Pivot", ""},
{CONSTRAINT_TYPE_RIGIDBODYJOINT, "RIGID_BODY_JOINT", ICON_CONSTRAINT_DATA, "Rigid Body Joint", ""},
{CONSTRAINT_TYPE_PYTHON, "SCRIPT", ICON_CONSTRAINT_DATA, "Script", ""},
@ -2037,11 +2038,6 @@ static void rna_def_constraint_follow_track(BlenderRNA *brna)
StructRNA *srna;
PropertyRNA *prop;
static EnumPropertyItem reference_items[] = {
{FOLLOWTRACK_TRACK, "TRACK", 0, "Track", "Use 2D track position as reference"},
{FOLLOWTRACK_BUNDLE, "BUNDLE", 0, "Bundle", "Use 3D reconstructed bundle position as reference"},
{0, NULL, 0, NULL, NULL}};
srna= RNA_def_struct(brna, "FollowTrackConstraint", "Constraint");
RNA_def_struct_ui_text(srna, "Follow Track Constraint", "Locks motion to the target motion track");
RNA_def_struct_sdna_from(srna, "bFollowTrackConstraint", "data");
@ -2059,18 +2055,17 @@ static void rna_def_constraint_follow_track(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Track", "Movie tracking track to follow");
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
/* reference */
prop= RNA_def_property(srna, "reference", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "reference");
RNA_def_property_enum_items(prop, reference_items);
RNA_def_property_ui_text(prop, "Reference", "Reference source to follow");
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
/* use default clip */
prop= RNA_def_property(srna, "use_active_clip", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", FOLLOWTRACK_ACTIVECLIP);
RNA_def_property_ui_text(prop, "Active Clip", "Use active clip defined in scene");
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
/* use 3d position */
prop= RNA_def_property(srna, "use_3d_position", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", FOLLOWTRACK_USE_3D_POSITION);
RNA_def_property_ui_text(prop, "3D Position", "Use 3D position of track to parent to");
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
}
static void rna_def_constraint_camera_solver(BlenderRNA *brna)

@ -1579,16 +1579,16 @@ static void rna_def_space_view3d(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Show Reconstruction", "Display reconstruction data from active movie clip");
RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
prop= RNA_def_property(srna, "bundle_draw_size", PROP_FLOAT, PROP_NONE);
prop= RNA_def_property(srna, "tracks_draw_size", PROP_FLOAT, PROP_NONE);
RNA_def_property_range(prop, 0.0, FLT_MAX);
RNA_def_property_float_sdna(prop, NULL, "bundle_size");
RNA_def_property_ui_text(prop, "Bundle Size", "Display size of bundles from reconstructed data");
RNA_def_property_ui_text(prop, "Tracks Size", "Display size of tracks from reconstructed data");
RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
prop= RNA_def_property(srna, "bundle_draw_type", PROP_ENUM, PROP_NONE);
prop= RNA_def_property(srna, "tracks_draw_type", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "bundle_drawtype");
RNA_def_property_enum_items(prop, bundle_drawtype_items);
RNA_def_property_ui_text(prop, "Bundle Display Type", "Viewport display style for bundles");
RNA_def_property_ui_text(prop, "Tracks Display Type", "Viewport display style for tracks");
RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
prop= RNA_def_property(srna, "show_camera_path", PROP_BOOLEAN, PROP_NONE);
@ -1596,9 +1596,9 @@ static void rna_def_space_view3d(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Show Camera Path", "Show reconstructed path of camera");
RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
prop= RNA_def_property(srna, "show_bundle_name", PROP_BOOLEAN, PROP_NONE);
prop= RNA_def_property(srna, "show_tracks_name", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag2", V3D_SHOW_BUNDLENAME);
RNA_def_property_ui_text(prop, "Show Bundle Name", "Show names for bundle objects");
RNA_def_property_ui_text(prop, "Show Tracks Name", "Show names for tracks objects");
RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
/* region */

@ -233,12 +233,12 @@ static void rna_def_trackingSettings(BlenderRNA *brna)
{0, "NONE", 0, "Nothing", "Do not refine camera intrinsics"},
{REFINE_FOCAL_LENGTH, "FOCAL_LENGTH", 0, "Focal Length", "Refine focal length"},
{REFINE_FOCAL_LENGTH|
REFINE_PRINCIPAL_POINT, "FOCAL_LENGTH_PRINCIPAL_POINT", 0, "Focal Length, Principal Point", "Refine focal length and principal point"},
REFINE_PRINCIPAL_POINT, "FOCAL_LENGTH_PRINCIPAL_POINT", 0, "Focal Length, Optical Center", "Refine focal length and optical center"},
{REFINE_FOCAL_LENGTH|
REFINE_PRINCIPAL_POINT|
REFINE_RADIAL_DISTORTION_K1|
REFINE_RADIAL_DISTORTION_K2,
"FOCAL_LENGTH_PRINCIPAL_POINT_RADIAL_K1_K2", 0, "Focal Length, Principal Point, K1, K2", "Refine focal length, principal point and radial distortion K1 and K2"},
"FOCAL_LENGTH_PRINCIPAL_POINT_RADIAL_K1_K2", 0, "Focal Length, Optical Center, K1, K2", "Refine focal length, optical center and radial distortion K1 and K2"},
{REFINE_FOCAL_LENGTH|
REFINE_RADIAL_DISTORTION_K1|
REFINE_RADIAL_DISTORTION_K2, "FOCAL_LENGTH_RADIAL_K1_K2", 0, "Focal length, K1. K2", "Refine focal length and radial distortion K1 and K2"},