DeleteSceneObject() public method

Synchronously delete the given object from the scene.
public DeleteSceneObject ( SceneObjectGroup group, bool silent ) : void
group SceneObjectGroup Object Id
silent bool Suppress broadcasting changes to other clients.
return void
Ejemplo n.º 1
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 void InventoryDeQueueAndDelete()
        {
            lock (m_threadLock)
            {
                IInventoryAccessModule invAccess = m_scene.RequestModuleInterface <IInventoryAccessModule>();
                if (invAccess == null)
                {
                    return;
                }

                int count = 0;
                while (m_inventoryDeletes.TryDequeue(out DeleteToInventoryHolder x))
                {
                    //  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
                    {
                        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);
                            }
                        }

                        count += x.objectGroups.Count;
                        if (count > 256)
                        {
                            Thread.Sleep(50); // throttle
                            count = 0;
                        }
                    }
                    catch
                    // catch (Exception e)
                    {
                        //m_log.ErrorFormat(
                        //    "[ASYNC OBJECT DELETER]: Exception background sending object: {0}{1}", e.Message, e.StackTrace);
                    }
                }
                // m_log.Debug("[ASYNC DELETER]: No objects left in inventory send queue.");
                m_running = false;
            }
        }
Ejemplo 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)
                    {
                        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);
        }