I’m not sure if this is the right forum, but it seemed the most appropriate.
I have a simple file (camera, lamp, and 3 cubes). When I used the following script …
for obj in bpy.data.objects:
print(">> OBJECT ", obj.name)
… it lists about 20 objects. The file was created by deleting a bunch of objects from an old file. When I view the the Outliner Editor (All Scenes), I don’t see the objects, but when I change to Outliner Editor (Groups), they’re all shown.
I understand this means I have disconnected (e.g. ghost) data, but my question is “How do I delete them?” I’ve tried selecting and deleting them through the menu, but the delete doesn’t work - they’re persistent little buggers and don’t want to leave.
I’m guessing I can use Python and loop through Groups and remove them all, but I’m still learning Python and the bgy/bge API so I haven’t figured out how to do this. Any suggestions, snippits, or commands that would exterminate these critters would be appreciated? Thanks!
You can try these functions if you like.
def removeObjectFromMemory (passedName):
ob = bpy.data.objects[passedName]
ob = None
if ob != None:
def removeMeshFromMemory (passedName):
me = bpy.data.meshes[passedName]
me = None
if me != None:
def removeCurveFromMemory (passedName):
cu = bpy.data.curves[passedName]
cu = None
if cu != None:
Had to use a combo of objects.remove and mesh.remove … but they worked like a charm …
Atom - you’re my new weekly hero … … Thanks!
You can also just restart blender and they disappear (like magic).
Uncle Entity: save the session and quit blender en start blender and load the last saved one?
Yep, if the object (or any datatype) has zero users it doesn’t get saved in the .blend. In the above example calling user_clear() is a sure-fire way to crash blender.
There are also cases where you can have an object in bpy.data.objects (like bone shapes) that aren’t linked into any scenes but still have a non-zero user count so they get saved.
A while ago I wrote an operator that would clear out bpy.data the ‘proper’ way but am way too lazy to search the forums for it now.
I’m using version 2.58, and the “save, exit Blender, reload” method wasn’t deleting them. That was my first thought and my first try. I don’t know who the “user” was, but for some reason they were not being removed by Blender … but I was able to use the script above and remove them one by one …
Im using the latest version of Blender and never had your problem, good luck.
thanks Atom for a great example