aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Environment/Scenes/InnerScene.cs14
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.Inventory.cs69
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs34
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectPart.cs5
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/EventManager.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/XEngine.cs2
6 files changed, 67 insertions, 59 deletions
diff --git a/OpenSim/Region/Environment/Scenes/InnerScene.cs b/OpenSim/Region/Environment/Scenes/InnerScene.cs
index f58f334..65fa544 100644
--- a/OpenSim/Region/Environment/Scenes/InnerScene.cs
+++ b/OpenSim/Region/Environment/Scenes/InnerScene.cs
@@ -418,8 +418,18 @@ namespace OpenSim.Region.Environment.Scenes
418 /// <param name="rot"></param> 418 /// <param name="rot"></param>
419 protected internal void AttachObject(IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, Quaternion rot) 419 protected internal void AttachObject(IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, Quaternion rot)
420 { 420 {
421 // Calls attach with a Zero position 421 // If we can't take it, we can't attach it!
422 //
423 SceneObjectPart part = m_parentScene.GetSceneObjectPart(objectLocalID);
424 if (part == null)
425 return;
422 426
427 if (!m_parentScene.ExternalChecks.ExternalChecksCanTakeObject(
428 part.UUID, remoteClient.AgentId))
429 return;
430
431 // Calls attach with a Zero position
432 //
423 AttachObject(remoteClient, objectLocalID, AttachmentPt, rot, Vector3.Zero); 433 AttachObject(remoteClient, objectLocalID, AttachmentPt, rot, Vector3.Zero);
424 } 434 }
425 435
@@ -431,6 +441,7 @@ namespace OpenSim.Region.Environment.Scenes
431 (uint)(PermissionMask.Copy | PermissionMask.Move | PermissionMask.Modify | PermissionMask.Transfer), 441 (uint)(PermissionMask.Copy | PermissionMask.Move | PermissionMask.Modify | PermissionMask.Transfer),
432 (uint)(PermissionMask.Copy | PermissionMask.Move | PermissionMask.Modify | PermissionMask.Transfer), 442 (uint)(PermissionMask.Copy | PermissionMask.Move | PermissionMask.Modify | PermissionMask.Transfer),
433 ItemFlags, false, false, remoteClient.AgentId, true); 443 ItemFlags, false, false, remoteClient.AgentId, true);
444 objatt.SetAttachmentPoint(Convert.ToByte(AttachmentPt));
434 445
435 if (objatt != null) 446 if (objatt != null)
436 { 447 {
@@ -514,7 +525,6 @@ namespace OpenSim.Region.Environment.Scenes
514 UUID newAssetID = m_parentScene.attachObjectAssetStore(remoteClient, group, remoteClient.AgentId); 525 UUID newAssetID = m_parentScene.attachObjectAssetStore(remoteClient, group, remoteClient.AgentId);
515 526
516 // sets assetID so client can show asset as 'attached' in inventory 527 // sets assetID so client can show asset as 'attached' in inventory
517 group.SetFromAssetID(newAssetID);
518 } 528 }
519 group.AttachToAgent(remoteClient.AgentId, AttachmentPt, attachPos); 529 group.AttachToAgent(remoteClient.AgentId, AttachmentPt, attachPos);
520 // In case it is later dropped again, don't let 530 // In case it is later dropped again, don't let
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
index 8557b1c..a7bce49 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
@@ -1684,7 +1684,8 @@ namespace OpenSim.Region.Environment.Scenes
1684 Queue<InventoryFolderImpl> searchfolders = new Queue<InventoryFolderImpl>(); 1684 Queue<InventoryFolderImpl> searchfolders = new Queue<InventoryFolderImpl>();
1685 searchfolders.Enqueue(userInfo.RootFolder); 1685 searchfolders.Enqueue(userInfo.RootFolder);
1686 1686
1687 UUID foundFolder = userInfo.RootFolder.ID; 1687 UUID foundFolder = UUID.Zero;
1688 InventoryItemBase item = null;
1688 1689
1689 // search through folders to find the asset. 1690 // search through folders to find the asset.
1690 while (searchfolders.Count > 0) 1691 while (searchfolders.Count > 0)
@@ -1696,6 +1697,7 @@ namespace OpenSim.Region.Environment.Scenes
1696 { 1697 {
1697 if (fld.Items.ContainsKey(assetID)) 1698 if (fld.Items.ContainsKey(assetID))
1698 { 1699 {
1700 item = fld.Items[assetID];
1699 foundFolder = fld.ID; 1701 foundFolder = fld.ID;
1700 searchfolders.Clear(); 1702 searchfolders.Clear();
1701 break; 1703 break;
@@ -1711,49 +1713,30 @@ namespace OpenSim.Region.Environment.Scenes
1711 } 1713 }
1712 } 1714 }
1713 1715
1714 AssetBase asset = CreateAsset( 1716 if (foundFolder != UUID.Zero && item != null)
1715 objectGroup.GetPartName(objectGroup.LocalId),
1716 objectGroup.GetPartDescription(objectGroup.LocalId),
1717 (sbyte)AssetType.Object,
1718 Utils.StringToBytes(sceneObjectXml));
1719 AssetCache.AddAsset(asset);
1720
1721 InventoryItemBase item = new InventoryItemBase();
1722 item.Creator = objectGroup.RootPart.CreatorID;
1723 item.Owner = agentID;
1724 item.ID = assetID;
1725 item.AssetID = asset.FullID;
1726 item.Description = asset.Description;
1727 item.Name = asset.Name;
1728 item.AssetType = asset.Type;
1729 item.InvType = (int)InventoryType.Object;
1730
1731 // Sticking it in root folder for now.. objects folder later?
1732
1733 item.Folder = foundFolder;// DeRezPacket.AgentBlock.DestinationID;
1734 if ((agentID != objectGroup.RootPart.OwnerID) && ExternalChecks.ExternalChecksPropagatePermissions())
1735 {
1736 item.BasePermissions = objectGroup.RootPart.NextOwnerMask;
1737 item.CurrentPermissions = objectGroup.RootPart.NextOwnerMask;
1738 item.NextPermissions = objectGroup.RootPart.NextOwnerMask;
1739 item.EveryOnePermissions = objectGroup.RootPart.EveryoneMask & objectGroup.RootPart.NextOwnerMask;
1740 }
1741 else
1742 { 1717 {
1743 item.BasePermissions = objectGroup.GetEffectivePermissions(); 1718 AssetBase asset = CreateAsset(
1744 item.CurrentPermissions = objectGroup.GetEffectivePermissions(); 1719 objectGroup.GetPartName(objectGroup.LocalId),
1745 item.NextPermissions = objectGroup.RootPart.NextOwnerMask; 1720 objectGroup.GetPartDescription(objectGroup.LocalId),
1746 item.EveryOnePermissions = objectGroup.RootPart.EveryoneMask; 1721 (sbyte)AssetType.Object,
1747 } 1722 Utils.StringToBytes(sceneObjectXml));
1723 AssetCache.AddAsset(asset);
1748 1724
1749 userInfo.AddItem(item); 1725 item.AssetID = asset.FullID;
1726 item.Description = asset.Description;
1727 item.Name = asset.Name;
1728 item.AssetType = asset.Type;
1729 item.InvType = (int)InventoryType.Object;
1730 item.Folder = foundFolder;
1750 1731
1751 // this gets called when the agent loggs off! 1732 userInfo.UpdateItem(item);
1752 if (remoteClient != null)
1753 {
1754 remoteClient.SendInventoryItemCreateUpdate(item);
1755 }
1756 1733
1734 // this gets called when the agent loggs off!
1735 if (remoteClient != null)
1736 {
1737 remoteClient.SendInventoryItemCreateUpdate(item);
1738 }
1739 }
1757 } 1740 }
1758 } 1741 }
1759 } 1742 }
@@ -1786,9 +1769,8 @@ namespace OpenSim.Region.Environment.Scenes
1786 item.AssetType = asset.Type; 1769 item.AssetType = asset.Type;
1787 item.InvType = (int)InventoryType.Object; 1770 item.InvType = (int)InventoryType.Object;
1788 1771
1789 // Sticking it in root folder for now.. objects folder later? 1772 item.Folder = UUID.Zero; // Objects folder!
1790 1773
1791 item.Folder = userInfo.RootFolder.ID;// DeRezPacket.AgentBlock.DestinationID;
1792 if ((remoteClient.AgentId != objectGroup.RootPart.OwnerID) && ExternalChecks.ExternalChecksPropagatePermissions()) 1774 if ((remoteClient.AgentId != objectGroup.RootPart.OwnerID) && ExternalChecks.ExternalChecksPropagatePermissions())
1793 { 1775 {
1794 item.BasePermissions = objectGroup.RootPart.NextOwnerMask; 1776 item.BasePermissions = objectGroup.RootPart.NextOwnerMask;
@@ -1805,8 +1787,11 @@ namespace OpenSim.Region.Environment.Scenes
1805 } 1787 }
1806 item.CreationDate = Util.UnixTimeSinceEpoch(); 1788 item.CreationDate = Util.UnixTimeSinceEpoch();
1807 1789
1790 grp.SetFromAssetID(item.ID);
1791
1808 userInfo.AddItem(item); 1792 userInfo.AddItem(item);
1809 remoteClient.SendInventoryItemCreateUpdate(item); 1793 remoteClient.SendInventoryItemCreateUpdate(item);
1794
1810 return item.AssetID; 1795 return item.AssetID;
1811 } 1796 }
1812 return UUID.Zero; 1797 return UUID.Zero;
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
index c779a5d..6cd0bae 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
@@ -734,16 +734,18 @@ namespace OpenSim.Region.Environment.Scenes
734 m_rootPart.IsAttachment = true; 734 m_rootPart.IsAttachment = true;
735 735
736 m_rootPart.SetParentLocalId(avatar.LocalId); 736 m_rootPart.SetParentLocalId(avatar.LocalId);
737 lock (m_parts) 737 SetAttachmentPoint(Convert.ToByte(attachmentpoint));
738 {
739 foreach (SceneObjectPart part in m_parts.Values)
740 {
741 part.SetAttachmentPoint(attachmentpoint);
742 }
743 }
744 738
745 avatar.AddAttachment(this); 739 avatar.AddAttachment(this);
746 m_rootPart.ScheduleFullUpdate(); 740 // Killing it here will cause the client to deselect it
741 // It then reappears on the avatar, deselected
742 // through the full update below
743 //
744 foreach (SceneObjectPart part in m_parts.Values)
745 m_scene.SendKiPrimitive(part.LocalId);
746
747 IsSelected = false; // fudge....
748 ScheduleGroupForFullUpdate();
747 } 749 }
748 } 750 }
749 public byte GetAttachmentPoint() 751 public byte GetAttachmentPoint()
@@ -757,10 +759,7 @@ namespace OpenSim.Region.Environment.Scenes
757 759
758 public void ClearPartAttachmentData() 760 public void ClearPartAttachmentData()
759 { 761 {
760 foreach (SceneObjectPart part in m_parts.Values) 762 SetAttachmentPoint((Byte)0);
761 {
762 part.SetAttachmentPoint((Byte)0);
763 }
764 } 763 }
765 764
766 public void DetachToGround() 765 public void DetachToGround()
@@ -775,7 +774,7 @@ namespace OpenSim.Region.Environment.Scenes
775 AbsolutePosition = detachedpos; 774 AbsolutePosition = detachedpos;
776 m_rootPart.AttachedAvatar = UUID.Zero; 775 m_rootPart.AttachedAvatar = UUID.Zero;
777 m_rootPart.SetParentLocalId(0); 776 m_rootPart.SetParentLocalId(0);
778 m_rootPart.SetAttachmentPoint((byte)0); 777 SetAttachmentPoint((byte)0);
779 m_rootPart.IsAttachment = false; 778 m_rootPart.IsAttachment = false;
780 m_rootPart.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), m_scene.m_physicalPrim); 779 m_rootPart.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), m_scene.m_physicalPrim);
781 HasGroupChanged = true; 780 HasGroupChanged = true;
@@ -2755,5 +2754,14 @@ namespace OpenSim.Region.Environment.Scenes
2755 { 2754 {
2756 return String.Format("{0} {1} ({2})", Name, UUID, AbsolutePosition); 2755 return String.Format("{0} {1} ({2})", Name, UUID, AbsolutePosition);
2757 } 2756 }
2757
2758 public void SetAttachmentPoint(byte point)
2759 {
2760 lock(m_parts)
2761 {
2762 foreach (SceneObjectPart part in m_parts.Values)
2763 part.SetAttachmentPoint(point);
2764 }
2765 }
2758 } 2766 }
2759} 2767}
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
index a214884..80c4259 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
@@ -2097,6 +2097,11 @@ namespace OpenSim.Region.Environment.Scenes
2097 /// <param name="clientFlags"></param> 2097 /// <param name="clientFlags"></param>
2098 public void SendFullUpdateToClient(IClientAPI remoteClient, Vector3 lPos, uint clientFlags) 2098 public void SendFullUpdateToClient(IClientAPI remoteClient, Vector3 lPos, uint clientFlags)
2099 { 2099 {
2100 // Suppress full updates during attachment editing
2101 //
2102 if (ParentGroup.IsSelected && IsAttachment)
2103 return;
2104
2100 clientFlags &= ~(uint) PrimFlags.CreateSelected; 2105 clientFlags &= ~(uint) PrimFlags.CreateSelected;
2101 2106
2102 if (remoteClient.AgentId == _ownerID) 2107 if (remoteClient.AgentId == _ownerID)
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/EventManager.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/EventManager.cs
index ef5f83d..4abea40 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/EventManager.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/EventManager.cs
@@ -244,7 +244,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
244 244
245 int lineEnd = script.IndexOf('\n'); 245 int lineEnd = script.IndexOf('\n');
246 246
247 if (lineEnd != -1) 247 if (lineEnd > 1)
248 { 248 {
249 string firstline = script.Substring(0, lineEnd).Trim(); 249 string firstline = script.Substring(0, lineEnd).Trim();
250 250
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
index 1833d5c..47f04d5 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
@@ -342,7 +342,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
342 342
343 int lineEnd = script.IndexOf('\n'); 343 int lineEnd = script.IndexOf('\n');
344 344
345 if (lineEnd != 1) 345 if (lineEnd > 1)
346 { 346 {
347 string firstline = script.Substring(0, lineEnd).Trim(); 347 string firstline = script.Substring(0, lineEnd).Trim();
348 348