Moved Metadata internals to anonymous namespace.

We don't want to expose them to the outside world.
Removed python/GafferUI/Metadata.py.

It was no longer imported by GafferUI/__init__.py since being replaced by Gaffer::Metadata in C++, but the file hadn't been removed as it should have.
Implemented per-instance Metadata for all Nodes and Plugs.

This will allow custom UI's to be defined for nodes other than Boxes.
Reimplemented per-instance Box metadata with new general functionality.

The methods on the Box are now deprecated and will be removed in future.
Converted BoxEditor into a generic UIEditor.

This allows the user plugs for any node to be given UI customisations.
Simplified Serialisation implementation.

We had nearly-identical copies of the code for iterating the root children and for iterating the children during walk(). Now all the work is done in walk().
Fixed Metadata loading/saving for Reference nodes.

We want the Reference node to load metadata provided by the saved reference, but we must ensure that we don't resave the Metadata into the script with the Reference in it - we want the referenced script to be the only source of metadata.
Fixed potential UIEditor plug reordering issue.

If the user accidentally dragged outside the editor, a drop event might never be sent, meaning that the changes wouldn't be flushed to the UI. Using a drag end signal ensures that we always flush the order when the drag ends.
Fixed error loading reference with metadata.
Fixed CompoundPlug plugSetSignal() emission when children change.

Previously we only emitted plugSetSignal for the CompoundPlug itself, and not all its ancestors up to the node as was done for normal plugSetSignal emission. Now the same code path is used in both scenarios.

This problem came to light when the ScriptNode failed to update its custom context variables when plugs were added during loading. This then became obvious when any bookmarks referring to those variables failed to evaluate.
Fixed Reference plug duplication.

Plugs which were loaded from a reference, but had no connections within the reference were being saved as dynamic plugs on the reference node, meaning that they doubled up next time the script was loaded. Reference::isReferencePlug() is now implemented to match the plug filtering in  Box::exportForReference().

Note that this does mean that any plugs which were added to reference nodes directly without an "__" prefix will no longer be saved, as reflected in the changes to ReferenceTest.testReloadDoesntRemoveCustomPlugs(). This is worth careful consideration during review - @davidminor could you take a look at this in relation to the IE internal code?

This change is an interim measure until we have the opportunity to break compatibility and implement the ideas in #801.
Fixed reloading of References with modified metadata.

This meant changing the reference reloading strategy from keeping old plugs in preference to matching new ones, to always keeping new plugs and ditching all the old ones. This will have repercussions for poorly implemented UIs which were relying on the previous behaviour - these will be addressed in subsequent commits.
Fixed SceneHierarchy and SceneInspector UIs for deleted plugs.

The plug being deleted now triggers a refresh where a new plug is found for display. This is robust to the new Reference reloading behaviour, as well as any other scenario which would remove plugs dynamically.
Merge pull request #799 from johnhaddon/referenceUI

Further custom UI improvements