- removed makeDispList, set_displist_onlyzero

- appropriate callers of makeDispList replaced with depgraph calls
 - unappropriate places just killed... small chance this gives some
   errors in corner cases if dep graph isn't notified (example, font
   family displists) but these can be tracked down as they show up.
 - still a large number of callers of makeDispListCurveTypes, but
   makeDispListMesh has just a few.
This commit is contained in:
Daniel Dunbar 2005-07-15 20:56:55 +00:00
parent 10d865df25
commit 8d2176bfeb
13 changed files with 33 additions and 106 deletions

@ -141,12 +141,9 @@ extern void curve_to_filledpoly(struct Curve *cu, struct ListBase *nurb, struct
extern void freedisplist(struct ListBase *lb);
extern int displist_has_faces(struct ListBase *lb);
extern float calc_taper(struct Object *taperobj, int cur, int tot);
extern void makeDispList(struct Object *ob);
extern void mesh_changed(struct Object *meshOb);
extern void makeDispListMesh(struct Object *ob);
extern void makeDispListCurveTypes(struct Object *ob);
extern void makeDispListMBall(struct Object *ob);
extern void set_displist_onlyzero(int val);
extern void shadeDispList(struct Object *ob);
void freefastshade(void);
void boundbox_displist(struct Object *ob);

@ -846,15 +846,6 @@ static void build_mesh_data(Object *ob, int inEditMode)
{
Mesh *me = ob->data;
/* Inside edit mode mesh modifiers aren't calculated */
if(ob->disp.first==NULL && !inEditMode) {
if ( (ob->parent && (ob->partype==PARSKEL || ob->parent->type==OB_LATTICE)) ||
ob->hooks.first ||
(ob->softflag & OB_SB_ENABLE) ||
(ob->effect.first && ((Effect*) ob->effect.first)->type==EFF_WAVE))
makeDispListMesh(ob);
}
if ((me->flag&ME_SUBSURF) && me->subdiv) {
if(inEditMode && !G.editMesh->derived) {
makeDispListMesh(ob);
@ -894,7 +885,7 @@ DerivedMesh *mesh_get_derived_render(Object *ob, int *needsFree)
*needsFree = 0;
// Don't reuse cache in editmode, we need to guarantee
// order of result and the incremental syncing messes
// index order of result and the incremental syncing messes
// with this (could be fixed). - zr
if(!(G.obedit && me==G.obedit->data)) {
return me->derived;

@ -1549,13 +1549,6 @@ void curve_to_filledpoly(Curve *cu, ListBase *nurb, ListBase *dispbase)
}
static int dl_onlyzero= 0;
void set_displist_onlyzero(int val)
{
dl_onlyzero= val;
}
/* taper rules:
- only 1 curve
- first point left, last point right
@ -1604,44 +1597,23 @@ float calc_taper(Object *taperobj, int cur, int tot)
return 1.0;
}
void mesh_changed(Object *meshOb)
void makeDispListMesh(Object *ob)
{
Mesh *me = meshOb->data;
Mesh *me;
if(!ob || (ob->flag&OB_FROMDUPLI) || ob->type!=OB_MESH) return;
me= ob->data;
/* also serves as signal to remake texspace */
if (me->bb) {
MEM_freeN(me->bb);
me->bb = NULL;
}
freedisplist(&meshOb->disp);
freedisplist(&me->disp);
if (me->derived) {
me->derived->release(me->derived);
me->derived = NULL;
}
/* This should really be delayed, but there is no simple way
* to signal to rebuild the derived mesh (we can't null it
* because it is used for incremental). Just need to add a
* flag at some point. - zr
*/
if (G.obedit && meshOb->data==G.obedit->data && mesh_uses_displist(me)) {
G.editMesh->derived= subsurf_make_derived_from_editmesh(G.editMesh, me->subdiv, me->subsurftype, G.editMesh->derived);
}
}
void makeDispListMesh(Object *ob)
{
Mesh *me;
if(!ob || (ob->flag&OB_FROMDUPLI) || ob->type!=OB_MESH) return;
freedisplist(&(ob->disp));
me= ob->data;
freedisplist(&me->disp);
if (me->derived) {
me->derived->release(me->derived);
me->derived= NULL;
@ -1700,7 +1672,6 @@ void makeDispListCurveTypes(Object *ob)
draw= ob->dt;
cu= ob->data;
dispbase= &(cu->disp);
if(dl_onlyzero && dispbase->first) return;
freedisplist(dispbase);
if(ob==G.obedit) nu= editNurb.first;
@ -1792,7 +1763,6 @@ void makeDispListCurveTypes(Object *ob)
draw= ob->dt;
cu= ob->data;
dispbase= &(cu->disp);
if(dl_onlyzero && dispbase->first) return;
freedisplist(dispbase);
BLI_freelistN(&(cu->bev));
@ -1936,18 +1906,6 @@ void makeDispListCurveTypes(Object *ob)
boundbox_displist(ob);
}
void makeDispList(Object *ob)
{
if (ob->type==OB_MESH) {
makeDispListMesh(ob);
} else if (ob->type==OB_MBALL) {
makeDispListMBall(ob);
} else {
makeDispListCurveTypes(ob);
}
}
/*******************************/
/***** OUTLINE *****/
/*******************************/

@ -805,14 +805,13 @@ void font_duplilist(Object *par)
yof= cu->yof;
ct= chartransdata;
set_displist_onlyzero(1);
for(a=0; a<slen; a++, ct++) {
ob= find_family_object(obar, cu->family, cu->str[a]);
if(ob) {
makeDispList(ob);
/* not clear if this free line here is still needed */
freedisplist(&ob->disp);
vec[0]= fsize*(ct->xof - xof);
vec[1]= fsize*(ct->yof - yof);
@ -836,6 +835,6 @@ void font_duplilist(Object *par)
}
}
set_displist_onlyzero(0);
MEM_freeN(chartransdata);
}

@ -1777,10 +1777,13 @@ void object_handle_update(Object *ob)
// printf("recalcdata %s\n", ob->id.name+2);
/* includes all keys and modifiers */
if(ob->type==OB_MESH) {
mesh_changed(ob);
makeDispListMesh(ob);
}
else if(ob->type && ob->type<OB_LAMP) {
makeDispList(ob);
else if(ob->type==OB_MBALL) {
makeDispListMBall(ob);
}
else if(ELEM3(ob->type, OB_CURVE, OB_SURF, OB_FONT)) {
makeDispListCurveTypes(ob);
}
else if(ob->type==OB_ARMATURE) {
/* this actually only happens for reading old files... */

@ -39,7 +39,6 @@
#include <DNA_ID.h>
#include <DNA_curve_types.h>
#include <BKE_library.h> /* for all_local */
#include "BKE_displist.h" /* for set_displist_onlyzero */
#include "BKE_font.h" /* for text_to_curve */
#include <BLO_readfile.h>
#include <BLI_linklist.h>
@ -342,25 +341,10 @@ PyObject *M_Library_Update( PyObject * self )
Object *ob = NULL;
Library *lib = NULL;
ob = G.main->object.first;
set_displist_onlyzero( 1 );
while( ob ) {
if( ob->id.lib ) {
if( ob->type == OB_FONT ) {
Curve *cu = ob->data;
if( cu->nurb.first == 0 )
text_to_curve( ob, 0 );
}
makeDispList( ob );
} else {
if( ob->type == OB_MESH && ob->parent
&& ob->parent->type == OB_LATTICE )
makeDispListMesh( ob );
}
ob = ob->id.next;
}
set_displist_onlyzero( 0 );
/* Displist code that was here is obsolete... depending on what
* this function is supposed to do (it should technically be unnecessary)
* can be replaced with depgraph calls - zr
*/
if( bpy_openlibname ) {
strcpy( G.lib, bpy_openlibname );

@ -1431,7 +1431,7 @@ static PyObject *Object_makeDisplayList( BPy_Object * self )
if( ob->type == OB_FONT )
text_to_curve( ob, 0 );
makeDispList( ob );
DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
Py_INCREF( Py_None );
return Py_None;

@ -2729,10 +2729,6 @@ void RE_freeRotateBlenderScene(void)
MEM_freeN(me->orco);
me->orco= 0;
}
if ((me->flag&ME_SUBSURF) && ((me->subdiv!=me->subdivr) || (ob->effect.first != NULL) || ob==G.obedit) ) {
/* Need to recalc for effects since they are time dependant */
makeDispListMesh(ob); /* XXX this should be replaced with proper caching */
}
}
else if(ob->type==OB_MBALL) {
if(ob->disp.first && ob->disp.first!=ob->disp.last) {

@ -594,7 +594,7 @@ void do_common_editbuts(unsigned short event) // old name, is a mix of object an
nu= nu->next;
}
}
makeDispList(G.obedit);
DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
allqueue(REDRAWVIEW3D, 0);
}
else if(G.vd) {

@ -670,8 +670,12 @@ void showkeypos(Key *key, KeyBlock *kb)
if(ob==NULL) return;
if(key == give_current_key(ob)) {
key->flag |= KEY_LOCKED; // prevents it from calculated
// key lock is for when a key is selected in the ipo window,
// it should be displayed in the 3d window then even though it
// is not actually for the current frame. this is not the best
// UI... - zr
key->flag |= KEY_LOCKED;
if(ob->type==OB_MESH) {
me= ob->data;

@ -54,6 +54,7 @@ editmesh_loop: tools with own drawing subloops, select, knife, subdiv
#include "BLI_arithb.h"
#include "BLI_editVert.h"
#include "BKE_depsgraph.h"
#include "BKE_displist.h"
#include "BKE_global.h"
#include "BKE_library.h"
@ -351,7 +352,7 @@ void CutEdgeloop(int numcuts){
esubdivideflag(SELECT,0,0,numcuts,1);
force_draw(0);
makeDispList(G.obedit);
DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
scrarea_queue_winredraw(curarea);
/* if this was a single cut, enter edgeslide mode */

@ -143,8 +143,6 @@ void exit_posemode (int freedata)
G.obpose= NULL;
makeDispList(ob);
if(freedata) {
setcursor_space(SPACE_VIEW3D, CURSOR_STD);

@ -904,7 +904,7 @@ int blenderqread(unsigned short event, short val)
}
else if(G.qual==(LR_ALTKEY|LR_CTRLKEY)) {
int a;
int event= pupmenu("10 Timer%t|draw|draw+swap|displist|undo");
int event= pupmenu("10 Timer%t|draw|draw+swap|undo");
if(event>0) {
double stime= PIL_check_seconds_timer();
char tmpstr[128];
@ -918,12 +918,8 @@ int blenderqread(unsigned short event, short val)
} else if (event==2) {
scrarea_do_windraw(curarea);
screen_swapbuffers();
} else if (event==3) {
if (OBACT) {
makeDispList(OBACT);
}
}
else if(event==4) {
else if(event==3) {
BKE_write_undo("10 timer");
}
}