Exemplo n.º 1
0
        private void ProcessObjectQueueDeleteToNode(VObject _obj)
        {
            if (_obj.Node == null)
                return;

            if (_obj.Prim != null)
            {
                Reference.Log.Debug("Delete avatar: Name:" + ((Avatar)_obj.Prim).Name + " Pos:" + _obj.Prim.Position.ToString());
            }
            else
            {
                Reference.Log.Debug("Delete avatar: Name: (NULL)");
            }

            if (_obj.IsGhost)
            {
                Reference.Viewer.EffectManager.RemoveGhostNode(_obj.Node);
            }

            // Remove this object from our picker.
            if (_obj.PickNode != null && _obj.PickNode.TriangleSelector != null)
            {
                if (trianglePickerMapper != null)
                {
                    trianglePickerMapper.RemTriangleSelector(_obj.PickNode.TriangleSelector);
                }
                lock (NativeElement.Elements) { if (NativeElement.Elements.ContainsKey(_obj.PickNode.TriangleSelector.Raw)) { NativeElement.Elements.Remove(_obj.PickNode.TriangleSelector.Raw); } }
            }

            _obj.Dispose();
            _obj.VoiceNode = null;
            _obj.MeshNode = null;
            _obj.PickNode = null;

            SceneNode node = null;
            if (userObject.Node != null && userObject.Node.Raw == _obj.Node.Raw)
            {
                node = Reference.SceneManager.AddEmptySceneNode(ParentNode, -1);
            }
            Reference.SceneManager.AddToDeletionQueue(_obj.Node);
            _obj.MeshNode = null;

            if (node != null)
                userObject.Node = node;
        }