diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2009-11-25 17:13:43 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2009-11-25 17:13:43 +0300 |
commit | 436969ce49bc17573e8f87a87ef89d1d036d5f4e (patch) | |
tree | 0a07481a318c47b55d3aa529aad55caceffa4da2 | |
parent | 2fd2c043818595f8cd7842406f2524cb244201f2 (diff) |
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.
-rw-r--r-- | release/scripts/ui/space_view3d_toolbar.py | 1 | ||||
-rw-r--r-- | source/blender/blenkernel/BKE_DerivedMesh.h | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/cdderivedmesh.c | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/subsurf_ccg.c | 6 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/drawobject.c | 10 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_edit.c | 34 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_view.c | 7 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_scene_types.h | 3 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_view3d_types.h | 1 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_sculpt_paint.c | 4 |
10 files changed, 46 insertions, 24 deletions
diff --git a/release/scripts/ui/space_view3d_toolbar.py b/release/scripts/ui/space_view3d_toolbar.py index defeec0b847..5dcd0c655ef 100644 --- a/release/scripts/ui/space_view3d_toolbar.py +++ b/release/scripts/ui/space_view3d_toolbar.py @@ -671,6 +671,7 @@ class VIEW3D_PT_sculpt_options(PaintPanel): col = layout.column() col.itemR(sculpt, "show_brush") + col.itemR(sculpt, "fast_navigate") split = self.layout.split() diff --git a/source/blender/blenkernel/BKE_DerivedMesh.h b/source/blender/blenkernel/BKE_DerivedMesh.h index 6bce7575556..bb14ac7e803 100644 --- a/source/blender/blenkernel/BKE_DerivedMesh.h +++ b/source/blender/blenkernel/BKE_DerivedMesh.h @@ -232,7 +232,7 @@ struct DerivedMesh { * 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 diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c index b3e75549028..77ad9fb7a7b 100644 --- a/source/blender/blenkernel/intern/cdderivedmesh.c +++ b/source/blender/blenkernel/intern/cdderivedmesh.c @@ -395,7 +395,7 @@ static void cdDM_drawLooseEdges(DerivedMesh *dm) 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; diff --git a/source/blender/blenkernel/intern/subsurf_ccg.c b/source/blender/blenkernel/intern/subsurf_ccg.c index 30766931a0b..716229e6ead 100644 --- a/source/blender/blenkernel/intern/subsurf_ccg.c +++ b/source/blender/blenkernel/intern/subsurf_ccg.c @@ -1223,15 +1223,15 @@ static void ccgDM_glNormalFast(float *a, float *b, float *c, float *d) } /* 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; diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 491559bf13d..01af339e7f7 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -2692,7 +2692,7 @@ static void draw_mesh_object_outline(View3D *v3d, Object *ob, DerivedMesh *dm) 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 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D 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 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D 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 @@ static void draw_object_mesh_instance(Scene *scene, View3D *v3d, RegionView3D *r 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) diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index 937a662e274..b0cbba9efc5 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -275,7 +275,7 @@ static void calctrackballvec(rcti *rect, int mx, int my, float *vec) } -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,6 +314,21 @@ static void viewops_data(bContext *C, wmOperator *op, wmEvent *event) 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 **********************************/ @@ -578,9 +593,7 @@ static int viewrotate_modal(bContext *C, wmOperator *op, wmEvent *event) } 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; } @@ -597,7 +610,7 @@ static int viewrotate_invoke(bContext *C, wmOperator *op, wmEvent *event) 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 @@ static int viewmove_modal(bContext *C, wmOperator *op, wmEvent *event) 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_modal(bContext *C, wmOperator *op, wmEvent *event) 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,9 +923,7 @@ static int viewzoom_modal(bContext *C, wmOperator *op, wmEvent *event) } 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; } @@ -974,7 +984,7 @@ static int viewzoom_invoke(bContext *C, wmOperator *op, wmEvent *event) } 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); diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c index cf34cf74296..3ba2145e9d0 100644 --- a/source/blender/editors/space_view3d/view3d_view.c +++ b/source/blender/editors/space_view3d/view3d_view.c @@ -286,6 +286,8 @@ void smooth_view(bContext *C, Object *oldcamera, Object *camera, float *ofs, flo /* 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 @@ static int view3d_smoothview_invoke(bContext *C, wmOperator *op, wmEvent *event) 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 @@ int initFlyInfo (bContext *C, FlyInfo *fly, wmOperator *op, wmEvent *event) 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 @@ static int flyEnd(bContext *C, FlyInfo *fly) /*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 */ diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h index 037a8c46222..bc592387a64 100644 --- a/source/blender/makesdna/DNA_scene_types.h +++ b/source/blender/makesdna/DNA_scene_types.h @@ -1047,7 +1047,8 @@ typedef struct Scene { /* Paint.flags */ typedef enum { - PAINT_SHOW_BRUSH = 1 + PAINT_SHOW_BRUSH = 1, + PAINT_FAST_NAVIGATE = 2 } PaintFlags; /* Sculpt.flags */ diff --git a/source/blender/makesdna/DNA_view3d_types.h b/source/blender/makesdna/DNA_view3d_types.h index 422c56fe4c1..9c1f01f12b4 100644 --- a/source/blender/makesdna/DNA_view3d_types.h +++ b/source/blender/makesdna/DNA_view3d_types.h @@ -210,6 +210,7 @@ typedef struct View3D { /* RegionView3d->rflag */ #define RV3D_FLYMODE 2 #define RV3D_CLIPPING 4 +#define RV3D_NAVIGATING 8 /* RegionView3d->viewlock */ #define RV3D_LOCKED 1 diff --git a/source/blender/makesrna/intern/rna_sculpt_paint.c b/source/blender/makesrna/intern/rna_sculpt_paint.c index 89e29596746..f365f053e79 100644 --- a/source/blender/makesrna/intern/rna_sculpt_paint.c +++ b/source/blender/makesrna/intern/rna_sculpt_paint.c @@ -174,6 +174,10 @@ static void rna_def_paint(BlenderRNA *brna) 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) |