Page MenuHome

Delete Globally won't work with Datablock ID Properties
Closed, ResolvedPublic

Description

System Information
Windows 10 x64
Renderer: GeForce GTX 860M/PCIe/SSE2

Blender Version
Broken: 2.78.4 4d0d1b5

Short description of error
Delete Globally does not take into account Datablock ID Properties, i. e. object referenced in add-on prop will be deleted from the scene, but not from the blend file.

Exact steps for others to reproduce the error

  1. Open provided blend file:
  2. Use Run Script from the Text Editor.
  3. Locate Test Panel tab in 3D View > Tool Shelf.
  4. Pick a Cube object using eyedropper.
  5. Delete Cube using Shift X for Delete Globally.

Now notice how Orphan Data in Outline doesn't show anything as it should, which means that Cube object is still has one user and will not be removed on save/open action. So user have to unreference it from every single add-on property manually.
To see how it should work do the following:

  1. Open provided blend file.
  2. Create new scene choosing Link Objects option (now we have two users on a Cube object).
  3. Delete Cube using Shift X for Delete Globally.

Now notice how Orphan Data shows Cube mesh with zero users, which means that Cube object is deleted from everywhere.

Event Timeline

@Bastien Montagne (mont29), If I understand correctly, "X" do removing for the current scene and "Shift+X" - for all scenes? So in case of single scene "X" should also work? If this operator has "scene" context, I suppose that lookup in scene idproperties should be sufficient?

OK, so… This is muddy waters, spent some time thinking about this and for now would consider this 'not a bug', as in, code is behaving as expected and consistently (since Object is user of itself, it is not a detectable orphaned currently, it’s an 'orphaned archipelago', a loop of orphanage, and we are not really ready to detect and handle those in current code).

To be more detailed, Object handling is currently in a big TODO stage - first because it used a lot of custom code that could be replaced by new generic one, but that kind of cleanup takes a lot of time to do and check! Furthermore, Object handling is also being changed to some extent in new blender2.8, so would rather not start messing with it in master at this point.

I think I'll just add a 'hack' around the issue for this specific case only: when you enable 'global' option for this operator, and object is local, just use 'full-nuke' delete ID code instead - simpler, shorter and should do the work.