コード例 #1
0
 // ----------------------------------------------------------------------
 // Reinitialize the editor object to its default values.
 public void DestroyInstance()
 {
     // Invoke event
     RunOnWillDestroy(this);
     // Destroy any children.
     ForEachChild(child => child.DestroyInstance());
     // Disconnect any port sourcing from this object.
     if (IsPort)
     {
         myIStorage.ForEach(
             child => {
             if (child.IsPort && child.ProducerPortId == InstanceId)
             {
                 child.ProducerPortId = -1;
             }
         }
             );
     }
     // Update child lists.
     if (IsParentValid)
     {
         Parent.RemoveChild(this);
     }
     // Assure that the selected object is not us.
     if (myIStorage.SelectedObject == EditorObject)
     {
         myIStorage.SelectedObject = null;
     }
     // Reset the associated engine object.
     EngineObject.DestroyInstance();
     // Remove editor object.
     EditorObjects[myId] = null;
 }