Camera tracking integration

===========================

- Hide all reconreuction-related sliders from Display N-panel
  of 3D viewport if "Show Reconstruction" is turned off.
- Added setting for shape of bundle. Default is sphere.
This commit is contained in:
Sergey Sharybin
2011-07-20 12:46:22 +00:00
parent f26aa456e7
commit add176fe6a
6 changed files with 62 additions and 52 deletions

View File

@@ -2181,11 +2181,12 @@ class VIEW3D_PT_view3d_display(bpy.types.Panel):
layout.separator()
layout.prop(view, "show_reconstruction")
sub = layout.column()
sub.active = view.show_reconstruction
sub.prop(view, "bundle_size")
sub.prop(view, "show_bundle_name")
sub.prop(view, "show_camera_path")
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()

View File

@@ -11823,10 +11823,14 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
for (sl= sa->spacedata.first; sl; sl= sl->next) {
if(sl->spacetype==SPACE_VIEW3D) {
View3D *v3d= (View3D *)sl;
if(v3d->bundle_size==0.0f) {
v3d->bundle_size= 0.1f;
v3d->flag2 |= V3D_SHOW_RECONSTRUCTION;
}
if(v3d->bundle_drawtype==0)
v3d->bundle_drawtype= OB_EMPTY_SPHERE;
}
else if(sl->spacetype==SPACE_CLIP) {
SpaceClip *sc= (SpaceClip *)sl;

View File

@@ -1401,37 +1401,6 @@ static void draw_bundle_sphere(void)
glCallList(displist);
}
static void draw_bundle_outline(void)
{
static GLuint displist=0;
if (displist == 0) {
GLUquadricObj *qobj;
displist= glGenLists(1);
glNewList(displist, GL_COMPILE);
glPushMatrix();
qobj= gluNewQuadric();
gluQuadricDrawStyle(qobj, GLU_SILHOUETTE);
gluDisk(qobj, 0.0, 0.05, 8, 1);
glRotatef(90, 0, 1, 0);
gluDisk(qobj, 0.0, 0.05, 8, 1);
glRotatef(90, 1, 0, 0);
gluDisk(qobj, 0.0, 0.05, 8, 1);
gluDeleteQuadric(qobj);
glPopMatrix();
glEndList();
}
glCallList(displist);
}
static void draw_viewport_reconstruction(Scene *scene, Base *base, View3D *v3d, MovieClip *clip, int flag)
{
MovieTracking *tracking= &clip->tracking;
@@ -1487,31 +1456,46 @@ static void draw_viewport_reconstruction(Scene *scene, Base *base, View3D *v3d,
else UI_ThemeColor(TH_SELECT);
} else UI_ThemeColor(TH_WIRE);
draw_bundle_outline();
drawaxes(0.05f, v3d->bundle_drawtype);
glDepthMask(1);
glEnable(GL_LIGHTING);
} else if(v3d->drawtype>OB_WIRE) {
/* selection outline */
if(TRACK_SELECTED(track)) {
if(base==BASACT) UI_ThemeColor(TH_ACTIVE);
else UI_ThemeColor(TH_SELECT);
if(v3d->bundle_drawtype==OB_EMPTY_SPHERE) {
/* selection outline */
if(TRACK_SELECTED(track)) {
if(base==BASACT) UI_ThemeColor(TH_ACTIVE);
else UI_ThemeColor(TH_SELECT);
glDepthMask(0);
glLineWidth(2.f);
glDisable(GL_LIGHTING);
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
glDepthMask(0);
glLineWidth(2.f);
glDisable(GL_LIGHTING);
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
draw_bundle_sphere();
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
glEnable(GL_LIGHTING);
glLineWidth(1.f);
glDepthMask(1);
}
UI_ThemeColor(TH_BUNDLE_SOLID);
draw_bundle_sphere();
} else {
glDisable(GL_LIGHTING);
glDepthMask(0);
if(TRACK_SELECTED(track)) {
if(base==BASACT) UI_ThemeColor(TH_ACTIVE);
else UI_ThemeColor(TH_SELECT);
} else UI_ThemeColor(TH_WIRE);
drawaxes(0.05f, v3d->bundle_drawtype);
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
glEnable(GL_LIGHTING);
glLineWidth(1.f);
glDepthMask(1);
glEnable(GL_LIGHTING);
}
UI_ThemeColor(TH_BUNDLE_SOLID);
draw_bundle_sphere();
}
glPopMatrix();

View File

@@ -262,6 +262,7 @@ static SpaceLink *view3d_new(const bContext *C)
v3d->around= V3D_CENTROID;
v3d->bundle_size= 0.1f;
v3d->bundle_drawtype= OB_EMPTY_SPHERE;
/* header */
ar= MEM_callocN(sizeof(ARegion), "header for view3d");

View File

@@ -148,7 +148,11 @@ typedef struct View3D {
short blockhandler[8];
float viewquat[4], dist; /* XXX depricated */
float bundle_size; /* size of bundles in reconstructed data */
short bundle_drawtype; /* display style for bundle */
char pad[6];
unsigned int lay_used; /* used while drawing */

View File

@@ -1208,6 +1208,16 @@ static void rna_def_space_view3d(BlenderRNA *brna)
{RV3D_CAMOB, "CAMERA", 0, "Camera", ""},
{0, NULL, 0, NULL, NULL}};
static EnumPropertyItem bundle_drawtype_items[] = {
{OB_PLAINAXES, "PLAIN_AXES", 0, "Plain Axes", ""},
{OB_ARROWS, "ARROWS", 0, "Arrows", ""},
{OB_SINGLE_ARROW, "SINGLE_ARROW", 0, "Single Arrow", ""},
{OB_CIRCLE, "CIRCLE", 0, "Circle", ""},
{OB_CUBE, "CUBE", 0, "Cube", ""},
{OB_EMPTY_SPHERE, "SPHERE", 0, "Sphere", ""},
{OB_EMPTY_CONE, "CONE", 0, "Cone", ""},
{0, NULL, 0, NULL, NULL}};
srna= RNA_def_struct(brna, "SpaceView3D", "Space");
RNA_def_struct_sdna(srna, "View3D");
RNA_def_struct_ui_text(srna, "3D View Space", "3D View space data");
@@ -1437,12 +1447,18 @@ 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_size", PROP_FLOAT, PROP_NONE);
prop= RNA_def_property(srna, "bundle_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_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
prop= RNA_def_property(srna, "bundle_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_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
prop= RNA_def_property(srna, "show_camera_path", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag2", V3D_SHOW_CAMERAPATH);
RNA_def_property_ui_text(prop, "Show Camera Path", "Show reconstructed path of ameraip");