remove SOP.AttachPoint, redundant( and incoerent) with SOG.AttachmentPoint

httptests
UbitUmarov 2017-01-26 19:43:00 +00:00
parent 2fc7993d69
commit ed365f6220
4 changed files with 25 additions and 44 deletions

View File

@ -481,14 +481,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
// "[ATTACHMENTS MODULE]: Attaching object {0} {1} to {2} point {3} from ground (silent = {4})", // "[ATTACHMENTS MODULE]: Attaching object {0} {1} to {2} point {3} from ground (silent = {4})",
// group.Name, group.LocalId, sp.Name, attachmentPt, silent); // group.Name, group.LocalId, sp.Name, attachmentPt, silent);
if (sp.GetAttachments().Contains(group))
{
// m_log.WarnFormat(
// "[ATTACHMENTS MODULE]: Ignoring request to attach {0} {1} to {2} on {3} since it's already attached",
// group.Name, group.LocalId, sp.Name, AttachmentPt);
return false;
}
if (group.GetSittingAvatarsCount() != 0) if (group.GetSittingAvatarsCount() != 0)
{ {
@ -500,6 +492,17 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
return false; return false;
} }
List<SceneObjectGroup> attachments = sp.GetAttachments(attachmentPt);
if (attachments.Contains(group))
{
// if (DebugLevel > 0)
// m_log.WarnFormat(
// "[ATTACHMENTS MODULE]: Ignoring request to attach {0} {1} to {2} on {3} since it's already attached",
// group.Name, group.LocalId, sp.Name, attachmentPt);
return false;
}
Vector3 attachPos = group.AbsolutePosition; Vector3 attachPos = group.AbsolutePosition;
// TODO: this short circuits multiple attachments functionality in LL viewer 2.1+ and should // TODO: this short circuits multiple attachments functionality in LL viewer 2.1+ and should
@ -533,7 +536,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
{ {
attachmentPt = (uint)group.RootPart.Shape.LastAttachPoint; attachmentPt = (uint)group.RootPart.Shape.LastAttachPoint;
attachPos = group.RootPart.AttachedPos; attachPos = group.RootPart.AttachedPos;
group.HasGroupChanged = true;
} }
// if we still didn't find a suitable attachment point....... // if we still didn't find a suitable attachment point.......
@ -544,18 +546,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
attachPos = Vector3.Zero; attachPos = Vector3.Zero;
} }
List<SceneObjectGroup> attachments = sp.GetAttachments(attachmentPt);
if (attachments.Contains(group))
{
if (DebugLevel > 0)
m_log.WarnFormat(
"[ATTACHMENTS MODULE]: Ignoring request to attach {0} {1} to {2} on {3} since it's already attached",
group.Name, group.LocalId, sp.Name, attachmentPt);
return false;
}
// If we already have 5, remove the oldest until only 4 are left. Skip over temp ones // If we already have 5, remove the oldest until only 4 are left. Skip over temp ones
while (attachments.Count >= 5) while (attachments.Count >= 5)
{ {
@ -579,7 +569,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
lock (sp.AttachmentsSyncLock) lock (sp.AttachmentsSyncLock)
{ {
group.AttachmentPoint = attachmentPt; group.AttachmentPoint = attachmentPt;
group.AbsolutePosition = attachPos; group.RootPart.AttachedPos = attachPos;
if (addToInventory && sp.PresenceType != PresenceType.Npc) if (addToInventory && sp.PresenceType != PresenceType.Npc)
UpdateUserInventoryWithAttachment(sp, group, attachmentPt, append); UpdateUserInventoryWithAttachment(sp, group, attachmentPt, append);
@ -956,7 +946,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
m_scene.DeleteFromStorage(so.UUID); m_scene.DeleteFromStorage(so.UUID);
m_scene.EventManager.TriggerParcelPrimCountTainted(); m_scene.EventManager.TriggerParcelPrimCountTainted();
so.AttachedAvatar = sp.UUID;
foreach (SceneObjectPart part in so.Parts) foreach (SceneObjectPart part in so.Parts)
{ {
@ -969,11 +958,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
} }
} }
so.AbsolutePosition = attachOffset;
so.RootPart.AttachedPos = attachOffset;
so.IsAttachment = true;
so.RootPart.SetParentLocalId(sp.LocalId); so.RootPart.SetParentLocalId(sp.LocalId);
so.AttachedAvatar = sp.UUID;
so.AttachmentPoint = attachmentpoint; so.AttachmentPoint = attachmentpoint;
so.RootPart.AttachedPos = attachOffset;
so.AbsolutePosition = attachOffset;
so.IsAttachment = true;
sp.AddAttachment(so); sp.AddAttachment(so);

View File

@ -427,20 +427,14 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
originalRotations[objectGroup.UUID] = inventoryStoredRotation; originalRotations[objectGroup.UUID] = inventoryStoredRotation;
// Restore attachment data after trip through the sim // Restore attachment data after trip through the sim
if (objectGroup.RootPart.AttachPoint > 0) if (objectGroup.AttachmentPoint > 0)
{ {
inventoryStoredPosition = objectGroup.RootPart.AttachedPos; inventoryStoredPosition = objectGroup.RootPart.AttachedPos;
inventoryStoredRotation = objectGroup.RootPart.AttachRotation; inventoryStoredRotation = objectGroup.RootPart.AttachRotation;
} if (objectGroup.RootPart.Shape.PCode != (byte) PCode.Tree &&
objectGroup.RootPart.Shape.PCode != (byte) PCode.NewTree)
objectGroup.RootPart.Shape.LastAttachPoint = (byte)objectGroup.AttachmentPoint;
// Trees could be attached and it's been done, but it makes
// no sense. State must be preserved because it's the tree type
if (objectGroup.RootPart.Shape.PCode != (byte) PCode.Tree &&
objectGroup.RootPart.Shape.PCode != (byte) PCode.NewTree)
{
objectGroup.RootPart.Shape.State = objectGroup.RootPart.AttachPoint;
if (objectGroup.RootPart.AttachPoint > 0)
objectGroup.RootPart.Shape.LastAttachPoint = objectGroup.RootPart.AttachPoint;
} }
objectGroup.AbsolutePosition = inventoryStoredPosition; objectGroup.AbsolutePosition = inventoryStoredPosition;

View File

@ -244,11 +244,6 @@ namespace OpenSim.Region.Framework.Scenes
public uint TimeStampTerse; public uint TimeStampTerse;
// The following two are to hold the attachment data
// while an object is inworld
[XmlIgnore]
public byte AttachPoint = 0;
[XmlIgnore] [XmlIgnore]
public Quaternion AttachRotation = Quaternion.Identity; public Quaternion AttachRotation = Quaternion.Identity;
@ -277,7 +272,11 @@ namespace OpenSim.Region.Framework.Scenes
public scriptEvents AggregateScriptEvents; public scriptEvents AggregateScriptEvents;
public Vector3 AttachedPos; public Vector3 AttachedPos
{
get;
set;
}
// rotation locks on local X,Y and or Z axis bit flags // rotation locks on local X,Y and or Z axis bit flags
// bits are as in llSetStatus defined in SceneObjectGroup.axisSelect enum // bits are as in llSetStatus defined in SceneObjectGroup.axisSelect enum

View File

@ -7972,7 +7972,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{ {
return 0; return 0;
} }
} }
public void llDialog(string avatar, string message, LSL_List buttons, int chat_channel) public void llDialog(string avatar, string message, LSL_List buttons, int chat_channel)
@ -15867,7 +15866,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return; return;
} }
group.RootPart.AttachPoint = group.RootPart.Shape.State;
group.RootPart.AttachedPos = group.AbsolutePosition; group.RootPart.AttachedPos = group.AbsolutePosition;
group.ResetIDs(); group.ResetIDs();