peng3d/model.py
def cleanup(self,obj):
        """
        Cleans up any left over data structures, including vertex lists that reside in GPU memory.
        
        Behaviour is undefined if it is attempted to use this model with the same object without calling :py:meth:`create()` first.
        
        It is very important to call this method manually during deletion as this will delete references to data objects stored in global variables of third-party modules.
        """
        if not hasattr(obj,"_modeldata"):
            return # already not initialized
        data = obj._modeldata
        
        if "_modelcache" in data:
            moddata = data["_modelcache"]
            
            if "vlists" in moddata:
                for vlist in list(moddata["vlists"].keys()):
                    del moddata["vlists"][vlist]
                del moddata["vlists"]
        
        if "_bones" in data:
            for bone in list(data["_bones"].keys()):
                del data["_bones"][bone]
            del data["_bones"]
        
        if "_anidata" in data:
            adata = data["_anidata"]
            if "_schedfunc" in adata:
                pyglet.clock.unschedule(adata["_schedfunc"])
        
        if data.get("_manual_render",False):
            del obj.batch3d
        
        # Removes open vertex lists and other caches
        
        if "_modelcache" not in data:
            return
        moddata = data["_modelcache"]
        
        if "vlist" in moddata:
            moddata["vlist"].delete() # Free up the graphics memory
        if "group" in moddata:
            del moddata["group"]
        
        del data["_modelcache"], moddata
def cleanup(self,obj):
        """
        Cleans up any left over data structures, including vertex lists that reside in GPU memory.
        
        Behaviour is undefined if it is attempted to use this model with the same object without calling :py:meth:`create()` first.
        
        It is very important to call this method manually during deletion as this will delete references to data objects stored in global variables of third-party modules.
        """
        if not hasattr(obj,"_modeldata"):
            return # already not initialized
        data = obj._modeldata
        
        if "_modelcache" in data:
            moddata = data["_modelcache"]
            
            if "vlists" in moddata:
                for vlist in list(moddata["vlists"].keys()):
                    del moddata["vlists"][vlist]
                del moddata["vlists"]
        
        if "_bones" in data:
            for bone in list(data["_bones"].keys()):
                del data["_bones"][bone]
            del data["_bones"]
        
        if "_anidata" in data:
            adata = data["_anidata"]
            if "_schedfunc" in adata:
                pyglet.clock.unschedule(adata["_schedfunc"])
        
        if data.get("_manual_render",False):
            del obj.batch3d
        
        # Removes open vertex lists and other caches
        
        if "_modelcache" not in data:
            return
        moddata = data["_modelcache"]
        
        if "vlist" in moddata:
            moddata["vlist"].delete() # Free up the graphics memory
        if "group" in moddata:
            del moddata["group"]
        
        del data["_modelcache"], moddata
def cleanup ( self , obj ) : if not hasattr ( obj , "_modeldata" ) : return # already not initialized data = obj . _modeldata if "_modelcache" in data : moddata = data [ "_modelcache" ] if "vlists" in moddata : for vlist in list ( moddata [ "vlists" ] . keys ( ) ) : del moddata [ "vlists" ] [ vlist ] del moddata [ "vlists" ] if "_bones" in data : for bone in list ( data [ "_bones" ] . keys ( ) ) : del data [ "_bones" ] [ bone ] del data [ "_bones" ] if "_anidata" in data : adata = data [ "_anidata" ] if "_schedfunc" in adata : pyglet . clock . unschedule ( adata [ "_schedfunc" ] ) if data . get ( "_manual_render" , False ) : del obj . batch3d # Removes open vertex lists and other caches if "_modelcache" not in data : return moddata = data [ "_modelcache" ] if "vlist" in moddata : moddata [ "vlist" ] . delete ( ) # Free up the graphics memory if "group" in moddata : del moddata [ "group" ] del data [ "_modelcache" ] , moddata
Cleans up any left over data structures, including vertex lists that reside in GPU memory.
        
        Behaviour is undefined if it is attempted to use this model with the same object without calling :py:meth:`create()` first.
        
        It is very important to call this method manually during deletion as this will delete references to data objects stored in global variables of third-party modules.
Cleans up any left over data structures including vertex lists that reside in GPU memory . Behaviour is undefined if it is attempted to use this model with the same object without calling : py : meth : create () first . It is very important to call this method manually during deletion as this will delete references to data objects stored in global variables of third - party modules .