Ejemplo n.º 1
0
 /// <summary>
 ///     Update the position of the given attachment
 /// </summary>
 /// <param name="client"></param>
 /// <param name="sog"></param>
 /// <param name="localID"></param>
 /// <param name="pos"></param>
 public void UpdateAttachmentPosition(IClientAPI client, ISceneEntity sog, uint localID, Vector3 pos)
 {
     if (sog != null)
     {
         // If this is an attachment, then we need to save the modified
         // object back into the avatar's inventory. First we save the
         // attachment point information, then we update the relative
         // positioning (which caused this method to get driven in the
         // first place. Then we have to mark the object as NOT an
         // attachment. This is necessary in order to correctly save
         // and retrieve GroupPosition information for the attachment.
         // Then we save the asset back into the appropriate inventory
         // entry. Finally, we restore the object's attachment status.
         byte attachmentPoint = (byte)sog.RootChild.AttachmentPoint;
         sog.UpdateGroupPosition(pos, true);
         sog.RootChild.AttachedPos = pos;
         sog.RootChild.FixOffsetPosition((pos), false);
         sog.SetAttachmentPoint(attachmentPoint);
         sog.ScheduleGroupUpdate(PrimUpdateFlags.TerseUpdate);
     }
     else
     {
         MainConsole.Instance.Warn("[Attachments]: Could not find attachment by ItemID!");
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Update the position of the given attachment
        /// </summary>
        /// <param name="client"></param>
        /// <param name="ItemID"></param>
        /// <param name="pos"></param>
        public void UpdateAttachmentPosition(IClientAPI client, UUID ItemID, Vector3 pos)
        {
            ISceneEntity[] attachments = GetAttachmentsForAvatar(client.AgentId);
            ISceneEntity   sog         = null;

            //Find the attachment we are trying to edit by ItemID
            foreach (ISceneEntity grp in attachments)
            {
                if (grp.RootChild.FromUserInventoryItemID == ItemID)
                {
                    sog = grp;
                    break;
                }
            }

            if (sog != null)
            {
                // If this is an attachment, then we need to save the modified
                // object back into the avatar's inventory. First we save the
                // attachment point information, then we update the relative
                // positioning (which caused this method to get driven in the
                // first place. Then we have to mark the object as NOT an
                // attachment. This is necessary in order to correctly save
                // and retrieve GroupPosition information for the attachment.
                // Then we save the asset back into the appropriate inventory
                // entry. Finally, we restore the object's attachment status.
                byte attachmentPoint = (byte)sog.RootChild.AttachmentPoint;
                sog.UpdateGroupPosition(pos, true);
                sog.RootChild.IsAttachment = false;
                sog.RootChild.AttachedPos  = pos;
                sog.AbsolutePosition       = sog.RootChild.AttachedPos;
                sog.SetAttachmentPoint(attachmentPoint);
                //Don't update right now, wait until logout
                //UpdateKnownItem(client, sog, sog.GetFromItemID(), sog.OwnerID);
            }
            else
            {
                m_log.Warn("[Attachments]: Could not find attachment by ItemID!");
            }
        }
Ejemplo n.º 3
0
 /// <summary>
 ///     Update the position of the given attachment
 /// </summary>
 /// <param name="client"></param>
 /// <param name="sog"></param>
 /// <param name="localID"></param>
 /// <param name="pos"></param>
 public void UpdateAttachmentPosition(IClientAPI client, ISceneEntity sog, uint localID, Vector3 pos)
 {
     if (sog != null)
     {
         // If this is an attachment, then we need to save the modified
         // object back into the avatar's inventory. First we save the
         // attachment point information, then we update the relative
         // positioning (which caused this method to get driven in the
         // first place. Then we have to mark the object as NOT an
         // attachment. This is necessary in order to correctly save
         // and retrieve GroupPosition information for the attachment.
         // Then we save the asset back into the appropriate inventory
         // entry. Finally, we restore the object's attachment status.
         byte attachmentPoint = (byte) sog.RootChild.AttachmentPoint;
         sog.UpdateGroupPosition(pos, true);
         sog.RootChild.AttachedPos = pos;
         sog.RootChild.FixOffsetPosition((pos), false);
         //sog.AbsolutePosition = sog.RootChild.AttachedPos;
         sog.SetAttachmentPoint(attachmentPoint);
         sog.ScheduleGroupUpdate(PrimUpdateFlags.TerseUpdate);
         //Don't update right now, wait until logout
         //UpdateKnownItem(client, sog, sog.GetFromItemID(), sog.OwnerID);
     }
     else
     {
         MainConsole.Instance.Warn("[Attachments]: Could not find attachment by ItemID!");
     }
 }