- switch to using DAG_object_flush_update instead of mesh_changed

- mesh drawing calculated derived surface before clipping to view matrix,
   waste for offscreen objects
This commit is contained in:
Daniel Dunbar 2005-07-14 17:10:44 +00:00
parent abbda3a8a1
commit aa454cd412
8 changed files with 27 additions and 17 deletions

@ -54,6 +54,7 @@
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
#include "BKE_depsgraph.h"
#include "BKE_main.h"
#include "BKE_DerivedMesh.h"
#include "BKE_global.h"
@ -1273,5 +1274,5 @@ void mesh_set_smooth_flag(Object *meshOb, int enableSmooth) {
}
}
mesh_changed(meshOb);
DAG_object_flush_update(G.scene, meshOb, OB_RECALC_DATA);
}

@ -397,7 +397,6 @@ void do_common_editbuts(unsigned short event) // old name, is a mix of object an
EditFace *efa;
Base *base;
Object *ob;
Mesh *me;
Nurb *nu;
Curve *cu;
BezTriple *bezt;

@ -1920,27 +1920,32 @@ static void draw_mesh_object(Base *base, int dt)
{
Object *ob= base->object;
Mesh *me= ob->data;
DerivedMesh *baseDM = mesh_get_base_derived(ob);
DerivedMesh *realDM = mesh_get_derived(ob);
int has_alpha= 0;
if(G.obedit && ob->data==G.obedit->data) {
DerivedMesh *baseDM = mesh_get_base_derived(ob);
DerivedMesh *realDM = mesh_get_derived(ob);
if(dt>OB_WIRE) init_gl_materials(ob); // no transp in editmode, the fancy draw over goes bad then
draw_em_fancy(ob, G.editMesh, baseDM, realDM, dt);
baseDM->release(baseDM);
}
else {
if(me->bb==NULL) tex_space_mesh(me);
if(me->totface<=4 || boundbox_clip(ob->obmat, me->bb)) {
DerivedMesh *baseDM = mesh_get_base_derived(ob);
DerivedMesh *realDM = mesh_get_derived(ob);
if(dt==OB_SOLID) has_alpha= init_gl_materials(ob);
draw_mesh_fancy(ob, baseDM, realDM, dt);
baseDM->release(baseDM);
}
}
/* init_gl_materials did the proper checking if this is needed */
if(has_alpha) add_view3d_after(G.vd, base, V3D_TRANSP);
baseDM->release(baseDM);
}
/* ************** DRAW DISPLIST ****************** */

@ -59,6 +59,7 @@
#include "DNA_userdef_types.h"
#include "BKE_utildefines.h"
#include "BKE_depsgraph.h"
#include "BKE_displist.h"
#include "BKE_global.h"
#include "BKE_mesh.h"
@ -885,7 +886,8 @@ void rotate_uv_tface()
}
BIF_undo_push("Rotate UV face");
mesh_changed(OBACT);
DAG_object_flush_update(G.scene, OBACT, OB_RECALC_DATA);
allqueue(REDRAWVIEW3D, 0);
allqueue(REDRAWIMAGE, 0);
}
@ -1228,7 +1230,7 @@ void set_faceselect() /* toggle */
else if((G.f & (G_WEIGHTPAINT|G_VERTEXPAINT|G_TEXTUREPAINT))==0) {
if(me) {
reveal_tface();
mesh_changed(ob);
DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
}
setcursor_space(SPACE_VIEW3D, CURSOR_STD);
BIF_undo_push("End UV Faceselect");

@ -2347,7 +2347,7 @@ void flip_subdivison(Object *ob, int level)
allqueue(REDRAWVIEW3D, 0);
allqueue(REDRAWOOPS, 0);
allqueue(REDRAWBUTSEDIT, 0);
mesh_changed(ob);
DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
BIF_undo_push("Switch subsurf on/off");
}

@ -59,6 +59,7 @@
#include "DNA_image_types.h"
#include "DNA_object_types.h" // only for uvedit_selectionCB() (struct Object)
#include "BKE_depsgraph.h"
#include "BKE_global.h"
#include "BKE_mesh.h"
#include "BKE_displist.h"
@ -761,7 +762,7 @@ void transform_tface_uv(int mode, int context) // 2 args, for callback
G.moving= 0;
prop_size*= 3;
mesh_changed(OBACT);
DAG_object_flush_update(G.scene, OBACT, OB_RECALC_DATA);
allqueue(REDRAWVIEW3D, 0);
if(event!=ESCKEY && event!=RIGHTMOUSE)

@ -67,6 +67,7 @@
#include "BLI_blenlib.h"
#include "BLI_arithb.h"
#include "BKE_depsgraph.h"
#include "BKE_plugin_types.h"
#include "BKE_utildefines.h"
#include "BKE_mesh.h"
@ -1808,8 +1809,8 @@ static void tb_do_mesh(void *arg, int event){
case 2: G.f ^= G_DRAWEDGES; break;
case 3: G.f ^= G_DRAWFACES; break;
case 4: G.f ^= G_DRAWNORMALS; break;
case 5: me->flag ^= ME_SUBSURF; mesh_changed(OBACT); break;
case 6: me->flag ^= ME_OPT_EDGES; mesh_changed(OBACT); break;
case 5: me->flag ^= ME_SUBSURF; DAG_object_flush_update(G.scene, OBACT, OB_RECALC_DATA); break;
case 6: me->flag ^= ME_OPT_EDGES; DAG_object_flush_update(G.scene, OBACT, OB_RECALC_DATA); break;
}
addqueue(curarea->win, REDRAW, 1);
}

@ -60,6 +60,7 @@
#include "DNA_view3d_types.h"
#include "DNA_userdef_types.h"
#include "BKE_depsgraph.h"
#include "BKE_displist.h"
#include "BKE_global.h"
#include "BKE_mesh.h"
@ -766,7 +767,7 @@ void wpaint_undo (void){
me->dvert= MEM_mallocN(sizeof(MDeformVert)*me->totvert, "deformVert");
copy_dverts(me->dvert, wpaintundobuf, totwpaintundo);
mesh_changed(OBACT);
DAG_object_flush_update(G.scene, OBACT, OB_RECALC_DATA);
scrarea_do_windraw(curarea);
}
@ -940,7 +941,7 @@ void weight_paint(void)
me->mcol= 0;
}
mesh_changed(ob);
DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
// this flag is event for softbody to refresh weightpaint values
if(ob->soft) ob->softflag |= OB_SB_REDO;
@ -1153,7 +1154,7 @@ void set_wpaint(void) /* toggle */
else {
freefastshade(); /* to be sure */
if (me) {
mesh_changed(ob);
DAG_object_flush_update(G.scene, OBACT, OB_RECALC_DATA);
}
if(!(G.f & G_FACESELECT))
setcursor_space(SPACE_VIEW3D, CURSOR_STD);
@ -1202,7 +1203,7 @@ void set_vpaint(void) /* toggle */
else {
freefastshade(); /* to be sure */
if (me) {
mesh_changed(ob);
DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
}
if((G.f & G_FACESELECT)==0) setcursor_space(SPACE_VIEW3D, CURSOR_STD);
}