[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [24888] branches/sculpt25: Sculpt: Fast Navigate option for multires.

Brecht Van Lommel brecht at blender.org
Wed Nov 25 15:13:43 CET 2009


Revision: 24888
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=24888
Author:   blendix
Date:     2009-11-25 15:13:43 +0100 (Wed, 25 Nov 2009)

Log Message:
-----------
Sculpt: Fast Navigate option for multires. This will show the lowest multires
level when rotating/panning/zooming the viewport, and only draw the full thing
at the end, to make the viewport more interactive.

Modified Paths:
--------------
    branches/sculpt25/release/scripts/ui/space_view3d_toolbar.py
    branches/sculpt25/source/blender/blenkernel/BKE_DerivedMesh.h
    branches/sculpt25/source/blender/blenkernel/intern/cdderivedmesh.c
    branches/sculpt25/source/blender/blenkernel/intern/subsurf_ccg.c
    branches/sculpt25/source/blender/editors/space_view3d/drawobject.c
    branches/sculpt25/source/blender/editors/space_view3d/view3d_edit.c
    branches/sculpt25/source/blender/editors/space_view3d/view3d_view.c
    branches/sculpt25/source/blender/makesdna/DNA_scene_types.h
    branches/sculpt25/source/blender/makesdna/DNA_view3d_types.h
    branches/sculpt25/source/blender/makesrna/intern/rna_sculpt_paint.c

Modified: branches/sculpt25/release/scripts/ui/space_view3d_toolbar.py
===================================================================
--- branches/sculpt25/release/scripts/ui/space_view3d_toolbar.py	2009-11-25 14:10:45 UTC (rev 24887)
+++ branches/sculpt25/release/scripts/ui/space_view3d_toolbar.py	2009-11-25 14:13:43 UTC (rev 24888)
@@ -671,6 +671,7 @@
 
         col = layout.column()
         col.itemR(sculpt, "show_brush")
+        col.itemR(sculpt, "fast_navigate")
 
         split = self.layout.split()
 

Modified: branches/sculpt25/source/blender/blenkernel/BKE_DerivedMesh.h
===================================================================
--- branches/sculpt25/source/blender/blenkernel/BKE_DerivedMesh.h	2009-11-25 14:10:45 UTC (rev 24887)
+++ branches/sculpt25/source/blender/blenkernel/BKE_DerivedMesh.h	2009-11-25 14:13:43 UTC (rev 24888)
@@ -232,7 +232,7 @@
 	 * Also called for *final* editmode DerivedMeshes
 	 */
 	void (*drawFacesSolid)(DerivedMesh *dm, float (*partial_redraw_planes)[4],
-	                       int (*setMaterial)(int, void *attribs));
+	                       int fast, int (*setMaterial)(int, void *attribs));
 
 	/* Draw all faces
 	 *  o If useTwoSided, draw front and back using col arrays

Modified: branches/sculpt25/source/blender/blenkernel/intern/cdderivedmesh.c
===================================================================
--- branches/sculpt25/source/blender/blenkernel/intern/cdderivedmesh.c	2009-11-25 14:10:45 UTC (rev 24887)
+++ branches/sculpt25/source/blender/blenkernel/intern/cdderivedmesh.c	2009-11-25 14:13:43 UTC (rev 24888)
@@ -395,7 +395,7 @@
 
 static void cdDM_drawFacesSolid(DerivedMesh *dm,
 				float (*partial_redraw_planes)[4],
-				int (*setMaterial)(int, void *attribs))
+				int fast, int (*setMaterial)(int, void *attribs))
 {
 	CDDerivedMesh *cddm = (CDDerivedMesh*) dm;
 	MVert *mvert = cddm->mvert;

Modified: branches/sculpt25/source/blender/blenkernel/intern/subsurf_ccg.c
===================================================================
--- branches/sculpt25/source/blender/blenkernel/intern/subsurf_ccg.c	2009-11-25 14:10:45 UTC (rev 24887)
+++ branches/sculpt25/source/blender/blenkernel/intern/subsurf_ccg.c	2009-11-25 14:13:43 UTC (rev 24888)
@@ -1223,15 +1223,15 @@
 }
 
 	/* Only used by non-editmesh types */
