public AddAttachment ( |
||
gobj | ||
리턴 | void |
/// <summary> /// Attach this scene object to the given avatar. /// </summary> /// <param name="agentID"></param> /// <param name="attachmentpoint"></param> /// <param name="AttachOffset"></param> private void AttachToAgent( ScenePresence avatar, SceneObjectGroup so, uint attachmentpoint, Vector3 attachOffset, bool silent) { if (avatar != null) { // don't attach attachments to child agents if (avatar.IsChildAgent) return; // Remove from database and parcel prim count m_scene.DeleteFromStorage(so.UUID); m_scene.EventManager.TriggerParcelPrimCountTainted(); so.AttachedAvatar = avatar.UUID; if (so.RootPart.PhysActor != null) { m_scene.PhysicsScene.RemovePrim(so.RootPart.PhysActor); so.RootPart.PhysActor = null; } so.AbsolutePosition = attachOffset; so.RootPart.AttachedPos = attachOffset; so.IsAttachment = true; so.RootPart.SetParentLocalId(avatar.LocalId); so.AttachmentPoint = attachmentpoint; avatar.AddAttachment(this); if (!silent) { // Killing it here will cause the client to deselect it // It then reappears on the avatar, deselected // through the full update below // if (IsSelected) { m_scene.SendKillObject(new List<uint> { m_rootPart.LocalId }); } IsSelected = false; // fudge.... ScheduleGroupForFullUpdate(); } } else { m_log.WarnFormat( "[SOG]: Tried to add attachment {0} to avatar with UUID {1} in region {2} but the avatar is not present", UUID, avatar.ControllingClient.AgentId, Scene.RegionInfo.RegionName); } }
/// <summary> /// Attach this scene object to the given avatar. /// </summary> /// /// This isn't publicly available since attachments should always perform the corresponding inventory /// operation (to show the attach in user inventory and update the asset with positional information). /// /// <param name="sp"></param> /// <param name="so"></param> /// <param name="attachmentpoint"></param> /// <param name="AttachOffset"></param> /// <param name="silent"></param> protected void AttachToAgent(ScenePresence avatar, SceneObjectGroup so, int attachmentpoint, Vector3 AttachOffset, bool silent) { // don't attach attachments to child agents if (avatar.IsChildAgent) return; // m_log.DebugFormat("[ATTACHMENTS MODULE]: Adding attachment {0} to avatar {1}", Name, avatar.Name); so.DetachFromBackup(); // Remove from database and parcel prim count m_scene.DeleteFromStorage(so.UUID); m_scene.EventManager.TriggerParcelPrimCountTainted(); so.RootPart.AttachedAvatar = avatar.UUID; //Anakin Lohner bug #3839 SceneObjectPart[] parts = so.Parts; for (int i = 0; i < parts.Length; i++) parts[i].AttachedAvatar = avatar.UUID; if (so.RootPart.PhysActor != null) { m_scene.PhysicsScene.RemovePrim(so.RootPart.PhysActor); so.RootPart.PhysActor = null; } so.AbsolutePosition = AttachOffset; so.RootPart.AttachedPos = AttachOffset; so.RootPart.IsAttachment = true; so.RootPart.SetParentLocalId(avatar.LocalId); so.SetAttachmentPoint(Convert.ToByte(attachmentpoint)); avatar.AddAttachment(so); if (!silent) { // Killing it here will cause the client to deselect it // It then reappears on the avatar, deselected // through the full update below // if (so.IsSelected) { m_scene.SendKillObject(so.RootPart.LocalId); } so.IsSelected = false; // fudge.... so.ScheduleGroupForFullUpdate(PrimUpdateFlags.FullUpdate); } // In case it is later dropped again, don't let // it get cleaned up so.RootPart.RemFlag(PrimFlags.TemporaryOnRez); so.HasGroupChanged = false; }
/// <summary> /// Attach this scene object to the given avatar. /// </summary> /// /// This isn't publicly available since attachments should always perform the corresponding inventory /// operation (to show the attach in user inventory and update the asset with positional information). /// /// <param name="sp"></param> /// <param name="so"></param> /// <param name="attachmentpoint"></param> /// <param name="AttachOffset"></param> /// <param name="silent"></param> protected void AttachToAgent(ScenePresence avatar, SceneObjectGroup so, int attachmentpoint, Vector3 AttachOffset) { // don't attach attachments to child agents if (avatar.IsChildAgent) return; // m_log.DebugFormat("[ATTACHMENTS MODULE]: Adding attachment {0} to avatar {1}", Name, avatar.Name); // Remove from database and parcel prim count IBackupModule backup = so.Scene.RequestModuleInterface<IBackupModule>(); if (backup != null) backup.DeleteFromStorage(so.UUID); so.RootPart.AttachedAvatar = avatar.UUID; //Anakin Lohner bug #3839 SceneObjectPart[] parts = so.Parts; for (int i = 0; i < parts.Length; i++) parts[i].AttachedAvatar = avatar.UUID; if (so.RootPart.PhysActor != null) { m_scene.SceneGraph.PhysicsScene.RemovePrim(so.RootPart.PhysActor); so.RootPart.PhysActor = null; } so.AbsolutePosition = AttachOffset; so.RootPart.AttachedPos = AttachOffset; so.RootPart.IsAttachment = true; so.RootPart.SetParentLocalId(avatar.LocalId); so.SetAttachmentPoint(Convert.ToByte(attachmentpoint)); avatar.AddAttachment(so); // Killing it here will cause the client to deselect it // It then reappears on the avatar, deselected // through the full update below // if (so.IsSelected) { m_scene.ForEachClient(delegate(IClientAPI client) { client.SendKillObject(m_scene.RegionInfo.RegionHandle, new ISceneEntity[] { so.RootPart }); }); foreach (SceneObjectPart part in so.ChildrenList) { part.CreateSelected = true; } } //NOTE: This MUST be here, otherwise we limit full updates during attachments when they are selected and it will block the first update. // So until that is changed, this MUST stay. The client will instantly reselect it, so this value doesn't stay borked for long. so.IsSelected = false; so.ScheduleGroupUpdate(PrimUpdateFlags.FullUpdate); // In case it is later dropped again, don't let // it get cleaned up so.RootPart.RemFlag(PrimFlags.TemporaryOnRez); so.HasGroupChanged = false; }