- removed makeDispList, set_displist_onlyzero
authorDaniel Dunbar <daniel@zuster.org>
Fri, 15 Jul 2005 20:56:55 +0000 (20:56 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Fri, 15 Jul 2005 20:56:55 +0000 (20:56 +0000)
 - 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.

13 files changed:
source/blender/blenkernel/BKE_displist.h
source/blender/blenkernel/intern/DerivedMesh.c
source/blender/blenkernel/intern/displist.c
source/blender/blenkernel/intern/font.c
source/blender/blenkernel/intern/object.c
source/blender/python/api2_2x/Library.c
source/blender/python/api2_2x/Object.c
source/blender/renderconverter/intern/convertBlenderScene.c
source/blender/src/buttons_editing.c
source/blender/src/editkey.c
source/blender/src/editmesh_loop.c
source/blender/src/poseobject.c
source/blender/src/toets.c

index 9a718eec5b99c9c4583ec72eb9d7b84560ee39db..d75a8a65f0a5438ee3691611b3d2018d3c313045 100644 (file)
@@ -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);
index 6f2ddc8c7837f470fe17f51470fcd3c233eae081..236d21bd71040c8231c41e8d9593885111177338 100644 (file)
@@ -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;
index 49f1736caf9e091563747af12f860aded6a7d3d4..874bec746f1567722eecea3dc77cf44f40f9212b 100644 (file)
@@ -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       *****/
 /*******************************/
index 7d59fb541e026e68398c7ddbbf28724a29f2f67b..6855b826f7c2755985e7b111ace0afc86b00e72c 100644 (file)
@@ -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);
 }
index 647a5bca76c26a469a8bccd33cb9f31de1ee8992..b46aa5ab67cfe0038ee05918f03236fcb2cc39d1 100644 (file)
@@ -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... */
index b75b77b4a04f48d760f268d362c674679495ea60..25ff6c3932388f1f00346a3221b7f184b97b7485 100644 (file)
@@ -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 );
index 6afd4a4a9fe8552d9828548168dc6e4aac7bfc98..2d3585f5f1e496a18bd681c5343110379b26b951 100644 (file)
@@ -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;
index 6f565d0348a75ecd556d7a0fa7d922db058ce7f4..4962f5129e7953ebc55bc9477a727e801a2d1a6d 100644 (file)
@@ -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) {
index d1db3b5de7e9fe7b44248bbd6671b1379cbf70f2..d5eca3c8a0a3d4d920e2287c2ad6e5e749640cde 100644 (file)
@@ -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) {
index 60328cfc43a69d1fca73bc5cf77f21341ac89ba0..909f29288f025043e86bc82ac7029a9633a667b6 100644 (file)
@@ -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;
index 3454873d416bfa24dc7b2e1197080900f89b27a8..fccde48edfb4712c6b8e2678784801ed15d7dd5e 100644 (file)
@@ -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 */
index 4954244dc4aa9c836091b1b463712a59f6fb58e3..064675281c0fe202f92e88199fa48c88ff8af126 100644 (file)
@@ -143,8 +143,6 @@ void exit_posemode (int freedata)
        
        G.obpose= NULL;
 
-       makeDispList(ob);
-       
        if(freedata) {
                setcursor_space(SPACE_VIEW3D, CURSOR_STD);
                
index fde39edf64083da706bcfd1b4639b14e2fced19a..a1e65c08feda5336117c776b83986e1712079864 100644 (file)
@@ -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");
                                        }
                                }