示例#1
0
        /// <summary>
        /// Reset all of the UUID's, localID's, etc in this group (includes children)
        /// </summary>
        /// <param name="entity"></param>
        private void ResetEntityIDs (ISceneEntity entity)
        {
            List<ISceneChildEntity> children = entity.ChildrenEntities ();
            //Sort so that we rebuild in the same order and the root being first
            children.Sort(LinkSetSorter);

            entity.ClearChildren();
            IComponentManager manager = m_parentScene.RequestModuleInterface<IComponentManager> ();
            foreach (ISceneChildEntity child in children)
            {
                UUID oldID = child.UUID;
                child.ResetEntityIDs();
                entity.AddChild (child, child.LinkNum);
                if (manager != null)
                    manager.ResetComponentIDsToNewObject (oldID, child);
            }
            //This clears the xml file, which will need rebuilt now that we have changed the UUIDs
            entity.HasGroupChanged = true;
            entity.ClearXMLRepresentation();
            foreach (ISceneChildEntity child in children)
            {
                if(!child.IsRoot)
                {
                    child.SetParentLocalId (entity.RootChild.LocalId);
                }
            }
        }