AnalyticalGraphicsInc/cesium — pull request #2217 by mramato (2014-10-23 14:57:55+00:00)
Title: Support detached ReferenceProperty instances

Previously, ReferenceProperty required that it's reference was always resolved. This enforces early failure for bad data (such as a CZML file that references a non-existent property). Unfortunately, this lead to problems when manipulating data on the client that would result in temporary or permanent detachment of references, for example #2044.

In order to address this, I've made a slight change to the reference semantics which cause a ReferenceProperty that already has a value to maintain that value if it ever becomes detached (i.e. the entity it references is removed from the target collection). It will also automatically reattach if the reference becomes valid again. It is still an error if a new reference is completely invalid (i.e. the reference was never resolved a first time). This still provides early failure in the cases we want it and more flexibility in the cases we don't. However, do to other changes in the property system, we could propably remove this requirement as well if it ever becomes a problem.

Fixes #2044