KatsBits Community

Game Editing => General Content Creation => Topic started by: kat on July 12, 2015, 12:29:21 AM

Title: [Blender] cleaning Orphan Data from *.blend files
Post by: kat on July 12, 2015, 12:29:21 AM
Problem
Over time and much editing, updating and deleting, *.blend files get filled with a lot of data that cannot be removed through normal means. This "Orphan Data" as it's called can eventually cause problems that can corrupt files if not taken care of.

Orphaned data happens because of the way Blender works, the application basically creates a central repository or library of actionable data, essentially block of instructions, that can be used in one way or another within Blender. In order for these "dataBlocks" to be used however, a "link" must be created between them and the instance representing them in a Scene - normally if a link doesn't exist the data tends to remove itself when the file is saved and reloaded (because the data no longer has a "User"). However, this linking functionality, after protracted editing sessions, might become corrupt leaving the datablock isolated and unused but still present in the file as if its not. It becomes 'orphaned' and often hidden from use as a result.

Being saved with the *.blend file, orphaned data is also persistent and carries over to newer versions of Blender when older files are opened. In addition to this true Orphaned data is rarely removed when *.blend files are re-saved and re-loaded, which is normally how its removed.

Solution
To fix Orphaned data a new *.blend file needs to be created to which data from the corrupt file will be imported using the "Append" feature - doing this instead of opening the old file directly loads in 'active' data only, i.e. data being used in the Scene or with active link of some kind (it has a "User").

To "Append" first create a new file, "File » New" (restarting Blender beforehand to clear memory), then from the "File" menu again click "Append" ("File » Append"). The "File Browse" window will appear. Here browse to the file that data is to be appended from and left-click it; this drills-down exposing the files contents and the data 'types'available - "Action", "Armature", "Image" and so on. Left-click a data type to further expose the sub-types associated contents and then (shift+)left-click (multi)select the items needed - only those available will be listed, which is why appending is used to fix the problem, Orphaned data isn't shown. Once done click the "Append from Library" button top-right to bring in the selection(s). Save the file once loaded into the Scene.

Quote
Design note: for older versions of Blender, 2.49 and below in particular, the "Append" button in the File Browser" Header must be active (clicked) otherwise selections are linked and not appended, i.e. they remain outside the new file and are referenced as an external resource.