-static void ccgDM_drawFacesSolid(DerivedMesh *dm, float (*partial_redraw_planes)[4]/*, int fast*/, int (*setMaterial)(int, void *attribs)) {
+static void ccgDM_drawFacesSolid(DerivedMesh *dm, float (*partial_redraw_planes)[4], int fast, int (*setMaterial)(int, void *attribs)) {
 	CCGDerivedMesh *ccgdm = (CCGDerivedMesh*) dm;
 	CCGSubSurf *ss = ccgdm->ss;
 	CCGFaceIterator *fi;
 	int gridSize = ccgSubSurf_getGridSize(ss);
 	char *faceFlags = ccgdm->faceFlags;
-	int step = 1; //(fast)? gridSize-1: 1;
+	int step = (fast)? gridSize-1: 1;
 
-	if(ccgdm->pbvh && ccgdm->multires.mmd) { // && !fast) {
+	if(ccgdm->pbvh && ccgdm->multires.mmd && !fast) {
 		CCGFace **faces;
 		int totface;
 

Modified: branches/sculpt25/source/blender/editors/space_view3d/drawobject.c
===================================================================
--- branches/sculpt25/source/blender/editors/space_view3d/drawobject.c	2009-11-25 14:10:45 UTC (rev 24887)
+++ branches/sculpt25/source/blender/editors/space_view3d/drawobject.c	2009-11-25 14:13:43 UTC (rev 24888)
@@ -2692,7 +2692,7 @@
 		   drawFacesSolid() doesn't draw the transparent faces */
 		if(ob->dtx & OB_DRAWTRANSP) {
 			glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); 
-			dm->drawFacesSolid(dm, NULL, GPU_enable_material);
+			dm->drawFacesSolid(dm, NULL, 0, GPU_enable_material);
 			glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
 			GPU_disable_material();
 		}
@@ -2793,8 +2793,10 @@
 		glFrontFace((ob->transflag&OB_NEG_SCALE)?GL_CW:GL_CCW);
 
 		if(ob->sculpt) {
+			Paint *p = paint_get_active(scene);
 			float planes[4][4];
 			float (*fpl)[4] = NULL;
+			int fast= (p->flags & PAINT_FAST_NAVIGATE) && (rv3d->rflag & RV3D_NAVIGATING);
 
 			if(ob->sculpt->partial_redraw) {
 				sculpt_get_redraw_planes(planes, ar, rv3d, ob);
@@ -2802,10 +2804,10 @@
 				ob->sculpt->partial_redraw = 0;
 			}
 
-			dm->drawFacesSolid(dm, fpl, GPU_enable_material);
+			dm->drawFacesSolid(dm, fpl, fast, GPU_enable_material);
 		}
 		else
-			dm->drawFacesSolid(dm, NULL, GPU_enable_material);
+			dm->drawFacesSolid(dm, NULL, 0, GPU_enable_material);
 
 		GPU_disable_material();
 
@@ -6270,7 +6272,7 @@
 		glEnable(GL_LIGHTING);
 		
 		if(dm) {
-			dm->drawFacesSolid(dm, NULL, GPU_enable_material);
+			dm->drawFacesSolid(dm, NULL, 0, GPU_enable_material);
 			GPU_end_object_materials();
 		}
 		else if(edm)

Modified: branches/sculpt25/source/blender/editors/space_view3d/view3d_edit.c
===================================================================
--- branches/sculpt25/source/blender/editors/space_view3d/view3d_edit.c	2009-11-25 14:10:45 UTC (rev 24887)
+++ branches/sculpt25/source/blender/editors/space_view3d/view3d_edit.c	2009-11-25 14:13:43 UTC (rev 24888)
@@ -275,7 +275,7 @@
 }
 
 
-static void viewops_data(bContext *C, wmOperator *op, wmEvent *event)
+static void viewops_data_create(bContext *C, wmOperator *op, wmEvent *event)
 {
 	static float lastofs[3] = {0,0,0};
 	View3D *v3d = CTX_wm_view3d(C);
@@ -314,8 +314,23 @@
 	if (rv3d->persmat[2][1] < 0.0f)
 		vod->reverse= -1.0f;
 
+	rv3d->rflag |= RV3D_NAVIGATING;
 }
 
+static void viewops_data_free(bContext *C, wmOperator *op)
+{
+	Paint *p = paint_get_active(CTX_data_scene(C));
+	ViewOpsData *vod= op->customdata;
+
+	vod->rv3d->rflag &= ~RV3D_NAVIGATING;
+
+	if(p && (p->flags & PAINT_FAST_NAVIGATE))
+		ED_region_tag_redraw(vod->ar);
+
+	MEM_freeN(vod);
+	op->customdata= NULL;
+}
+
 /* ************************** viewrotate **********************************/
 
 static const float thres = 0.93f; //cos(20 deg);
@@ -578,10 +593,8 @@
 	}
 	else if (event_code==VIEW_CONFIRM) {
 		request_depth_update(CTX_wm_region_view3d(C));
+		viewops_data_free(C, op);
 
-		MEM_freeN(vod);
-		op->customdata= NULL;
-
 		return OPERATOR_FINISHED;
 	}
 
@@ -597,7 +610,7 @@
 		return OPERATOR_CANCELLED;
 
 	/* makes op->customdata */
-	viewops_data(C, op, event);
+	viewops_data_create(C, op, event);
 	vod= op->customdata;
 
 	/* switch from camera view when: */
@@ -718,8 +731,7 @@
 	else if (event_code==VIEW_CONFIRM) {
 		request_depth_update(CTX_wm_region_view3d(C));
 
-		MEM_freeN(vod);
-		op->customdata= NULL;
+		viewops_data_free(C, op);
 
 		return OPERATOR_FINISHED;
 	}
@@ -730,7 +742,7 @@
 static int viewmove_invoke(bContext *C, wmOperator *op, wmEvent *event)
 {
 	/* makes op->customdata */
-	viewops_data(C, op, event);
+	viewops_data_create(C, op, event);
 
 	/* add temp handler */
 	WM_event_add_modal_handler(C, op);
@@ -911,10 +923,8 @@
 	}
 	else if (event_code==VIEW_CONFIRM) {
 		request_depth_update(CTX_wm_region_view3d(C));
+		viewops_data_free(C, op);
 
-		MEM_freeN(vod);
-		op->customdata= NULL;
-
 		return OPERATOR_FINISHED;
 	}
 
@@ -974,7 +984,7 @@
 	}
 	else {
 		/* makes op->customdata */
-		viewops_data(C, op, event);
+		viewops_data_create(C, op, event);
 
 		/* add temp handler */
 		WM_event_add_modal_handler(C, op);

Modified: branches/sculpt25/source/blender/editors/space_view3d/view3d_view.c
===================================================================
--- branches/sculpt25/source/blender/editors/space_view3d/view3d_view.c	2009-11-25 14:10:45 UTC (rev 24887)
+++ branches/sculpt25/source/blender/editors/space_view3d/view3d_view.c	2009-11-25 14:13:43 UTC (rev 24888)
@@ -286,6 +286,8 @@
 			
 			/* ensure it shows correct */
 			if(sms.to_camera) rv3d->persp= RV3D_PERSP;
+
+			rv3d->rflag |= RV3D_NAVIGATING;
 			
 			/* keep track of running timer! */
 			if(rv3d->sms==NULL)
@@ -348,6 +350,7 @@
 		
 		WM_event_remove_timer(CTX_wm_manager(C), CTX_wm_window(C), rv3d->smooth_timer);
 		rv3d->smooth_timer= NULL;
+		rv3d->rflag &= ~RV3D_NAVIGATING;
 	}
 	else {
 		int i;
@@ -1885,7 +1888,7 @@
 
 	fly->time_lastdraw= fly->time_lastwheel= PIL_check_seconds_timer();
 
-	fly->rv3d->rflag |= RV3D_FLYMODE; /* so we draw the corner margins */
+	fly->rv3d->rflag |= RV3D_FLYMODE|RV3D_NAVIGATING; /* so we draw the corner margins */
 
 	/* detect weather to start with Z locking */
 	upvec[0]=1.0f; upvec[1]=0.0f; upvec[2]=0.0f;
@@ -1985,7 +1988,7 @@
 		/*Done with correcting for the dist */
 	}
 
