diff options
Diffstat (limited to 'OpenSim/Region')
10 files changed, 178 insertions, 348 deletions
diff --git a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs index a0648f7..8e2dba4 100644 --- a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs +++ b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs | |||
@@ -313,15 +313,11 @@ namespace Flotsam.RegionModules.AssetCache | |||
313 | } | 313 | } |
314 | catch (Exception e) | 314 | catch (Exception e) |
315 | { | 315 | { |
316 | LogException(e); | 316 | m_log.ErrorFormat( |
317 | "[FLOTSAM ASSET CACHE]: Failed to update cache for asset {0}. Exception {1} {2}", | ||
318 | asset.ID, e.Message, e.StackTrace); | ||
317 | } | 319 | } |
318 | } | 320 | } |
319 | catch (Exception e) | ||
320 | { | ||
321 | m_log.ErrorFormat( | ||
322 | "[FLOTSAM ASSET CACHE]: Failed to update cache for asset {0}. Exception {1} {2}", | ||
323 | asset.ID, e.Message, e.StackTrace); | ||
324 | } | ||
325 | } | 321 | } |
326 | 322 | ||
327 | public void Cache(AssetBase asset) | 323 | public void Cache(AssetBase asset) |
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index 8be0455..218b7b8 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | |||
@@ -131,7 +131,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
131 | // If we're an NPC then skip all the item checks and manipulations since we don't have an | 131 | // If we're an NPC then skip all the item checks and manipulations since we don't have an |
132 | // inventory right now. | 132 | // inventory right now. |
133 | if (sp.PresenceType == PresenceType.Npc) | 133 | if (sp.PresenceType == PresenceType.Npc) |
134 | RezSingleAttachmentFromInventoryInternal(sp, UUID.Zero, attach.AssetID, p); | 134 | RezSingleAttachmentFromInventoryInternal(sp, UUID.Zero, attach.AssetID, p, null); |
135 | else | 135 | else |
136 | RezSingleAttachmentFromInventory(sp.ControllingClient, attach.ItemID, p); | 136 | RezSingleAttachmentFromInventory(sp.ControllingClient, attach.ItemID, p); |
137 | } | 137 | } |
@@ -343,17 +343,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
343 | return RezSingleAttachmentFromInventory(remoteClient, itemID, AttachmentPt, true, null); | 343 | return RezSingleAttachmentFromInventory(remoteClient, itemID, AttachmentPt, true, null); |
344 | } | 344 | } |
345 | 345 | ||
346 | public UUID RezSingleAttachmentFromInventory( | 346 | public ISceneEntity RezSingleAttachmentFromInventory( |
347 | IClientAPI remoteClient, UUID itemID, uint AttachmentPt, bool updateInventoryStatus, XmlDocument doc) | 347 | IClientAPI remoteClient, UUID itemID, uint AttachmentPt, bool updateInventoryStatus, XmlDocument doc) |
348 | ScenePresence sp = m_scene.GetScenePresence(remoteClient.AgentId); | ||
349 | |||
350 | { | 348 | { |
349 | ScenePresence sp = m_scene.GetScenePresence(remoteClient.AgentId); | ||
351 | if (sp == null) { m_log.ErrorFormat( "[ATTACHMENTS MODULE]: Could not find presence for client {0} {1} in RezSingleAttachmentFromInventory()", remoteClient.Name, remoteClient.AgentId); return null; } | 350 | if (sp == null) { m_log.ErrorFormat( "[ATTACHMENTS MODULE]: Could not find presence for client {0} {1} in RezSingleAttachmentFromInventory()", remoteClient.Name, remoteClient.AgentId); return null; } |
352 | // TODO: this short circuits multiple attachments functionality in LL viewer 2.1+ and should | 351 | // TODO: this short circuits multiple attachments functionality in LL viewer 2.1+ and should |
353 | // be removed when that functionality is implemented in opensim | 352 | // be removed when that functionality is implemented in opensim |
354 | AttachmentPt &= 0x7f; | 353 | AttachmentPt &= 0x7f; |
355 | 354 | ||
356 | SceneObjectGroup att = RezSingleAttachmentFromInventoryInternal(remoteClient, itemID, AttachmentPt, doc); | 355 | SceneObjectGroup att = RezSingleAttachmentFromInventoryInternal(sp, itemID, UUID.Zero, AttachmentPt, doc); |
357 | 356 | ||
358 | if (updateInventoryStatus) | 357 | if (updateInventoryStatus) |
359 | { | 358 | { |
@@ -367,7 +366,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
367 | } | 366 | } |
368 | 367 | ||
369 | protected SceneObjectGroup RezSingleAttachmentFromInventoryInternal( | 368 | protected SceneObjectGroup RezSingleAttachmentFromInventoryInternal( |
370 | IClientAPI remoteClient, UUID itemID, uint AttachmentPt, XmlDocument doc) | 369 | IScenePresence sp, UUID itemID, UUID assetID, uint attachmentPt, XmlDocument doc) |
371 | { | 370 | { |
372 | IInventoryAccessModule invAccess = m_scene.RequestModuleInterface<IInventoryAccessModule>(); | 371 | IInventoryAccessModule invAccess = m_scene.RequestModuleInterface<IInventoryAccessModule>(); |
373 | if (invAccess != null) | 372 | if (invAccess != null) |
@@ -462,9 +461,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
462 | if (!att.IsDeleted) | 461 | if (!att.IsDeleted) |
463 | attachmentPoint = att.AttachmentPoint; | 462 | attachmentPoint = att.AttachmentPoint; |
464 | 463 | ||
465 | ScenePresence presence; | ||
466 | if (m_scene.TryGetScenePresence(remoteClient.AgentId, out presence)) | ||
467 | { | ||
468 | InventoryItemBase item = new InventoryItemBase(itemID, sp.UUID); | 464 | InventoryItemBase item = new InventoryItemBase(itemID, sp.UUID); |
469 | if (m_scene.InventoryService != null) | 465 | if (m_scene.InventoryService != null) |
470 | item = m_scene.InventoryService.GetItem(item); | 466 | item = m_scene.InventoryService.GetItem(item); |
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index a3066e7..474905a 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs | |||
@@ -96,6 +96,8 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
96 | 96 | ||
97 | // caches ExtendedLandData | 97 | // caches ExtendedLandData |
98 | private Cache parcelInfoCache; | 98 | private Cache parcelInfoCache; |
99 | private Dictionary<UUID, Vector3> forcedPosition = | ||
100 | new Dictionary<UUID, Vector3>(); | ||
99 | 101 | ||
100 | #region INonSharedRegionModule Members | 102 | #region INonSharedRegionModule Members |
101 | 103 | ||
diff --git a/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs b/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs index 6bbdd7d..59c26e7 100644 --- a/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs | |||
@@ -103,7 +103,7 @@ namespace OpenSim.Region.Framework.Interfaces | |||
103 | IClientAPI remoteClient, UUID itemID, uint AttachmentPt, bool updateInventoryStatus); | 103 | IClientAPI remoteClient, UUID itemID, uint AttachmentPt, bool updateInventoryStatus); |
104 | 104 | ||
105 | // Same as above, but also load script states from a separate doc | 105 | // Same as above, but also load script states from a separate doc |
106 | UUID RezSingleAttachmentFromInventory( | 106 | ISceneEntity RezSingleAttachmentFromInventory( |
107 | IClientAPI remoteClient, UUID itemID, uint AttachmentPt, bool updateInventoryStatus, XmlDocument doc); | 107 | IClientAPI remoteClient, UUID itemID, uint AttachmentPt, bool updateInventoryStatus, XmlDocument doc); |
108 | 108 | ||
109 | /// <summary> | 109 | /// <summary> |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 345c2df..a661ab8 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -2695,9 +2695,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
2695 | EventManager.TriggerOnClientLogin(client); | 2695 | EventManager.TriggerOnClientLogin(client); |
2696 | 2696 | ||
2697 | // Send initial parcel data | 2697 | // Send initial parcel data |
2698 | Vector3 pos = presence.AbsolutePosition; | 2698 | Vector3 pos = createdSp.AbsolutePosition; |
2699 | ILandObject land = LandChannel.GetLandObject(pos.X, pos.Y); | 2699 | ILandObject land = LandChannel.GetLandObject(pos.X, pos.Y); |
2700 | land.SendLandUpdateToClient(presence.ControllingClient); | 2700 | land.SendLandUpdateToClient(client); |
2701 | } | 2701 | } |
2702 | } | 2702 | } |
2703 | } | 2703 | } |
@@ -3500,7 +3500,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3500 | // check if banned regions are to be blacked out. | 3500 | // check if banned regions are to be blacked out. |
3501 | if (vialogin || (!m_seeIntoBannedRegion)) | 3501 | if (vialogin || (!m_seeIntoBannedRegion)) |
3502 | { | 3502 | { |
3503 | if (!AuthorizeUser(agent.AgentID, out reason)) | 3503 | if (!AuthorizeUser(agent, out reason)) |
3504 | return false; | 3504 | return false; |
3505 | } | 3505 | } |
3506 | } | 3506 | } |
@@ -3696,47 +3696,31 @@ namespace OpenSim.Region.Framework.Scenes | |||
3696 | /// <param name="reason">outputs the reason to this string</param> | 3696 | /// <param name="reason">outputs the reason to this string</param> |
3697 | /// <returns>True if the region accepts this agent. False if it does not. False will | 3697 | /// <returns>True if the region accepts this agent. False if it does not. False will |
3698 | /// also return a reason.</returns> | 3698 | /// also return a reason.</returns> |
3699 | protected virtual bool AuthorizeUser(UUID agentID, out string reason) | 3699 | protected virtual bool AuthorizeUser(AgentCircuitData agent, out string reason) |
3700 | { | 3700 | { |
3701 | reason = String.Empty; | 3701 | reason = String.Empty; |
3702 | 3702 | ||
3703 | if (!m_strictAccessControl) return true; | 3703 | if (!m_strictAccessControl) return true; |
3704 | if (Permissions.IsGod(agentID)) return true; | 3704 | if (Permissions.IsGod(agent.AgentID)) return true; |
3705 | 3705 | ||
3706 | if (AuthorizationService != null) | 3706 | if (AuthorizationService != null) |
3707 | { | 3707 | { |
3708 | if (!AuthorizationService.IsAuthorizedForRegion( | 3708 | if (!AuthorizationService.IsAuthorizedForRegion( |
3709 | agent.AgentID.ToString(), agent.firstname, agent.lastname, RegionInfo.RegionID.ToString(), out reason)) | 3709 | agent.AgentID.ToString(), agent.firstname, agent.lastname, RegionInfo.RegionID.ToString(), out reason)) |
3710 | { | 3710 | { |
3711 | m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} at {1} because the user does not have access to the region", | 3711 | m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user does not have access to the region", |
3712 | agentID, RegionInfo.RegionName); | 3712 | agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName); |
3713 | 3713 | ||
3714 | return false; | 3714 | return false; |
3715 | } | 3715 | } |
3716 | } | 3716 | } |
3717 | 3717 | ||
3718 | if (m_regInfo.EstateSettings != null) | 3718 | if (m_regInfo.EstateSettings != null) |
3719 | { | 3719 | { |
3720 | int flags = GetUserFlags(agentID); | 3720 | if (m_regInfo.EstateSettings.IsBanned(agent.AgentID,0)) |
3721 | if (m_regInfo.EstateSettings.IsBanned(agentID, flags)) | ||
3722 | { | 3721 | { |
3723 | //Add some more info to help users | 3722 | m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user is on the banlist", |
3724 | if (!m_regInfo.EstateSettings.IsBanned(agentID, 32)) | 3723 | agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName); |
3725 | { | ||
3726 | m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} at {1} because the region requires age verification", | ||
3727 | agentID, RegionInfo.RegionName); | ||
3728 | reason = String.Format("Denied access to region {0}: Region requires age verification", RegionInfo.RegionName); | ||
3729 | return false; | ||
3730 | } | ||
3731 | if (!m_regInfo.EstateSettings.IsBanned(agentID, 4)) | ||
3732 | { | ||
3733 | m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} {1} because the region requires payment info on file", | ||
3734 | agentID, RegionInfo.RegionName); | ||
3735 | reason = String.Format("Denied access to region {0}: Region requires payment info on file", RegionInfo.RegionName); | ||
3736 | return false; | ||
3737 | } | ||
3738 | m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} at {3} because the user is on the banlist", | ||
3739 | agentID, RegionInfo.RegionName); | ||
3740 | reason = String.Format("Denied access to region {0}: You have been banned from that region.", | 3724 | reason = String.Format("Denied access to region {0}: You have been banned from that region.", |
3741 | RegionInfo.RegionName); | 3725 | RegionInfo.RegionName); |
3742 | return false; | 3726 | return false; |
@@ -3753,7 +3737,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3753 | if (groupsModule != null) | 3737 | if (groupsModule != null) |
3754 | { | 3738 | { |
3755 | GroupMembershipData[] GroupMembership = | 3739 | GroupMembershipData[] GroupMembership = |
3756 | groupsModule.GetMembershipData(agentID); | 3740 | groupsModule.GetMembershipData(agent.AgentID); |
3757 | 3741 | ||
3758 | if (GroupMembership != null) | 3742 | if (GroupMembership != null) |
3759 | { | 3743 | { |
@@ -3782,16 +3766,44 @@ namespace OpenSim.Region.Framework.Scenes | |||
3782 | m_log.ErrorFormat("[CONNECTION BEGIN]: EstateGroups is null!"); | 3766 | m_log.ErrorFormat("[CONNECTION BEGIN]: EstateGroups is null!"); |
3783 | 3767 | ||
3784 | if (!m_regInfo.EstateSettings.PublicAccess && | 3768 | if (!m_regInfo.EstateSettings.PublicAccess && |
3785 | !m_regInfo.EstateSettings.HasAccess(agentID) && | 3769 | !m_regInfo.EstateSettings.HasAccess(agent.AgentID) && |
3786 | !groupAccess) | 3770 | !groupAccess) |
3787 | { | 3771 | { |
3788 | m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} at {1} because the user does not have access to the estate", | 3772 | m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user does not have access to the estate", |
3789 | agentID, RegionInfo.RegionName); | 3773 | agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName); |
3790 | reason = String.Format("Denied access to private region {0}: You are not on the access list for that region.", | 3774 | reason = String.Format("Denied access to private region {0}: You are not on the access list for that region.", |
3791 | RegionInfo.RegionName); | 3775 | RegionInfo.RegionName); |
3792 | return false; | 3776 | return false; |
3793 | } | 3777 | } |
3794 | 3778 | ||
3779 | // TODO: estate/region settings are not properly hooked up | ||
3780 | // to ILandObject.isRestrictedFromLand() | ||
3781 | // if (null != LandChannel) | ||
3782 | // { | ||
3783 | // // region seems to have local Id of 1 | ||
3784 | // ILandObject land = LandChannel.GetLandObject(1); | ||
3785 | // if (null != land) | ||
3786 | // { | ||
3787 | // if (land.isBannedFromLand(agent.AgentID)) | ||
3788 | // { | ||
3789 | // m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user has been banned from land", | ||
3790 | // agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName); | ||
3791 | // reason = String.Format("Denied access to private region {0}: You are banned from that region.", | ||
3792 | // RegionInfo.RegionName); | ||
3793 | // return false; | ||
3794 | // } | ||
3795 | |||
3796 | // if (land.isRestrictedFromLand(agent.AgentID)) | ||
3797 | // { | ||
3798 | // m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user does not have access to the region", | ||
3799 | // agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName); | ||
3800 | // reason = String.Format("Denied access to private region {0}: You are not on the access list for that region.", | ||
3801 | // RegionInfo.RegionName); | ||
3802 | // return false; | ||
3803 | // } | ||
3804 | // } | ||
3805 | // } | ||
3806 | |||
3795 | return true; | 3807 | return true; |
3796 | } | 3808 | } |
3797 | 3809 | ||
@@ -5387,9 +5399,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
5387 | } | 5399 | } |
5388 | } | 5400 | } |
5389 | 5401 | ||
5390 | if (!AuthorizeUser(agentID, out reason)) | 5402 | try |
5403 | { | ||
5404 | if (!AuthorizeUser(GetScenePresence(agentID).ControllingClient.RequestClientInfo(), out reason)) | ||
5405 | { | ||
5406 | // m_log.DebugFormat("[SCENE]: Denying access for {0}", agentID); | ||
5407 | return false; | ||
5408 | } | ||
5409 | } | ||
5410 | catch | ||
5391 | { | 5411 | { |
5392 | // m_log.DebugFormat("[SCENE]: Denying access for {0}", agentID); | ||
5393 | return false; | 5412 | return false; |
5394 | } | 5413 | } |
5395 | 5414 | ||
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 35684e0..ea6aab0 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -1245,7 +1245,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1245 | 1245 | ||
1246 | public void DetachToGround() | 1246 | public void DetachToGround() |
1247 | { | 1247 | { |
1248 | ScenePresence avatar = m_scene.GetScenePresence(m_rootPart.AttachedAvatar); | 1248 | ScenePresence avatar = m_scene.GetScenePresence(AttachedAvatar); |
1249 | if (avatar == null) | 1249 | if (avatar == null) |
1250 | return; | 1250 | return; |
1251 | 1251 | ||
@@ -1259,14 +1259,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
1259 | RootPart.FromItemID = UUID.Zero; | 1259 | RootPart.FromItemID = UUID.Zero; |
1260 | 1260 | ||
1261 | AbsolutePosition = detachedpos; | 1261 | AbsolutePosition = detachedpos; |
1262 | m_rootPart.AttachedAvatar = UUID.Zero; | 1262 | AttachedAvatar = UUID.Zero; |
1263 | 1263 | ||
1264 | SceneObjectPart[] parts = m_parts.GetArray(); | 1264 | //SceneObjectPart[] parts = m_parts.GetArray(); |
1265 | for (int i = 0; i < parts.Length; i++) | 1265 | //for (int i = 0; i < parts.Length; i++) |
1266 | parts[i].AttachedAvatar = UUID.Zero; | 1266 | // parts[i].AttachedAvatar = UUID.Zero; |
1267 | 1267 | ||
1268 | m_rootPart.SetParentLocalId(0); | 1268 | m_rootPart.SetParentLocalId(0); |
1269 | SetAttachmentPoint((byte)0); | 1269 | AttachmentPoint = (byte)0; |
1270 | m_rootPart.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), m_rootPart.VolumeDetectActive, m_scene.m_physicalPrim); | 1270 | m_rootPart.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), m_rootPart.VolumeDetectActive, m_scene.m_physicalPrim); |
1271 | HasGroupChanged = true; | 1271 | HasGroupChanged = true; |
1272 | RootPart.Rezzed = DateTime.Now; | 1272 | RootPart.Rezzed = DateTime.Now; |
@@ -1279,7 +1279,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1279 | 1279 | ||
1280 | public void DetachToInventoryPrep() | 1280 | public void DetachToInventoryPrep() |
1281 | { | 1281 | { |
1282 | ScenePresence avatar = m_scene.GetScenePresence(m_rootPart.AttachedAvatar); | 1282 | ScenePresence avatar = m_scene.GetScenePresence(AttachedAvatar); |
1283 | //Vector3 detachedpos = new Vector3(127f, 127f, 127f); | 1283 | //Vector3 detachedpos = new Vector3(127f, 127f, 127f); |
1284 | if (avatar != null) | 1284 | if (avatar != null) |
1285 | { | 1285 | { |
@@ -1287,15 +1287,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
1287 | avatar.RemoveAttachment(this); | 1287 | avatar.RemoveAttachment(this); |
1288 | } | 1288 | } |
1289 | 1289 | ||
1290 | m_rootPart.AttachedAvatar = UUID.Zero; | 1290 | AttachedAvatar = UUID.Zero; |
1291 | 1291 | ||
1292 | SceneObjectPart[] parts = m_parts.GetArray(); | 1292 | /*SceneObjectPart[] parts = m_parts.GetArray(); |
1293 | for (int i = 0; i < parts.Length; i++) | 1293 | for (int i = 0; i < parts.Length; i++) |
1294 | parts[i].AttachedAvatar = UUID.Zero; | 1294 | parts[i].AttachedAvatar = UUID.Zero;*/ |
1295 | 1295 | ||
1296 | m_rootPart.SetParentLocalId(0); | 1296 | m_rootPart.SetParentLocalId(0); |
1297 | //m_rootPart.SetAttachmentPoint((byte)0); | 1297 | //m_rootPart.SetAttachmentPoint((byte)0); |
1298 | m_rootPart.IsAttachment = false; | 1298 | IsAttachment = false; |
1299 | AbsolutePosition = m_rootPart.AttachedPos; | 1299 | AbsolutePosition = m_rootPart.AttachedPos; |
1300 | //m_rootPart.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), m_scene.m_physicalPrim); | 1300 | //m_rootPart.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), m_scene.m_physicalPrim); |
1301 | //AttachToBackup(); | 1301 | //AttachToBackup(); |
@@ -1471,7 +1471,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1471 | public void DeleteGroupFromScene(bool silent) | 1471 | public void DeleteGroupFromScene(bool silent) |
1472 | { | 1472 | { |
1473 | // We need to keep track of this state in case this group is still queued for backup. | 1473 | // We need to keep track of this state in case this group is still queued for backup. |
1474 | m_isDeleted = true; | 1474 | IsDeleted = true; |
1475 | 1475 | ||
1476 | DetachFromBackup(); | 1476 | DetachFromBackup(); |
1477 | 1477 | ||
@@ -1746,97 +1746,63 @@ namespace OpenSim.Region.Framework.Scenes | |||
1746 | /// <returns></returns> | 1746 | /// <returns></returns> |
1747 | public SceneObjectGroup Copy(bool userExposed) | 1747 | public SceneObjectGroup Copy(bool userExposed) |
1748 | { | 1748 | { |
1749 | SceneObjectGroup dupe; | 1749 | SceneObjectGroup dupe = (SceneObjectGroup)MemberwiseClone(); |
1750 | try | 1750 | dupe.m_isBackedUp = false; |
1751 | { | 1751 | dupe.m_parts = new MapAndArray<OpenMetaverse.UUID, SceneObjectPart>(); |
1752 | m_dupeInProgress = true; | ||
1753 | dupe = (SceneObjectGroup)MemberwiseClone(); | ||
1754 | dupe.m_isBackedUp = false; | ||
1755 | dupe.m_parts = new MapAndArray<OpenMetaverse.UUID, SceneObjectPart>(); | ||
1756 | 1752 | ||
1757 | // Warning, The following code related to previousAttachmentStatus is needed so that clones of | 1753 | // Warning, The following code related to previousAttachmentStatus is needed so that clones of |
1758 | // attachments do not bordercross while they're being duplicated. This is hacktastic! | 1754 | // attachments do not bordercross while they're being duplicated. This is hacktastic! |
1759 | // Normally, setting AbsolutePosition will bordercross a prim if it's outside the region! | 1755 | // Normally, setting AbsolutePosition will bordercross a prim if it's outside the region! |
1760 | // unless IsAttachment is true!, so to prevent border crossing, we save it's attachment state | 1756 | // unless IsAttachment is true!, so to prevent border crossing, we save it's attachment state |
1761 | // (which should be false anyway) set it as an Attachment and then set it's Absolute Position, | 1757 | // (which should be false anyway) set it as an Attachment and then set it's Absolute Position, |
1762 | // then restore it's attachment state | 1758 | // then restore it's attachment state |
1763 | 1759 | ||
1764 | // This is only necessary when userExposed is false! | 1760 | // This is only necessary when userExposed is false! |
1765 | 1761 | ||
1766 | bool previousAttachmentStatus = dupe.IsAttachment; | 1762 | bool previousAttachmentStatus = dupe.IsAttachment; |
1767 | |||
1768 | if (!userExposed) | ||
1769 | dupe.IsAttachment = true; | ||
1770 | 1763 | ||
1771 | if (!userExposed) | 1764 | if (!userExposed) |
1772 | dupe.RootPart.IsAttachment = true; | 1765 | dupe.IsAttachment = true; |
1773 | 1766 | ||
1774 | dupe.AbsolutePosition = new Vector3(AbsolutePosition.X, AbsolutePosition.Y, AbsolutePosition.Z); | 1767 | dupe.AbsolutePosition = new Vector3(AbsolutePosition.X, AbsolutePosition.Y, AbsolutePosition.Z); |
1775 | if (!userExposed) | ||
1776 | { | ||
1777 | dupe.IsAttachment = previousAttachmentStatus; | ||
1778 | } | ||
1779 | 1768 | ||
1780 | if (!userExposed) | 1769 | if (!userExposed) |
1781 | { | 1770 | { |
1782 | dupe.RootPart.IsAttachment = previousAttachmentStatus; | 1771 | dupe.IsAttachment = previousAttachmentStatus; |
1783 | } | 1772 | } |
1784 | 1773 | ||
1785 | dupe.CopyRootPart(m_rootPart, OwnerID, GroupID, userExposed); | 1774 | dupe.CopyRootPart(m_rootPart, OwnerID, GroupID, userExposed); |
1786 | dupe.m_rootPart.LinkNum = m_rootPart.LinkNum; | 1775 | dupe.m_rootPart.LinkNum = m_rootPart.LinkNum; |
1787 | 1776 | ||
1788 | if (userExposed) | 1777 | if (userExposed) |
1789 | dupe.m_rootPart.TrimPermissions(); | 1778 | dupe.m_rootPart.TrimPermissions(); |
1790 | 1779 | ||
1791 | List<SceneObjectPart> partList = new List<SceneObjectPart>(m_parts.GetArray()); | 1780 | List<SceneObjectPart> partList = new List<SceneObjectPart>(m_parts.GetArray()); |
1792 | 1781 | ||
1793 | partList.Sort(delegate(SceneObjectPart p1, SceneObjectPart p2) | 1782 | partList.Sort(delegate(SceneObjectPart p1, SceneObjectPart p2) |
1794 | { | 1783 | { |
1795 | return p1.LinkNum.CompareTo(p2.LinkNum); | 1784 | return p1.LinkNum.CompareTo(p2.LinkNum); |
1796 | } | 1785 | } |
1797 | ); | 1786 | ); |
1798 | 1787 | ||
1799 | foreach (SceneObjectPart part in partList) | 1788 | foreach (SceneObjectPart part in partList) |
1789 | { | ||
1790 | SceneObjectPart newPart; | ||
1791 | if (part.UUID != m_rootPart.UUID) | ||
1800 | { | 1792 | { |
1801 | if (part.UUID != m_rootPart.UUID) | 1793 | newPart = dupe.CopyPart(part, OwnerID, GroupID, userExposed); |
1802 | { | 1794 | newPart.LinkNum = part.LinkNum; |
1803 | SceneObjectPart newPart = dupe.CopyPart(part, OwnerID, GroupID, userExposed); | ||
1804 | |||
1805 | newPart.LinkNum = part.LinkNum; | ||
1806 | } | ||
1807 | |||
1808 | // Need to duplicate the physics actor as well | ||
1809 | if (part.PhysActor != null && userExposed) | ||
1810 | { | ||
1811 | PrimitiveBaseShape pbs = part.Shape; | ||
1812 | |||
1813 | part.PhysActor | ||
1814 | = m_scene.PhysicsScene.AddPrimShape( | ||
1815 | string.Format("{0}/{1}", part.Name, part.UUID), | ||
1816 | pbs, | ||
1817 | part.AbsolutePosition, | ||
1818 | part.Scale, | ||
1819 | part.RotationOffset, | ||
1820 | part.PhysActor.IsPhysical, | ||
1821 | m_localId); | ||
1822 | part.PhysActor.SetMaterial((int)part.Material); | ||
1823 | |||
1824 | part.PhysActor.LocalID = part.LocalId; | ||
1825 | part.DoPhysicsPropertyUpdate(part.PhysActor.IsPhysical, true); | ||
1826 | } | ||
1827 | } | 1795 | } |
1828 | if (userExposed) | 1796 | else |
1829 | { | 1797 | { |
1830 | dupe.UpdateParentIDs(); | 1798 | newPart = dupe.m_rootPart; |
1831 | dupe.HasGroupChanged = true; | ||
1832 | dupe.AttachToBackup(); | ||
1833 | } | 1799 | } |
1834 | ScheduleGroupForFullUpdate(); | 1800 | |
1835 | // Need to duplicate the physics actor as well | 1801 | // Need to duplicate the physics actor as well |
1836 | if (part.PhysActor != null && userExposed) | 1802 | if (part.PhysActor != null && userExposed) |
1837 | { | 1803 | { |
1838 | PrimitiveBaseShape pbs = newPart.Shape; | 1804 | PrimitiveBaseShape pbs = newPart.Shape; |
1839 | 1805 | ||
1840 | newPart.PhysActor | 1806 | newPart.PhysActor |
1841 | = m_scene.PhysicsScene.AddPrimShape( | 1807 | = m_scene.PhysicsScene.AddPrimShape( |
1842 | string.Format("{0}/{1}", newPart.Name, newPart.UUID), | 1808 | string.Format("{0}/{1}", newPart.Name, newPart.UUID), |
@@ -1846,14 +1812,20 @@ namespace OpenSim.Region.Framework.Scenes | |||
1846 | newPart.RotationOffset, | 1812 | newPart.RotationOffset, |
1847 | part.PhysActor.IsPhysical, | 1813 | part.PhysActor.IsPhysical, |
1848 | newPart.LocalId); | 1814 | newPart.LocalId); |
1849 | 1815 | ||
1850 | newPart.DoPhysicsPropertyUpdate(part.PhysActor.IsPhysical, true); | 1816 | newPart.DoPhysicsPropertyUpdate(part.PhysActor.IsPhysical, true); |
1851 | } | 1817 | } |
1852 | } | 1818 | } |
1853 | finally | 1819 | |
1820 | if (userExposed) | ||
1854 | { | 1821 | { |
1855 | m_dupeInProgress = false; | 1822 | dupe.UpdateParentIDs(); |
1823 | dupe.HasGroupChanged = true; | ||
1824 | dupe.AttachToBackup(); | ||
1825 | |||
1826 | ScheduleGroupForFullUpdate(); | ||
1856 | } | 1827 | } |
1828 | |||
1857 | return dupe; | 1829 | return dupe; |
1858 | } | 1830 | } |
1859 | 1831 | ||
@@ -1983,22 +1955,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1983 | 1955 | ||
1984 | public void stopMoveToTarget() | 1956 | public void stopMoveToTarget() |
1985 | { | 1957 | { |
1986 | SceneObjectPart rootpart = m_rootPart; | 1958 | if (RootPart.PhysActor != null) |
1987 | if (rootpart != null) | 1959 | RootPart.PhysActor.PIDActive = false; |
1988 | { | ||
1989 | if (IsAttachment) | ||
1990 | { | ||
1991 | ScenePresence avatar = m_scene.GetScenePresence(rootpart.AttachedAvatar); | ||
1992 | if (avatar != null) avatar.StopMoveToPosition(); | ||
1993 | } | ||
1994 | else | ||
1995 | { | ||
1996 | if (rootpart.PhysActor != null) | ||
1997 | { | ||
1998 | rootpart.PhysActor.PIDActive = false; | ||
1999 | } | ||
2000 | } | ||
2001 | } | ||
2002 | } | 1960 | } |
2003 | 1961 | ||
2004 | public void rotLookAt(Quaternion target, float strength, float damping) | 1962 | public void rotLookAt(Quaternion target, float strength, float damping) |
@@ -3087,8 +3045,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
3087 | prevScale.X *= x; | 3045 | prevScale.X *= x; |
3088 | prevScale.Y *= y; | 3046 | prevScale.Y *= y; |
3089 | prevScale.Z *= z; | 3047 | prevScale.Z *= z; |
3090 | part.IgnoreUndoUpdate = false; | ||
3091 | |||
3092 | // RootPart.IgnoreUndoUpdate = true; | 3048 | // RootPart.IgnoreUndoUpdate = true; |
3093 | RootPart.Resize(prevScale); | 3049 | RootPart.Resize(prevScale); |
3094 | // RootPart.IgnoreUndoUpdate = false; | 3050 | // RootPart.IgnoreUndoUpdate = false; |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 6988718..0c3b404 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -3243,6 +3243,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
3243 | STATUS_ROTATE_Z = rotate; | 3243 | STATUS_ROTATE_Z = rotate; |
3244 | } | 3244 | } |
3245 | 3245 | ||
3246 | public void SetBuoyancy(float fvalue) | ||
3247 | { | ||
3248 | if (PhysActor != null) | ||
3249 | { | ||
3250 | PhysActor.Buoyancy = fvalue; | ||
3251 | } | ||
3252 | } | ||
3253 | |||
3246 | public void SetDieAtEdge(bool p) | 3254 | public void SetDieAtEdge(bool p) |
3247 | { | 3255 | { |
3248 | if (m_parentGroup.IsDeleted) | 3256 | if (m_parentGroup.IsDeleted) |
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 8ee7d89..35a8df7 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -131,6 +131,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
131 | // private SceneObjectGroup proxyObjectGroup; | 131 | // private SceneObjectGroup proxyObjectGroup; |
132 | //private SceneObjectPart proxyObjectPart = null; | 132 | //private SceneObjectPart proxyObjectPart = null; |
133 | public Vector3 lastKnownAllowedPosition; | 133 | public Vector3 lastKnownAllowedPosition; |
134 | public bool sentMessageAboutRestrictedParcelFlyingDown; | ||
134 | public Vector4 CollisionPlane = Vector4.UnitW; | 135 | public Vector4 CollisionPlane = Vector4.UnitW; |
135 | 136 | ||
136 | private Vector3 m_avInitialPos; // used to calculate unscripted sit rotation | 137 | private Vector3 m_avInitialPos; // used to calculate unscripted sit rotation |
@@ -4316,103 +4317,6 @@ if (m_animator.m_jumping) force.Z = m_animator.m_jumpVelocity; // add for ju | |||
4316 | return flags; | 4317 | return flags; |
4317 | } | 4318 | } |
4318 | 4319 | ||
4319 | /// <summary> | ||
4320 | /// RezAttachments. This should only be called upon login on the first region. | ||
4321 | /// Attachment rezzings on crossings and TPs are done in a different way. | ||
4322 | /// </summary> | ||
4323 | public void RezAttachments() | ||
4324 | { | ||
4325 | if (null == m_appearance) | ||
4326 | { | ||
4327 | m_log.WarnFormat("[ATTACHMENT]: Appearance has not been initialized for agent {0}", UUID); | ||
4328 | return; | ||
4329 | } | ||
4330 | |||
4331 | XmlDocument doc = new XmlDocument(); | ||
4332 | string stateData = String.Empty; | ||
4333 | |||
4334 | IAttachmentsService attServ = m_scene.RequestModuleInterface<IAttachmentsService>(); | ||
4335 | if (attServ != null) | ||
4336 | { | ||
4337 | m_log.DebugFormat("[ATTACHMENT]: Loading attachment data from attachment service"); | ||
4338 | stateData = attServ.Get(ControllingClient.AgentId.ToString()); | ||
4339 | if (stateData != String.Empty) | ||
4340 | { | ||
4341 | try | ||
4342 | { | ||
4343 | doc.LoadXml(stateData); | ||
4344 | } | ||
4345 | catch { } | ||
4346 | } | ||
4347 | } | ||
4348 | |||
4349 | Dictionary<UUID, string> itemData = new Dictionary<UUID, string>(); | ||
4350 | |||
4351 | XmlNodeList nodes = doc.GetElementsByTagName("Attachment"); | ||
4352 | if (nodes.Count > 0) | ||
4353 | { | ||
4354 | foreach (XmlNode n in nodes) | ||
4355 | { | ||
4356 | XmlElement elem = (XmlElement)n; | ||
4357 | string itemID = elem.GetAttribute("ItemID"); | ||
4358 | string xml = elem.InnerXml; | ||
4359 | |||
4360 | itemData[new UUID(itemID)] = xml; | ||
4361 | } | ||
4362 | } | ||
4363 | |||
4364 | List<AvatarAttachment> attachments = m_appearance.GetAttachments(); | ||
4365 | foreach (AvatarAttachment attach in attachments) | ||
4366 | { | ||
4367 | if (IsDeleted) | ||
4368 | return; | ||
4369 | |||
4370 | int p = attach.AttachPoint; | ||
4371 | UUID itemID = attach.ItemID; | ||
4372 | |||
4373 | //UUID assetID = attach.AssetID; | ||
4374 | // For some reason assetIDs are being written as Zero's in the DB -- need to track tat down | ||
4375 | // But they're not used anyway, the item is being looked up for now, so let's proceed. | ||
4376 | //if (UUID.Zero == assetID) | ||
4377 | //{ | ||
4378 | // m_log.DebugFormat("[ATTACHMENT]: Cannot rez attachment in point {0} with itemID {1}", p, itemID); | ||
4379 | // continue; | ||
4380 | //} | ||
4381 | |||
4382 | try | ||
4383 | { | ||
4384 | string xmlData; | ||
4385 | XmlDocument d = new XmlDocument(); | ||
4386 | UUID asset; | ||
4387 | if (itemData.TryGetValue(itemID, out xmlData)) | ||
4388 | { | ||
4389 | d.LoadXml(xmlData); | ||
4390 | m_log.InfoFormat("[ATTACHMENT]: Found saved state for item {0}, loading it", itemID); | ||
4391 | |||
4392 | // Rez from inventory | ||
4393 | asset | ||
4394 | = m_scene.AttachmentsModule.RezSingleAttachmentFromInventory(ControllingClient, itemID, (uint)p, true, d); | ||
4395 | |||
4396 | } | ||
4397 | else | ||
4398 | { | ||
4399 | // Rez from inventory (with a null doc to let | ||
4400 | // CHANGED_OWNER happen) | ||
4401 | asset | ||
4402 | = m_scene.AttachmentsModule.RezSingleAttachmentFromInventory(ControllingClient, itemID, (uint)p, true, null); | ||
4403 | } | ||
4404 | |||
4405 | m_log.InfoFormat( | ||
4406 | "[ATTACHMENT]: Rezzed attachment in point {0} from item {1} and asset {2}", | ||
4407 | p, itemID, asset); | ||
4408 | } | ||
4409 | catch (Exception e) | ||
4410 | { | ||
4411 | m_log.ErrorFormat("[ATTACHMENT]: Unable to rez attachment: {0}{1}", e.Message, e.StackTrace); | ||
4412 | } | ||
4413 | } | ||
4414 | } | ||
4415 | |||
4416 | private void ReprioritizeUpdates() | 4320 | private void ReprioritizeUpdates() |
4417 | { | 4321 | { |
4418 | if (Scene.IsReprioritizationEnabled && Scene.UpdatePrioritizationScheme != UpdatePrioritizationSchemes.Time) | 4322 | if (Scene.IsReprioritizationEnabled && Scene.UpdatePrioritizationScheme != UpdatePrioritizationSchemes.Time) |
diff --git a/OpenSim/Region/Framework/Scenes/UndoState.cs b/OpenSim/Region/Framework/Scenes/UndoState.cs index 81f41db..0a30f4b 100644 --- a/OpenSim/Region/Framework/Scenes/UndoState.cs +++ b/OpenSim/Region/Framework/Scenes/UndoState.cs | |||
@@ -50,16 +50,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
50 | 50 | ||
51 | public class UndoState | 51 | public class UndoState |
52 | { | 52 | { |
53 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 53 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
54 | 54 | ||
55 | public Vector3 Position = Vector3.Zero; | 55 | public Vector3 Position = Vector3.Zero; |
56 | public Vector3 Scale = Vector3.Zero; | 56 | public Vector3 Scale = Vector3.Zero; |
57 | public Quaternion Rotation = Quaternion.Identity; | 57 | public Quaternion Rotation = Quaternion.Identity; |
58 | public Vector3 GroupPosition = Vector3.Zero; | ||
59 | public Quaternion GroupRotation = Quaternion.Identity; | ||
60 | public Vector3 GroupScale = Vector3.Zero; | ||
61 | public DateTime LastUpdated = DateTime.Now; | ||
62 | public UndoType Type; | ||
63 | 58 | ||
64 | /// <summary> | 59 | /// <summary> |
65 | /// Is this undo state for an entire group? | 60 | /// Is this undo state for an entire group? |
@@ -77,88 +72,40 @@ namespace OpenSim.Region.Framework.Scenes | |||
77 | { | 72 | { |
78 | ForGroup = forGroup; | 73 | ForGroup = forGroup; |
79 | 74 | ||
80 | // if (ForGroup) | 75 | // if (ForGroup) |
81 | GroupScale = part.ParentGroup.RootPart.Shape.Scale; | 76 | Position = part.ParentGroup.AbsolutePosition; |
77 | // else | ||
78 | // Position = part.OffsetPosition; | ||
82 | 79 | ||
83 | //FUBAR WARNING: Do NOT get the group's absoluteposition here | 80 | // m_log.DebugFormat( |
84 | //or you'll experience a loop and/or a stack issue | 81 | // "[UNDO STATE]: Storing undo position {0} for root part", Position); |
85 | GroupPosition = part.ParentGroup.RootPart.AbsolutePosition; | ||
86 | GroupRotation = part.ParentGroup.GroupRotation; | ||
87 | Position = part.ParentGroup.RootPart.AbsolutePosition; | ||
88 | // else | ||
89 | // Position = part.OffsetPosition; | ||
90 | |||
91 | // m_log.DebugFormat( | ||
92 | // "[UNDO STATE]: Storing undo position {0} for root part", Position); | ||
93 | 82 | ||
94 | Rotation = part.RotationOffset; | 83 | Rotation = part.RotationOffset; |
95 | 84 | ||
96 | // m_log.DebugFormat( | 85 | // m_log.DebugFormat( |
97 | // "[UNDO STATE]: Storing undo rotation {0} for root part", Rotation); | 86 | // "[UNDO STATE]: Storing undo rotation {0} for root part", Rotation); |
98 | 87 | ||
99 | Scale = part.Shape.Scale; | 88 | Scale = part.Shape.Scale; |
100 | 89 | ||
101 | // m_log.DebugFormat( | 90 | // m_log.DebugFormat( |
102 | // "[UNDO STATE]: Storing undo scale {0} for root part", Scale); | 91 | // "[UNDO STATE]: Storing undo scale {0} for root part", Scale); |
103 | } | 92 | } |
104 | else | 93 | else |
105 | { | 94 | { |
106 | Position = part.OffsetPosition; | 95 | Position = part.OffsetPosition; |
107 | // m_log.DebugFormat( | 96 | // m_log.DebugFormat( |
108 | // "[UNDO STATE]: Storing undo position {0} for child part", Position); | 97 | // "[UNDO STATE]: Storing undo position {0} for child part", Position); |
109 | 98 | ||
110 | Rotation = part.RotationOffset; | 99 | Rotation = part.RotationOffset; |
111 | // m_log.DebugFormat( | 100 | // m_log.DebugFormat( |
112 | // "[UNDO STATE]: Storing undo rotation {0} for child part", Rotation); | 101 | // "[UNDO STATE]: Storing undo rotation {0} for child part", Rotation); |
113 | 102 | ||
114 | Scale = part.Shape.Scale; | 103 | Scale = part.Shape.Scale; |
115 | // m_log.DebugFormat( | 104 | // m_log.DebugFormat( |
116 | // "[UNDO STATE]: Storing undo scale {0} for child part", Scale); | 105 | // "[UNDO STATE]: Storing undo scale {0} for child part", Scale); |
117 | } | ||
118 | } | ||
119 | public void Merge(UndoState last) | ||
120 | { | ||
121 | if ((Type & UndoType.STATE_GROUP_POSITION) == 0 || ((last.Type & UndoType.STATE_GROUP_POSITION) >= (Type & UndoType.STATE_GROUP_POSITION))) | ||
122 | { | ||
123 | GroupPosition = last.GroupPosition; | ||
124 | Position = last.Position; | ||
125 | } | ||
126 | if ((Type & UndoType.STATE_GROUP_SCALE) == 0 || ((last.Type & UndoType.STATE_GROUP_SCALE) >= (Type & UndoType.STATE_GROUP_SCALE))) | ||
127 | { | ||
128 | GroupScale = last.GroupScale; | ||
129 | Scale = last.Scale; | ||
130 | } | ||
131 | if ((Type & UndoType.STATE_GROUP_ROTATION) == 0 || ((last.Type & UndoType.STATE_GROUP_ROTATION) >= (Type & UndoType.STATE_GROUP_ROTATION))) | ||
132 | { | ||
133 | GroupRotation = last.GroupRotation; | ||
134 | Rotation = last.Rotation; | ||
135 | } | ||
136 | if ((Type & UndoType.STATE_PRIM_POSITION) == 0 || ((last.Type & UndoType.STATE_PRIM_POSITION) >= (Type & UndoType.STATE_PRIM_POSITION))) | ||
137 | { | ||
138 | Position = last.Position; | ||
139 | } | ||
140 | if ((Type & UndoType.STATE_PRIM_SCALE) == 0 || ((last.Type & UndoType.STATE_PRIM_SCALE) >= (Type & UndoType.STATE_PRIM_SCALE))) | ||
141 | { | ||
142 | Scale = last.Scale; | ||
143 | } | ||
144 | if ((Type & UndoType.STATE_PRIM_ROTATION) == 0 || ((last.Type & UndoType.STATE_PRIM_ROTATION) >= (Type & UndoType.STATE_PRIM_ROTATION))) | ||
145 | { | ||
146 | Rotation = last.Rotation; | ||
147 | } | ||
148 | Type = Type | last.Type; | ||
149 | } | ||
150 | public bool Compare(UndoState undo) | ||
151 | { | ||
152 | if (undo == null || Position == null) return false; | ||
153 | if (undo.Position == Position && undo.Rotation == Rotation && undo.Scale == Scale && undo.GroupPosition == GroupPosition && undo.GroupScale == GroupScale && undo.GroupRotation == GroupRotation) | ||
154 | { | ||
155 | return true; | ||
156 | } | ||
157 | else | ||
158 | { | ||
159 | return false; | ||
160 | } | 106 | } |
161 | } | 107 | } |
108 | |||
162 | /// <summary> | 109 | /// <summary> |
163 | /// Compare the relevant state in the given part to this state. | 110 | /// Compare the relevant state in the given part to this state. |
164 | /// </summary> | 111 | /// </summary> |
@@ -183,15 +130,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
183 | return false; | 130 | return false; |
184 | } | 131 | } |
185 | 132 | ||
186 | private void RestoreState(SceneObjectPart part) | 133 | public void PlaybackState(SceneObjectPart part) |
187 | { | 134 | { |
188 | part.Undoing = true; | 135 | part.Undoing = true; |
189 | 136 | ||
190 | if (part.ParentID == 0) | 137 | if (part.ParentID == 0) |
191 | { | 138 | { |
192 | // m_log.DebugFormat( | 139 | // m_log.DebugFormat( |
193 | // "[UNDO STATE]: Undoing position to {0} for root part {1} {2}", | 140 | // "[UNDO STATE]: Undoing position to {0} for root part {1} {2}", |
194 | // Position, part.Name, part.LocalId); | 141 | // Position, part.Name, part.LocalId); |
195 | 142 | ||
196 | if (Position != Vector3.Zero) | 143 | if (Position != Vector3.Zero) |
197 | { | 144 | { |
@@ -201,9 +148,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
201 | part.ParentGroup.UpdateRootPosition(Position); | 148 | part.ParentGroup.UpdateRootPosition(Position); |
202 | } | 149 | } |
203 | 150 | ||
204 | // m_log.DebugFormat( | 151 | // m_log.DebugFormat( |
205 | // "[UNDO STATE]: Undoing rotation {0} to {1} for root part {2} {3}", | 152 | // "[UNDO STATE]: Undoing rotation {0} to {1} for root part {2} {3}", |
206 | // part.RotationOffset, Rotation, part.Name, part.LocalId); | 153 | // part.RotationOffset, Rotation, part.Name, part.LocalId); |
207 | 154 | ||
208 | if (ForGroup) | 155 | if (ForGroup) |
209 | part.UpdateRotation(Rotation); | 156 | part.UpdateRotation(Rotation); |
@@ -212,9 +159,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
212 | 159 | ||
213 | if (Scale != Vector3.Zero) | 160 | if (Scale != Vector3.Zero) |
214 | { | 161 | { |
215 | // m_log.DebugFormat( | 162 | // m_log.DebugFormat( |
216 | // "[UNDO STATE]: Undoing scale {0} to {1} for root part {2} {3}", | 163 | // "[UNDO STATE]: Undoing scale {0} to {1} for root part {2} {3}", |
217 | // part.Shape.Scale, Scale, part.Name, part.LocalId); | 164 | // part.Shape.Scale, Scale, part.Name, part.LocalId); |
218 | 165 | ||
219 | if (ForGroup) | 166 | if (ForGroup) |
220 | part.ParentGroup.GroupResize(Scale); | 167 | part.ParentGroup.GroupResize(Scale); |
@@ -228,24 +175,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
228 | { | 175 | { |
229 | if (Position != Vector3.Zero) | 176 | if (Position != Vector3.Zero) |
230 | { | 177 | { |
231 | // m_log.DebugFormat( | 178 | // m_log.DebugFormat( |
232 | // "[UNDO STATE]: Undoing position {0} to {1} for child part {2} {3}", | 179 | // "[UNDO STATE]: Undoing position {0} to {1} for child part {2} {3}", |
233 | // part.OffsetPosition, Position, part.Name, part.LocalId); | 180 | // part.OffsetPosition, Position, part.Name, part.LocalId); |
234 | 181 | ||
235 | part.OffsetPosition = Position; | 182 | part.OffsetPosition = Position; |
236 | } | 183 | } |
237 | 184 | ||
238 | // m_log.DebugFormat( | 185 | // m_log.DebugFormat( |
239 | // "[UNDO STATE]: Undoing rotation {0} to {1} for child part {2} {3}", | 186 | // "[UNDO STATE]: Undoing rotation {0} to {1} for child part {2} {3}", |
240 | // part.RotationOffset, Rotation, part.Name, part.LocalId); | 187 | // part.RotationOffset, Rotation, part.Name, part.LocalId); |
241 | 188 | ||
242 | part.UpdateRotation(Rotation); | 189 | part.UpdateRotation(Rotation); |
243 | 190 | ||
244 | if (Scale != Vector3.Zero) | 191 | if (Scale != Vector3.Zero) |
245 | { | 192 | { |
246 | // m_log.DebugFormat( | 193 | // m_log.DebugFormat( |
247 | // "[UNDO STATE]: Undoing scale {0} to {1} for child part {2} {3}", | 194 | // "[UNDO STATE]: Undoing scale {0} to {1} for child part {2} {3}", |
248 | // part.Shape.Scale, Scale, part.Name, part.LocalId); | 195 | // part.Shape.Scale, Scale, part.Name, part.LocalId); |
249 | 196 | ||
250 | part.Resize(Scale); | 197 | part.Resize(Scale); |
251 | } | 198 | } |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index bf791a9..6f34168 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -1219,7 +1219,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1219 | public virtual void llDie() | 1219 | public virtual void llDie() |
1220 | { | 1220 | { |
1221 | m_host.AddScriptLPS(1); | 1221 | m_host.AddScriptLPS(1); |
1222 | if (!m_host.IsAttachment) throw new SelfDeleteException(); | 1222 | if (!m_host.ParentGroup.IsAttachment) throw new SelfDeleteException(); |
1223 | } | 1223 | } |
1224 | 1224 | ||
1225 | public LSL_Float llGround(LSL_Vector offset) | 1225 | public LSL_Float llGround(LSL_Vector offset) |
@@ -3250,8 +3250,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3250 | SceneObjectGroup grp = m_host.ParentGroup; | 3250 | SceneObjectGroup grp = m_host.ParentGroup; |
3251 | 3251 | ||
3252 | ScenePresence presence = World.GetScenePresence(m_host.OwnerID); | 3252 | ScenePresence presence = World.GetScenePresence(m_host.OwnerID); |
3253 | 3253 | if (presence.Scene.AttachmentsModule != null) | |
3254 | grp.AttachToAgent(m_host.OwnerID, (uint)attachment, Vector3.Zero, false); | 3254 | { |
3255 | presence.Scene.AttachmentsModule.AttachObject(presence.ControllingClient, grp, (uint)attachment, false); | ||
3256 | } | ||
3255 | } | 3257 | } |
3256 | } | 3258 | } |
3257 | 3259 | ||
@@ -8034,7 +8036,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8034 | // the UUID with the avatar UUID and report it's bounding box | 8036 | // the UUID with the avatar UUID and report it's bounding box |
8035 | SceneObjectPart part = World.GetSceneObjectPart(objID); | 8037 | SceneObjectPart part = World.GetSceneObjectPart(objID); |
8036 | if (part != null && part.ParentGroup.IsAttachment) | 8038 | if (part != null && part.ParentGroup.IsAttachment) |
8037 | objID = part.ParentGroup.RootPart.AttachedAvatar; | 8039 | objID = part.ParentGroup.AttachedAvatar; |
8038 | 8040 | ||
8039 | // Find out if this is an avatar ID. If so, return it's box | 8041 | // Find out if this is an avatar ID. If so, return it's box |
8040 | ScenePresence presence = World.GetScenePresence(objID); | 8042 | ScenePresence presence = World.GetScenePresence(objID); |
@@ -10064,7 +10066,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
10064 | DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_itemID, 0); | 10066 | DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_itemID, 0); |
10065 | if (detectedParams == null) | 10067 | if (detectedParams == null) |
10066 | { | 10068 | { |
10067 | if (m_host.IsAttachment == true) | 10069 | if (m_host.ParentGroup.IsAttachment == true) |
10068 | { | 10070 | { |
10069 | detectedParams = new DetectParams(); | 10071 | detectedParams = new DetectParams(); |
10070 | detectedParams.Key = m_host.OwnerID; | 10072 | detectedParams.Key = m_host.OwnerID; |