/// <summary>
        /// Delete the given object from the scene
        /// </summary>
        public void DeleteToInventory(DeRezAction action, UUID folderID,
                SceneObjectGroup objectGroup, IClientAPI remoteClient, 
                bool permissionToDelete)
        {
            if (Enabled)
                lock (m_inventoryTicker)
                    m_inventoryTicker.Stop();

            lock (m_inventoryDeletes)
            {
                DeleteToInventoryHolder dtis = new DeleteToInventoryHolder();
                dtis.action = action;
                dtis.folderID = folderID;
                dtis.objectGroup = objectGroup;
                dtis.remoteClient = remoteClient;
                dtis.permissionToDelete = permissionToDelete;

                m_inventoryDeletes.Enqueue(dtis);
            }

            if (Enabled)
                lock (m_inventoryTicker)
                    m_inventoryTicker.Start();
        
            // Visually remove it, even if it isnt really gone yet.  This means that if we crash before the object
            // has gone to inventory, it will reappear in the region again on restart instead of being lost.
            // This is not ideal since the object will still be available for manipulation when it should be, but it's
            // better than losing the object for now.
            if (permissionToDelete)
                objectGroup.DeleteGroup(false);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Delete the given object from the scene
        /// </summary>
        public void DeleteToInventory(DeRezAction action, UUID folderID,
                                      SceneObjectGroup objectGroup, IClientAPI remoteClient,
                                      bool permissionToDelete)
        {
            if (Enabled)
            {
                m_inventoryTicker.Stop();
            }

            lock (m_inventoryDeletes)
            {
                DeleteToInventoryHolder dtis = new DeleteToInventoryHolder();
                dtis.action             = action;
                dtis.folderID           = folderID;
                dtis.objectGroup        = objectGroup;
                dtis.remoteClient       = remoteClient;
                dtis.permissionToDelete = permissionToDelete;

                m_inventoryDeletes.Enqueue(dtis);
            }

            if (Enabled)
            {
                m_inventoryTicker.Start();
            }

            // Visually remove it, even if it isnt really gone yet.  This means that if we crash before the object
            // has gone to inventory, it will reappear in the region again on restart instead of being lost.
            // This is not ideal since the object will still be available for manipulation when it should be, but it's
            // better than losing the object for now.
            if (permissionToDelete)
            {
                objectGroup.DeleteGroup(false);
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Move the next object in the queue to inventory.  Then delete it properly from the scene.
        /// </summary>
        /// <returns></returns>
        public bool InventoryDeQueueAndDelete()
        {
            DeleteToInventoryHolder x = null;

            try
            {
                lock (m_inventoryDeletes)
                {
                    int left = m_inventoryDeletes.Count;
                    if (left > 0)
                    {
                        x = m_inventoryDeletes.Dequeue();

                        //                        m_log.DebugFormat(
                        //                            "[ASYNC DELETER]: Sending object to user's inventory, action {1}, count {2}, {0} item(s) remaining.",
                        //                            left, x.action, x.objectGroups.Count);

                        try
                        {
                            IInventoryAccessModule invAccess = m_scene.RequestModuleInterface <IInventoryAccessModule>();
                            if (invAccess != null)
                            {
                                invAccess.CopyToInventory(x.action, x.folderID, x.objectGroups, x.remoteClient, false);
                            }

                            if (x.permissionToDelete)
                            {
                                foreach (SceneObjectGroup g in x.objectGroups)
                                {
                                    m_scene.DeleteSceneObject(g, true);
                                }
                            }
                        }
                        catch (Exception e)
                        {
                            m_log.ErrorFormat(
                                "[ASYNC DELETER]: Exception background sending object: {0}{1}", e.Message, e.StackTrace);
                        }

                        return(true);
                    }
                }
            }
            catch (Exception e)
            {
                // We can't put the object group details in here since the root part may have disappeared (which is where these sit).
                // FIXME: This needs to be fixed.
                m_log.ErrorFormat(
                    "[ASYNC DELETER]: Queued sending of scene object to agent {0} {1} failed: {2} {3}",
                    (x != null ? x.remoteClient.Name : "unavailable"),
                    (x != null ? x.remoteClient.AgentId.ToString() : "unavailable"),
                    e.Message,
                    e.StackTrace);
            }

            //            m_log.Debug("[ASYNC DELETER]: No objects left in inventory send queue.");

            return(false);
        }
        /// <summary>
        /// Move the next object in the queue to inventory.  Then delete it properly from the scene.
        /// </summary>
        /// <returns></returns>
        public bool InventoryDeQueueAndDelete()
        {
            DeleteToInventoryHolder x = null;

            try
            {
                lock (m_inventoryDeletes)
                {
                    int left = m_inventoryDeletes.Count;
                    if (left > 0)
                    {
                        x = m_inventoryDeletes.Dequeue();
                    }
                }

                if (x != null)
                {
                    try
                    {
                        m_scene.DeleteToInventory(x.action, x.folderID, x.objectGroups, x.remoteClient);

                        if (x.permissionToDelete)
                        {
                            m_scene.DeleteSceneObjects(x.objectGroups, false);
                        }
                    }
                    catch (Exception e)
                    {
                        System.Text.StringBuilder objectNames = new System.Text.StringBuilder();
                        foreach (var obj in x.objectGroups)
                        {
                            objectNames.Append(obj.Name);
                            objectNames.Append(", ");
                        }

                        m_log.DebugFormat("[SCENE] Exception background sending object(s) {0}: {1}", objectNames.ToString(), e);
                    }

                    return(true);
                }
            }
            catch (Exception e)
            {
                // We can't put the object group details in here since the root part may have disappeared (which is where these sit).
                // FIXME: This needs to be fixed.
                m_log.ErrorFormat(
                    "[SCENE]: Queued sending of scene object to agent {0} {1} failed: {2}",
                    (x != null ? x.remoteClient.Name : "unavailable"), (x != null ? x.remoteClient.AgentId.ToString() : "unavailable"), e.ToString());
            }

            return(false);
        }
        /// <summary>
        /// Delete the given object from the scene
        /// </summary>
        public void DeleteToInventory(DeRezAction action, UUID folderID,
                                      IEnumerable <SceneObjectGroup> objectGroups, IClientAPI remoteClient,
                                      bool permissionToDelete)
        {
            if (Enabled)
            {
                m_inventoryTicker.Stop();
            }


            lock (m_inventoryDeletes)
            {
                DeleteToInventoryHolder dtis = new DeleteToInventoryHolder();
                dtis.action       = action;
                dtis.folderID     = folderID;
                dtis.objectGroups = new List <SceneObjectGroup>(objectGroups);

                if (dtis.objectGroups.Count == 0)
                {
                    //something is wrong, caller sent us an empty set
                    throw new ArgumentException("DeleteToInventory() Can not work with an empty set", "objectGroups");
                }

                dtis.remoteClient       = remoteClient;
                dtis.permissionToDelete = permissionToDelete;

                m_inventoryDeletes.Enqueue(dtis);
            }

            if (Enabled)
            {
                m_inventoryTicker.Start();
            }

            // Visually remove it, even if it isnt really gone yet.  This means that if we crash before the object
            // has gone to inventory, it will reappear in the region again on restart instead of being lost.
            // This is not ideal since the object will still be available for manipulation when it should be, but it's
            // better than losing the object for now.
            if (permissionToDelete)
            {
                foreach (SceneObjectGroup group in objectGroups)
                {
                    group.DeleteGroup(false);
                }
            }
        }
Exemplo n.º 6
0
        /// <summary>
        /// Delete the given object from the scene
        /// </summary>
        public void DeleteToInventory(DeRezAction action, UUID folderID,
                                      List <SceneObjectGroup> objectGroups, IClientAPI remoteClient,
                                      bool permissionToDelete)
        {
            if (Enabled)
            {
                lock (m_inventoryTicker)
                    m_inventoryTicker.Stop();
            }

            lock (m_inventoryDeletes)
            {
                DeleteToInventoryHolder dtis = new DeleteToInventoryHolder();
                dtis.action             = action;
                dtis.folderID           = folderID;
                dtis.objectGroups       = objectGroups;
                dtis.remoteClient       = remoteClient;
                dtis.permissionToDelete = permissionToDelete;

                m_inventoryDeletes.Enqueue(dtis);
            }

            if (Enabled)
            {
                lock (m_inventoryTicker)
                    m_inventoryTicker.Start();
            }

            // Visually remove it, even if it isnt really gone yet.  This means that if we crash before the object
            // has gone to inventory, it will reappear in the region again on restart instead of being lost.
            // This is not ideal since the object will still be available for manipulation when it should be, but it's
            // better than losing the object for now.
            if (permissionToDelete)
            {
                List <uint> killIDs = new List <uint>();

                foreach (SceneObjectGroup g in objectGroups)
                {
                    killIDs.Add(g.LocalId);
                    g.DeleteGroupFromScene(true);
                }

                m_scene.SendKillObject(killIDs);
            }
        }
Exemplo n.º 7
0
        /// <summary>
        /// Move the next object in the queue to inventory.  Then delete it properly from the scene.
        /// </summary>
        /// <returns></returns>
        public bool InventoryDeQueueAndDelete()
        {
            DeleteToInventoryHolder x = null;

            try
            {
                lock (m_inventoryDeletes)
                {
                    int left = m_inventoryDeletes.Count;
                    if (left > 0)
                    {
                        m_log.DebugFormat(
                            "[SCENE]: Sending object to user's inventory, {0} item(s) remaining.", left);

                        x = m_inventoryDeletes.Dequeue();

                        try
                        {
                            m_scene.DeleteToInventory(x.action, x.folderID, x.objectGroup, x.remoteClient);
                            if (x.permissionToDelete)
                            {
                                m_scene.DeleteSceneObject(x.objectGroup, false);
                            }
                        }
                        catch (Exception e)
                        {
                            m_log.DebugFormat("Exception background sending object: " + e);
                        }

                        return(true);
                    }
                }
            }
            catch (Exception e)
            {
                // We can't put the object group details in here since the root part may have disappeared (which is where these sit).
                // FIXME: This needs to be fixed.
                m_log.ErrorFormat(
                    "[SCENE]: Queued sending of scene object to agent {0} {1} failed: {2}",
                    (x != null ? x.remoteClient.Name : "unavailable"), (x != null ? x.remoteClient.AgentId.ToString() : "unavailable"), e.ToString());
            }

            m_log.Debug("[SCENE]: No objects left in inventory send queue.");
            return(false);
        }
        /// <summary>
        /// Delete the given object from the scene
        /// </summary>
        public void DeleteToInventory(DeRezAction action, UUID folderID,
                IEnumerable<SceneObjectGroup> objectGroups, IClientAPI remoteClient, 
                bool permissionToDelete)
        {
            if (Enabled)
                m_inventoryTicker.Stop();


            lock (m_inventoryDeletes)
            {
                DeleteToInventoryHolder dtis = new DeleteToInventoryHolder();
                dtis.action = action;
                dtis.folderID = folderID;
                dtis.objectGroups = new List<SceneObjectGroup>(objectGroups);

                if (dtis.objectGroups.Count == 0)
                {
                    //something is wrong, caller sent us an empty set
                    throw new ArgumentException("DeleteToInventory() Can not work with an empty set", "objectGroups");
                }

                dtis.remoteClient = remoteClient;
                dtis.permissionToDelete = permissionToDelete;

                m_inventoryDeletes.Enqueue(dtis);
            }

            if (Enabled)
                m_inventoryTicker.Start();
        
            // Visually remove it, even if it isnt really gone yet.  This means that if we crash before the object
            // has gone to inventory, it will reappear in the region again on restart instead of being lost.
            // This is not ideal since the object will still be available for manipulation when it should be, but it's
            // better than losing the object for now.
            if (permissionToDelete)
            {
                foreach (SceneObjectGroup group in objectGroups)
                {
                    group.DeleteGroup(false);
                }
            }
        }
        /// <summary>
        /// Delete the given object from the scene
        /// </summary>
        public void DeleteToInventory(DeRezAction action, UUID folderID,
                                      List <SceneObjectGroup> objectGroups, IClientAPI remoteClient,
                                      bool permissionToDelete)
        {
            DeleteToInventoryHolder dtis = new DeleteToInventoryHolder();

            dtis.action             = action;
            dtis.folderID           = folderID;
            dtis.objectGroups       = objectGroups;
            dtis.remoteClient       = remoteClient;
            dtis.permissionToDelete = permissionToDelete;

            m_inventoryDeletes.Enqueue(dtis);

            if (permissionToDelete)
            {
                foreach (SceneObjectGroup g in objectGroups)
                {
                    g.DeleteGroupFromScene(false);
                }
            }

            if (Monitor.TryEnter(m_threadLock))
            {
                if (!m_running)
                {
                    if (Enabled)
                    {
                        m_running = true;
                        Util.FireAndForget(x => InventoryDeQueueAndDelete());
                    }
                    else
                    {
                        m_running = true;
                        InventoryDeQueueAndDelete();
                    }
                }
                Monitor.Exit(m_threadLock);
            }
        }
        /// <summary>
        /// Delete the given object from the scene
        /// </summary>
        public void DeleteToInventory(DeRezAction action, UUID folderID,
                List<SceneObjectGroup> objectGroups, UUID AgentId,
                bool permissionToDelete, bool permissionToTake)
        {
            DeleteToInventoryHolder dtis = new DeleteToInventoryHolder();
            dtis.action = action;
            dtis.folderID = folderID;
            dtis.objectGroups = objectGroups;
            dtis.agentId = AgentId;
            dtis.permissionToDelete = permissionToDelete;
            dtis.permissionToTake = permissionToTake;
            //Do this before the locking so that the objects 'appear' gone and the client doesn't think things have gone wrong
            if (permissionToDelete)
            {
                m_scene.DeleteGroups(objectGroups);
            }

            lock (m_sendToInventoryQueue)
            {
                m_sendToInventoryQueue.Enqueue(dtis);
            }

            lock (m_removeFromSimQueue)
            {
                m_removeFromSimQueue.Enqueue(dtis);
            }

            if (!DeleteLoopInUse)
            {
                DeleteLoopInUse = true;
                //m_log.Debug("[SCENE]: Starting delete loop");
                Util.FireAndForget(DoDeleteObject, new Object[] { 0 });
            }
            if (!SendToInventoryLoopInUse)
            {
                SendToInventoryLoopInUse = true;
                //m_log.Debug("[SCENE]: Starting send to inventory loop");
                Util.FireAndForget(DoSendToInventory, new Object[] { 0 });
            }
        }
Exemplo n.º 11
0
        /// <summary>
        /// Delete the given object from the scene
        /// </summary>
        public void DeleteToInventory(DeRezAction action, UUID folderID,
                                      List <SceneObjectGroup> objectGroups, IClientAPI remoteClient,
                                      bool permissionToDelete)
        {
            if (Enabled)
            {
                lock (m_inventoryTicker)
                    m_inventoryTicker.Stop();
            }

            lock (m_inventoryDeletes)
            {
                DeleteToInventoryHolder dtis = new DeleteToInventoryHolder();
                dtis.action             = action;
                dtis.folderID           = folderID;
                dtis.objectGroups       = objectGroups;
                dtis.remoteClient       = remoteClient;
                dtis.permissionToDelete = permissionToDelete;

                m_inventoryDeletes.Enqueue(dtis);
            }

            if (permissionToDelete)
            {
                foreach (SceneObjectGroup g in objectGroups)
                {
                    g.DeleteGroupFromScene(false);
                }
            }

            if (Enabled)
            {
                lock (m_inventoryTicker)
                    m_inventoryTicker.Start();
            }
        }
Exemplo n.º 12
0
        /// <summary>
        /// Delete the given object from the scene
        /// </summary>
        public void DeleteToInventory(DeRezAction action, UUID folderID,
                List<SceneObjectGroup> objectGroups, IClientAPI remoteClient, 
                bool permissionToDelete)
        {
            if (Enabled)
                lock (m_inventoryTicker)
                    m_inventoryTicker.Stop();

            lock (m_inventoryDeletes)
            {
                DeleteToInventoryHolder dtis = new DeleteToInventoryHolder();
                dtis.action = action;
                dtis.folderID = folderID;
                dtis.objectGroups = objectGroups;
                dtis.remoteClient = remoteClient;
                dtis.permissionToDelete = permissionToDelete;

                m_inventoryDeletes.Enqueue(dtis);
            }

            if (Enabled)
                lock (m_inventoryTicker)
                    m_inventoryTicker.Start();
        
            // Visually remove it, even if it isnt really gone yet.  This means that if we crash before the object
            // has gone to inventory, it will reappear in the region again on restart instead of being lost.
            // This is not ideal since the object will still be available for manipulation when it should be, but it's
            // better than losing the object for now.
            if (permissionToDelete)
            {
                List<uint> killIDs = new List<uint>();

                foreach (SceneObjectGroup g in objectGroups)
                {   killIDs.Add(g.LocalId);
                    g.DeleteGroupFromScene(true);
                }

                m_scene.SendKillObject(killIDs);
            }
        }