-	rv3d->rflag &= ~RV3D_FLYMODE;
+	rv3d->rflag &= ~(RV3D_FLYMODE|RV3D_NAVIGATING);
 //XXX2.5	BIF_view3d_previewrender_signal(fly->sa, PR_DBASE|PR_DISPRECT); /* not working at the moment not sure why */
 
 

Modified: branches/sculpt25/source/blender/makesdna/DNA_scene_types.h
===================================================================
--- branches/sculpt25/source/blender/makesdna/DNA_scene_types.h	2009-11-25 14:10:45 UTC (rev 24887)
+++ branches/sculpt25/source/blender/makesdna/DNA_scene_types.h	2009-11-25 14:13:43 UTC (rev 24888)
@@ -1047,7 +1047,8 @@
 
 /* Paint.flags */
 typedef enum {
-	PAINT_SHOW_BRUSH = 1
+	PAINT_SHOW_BRUSH = 1,
+	PAINT_FAST_NAVIGATE = 2
 } PaintFlags;
 
 /* Sculpt.flags */

Modified: branches/sculpt25/source/blender/makesdna/DNA_view3d_types.h
===================================================================
--- branches/sculpt25/source/blender/makesdna/DNA_view3d_types.h	2009-11-25 14:10:45 UTC (rev 24887)
+++ branches/sculpt25/source/blender/makesdna/DNA_view3d_types.h	2009-11-25 14:13:43 UTC (rev 24888)
@@ -210,6 +210,7 @@
 /* RegionView3d->rflag */
 #define RV3D_FLYMODE				2
 #define RV3D_CLIPPING				4
+#define RV3D_NAVIGATING				8
 
 /* RegionView3d->viewlock */
 #define RV3D_LOCKED			1

Modified: branches/sculpt25/source/blender/makesrna/intern/rna_sculpt_paint.c
===================================================================
--- branches/sculpt25/source/blender/makesrna/intern/rna_sculpt_paint.c	2009-11-25 14:10:45 UTC (rev 24887)
+++ branches/sculpt25/source/blender/makesrna/intern/rna_sculpt_paint.c	2009-11-25 14:13:43 UTC (rev 24888)
@@ -174,6 +174,10 @@
 	prop= RNA_def_property(srna, "show_brush", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flags", PAINT_SHOW_BRUSH);
 	RNA_def_property_ui_text(prop, "Show Brush", "");
+
+	prop= RNA_def_property(srna, "fast_navigate", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_sdna(prop, NULL, "flags", PAINT_FAST_NAVIGATE);
+	RNA_def_property_ui_text(prop, "Fast Navigate", "For multires, show low resolution while navigating the view.");
 }
 
 static void rna_def_sculpt(BlenderRNA  *brna)





More information about the Bf-blender-cvs mailing list