[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [38536] branches/soc-2011-tomato: Camera tracking integration

Sergey Sharybin g.ulairi at gmail.com
Wed Jul 20 14:46:22 CEST 2011


Revision: 38536
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=38536
Author:   nazgul
Date:     2011-07-20 12:46:22 +0000 (Wed, 20 Jul 2011)
Log Message:
-----------
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.

Modified Paths:
--------------
    branches/soc-2011-tomato/release/scripts/startup/bl_ui/space_view3d.py
    branches/soc-2011-tomato/source/blender/blenloader/intern/readfile.c
    branches/soc-2011-tomato/source/blender/editors/space_view3d/drawobject.c
    branches/soc-2011-tomato/source/blender/editors/space_view3d/space_view3d.c
    branches/soc-2011-tomato/source/blender/makesdna/DNA_view3d_types.h
    branches/soc-2011-tomato/source/blender/makesrna/intern/rna_space.c

Modified: branches/soc-2011-tomato/release/scripts/startup/bl_ui/space_view3d.py
===================================================================
--- branches/soc-2011-tomato/release/scripts/startup/bl_ui/space_view3d.py	2011-07-20 12:44:29 UTC (rev 38535)
+++ branches/soc-2011-tomato/release/scripts/startup/bl_ui/space_view3d.py	2011-07-20 12:46:22 UTC (rev 38536)
@@ -2181,11 +2181,12 @@
         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()
 

Modified: branches/soc-2011-tomato/source/blender/blenloader/intern/readfile.c
===================================================================
--- branches/soc-2011-tomato/source/blender/blenloader/intern/readfile.c	2011-07-20 12:44:29 UTC (rev 38535)
+++ branches/soc-2011-tomato/source/blender/blenloader/intern/readfile.c	2011-07-20 12:46:22 UTC (rev 38536)
@@ -11823,10 +11823,14 @@
 				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;

Modified: branches/soc-2011-tomato/source/blender/editors/space_view3d/drawobject.c
===================================================================
--- branches/soc-2011-tomato/source/blender/editors/space_view3d/drawobject.c	2011-07-20 12:44:29 UTC (rev 38535)
+++ branches/soc-2011-tomato/source/blender/editors/space_view3d/drawobject.c	2011-07-20 12:46:22 UTC (rev 38536)
@@ -1401,37 +1401,6 @@
 	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 @@
 					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);
 
-					glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
-					glEnable(GL_LIGHTING);
-					glLineWidth(1.f);
+					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);
+
 					glDepthMask(1);
+					glEnable(GL_LIGHTING);
 				}
-
-				UI_ThemeColor(TH_BUNDLE_SOLID);
-				draw_bundle_sphere();
 			}
 
 		glPopMatrix();

Modified: branches/soc-2011-tomato/source/blender/editors/space_view3d/space_view3d.c
===================================================================
--- branches/soc-2011-tomato/source/blender/editors/space_view3d/space_view3d.c	2011-07-20 12:44:29 UTC (rev 38535)
+++ branches/soc-2011-tomato/source/blender/editors/space_view3d/space_view3d.c	2011-07-20 12:46:22 UTC (rev 38536)
@@ -262,6 +262,7 @@
 	v3d->around= V3D_CENTROID;
 	
 	v3d->bundle_size= 0.1f;
+	v3d->bundle_drawtype= OB_EMPTY_SPHERE;
 	
 	/* header */
 	ar= MEM_callocN(sizeof(ARegion), "header for view3d");

Modified: branches/soc-2011-tomato/source/blender/makesdna/DNA_view3d_types.h
===================================================================
--- branches/soc-2011-tomato/source/blender/makesdna/DNA_view3d_types.h	2011-07-20 12:44:29 UTC (rev 38535)
+++ branches/soc-2011-tomato/source/blender/makesdna/DNA_view3d_types.h	2011-07-20 12:46:22 UTC (rev 38536)
@@ -148,7 +148,11 @@
 	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 */
 	

Modified: branches/soc-2011-tomato/source/blender/makesrna/intern/rna_space.c
===================================================================
--- branches/soc-2011-tomato/source/blender/makesrna/intern/rna_space.c	2011-07-20 12:44:29 UTC (rev 38535)
+++ branches/soc-2011-tomato/source/blender/makesrna/intern/rna_space.c	2011-07-20 12:46:22 UTC (rev 38536)
@@ -1208,6 +1208,16 @@
 		{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 @@
 	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");




More information about the Bf-blender-cvs mailing list