Metadata / notes / comments in .blend files? I was wondering - what options are there to include metadata, copyright information, and/or comments/notes in a .blend file?

I realized late that in the main dropdown (where 3D view is), one can select "Text Editor", and then do Text / Create Text Block (these are then shown under Outliner > Datablocks / Texts). I'm guessing these are for scripts, but when I see, say http://en.wikibooks.org/wiki/Blender_3D:_Noob_to_Pro/Creating_Blender_Libraries:


  make visible upon loading one small text file which lists layers and objects
  ...
  make your licensing expectations clear: artistic license, creative commons, etc.
  ...
  sign your work, stable email address or website url if possible


... I simply cannot see where else could I add this information, but in a "text block" as described above. The Outliner / Datablocks view looks like it might contain some metadata, but seemingly it is not editable. 

So my question is - what is the preferred way to enter metadata (e.g. key/value combinations like author, license, date, etc), and to enter notes/comments in a .blend file?
Its quite common just to distribute a text block with some plain text information.

Some options you have for storing more structured meta-data in a Blend file.


Text-Block

You might want to use JSON/XML/MIME encoding to dump your data to this in your own format which you can read back.
Text blocks can be hidden (indeed any data-blocks), by starting the name with a . - Unix .convention).



Example:

import bpy
import json
metadata = dict(author="Me", date="Today", rating=100)

# hidden text block
text = bpy.data.texts.new(".metadata")
text.write(json.dumps(metadata))

# print it back out
print(text.as_string())



ID Properties

attach a dictionary like object to any data-block.
only support primitive data types str,int,float,dict,array - but can be nested.



Example:

import bpy
metadata = dict(author="Me", date="Today", rating=100)
# attach to current Scene
scene = bpy.context.scene
scene["metadata"] = metadata

# print it back out
print(scene["metadata"].to_dict())




Neither of these options are especially easy to extract from the Blend file without loading the file in Blender first, however it is possible.

See: https://developer.blender.org/diffusion/BAM/browse/master/bam/blend/blendfile.py