diff options
author | Melanie Thielker | 2008-08-20 01:48:51 +0000 |
---|---|---|
committer | Melanie Thielker | 2008-08-20 01:48:51 +0000 |
commit | f206ffd5a8cd0ef362e972abf7375eb739f82e5b (patch) | |
tree | e05c17a865f02beecddbe2c9c04705bc08c03db1 /OpenSim/Region/Environment/Scenes | |
parent | Remove trailing whitespace in prebuild.xml. (diff) | |
download | opensim-SC-f206ffd5a8cd0ef362e972abf7375eb739f82e5b.zip opensim-SC-f206ffd5a8cd0ef362e972abf7375eb739f82e5b.tar.gz opensim-SC-f206ffd5a8cd0ef362e972abf7375eb739f82e5b.tar.bz2 opensim-SC-f206ffd5a8cd0ef362e972abf7375eb739f82e5b.tar.xz |
Mantis #2003 - thank you, SachaMagne, for a patch that implements
the first part of gesture persistence.
----------------------------------------------------------
Attachments no longer vanish on walking crossing. Teleport is still
problematic, but will now be blocked with message "Inconsistent
attachment state" rather than losing the attachment. Detach to be
able to TP in that case.
Diffstat (limited to 'OpenSim/Region/Environment/Scenes')
4 files changed, 93 insertions, 8 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs index 171868b..9c91725 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs | |||
@@ -2343,6 +2343,11 @@ namespace OpenSim.Region.Environment.Scenes | |||
2343 | } | 2343 | } |
2344 | } | 2344 | } |
2345 | 2345 | ||
2346 | public void AttachObject(IClientAPI controllingClient, uint localID, uint attachPoint, LLQuaternion rot, LLVector3 pos) | ||
2347 | { | ||
2348 | m_innerScene.AttachObject(controllingClient, localID, attachPoint, rot, pos); | ||
2349 | } | ||
2350 | |||
2346 | public void DetachSingleAttachmentToInv(LLUUID itemID, IClientAPI remoteClient) | 2351 | public void DetachSingleAttachmentToInv(LLUUID itemID, IClientAPI remoteClient) |
2347 | { | 2352 | { |
2348 | ScenePresence presence; | 2353 | ScenePresence presence; |
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 363d0f8..fb2cbb6 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs | |||
@@ -2020,7 +2020,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
2020 | // with the deeded object, it goes back to them | 2020 | // with the deeded object, it goes back to them |
2021 | 2021 | ||
2022 | grp.SetFromAssetID(grp.RootPart.LastOwnerID); | 2022 | grp.SetFromAssetID(grp.RootPart.LastOwnerID); |
2023 | m_innerScene.AttachObject(sp.ControllingClient, grp.LocalId, (uint)0, grp.GroupRotation, grp.AbsolutePosition); | 2023 | AttachObject(sp.ControllingClient, grp.LocalId, (uint)0, grp.GroupRotation, grp.AbsolutePosition); |
2024 | } | 2024 | } |
2025 | } | 2025 | } |
2026 | } | 2026 | } |
@@ -2161,9 +2161,56 @@ namespace OpenSim.Region.Environment.Scenes | |||
2161 | 2161 | ||
2162 | client.OnUnackedTerrain += TerrainUnAcked; | 2162 | client.OnUnackedTerrain += TerrainUnAcked; |
2163 | 2163 | ||
2164 | //Gesture | ||
2165 | client.OnActivateGesture += ActivateGesture; | ||
2166 | client.OnDeactivateGesture += DeactivateGesture; | ||
2167 | |||
2164 | // EventManager.TriggerOnNewClient(client); | 2168 | // EventManager.TriggerOnNewClient(client); |
2165 | } | 2169 | } |
2166 | 2170 | ||
2171 | // Gesture | ||
2172 | public virtual void ActivateGesture(IClientAPI client, LLUUID assetId, LLUUID gestureId) | ||
2173 | { | ||
2174 | // UserProfileCacheService User = CommsManager.SecureInventoryService.UpdateItem(gestureid, agentID); | ||
2175 | CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(client.AgentId); | ||
2176 | |||
2177 | if (userInfo != null) | ||
2178 | { | ||
2179 | |||
2180 | InventoryItemBase item = userInfo.RootFolder.FindItem(gestureId); | ||
2181 | if (item != null) | ||
2182 | { | ||
2183 | item.Flags = 1; | ||
2184 | userInfo.UpdateItem(item); | ||
2185 | } | ||
2186 | else m_log.Error("Unable to find gesture"); | ||
2187 | } | ||
2188 | else m_log.Error("Gesture : Unable to find user "); | ||
2189 | |||
2190 | m_log.DebugFormat("Asset : {0} gesture :{1}", gestureId.ToString(), assetId.ToString()); | ||
2191 | } | ||
2192 | |||
2193 | public virtual void DeactivateGesture(IClientAPI client, LLUUID gestureId) | ||
2194 | { | ||
2195 | // UserProfileCacheService User = CommsManager.SecureInventoryService.UpdateItem(gestureid, agentID); | ||
2196 | CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(client.AgentId); | ||
2197 | |||
2198 | if (userInfo != null) | ||
2199 | { | ||
2200 | |||
2201 | InventoryItemBase item = userInfo.RootFolder.FindItem(gestureId); | ||
2202 | if (item != null) | ||
2203 | { | ||
2204 | item.Flags = 0; | ||
2205 | userInfo.UpdateItem(item); | ||
2206 | } | ||
2207 | else m_log.Error("Unable to find gesture"); | ||
2208 | } | ||
2209 | else m_log.Error("Gesture : Unable to find user "); | ||
2210 | |||
2211 | m_log.DebugFormat("gesture : {0} ", gestureId.ToString()); | ||
2212 | } | ||
2213 | |||
2167 | public virtual void TeleportClientHome(LLUUID agentId, IClientAPI client) | 2214 | public virtual void TeleportClientHome(LLUUID agentId, IClientAPI client) |
2168 | { | 2215 | { |
2169 | UserProfileData UserProfile = CommsManager.UserService.GetUserProfile(agentId); | 2216 | UserProfileData UserProfile = CommsManager.UserService.GetUserProfile(agentId); |
diff --git a/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs index f1af15f..4823aa1 100644 --- a/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs +++ b/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs | |||
@@ -615,6 +615,12 @@ namespace OpenSim.Region.Environment.Scenes | |||
615 | 615 | ||
616 | if (destRegionUp) | 616 | if (destRegionUp) |
617 | { | 617 | { |
618 | if(!avatar.ValidateAttachments()) | ||
619 | { | ||
620 | avatar.ControllingClient.SendTeleportFailed("Inconsistent attachment state"); | ||
621 | return; | ||
622 | } | ||
623 | |||
618 | avatar.Close(); | 624 | avatar.Close(); |
619 | 625 | ||
620 | // Compared to ScenePresence.CrossToNewRegion(), there's no obvious code to handle a teleport | 626 | // Compared to ScenePresence.CrossToNewRegion(), there's no obvious code to handle a teleport |
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs index cc70210..cf24c73 100644 --- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs | |||
@@ -1972,7 +1972,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1972 | LLVector3 vel = m_velocity; | 1972 | LLVector3 vel = m_velocity; |
1973 | ulong neighbourHandle = Helpers.UIntsToLong((uint)(neighbourx * Constants.RegionSize), (uint)(neighboury * Constants.RegionSize)); | 1973 | ulong neighbourHandle = Helpers.UIntsToLong((uint)(neighbourx * Constants.RegionSize), (uint)(neighboury * Constants.RegionSize)); |
1974 | SimpleRegionInfo neighbourRegion = m_scene.RequestNeighbouringRegionInfo(neighbourHandle); | 1974 | SimpleRegionInfo neighbourRegion = m_scene.RequestNeighbouringRegionInfo(neighbourHandle); |
1975 | if (neighbourRegion != null) | 1975 | if (neighbourRegion != null && ValidateAttachments()) |
1976 | { | 1976 | { |
1977 | // When the neighbour is informed of the border crossing, it will set up CAPS handlers for the avatar | 1977 | // When the neighbour is informed of the border crossing, it will set up CAPS handlers for the avatar |
1978 | // This means we need to remove the current caps handler here and possibly compensate later, | 1978 | // This means we need to remove the current caps handler here and possibly compensate later, |
@@ -2343,15 +2343,41 @@ namespace OpenSim.Region.Environment.Scenes | |||
2343 | } | 2343 | } |
2344 | } | 2344 | } |
2345 | 2345 | ||
2346 | public void CrossAttachmentsIntoNewRegion(ulong regionHandle) | 2346 | public bool ValidateAttachments() |
2347 | { | ||
2348 | lock (m_attachments) | ||
2349 | { | ||
2350 | // Validate | ||
2351 | foreach (SceneObjectGroup gobj in m_attachments) | ||
2352 | { | ||
2353 | if(gobj == null) | ||
2354 | return false; | ||
2355 | |||
2356 | if(gobj.RootPart == null) | ||
2357 | { | ||
2358 | return false; | ||
2359 | } | ||
2360 | } | ||
2361 | } | ||
2362 | return true; | ||
2363 | } | ||
2364 | |||
2365 | public bool CrossAttachmentsIntoNewRegion(ulong regionHandle) | ||
2347 | { | 2366 | { |
2348 | m_attachmentsTransported = true; | 2367 | m_attachmentsTransported = true; |
2349 | lock (m_attachments) | 2368 | lock (m_attachments) |
2350 | { | 2369 | { |
2370 | // Validate | ||
2371 | foreach (SceneObjectGroup gobj in m_attachments) | ||
2372 | { | ||
2373 | if(gobj == null || gobj.RootPart == null) | ||
2374 | return false; | ||
2375 | } | ||
2376 | |||
2351 | foreach (SceneObjectGroup gobj in m_attachments) | 2377 | foreach (SceneObjectGroup gobj in m_attachments) |
2352 | { | 2378 | { |
2353 | // If the prim group is null then something must have happened to it! | 2379 | // If the prim group is null then something must have happened to it! |
2354 | if (gobj != null) | 2380 | if (gobj != null && gobj.RootPart != null) |
2355 | { | 2381 | { |
2356 | // Set the parent localID to 0 so it transfers over properly. | 2382 | // Set the parent localID to 0 so it transfers over properly. |
2357 | gobj.RootPart.SetParentLocalId(0); | 2383 | gobj.RootPart.SetParentLocalId(0); |
@@ -2362,6 +2388,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
2362 | } | 2388 | } |
2363 | } | 2389 | } |
2364 | m_attachments.Clear(); | 2390 | m_attachments.Clear(); |
2391 | |||
2392 | return true; | ||
2365 | } | 2393 | } |
2366 | } | 2394 | } |
2367 | 2395 | ||
@@ -2903,10 +2931,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
2903 | m_log.InfoFormat("[ATTACHEMENT] Attach from world {0}", | 2931 | m_log.InfoFormat("[ATTACHEMENT] Attach from world {0}", |
2904 | itemID.ToString()); | 2932 | itemID.ToString()); |
2905 | 2933 | ||
2906 | // Attach from world | 2934 | // Attach from world, if not already attached |
2907 | if (att.ParentGroup != null) | 2935 | if (att.ParentGroup != null && !att.IsAttachment) |
2908 | m_scene.RezSingleAttachment(att.ParentGroup, | 2936 | m_scene.AttachObject(ControllingClient, att.ParentGroup.LocalId, (uint)0, att.ParentGroup.GroupRotation, LLVector3.Zero); |
2909 | ControllingClient, itemID, (uint)attachpoint, 0, 0); | ||
2910 | } | 2937 | } |
2911 | } | 2938 | } |
2912 | } | 2939 | } |