From 0a83fde85c8cffa1da46ef0a17390399ae74fa61 Mon Sep 17 00:00:00 2001 From: Jonathan Freedman Date: Sun, 29 Aug 2010 21:28:31 -0400 Subject: Implements parcel media setting persistence and packet / CAPS handling properly for the new media settings. Signed-off-by: Melanie --- .../Region/ClientStack/LindenUDP/LLClientView.cs | 132 +++++++++++---------- .../Framework/EventQueue/EventQueueGetModule.cs | 18 +-- .../Framework/EventQueue/EventQueueHelper.cs | 120 ++----------------- .../CoreModules/World/Land/LandManagementModule.cs | 65 +++++++++- .../Region/CoreModules/World/Land/LandObject.cs | 7 ++ OpenSim/Region/Framework/Interfaces/IEventQueue.cs | 3 +- .../Shared/Api/Implementation/LSL_Api.cs | 8 +- 7 files changed, 166 insertions(+), 187 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 092c96e..0d142f4 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -37,6 +37,7 @@ using System.Xml; using log4net; using OpenMetaverse; using OpenMetaverse.Packets; +using OpenMetaverse.Messages.Linden; using OpenMetaverse.StructuredData; using OpenSim.Framework; using OpenSim.Framework.Client; @@ -4199,94 +4200,101 @@ namespace OpenSim.Region.ClientStack.LindenUDP public void SendLandProperties(int sequence_id, bool snap_selection, int request_result, LandData landData, float simObjectBonusFactor, int parcelObjectCapacity, int simObjectCapacity, uint regionFlags) { - ParcelPropertiesPacket updatePacket = (ParcelPropertiesPacket)PacketPool.Instance.GetPacket(PacketType.ParcelProperties); - // TODO: don't create new blocks if recycling an old packet + ParcelPropertiesMessage updateMessage = new ParcelPropertiesMessage(); - updatePacket.ParcelData.AABBMax = landData.AABBMax; - updatePacket.ParcelData.AABBMin = landData.AABBMin; - updatePacket.ParcelData.Area = landData.Area; - updatePacket.ParcelData.AuctionID = landData.AuctionID; - updatePacket.ParcelData.AuthBuyerID = landData.AuthBuyerID; + updateMessage.AABBMax = landData.AABBMax; + updateMessage.AABBMin = landData.AABBMin; + updateMessage.Area = landData.Area; + updateMessage.AuctionID = landData.AuctionID; + updateMessage.AuthBuyerID = landData.AuthBuyerID; - updatePacket.ParcelData.Bitmap = landData.Bitmap; + updateMessage.Bitmap = landData.Bitmap; - updatePacket.ParcelData.Desc = Utils.StringToBytes(landData.Description); - updatePacket.ParcelData.Category = (byte)landData.Category; - updatePacket.ParcelData.ClaimDate = landData.ClaimDate; - updatePacket.ParcelData.ClaimPrice = landData.ClaimPrice; - updatePacket.ParcelData.GroupID = landData.GroupID; - updatePacket.ParcelData.GroupPrims = landData.GroupPrims; - updatePacket.ParcelData.IsGroupOwned = landData.IsGroupOwned; - updatePacket.ParcelData.LandingType = landData.LandingType; - updatePacket.ParcelData.LocalID = landData.LocalID; + updateMessage.Desc = landData.Description; + updateMessage.Category = landData.Category; + updateMessage.ClaimDate = Util.ToDateTime(landData.ClaimDate); + updateMessage.ClaimPrice = landData.ClaimPrice; + updateMessage.GroupID = landData.GroupID; + updateMessage.GroupPrims = landData.GroupPrims; + updateMessage.IsGroupOwned = landData.IsGroupOwned; + updateMessage.LandingType = (LandingType) landData.LandingType; + updateMessage.LocalID = landData.LocalID; if (landData.Area > 0) { - updatePacket.ParcelData.MaxPrims = parcelObjectCapacity; + updateMessage.MaxPrims = parcelObjectCapacity; } else { - updatePacket.ParcelData.MaxPrims = 0; - } - - updatePacket.ParcelData.MediaAutoScale = landData.MediaAutoScale; - updatePacket.ParcelData.MediaID = landData.MediaID; - updatePacket.ParcelData.MediaURL = Util.StringToBytes256(landData.MediaURL); - updatePacket.ParcelData.MusicURL = Util.StringToBytes256(landData.MusicURL); - updatePacket.ParcelData.Name = Util.StringToBytes256(landData.Name); - updatePacket.ParcelData.OtherCleanTime = landData.OtherCleanTime; - updatePacket.ParcelData.OtherCount = 0; //TODO: Unimplemented - updatePacket.ParcelData.OtherPrims = landData.OtherPrims; - updatePacket.ParcelData.OwnerID = landData.OwnerID; - updatePacket.ParcelData.OwnerPrims = landData.OwnerPrims; - updatePacket.ParcelData.ParcelFlags = landData.Flags; - updatePacket.ParcelData.ParcelPrimBonus = simObjectBonusFactor; - updatePacket.ParcelData.PassHours = landData.PassHours; - updatePacket.ParcelData.PassPrice = landData.PassPrice; - updatePacket.ParcelData.PublicCount = 0; //TODO: Unimplemented - - updatePacket.ParcelData.RegionDenyAnonymous = (regionFlags & (uint)RegionFlags.DenyAnonymous) > 0; - updatePacket.ParcelData.RegionDenyIdentified = (regionFlags & (uint)RegionFlags.DenyIdentified) > 0; - updatePacket.ParcelData.RegionDenyTransacted = (regionFlags & (uint)RegionFlags.DenyTransacted) > 0; - updatePacket.ParcelData.RegionPushOverride = (regionFlags & (uint)RegionFlags.RestrictPushObject) > 0; - - updatePacket.ParcelData.RentPrice = 0; - updatePacket.ParcelData.RequestResult = request_result; - updatePacket.ParcelData.SalePrice = landData.SalePrice; - updatePacket.ParcelData.SelectedPrims = landData.SelectedPrims; - updatePacket.ParcelData.SelfCount = 0; //TODO: Unimplemented - updatePacket.ParcelData.SequenceID = sequence_id; + updateMessage.MaxPrims = 0; + } + + updateMessage.MediaAutoScale = Convert.ToBoolean(landData.MediaAutoScale); + updateMessage.MediaID = landData.MediaID; + updateMessage.MediaURL = landData.MediaURL; + updateMessage.MusicURL = landData.MusicURL; + updateMessage.Name = landData.Name; + updateMessage.OtherCleanTime = landData.OtherCleanTime; + updateMessage.OtherCount = 0; //TODO: Unimplemented + updateMessage.OtherPrims = landData.OtherPrims; + updateMessage.OwnerID = landData.OwnerID; + updateMessage.OwnerPrims = landData.OwnerPrims; + updateMessage.ParcelFlags = (ParcelFlags) landData.Flags; + updateMessage.ParcelPrimBonus = simObjectBonusFactor; + updateMessage.PassHours = landData.PassHours; + updateMessage.PassPrice = landData.PassPrice; + updateMessage.PublicCount = 0; //TODO: Unimplemented + + updateMessage.RegionPushOverride = (regionFlags & (uint)RegionFlags.RestrictPushObject) > 0; + updateMessage.RegionDenyAnonymous = (regionFlags & (uint)RegionFlags.DenyAnonymous) > 0; + + //updateMessage.RegionDenyIdentified = (regionFlags & (uint)RegionFlags.DenyIdentified) > 0; + //updateMessage.RegionDenyTransacted = (regionFlags & (uint)RegionFlags.DenyTransacted) > 0; + + updateMessage.RentPrice = 0; + updateMessage.RequestResult = (ParcelResult) request_result; + updateMessage.SalePrice = landData.SalePrice; + updateMessage.SelectedPrims = landData.SelectedPrims; + updateMessage.SelfCount = 0; //TODO: Unimplemented + updateMessage.SequenceID = sequence_id; if (landData.SimwideArea > 0) { - updatePacket.ParcelData.SimWideMaxPrims = parcelObjectCapacity; + updateMessage.SimWideMaxPrims = parcelObjectCapacity; } else { - updatePacket.ParcelData.SimWideMaxPrims = 0; + updateMessage.SimWideMaxPrims = 0; } - updatePacket.ParcelData.SimWideTotalPrims = landData.SimwidePrims; - updatePacket.ParcelData.SnapSelection = snap_selection; - updatePacket.ParcelData.SnapshotID = landData.SnapshotID; - updatePacket.ParcelData.Status = (byte)landData.Status; - updatePacket.ParcelData.TotalPrims = landData.OwnerPrims + landData.GroupPrims + landData.OtherPrims + + updateMessage.SimWideTotalPrims = landData.SimwidePrims; + updateMessage.SnapSelection = snap_selection; + updateMessage.SnapshotID = landData.SnapshotID; + updateMessage.Status = (ParcelStatus) landData.Status; + updateMessage.TotalPrims = landData.OwnerPrims + landData.GroupPrims + landData.OtherPrims + landData.SelectedPrims; - updatePacket.ParcelData.UserLocation = landData.UserLocation; - updatePacket.ParcelData.UserLookAt = landData.UserLookAt; - updatePacket.Header.Zerocoded = true; + updateMessage.UserLocation = landData.UserLocation; + updateMessage.UserLookAt = landData.UserLookAt; + + updateMessage.MediaType = landData.MediaType; + updateMessage.MediaDesc = landData.MediaDescription; + updateMessage.MediaWidth = landData.MediaWidth; + updateMessage.MediaHeight = landData.MediaHeight; + updateMessage.MediaLoop = landData.MediaLoop; + updateMessage.ObscureMusic = landData.ObscureMusic; + updateMessage.ObscureMedia = landData.ObscureMedia; try { IEventQueue eq = Scene.RequestModuleInterface(); if (eq != null) { - eq.ParcelProperties(updatePacket, this.AgentId); - } + eq.ParcelProperties(updateMessage, this.AgentId); + } else { + m_log.Warn("No EQ Interface when sending parcel data."); + } } catch (Exception ex) { m_log.Error("Unable to send parcel data via eventqueue - exception: " + ex.ToString()); - m_log.Warn("sending parcel data via UDP"); - OutPacket(updatePacket, ThrottleOutPacketType.Task); } } diff --git a/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueGetModule.cs b/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueGetModule.cs index 0c6cb1b..35b70de 100644 --- a/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueGetModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueGetModule.cs @@ -34,6 +34,7 @@ using System.Threading; using log4net; using Nini.Config; using OpenMetaverse; +using OpenMetaverse.Messages.Linden; using OpenMetaverse.Packets; using OpenMetaverse.StructuredData; using OpenSim.Framework; @@ -137,10 +138,11 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue { if (!queues.ContainsKey(agentId)) { + /* m_log.DebugFormat( "[EVENTQUEUE]: Adding new queue for agent {0} in region {1}", agentId, m_scene.RegionInfo.RegionName); - + */ queues[agentId] = new Queue(); } @@ -200,7 +202,7 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue private void ClientClosed(UUID AgentID, Scene scene) { - m_log.DebugFormat("[EVENTQUEUE]: Closed client {0} in region {1}", AgentID, m_scene.RegionInfo.RegionName); + //m_log.DebugFormat("[EVENTQUEUE]: Closed client {0} in region {1}", AgentID, m_scene.RegionInfo.RegionName); int count = 0; while (queues.ContainsKey(AgentID) && queues[AgentID].Count > 0 && count++ < 5) @@ -284,7 +286,7 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue // Reuse open queues. The client does! if (m_AvatarQueueUUIDMapping.ContainsKey(agentID)) { - m_log.DebugFormat("[EVENTQUEUE]: Found Existing UUID!"); + //m_log.DebugFormat("[EVENTQUEUE]: Found Existing UUID!"); EventQueueGetUUID = m_AvatarQueueUUIDMapping[agentID]; } else @@ -365,7 +367,7 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue { // Send it a fake event to keep the client polling! It doesn't like 502s like the proxys say! array.Add(EventQueueHelper.KeepAliveEvent()); - m_log.DebugFormat("[EVENTQUEUE]: adding fake event for {0} in region {1}", pAgentId, m_scene.RegionInfo.RegionName); + //m_log.DebugFormat("[EVENTQUEUE]: adding fake event for {0} in region {1}", pAgentId, m_scene.RegionInfo.RegionName); } else { @@ -394,8 +396,8 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue responsedata["keepalive"] = false; responsedata["reusecontext"] = false; responsedata["str_response_string"] = OSDParser.SerializeLLSDXmlString(events); + //m_log.DebugFormat("[EVENTQUEUE]: sending response for {0} in region {1}: {2}", pAgentId, m_scene.RegionInfo.RegionName, responsedata["str_response_string"]); return responsedata; - //m_log.DebugFormat("[EVENTQUEUE]: sending response for {0} in region {1}: {2}", agentID, m_scene.RegionInfo.RegionName, responsedata["str_response_string"]); } public Hashtable NoEvents(UUID requestID, UUID agentID) @@ -461,7 +463,7 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue { // Send it a fake event to keep the client polling! It doesn't like 502s like the proxys say! array.Add(EventQueueHelper.KeepAliveEvent()); - m_log.DebugFormat("[EVENTQUEUE]: adding fake event for {0} in region {1}", agentID, m_scene.RegionInfo.RegionName); + //m_log.DebugFormat("[EVENTQUEUE]: adding fake event for {0} in region {1}", agentID, m_scene.RegionInfo.RegionName); } else { @@ -697,9 +699,9 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue //m_log.InfoFormat("########### eq ChatterBoxSessionAgentListUpdates #############\n{0}", item); } - public void ParcelProperties(ParcelPropertiesPacket parcelPropertiesPacket, UUID avatarID) + public void ParcelProperties(ParcelPropertiesMessage parcelPropertiesMessage, UUID avatarID) { - OSD item = EventQueueHelper.ParcelProperties(parcelPropertiesPacket); + OSD item = EventQueueHelper.ParcelProperties(parcelPropertiesMessage); Enqueue(item, avatarID); } diff --git a/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueHelper.cs b/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueHelper.cs index e9bcae3..6294935 100644 --- a/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueHelper.cs +++ b/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueHelper.cs @@ -30,6 +30,7 @@ using System.Net; using OpenMetaverse; using OpenMetaverse.Packets; using OpenMetaverse.StructuredData; +using OpenMetaverse.Messages.Linden; namespace OpenSim.Region.CoreModules.Framework.EventQueue { @@ -309,116 +310,6 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue return chatterBoxSessionAgentListUpdates; } - public static OSD ParcelProperties(ParcelPropertiesPacket parcelPropertiesPacket) - { - OSDMap parcelProperties = new OSDMap(); - OSDMap body = new OSDMap(); - - OSDArray ageVerificationBlock = new OSDArray(); - OSDMap ageVerificationMap = new OSDMap(); - ageVerificationMap.Add("RegionDenyAgeUnverified", - OSD.FromBoolean(parcelPropertiesPacket.AgeVerificationBlock.RegionDenyAgeUnverified)); - ageVerificationBlock.Add(ageVerificationMap); - body.Add("AgeVerificationBlock", ageVerificationBlock); - - // LL sims send media info in this event queue message but it's not in the UDP - // packet we construct this event queue message from. This should be refactored in - // other areas of the code so it can all be send in the same message. Until then we will - // still send the media info via UDP - - //OSDArray mediaData = new OSDArray(); - //OSDMap mediaDataMap = new OSDMap(); - //mediaDataMap.Add("MediaDesc", OSD.FromString("")); - //mediaDataMap.Add("MediaHeight", OSD.FromInteger(0)); - //mediaDataMap.Add("MediaLoop", OSD.FromInteger(0)); - //mediaDataMap.Add("MediaType", OSD.FromString("type/type")); - //mediaDataMap.Add("MediaWidth", OSD.FromInteger(0)); - //mediaDataMap.Add("ObscureMedia", OSD.FromInteger(0)); - //mediaDataMap.Add("ObscureMusic", OSD.FromInteger(0)); - //mediaData.Add(mediaDataMap); - //body.Add("MediaData", mediaData); - - OSDArray parcelData = new OSDArray(); - OSDMap parcelDataMap = new OSDMap(); - OSDArray AABBMax = new OSDArray(3); - AABBMax.Add(OSD.FromReal(parcelPropertiesPacket.ParcelData.AABBMax.X)); - AABBMax.Add(OSD.FromReal(parcelPropertiesPacket.ParcelData.AABBMax.Y)); - AABBMax.Add(OSD.FromReal(parcelPropertiesPacket.ParcelData.AABBMax.Z)); - parcelDataMap.Add("AABBMax", AABBMax); - - OSDArray AABBMin = new OSDArray(3); - AABBMin.Add(OSD.FromReal(parcelPropertiesPacket.ParcelData.AABBMin.X)); - AABBMin.Add(OSD.FromReal(parcelPropertiesPacket.ParcelData.AABBMin.Y)); - AABBMin.Add(OSD.FromReal(parcelPropertiesPacket.ParcelData.AABBMin.Z)); - parcelDataMap.Add("AABBMin", AABBMin); - - parcelDataMap.Add("Area", OSD.FromInteger(parcelPropertiesPacket.ParcelData.Area)); - parcelDataMap.Add("AuctionID", OSD.FromBinary(uintToByteArray(parcelPropertiesPacket.ParcelData.AuctionID))); - parcelDataMap.Add("AuthBuyerID", OSD.FromUUID(parcelPropertiesPacket.ParcelData.AuthBuyerID)); - parcelDataMap.Add("Bitmap", OSD.FromBinary(parcelPropertiesPacket.ParcelData.Bitmap)); - parcelDataMap.Add("Category", OSD.FromInteger((int)parcelPropertiesPacket.ParcelData.Category)); - parcelDataMap.Add("ClaimDate", OSD.FromInteger(parcelPropertiesPacket.ParcelData.ClaimDate)); - parcelDataMap.Add("ClaimPrice", OSD.FromInteger(parcelPropertiesPacket.ParcelData.ClaimPrice)); - parcelDataMap.Add("Desc", OSD.FromString(Utils.BytesToString(parcelPropertiesPacket.ParcelData.Desc))); - parcelDataMap.Add("GroupID", OSD.FromUUID(parcelPropertiesPacket.ParcelData.GroupID)); - parcelDataMap.Add("GroupPrims", OSD.FromInteger(parcelPropertiesPacket.ParcelData.GroupPrims)); - parcelDataMap.Add("IsGroupOwned", OSD.FromBoolean(parcelPropertiesPacket.ParcelData.IsGroupOwned)); - parcelDataMap.Add("LandingType", OSD.FromInteger(parcelPropertiesPacket.ParcelData.LandingType)); - parcelDataMap.Add("LocalID", OSD.FromInteger(parcelPropertiesPacket.ParcelData.LocalID)); - parcelDataMap.Add("MaxPrims", OSD.FromInteger(parcelPropertiesPacket.ParcelData.MaxPrims)); - parcelDataMap.Add("MediaAutoScale", OSD.FromInteger((int)parcelPropertiesPacket.ParcelData.MediaAutoScale)); - parcelDataMap.Add("MediaID", OSD.FromUUID(parcelPropertiesPacket.ParcelData.MediaID)); - parcelDataMap.Add("MediaURL", OSD.FromString(Utils.BytesToString(parcelPropertiesPacket.ParcelData.MediaURL))); - parcelDataMap.Add("MusicURL", OSD.FromString(Utils.BytesToString(parcelPropertiesPacket.ParcelData.MusicURL))); - parcelDataMap.Add("Name", OSD.FromString(Utils.BytesToString(parcelPropertiesPacket.ParcelData.Name))); - parcelDataMap.Add("OtherCleanTime", OSD.FromInteger(parcelPropertiesPacket.ParcelData.OtherCleanTime)); - parcelDataMap.Add("OtherCount", OSD.FromInteger(parcelPropertiesPacket.ParcelData.OtherCount)); - parcelDataMap.Add("OtherPrims", OSD.FromInteger(parcelPropertiesPacket.ParcelData.OtherPrims)); - parcelDataMap.Add("OwnerID", OSD.FromUUID(parcelPropertiesPacket.ParcelData.OwnerID)); - parcelDataMap.Add("OwnerPrims", OSD.FromInteger(parcelPropertiesPacket.ParcelData.OwnerPrims)); - parcelDataMap.Add("ParcelFlags", OSD.FromBinary(uintToByteArray(parcelPropertiesPacket.ParcelData.ParcelFlags))); - parcelDataMap.Add("ParcelPrimBonus", OSD.FromReal(parcelPropertiesPacket.ParcelData.ParcelPrimBonus)); - parcelDataMap.Add("PassHours", OSD.FromReal(parcelPropertiesPacket.ParcelData.PassHours)); - parcelDataMap.Add("PassPrice", OSD.FromInteger(parcelPropertiesPacket.ParcelData.PassPrice)); - parcelDataMap.Add("PublicCount", OSD.FromInteger(parcelPropertiesPacket.ParcelData.PublicCount)); - parcelDataMap.Add("RegionDenyAnonymous", OSD.FromBoolean(parcelPropertiesPacket.ParcelData.RegionDenyAnonymous)); - parcelDataMap.Add("RegionDenyIdentified", OSD.FromBoolean(parcelPropertiesPacket.ParcelData.RegionDenyIdentified)); - parcelDataMap.Add("RegionDenyTransacted", OSD.FromBoolean(parcelPropertiesPacket.ParcelData.RegionDenyTransacted)); - - parcelDataMap.Add("RegionPushOverride", OSD.FromBoolean(parcelPropertiesPacket.ParcelData.RegionPushOverride)); - parcelDataMap.Add("RentPrice", OSD.FromInteger(parcelPropertiesPacket.ParcelData.RentPrice)); - parcelDataMap.Add("RequestResult", OSD.FromInteger(parcelPropertiesPacket.ParcelData.RequestResult)); - parcelDataMap.Add("SalePrice", OSD.FromInteger(parcelPropertiesPacket.ParcelData.SalePrice)); - parcelDataMap.Add("SelectedPrims", OSD.FromInteger(parcelPropertiesPacket.ParcelData.SelectedPrims)); - parcelDataMap.Add("SelfCount", OSD.FromInteger(parcelPropertiesPacket.ParcelData.SelfCount)); - parcelDataMap.Add("SequenceID", OSD.FromInteger(parcelPropertiesPacket.ParcelData.SequenceID)); - parcelDataMap.Add("SimWideMaxPrims", OSD.FromInteger(parcelPropertiesPacket.ParcelData.SimWideMaxPrims)); - parcelDataMap.Add("SimWideTotalPrims", OSD.FromInteger(parcelPropertiesPacket.ParcelData.SimWideTotalPrims)); - parcelDataMap.Add("SnapSelection", OSD.FromBoolean(parcelPropertiesPacket.ParcelData.SnapSelection)); - parcelDataMap.Add("SnapshotID", OSD.FromUUID(parcelPropertiesPacket.ParcelData.SnapshotID)); - parcelDataMap.Add("Status", OSD.FromInteger((int)parcelPropertiesPacket.ParcelData.Status)); - parcelDataMap.Add("TotalPrims", OSD.FromInteger(parcelPropertiesPacket.ParcelData.TotalPrims)); - - OSDArray UserLocation = new OSDArray(3); - UserLocation.Add(OSD.FromReal(parcelPropertiesPacket.ParcelData.UserLocation.X)); - UserLocation.Add(OSD.FromReal(parcelPropertiesPacket.ParcelData.UserLocation.Y)); - UserLocation.Add(OSD.FromReal(parcelPropertiesPacket.ParcelData.UserLocation.Z)); - parcelDataMap.Add("UserLocation", UserLocation); - - OSDArray UserLookAt = new OSDArray(3); - UserLookAt.Add(OSD.FromReal(parcelPropertiesPacket.ParcelData.UserLookAt.X)); - UserLookAt.Add(OSD.FromReal(parcelPropertiesPacket.ParcelData.UserLookAt.Y)); - UserLookAt.Add(OSD.FromReal(parcelPropertiesPacket.ParcelData.UserLookAt.Z)); - parcelDataMap.Add("UserLookAt", UserLookAt); - - parcelData.Add(parcelDataMap); - body.Add("ParcelData", parcelData); - parcelProperties.Add("body", body); - parcelProperties.Add("message", OSD.FromString("ParcelProperties")); - - return parcelProperties; - } - public static OSD GroupMembership(AgentGroupDataUpdatePacket groupUpdatePacket) { OSDMap groupUpdate = new OSDMap(); @@ -495,5 +386,14 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue return placesReply; } + public static OSD ParcelProperties(ParcelPropertiesMessage parcelPropertiesMessage) + { + OSDMap message = new OSDMap(); + message.Add("message", OSD.FromString("ParcelProperties")); + OSD message_body = parcelPropertiesMessage.Serialize(); + message.Add("body", message_body); + return message; + } + } } diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index 15dc301..3e79ec0 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs @@ -33,6 +33,8 @@ using System.Reflection; using log4net; using Nini.Config; using OpenMetaverse; +using OpenMetaverse.StructuredData; +using OpenMetaverse.Messages.Linden; using OpenSim.Framework; using OpenSim.Framework.Capabilities; using OpenSim.Framework.Servers; @@ -1066,7 +1068,6 @@ namespace OpenSim.Region.CoreModules.World.Land { for (int y = 0; y < inc_y; y++) { - ILandObject currentParcel = GetLandObject(start_x + x, start_y + y); if (currentParcel != null) @@ -1353,8 +1354,68 @@ namespace OpenSim.Region.CoreModules.World.Land { return RemoteParcelRequest(request, path, param, agentID, caps); })); - } + UUID parcelCapID = UUID.Random(); + caps.RegisterHandler("ParcelPropertiesUpdate", + new RestStreamHandler("POST", "/CAPS/" + parcelCapID, + delegate(string request, string path, string param, + OSHttpRequest httpRequest, OSHttpResponse httpResponse) + { + return ProcessPropertiesUpdate(request, path, param, agentID, caps); + })); + } + private string ProcessPropertiesUpdate(string request, string path, string param, UUID agentID, Caps caps) + { + IClientAPI client; + if ( ! m_scene.TryGetClient(agentID, out client) ) { + m_log.WarnFormat("[LAND] unable to retrieve IClientAPI for {0}", agentID.ToString() ); + return LLSDHelpers.SerialiseLLSDReply(new LLSDEmpty()); + } + + ParcelPropertiesUpdateMessage properties = new ParcelPropertiesUpdateMessage(); + OpenMetaverse.StructuredData.OSDMap args = (OpenMetaverse.StructuredData.OSDMap) OSDParser.DeserializeLLSDXml(request); + + properties.Deserialize(args); + + LandUpdateArgs land_update = new LandUpdateArgs(); + int parcelID = properties.LocalID; + land_update.AuthBuyerID = properties.AuthBuyerID; + land_update.Category = properties.Category; + land_update.Desc = properties.Desc; + land_update.GroupID = properties.GroupID; + land_update.LandingType = (byte) properties.Landing; + land_update.MediaAutoScale = (byte) Convert.ToInt32(properties.MediaAutoScale); + land_update.MediaID = properties.MediaID; + land_update.MediaURL = properties.MediaURL; + land_update.MusicURL = properties.MusicURL; + land_update.Name = properties.Name; + land_update.ParcelFlags = (uint) properties.ParcelFlags; + land_update.PassHours = (int) properties.PassHours; + land_update.PassPrice = (int) properties.PassPrice; + land_update.SalePrice = (int) properties.SalePrice; + land_update.SnapshotID = properties.SnapshotID; + land_update.UserLocation = properties.UserLocation; + land_update.UserLookAt = properties.UserLookAt; + land_update.MediaDescription = properties.MediaDesc; + land_update.MediaType = properties.MediaType; + land_update.MediaWidth = properties.MediaWidth; + land_update.MediaHeight = properties.MediaHeight; + land_update.MediaLoop = properties.MediaLoop; + land_update.ObscureMusic = properties.ObscureMusic; + land_update.ObscureMedia = properties.ObscureMedia; + + ILandObject land; + lock (m_landList) + { + m_landList.TryGetValue(parcelID, out land); + } + if (land != null) { + land.UpdateLandProperties(land_update, client); + } else { + m_log.WarnFormat("[LAND] unable to find parcelID {0}", parcelID); + } + return LLSDHelpers.SerialiseLLSDReply(new LLSDEmpty()); + } // we cheat here: As we don't have (and want) a grid-global parcel-store, we can't return the // "real" parcelID, because we wouldn't be able to map that to the region the parcel belongs to. // So, we create a "fake" parcelID by using the regionHandle (64 bit), and the local (integer) x diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs index 6864629..499b60c 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs @@ -229,6 +229,13 @@ namespace OpenSim.Region.CoreModules.World.Land newData.SnapshotID = args.SnapshotID; newData.UserLocation = args.UserLocation; newData.UserLookAt = args.UserLookAt; + newData.MediaType = args.MediaType; + newData.MediaDescription = args.MediaDescription; + newData.MediaWidth = args.MediaWidth; + newData.MediaHeight = args.MediaHeight; + newData.MediaLoop = args.MediaLoop; + newData.ObscureMusic = args.ObscureMusic; + newData.ObscureMedia = args.ObscureMedia; m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData); diff --git a/OpenSim/Region/Framework/Interfaces/IEventQueue.cs b/OpenSim/Region/Framework/Interfaces/IEventQueue.cs index e093f0a..81e4952 100644 --- a/OpenSim/Region/Framework/Interfaces/IEventQueue.cs +++ b/OpenSim/Region/Framework/Interfaces/IEventQueue.cs @@ -28,6 +28,7 @@ using System.Net; using OpenMetaverse; using OpenMetaverse.Packets; +using OpenMetaverse.Messages.Linden; using OpenMetaverse.StructuredData; namespace OpenSim.Region.Framework.Interfaces @@ -54,7 +55,7 @@ namespace OpenSim.Region.Framework.Interfaces uint ttl, UUID transactionID, bool fromGroup, byte[] binaryBucket); void ChatterBoxSessionAgentListUpdates(UUID sessionID, UUID fromAgent, UUID toAgent, bool canVoiceChat, bool isModerator, bool textMute); - void ParcelProperties(ParcelPropertiesPacket parcelPropertiesPacket, UUID avatarID); + void ParcelProperties(ParcelPropertiesMessage parcelPropertiesMessage, UUID avatarID); void GroupMembership(AgentGroupDataUpdatePacket groupUpdate, UUID avatarID); } } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index af42dae..b51b410 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -9137,8 +9137,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api // we send to all landData.MediaID = new UUID(texture); landData.MediaAutoScale = autoAlign ? (byte)1 : (byte)0; - landData.MediaSize[0] = width; - landData.MediaSize[1] = height; + landData.MediaWidth = width; + landData.MediaHeight = height; landData.MediaType = mediaType; // do that one last, it will cause a ParcelPropertiesUpdate @@ -9224,8 +9224,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api list.Add(new LSL_String(World.GetLandData(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).MediaType)); break; case ParcelMediaCommandEnum.Size: - list.Add(new LSL_String(World.GetLandData(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).MediaSize[0])); - list.Add(new LSL_String(World.GetLandData(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).MediaSize[1])); + list.Add(new LSL_String(World.GetLandData(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).MediaWidth)); + list.Add(new LSL_String(World.GetLandData(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).MediaHeight)); break; default: ParcelMediaCommandEnum mediaCommandEnum = ParcelMediaCommandEnum.Url; -- cgit v1.1 From 3cd7761d65270531f6db4091a3702179bf41316e Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 30 Aug 2010 21:23:19 +0100 Subject: Report exception message as well as stack trace if a region fails to register with the grid service in grid mode --- OpenSim/Region/Application/OpenSimBase.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index b80d17d..526d3b5 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs @@ -356,7 +356,9 @@ namespace OpenSim } catch (Exception e) { - m_log.ErrorFormat("[STARTUP]: Registration of region with grid failed, aborting startup - {0}", e.StackTrace); + m_log.ErrorFormat( + "[STARTUP]: Registration of region with grid failed, aborting startup due to {0} {1}", + e.Message, e.StackTrace); // Carrying on now causes a lot of confusion down the // line - we need to get the user's attention -- cgit v1.1 From b8c58e5f9f5957ae5b28bc17b2db2eb9f55dcd7b Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 31 Aug 2010 18:27:10 +0100 Subject: reinsert functionality to debug log more levels of incoming and outgoing client protocol packets These levels correspond to packets that one isn't usually interested in when debugging (e.g. regular outgoing SimStats packets) This is equivalent to what we had a year ago before it was removed. It's extremely crude since it doesn't allow one to pick individual clients or packets. However, it can still be useful when debugging packet race conditions. --- OpenSim/Region/Application/OpenSim.cs | 8 +++- OpenSim/Region/Application/OpenSimBase.cs | 1 - .../Region/ClientStack/LindenUDP/LLClientView.cs | 52 ++++++++++++++++++---- 3 files changed, 50 insertions(+), 11 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index 6834606..3c2575d 100644 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs @@ -218,7 +218,13 @@ namespace OpenSim m_console.Commands.AddCommand("region", false, "debug packet", "debug packet ", - "Turn on packet debugging", Debug); + "Turn on packet debugging", + "If level > 255 then all incoming and outgoing packets are logged.\n" + + "If level <= 255 then incoming AgentUpdate and outgoing SimStats and SimulatorViewerTimeMessage packets are not logged.\n" + + "If level <= 200 then incoming RequestImage and outgoing ImagePacket, ImageData, LayerData and CoarseLocationUpdate packets are not logged.\n" + + "If level <= 100 then incoming ViewerEffect and AgentAnimation and outgoing ViewerEffect and AvatarAnimation packets are not logged.\n" + + "If level <= 0 then no packets are logged.", + Debug); m_console.Commands.AddCommand("region", false, "debug scene", "debug scene ", diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index 526d3b5..d2d2607 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs @@ -36,7 +36,6 @@ using Nini.Config; using OpenMetaverse; using OpenSim.Framework; using OpenSim.Framework.Communications; - using OpenSim.Framework.Console; using OpenSim.Framework.Servers; using OpenSim.Framework.Servers.HttpServer; diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 0d142f4..fddb966 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -60,7 +60,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP public class LLClientView : IClientAPI, IClientCore, IClientIM, IClientChat, IClientIPEndpoint, IStatsCollector { /// - /// Debug packet level. At the moment, only 255 does anything (prints out all in and out packets). + /// Debug packet level. See OpenSim.RegisterConsoleCommands() for more details. /// protected int m_debugPacketLevel = 0; @@ -11174,8 +11174,28 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// handles splitting manually protected void OutPacket(Packet packet, ThrottleOutPacketType throttlePacketType, bool doAutomaticSplitting) { - if (m_debugPacketLevel >= 255) - m_log.DebugFormat("[CLIENT]: Packet OUT {0}", packet.Type); + if (m_debugPacketLevel > 0) + { + bool outputPacket = true; + + if (m_debugPacketLevel <= 255 + && (packet.Type == PacketType.SimStats || packet.Type == PacketType.SimulatorViewerTimeMessage)) + outputPacket = false; + + if (m_debugPacketLevel <= 200 + && + (packet.Type == PacketType.ImagePacket + || packet.Type == PacketType.ImageData + || packet.Type == PacketType.LayerData + || packet.Type == PacketType.CoarseLocationUpdate)) + outputPacket = false; + + if (m_debugPacketLevel <= 100 && (packet.Type == PacketType.AvatarAnimation || packet.Type == PacketType.ViewerEffect)) + outputPacket = false; + + if (outputPacket) + m_log.DebugFormat("[CLIENT]: Packet OUT {0}", packet.Type); + } m_udpServer.SendPacket(m_udpClient, packet, throttlePacketType, doAutomaticSplitting); } @@ -11246,15 +11266,29 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// Entryway from the client to the simulator. All UDP packets from the client will end up here /// /// OpenMetaverse.packet - public void ProcessInPacket(Packet Pack) + public void ProcessInPacket(Packet packet) { - if (m_debugPacketLevel >= 255) - m_log.DebugFormat("[CLIENT]: Packet IN {0}", Pack.Type); + if (m_debugPacketLevel > 0) + { + bool outputPacket = true; + + if (m_debugPacketLevel <= 255 && packet.Type == PacketType.AgentUpdate) + outputPacket = false; + + if (m_debugPacketLevel <= 200 && packet.Type == PacketType.RequestImage) + outputPacket = false; + + if (m_debugPacketLevel <= 100 && (packet.Type == PacketType.ViewerEffect || packet.Type == PacketType.AgentAnimation)) + outputPacket = false; + + if (outputPacket) + m_log.DebugFormat("[CLIENT]: Packet IN {0}", packet.Type); + } - if (!ProcessPacketMethod(Pack)) - m_log.Warn("[CLIENT]: unhandled packet " + Pack.Type); + if (!ProcessPacketMethod(packet)) + m_log.Warn("[CLIENT]: unhandled packet " + packet.Type); - PacketPool.Instance.ReturnPacket(Pack); + PacketPool.Instance.ReturnPacket(packet); } private static PrimitiveBaseShape GetShapeFromAddPacket(ObjectAddPacket addPacket) -- cgit v1.1 From 9c1c378aa1b8c4f7738514614cdf8e8b870e7263 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 31 Aug 2010 22:16:23 +0100 Subject: Add ScenePresence.GetAttachments(uint attachmentPoint) --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index fbb3177..339d0c4 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -3383,6 +3383,27 @@ namespace OpenSim.Region.Framework.Scenes m_attachments.Add(gobj); } } + + /// + /// Get the scene object attached to the given point. + /// + /// + /// Returns an empty list if there were no attachments at the point. + public List GetAttachments(uint attachmentPoint) + { + List attachments = new List(); + + lock (m_attachments) + { + foreach (SceneObjectGroup so in m_attachments) + { + if (attachmentPoint == so.RootPart.AttachmentPoint) + attachments.Add(so); + } + } + + return attachments; + } public bool HasAttachments() { -- cgit v1.1 From 01276ef43304c3bd9a090e809b7d4f44ecfffcf5 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 31 Aug 2010 22:22:45 +0100 Subject: refactor: change AttachmentsModule.AttachObject to use sp.GetAttachments rather than filter sp.Attachments list directly --- .../CoreModules/Avatar/Attachments/AttachmentsModule.cs | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index d56145a..de65460 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs @@ -173,16 +173,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments UUID itemID = UUID.Zero; if (sp != null) { - foreach(SceneObjectGroup grp in sp.Attachments) + foreach(SceneObjectGroup grp in sp.GetAttachments(AttachmentPt)) { - if (grp.GetAttachmentPoint() == (byte)AttachmentPt) - { - itemID = grp.GetFromItemID(); - break; - } - } - if (itemID != UUID.Zero) - DetachSingleAttachmentToInv(itemID, remoteClient); + itemID = grp.GetFromItemID(); + if (itemID != UUID.Zero) + DetachSingleAttachmentToInv(itemID, remoteClient); + } } if (group.GetFromItemID() == UUID.Zero) -- cgit v1.1 From c47de942637281714c3e85bfc8b3af4405713fd3 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Tue, 31 Aug 2010 22:24:11 +0200 Subject: Adjust the "Magic numbers" we use because we can't reference the actual script state enum to reflect recent changes. --- .../CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs | 2 +- OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 2 +- OpenSim/Region/Framework/Scenes/Scene.cs | 2 +- OpenSim/Region/Framework/Scenes/SceneGraph.cs | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index 6decf54..2ac2324 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs @@ -641,7 +641,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess } // Fire on_rez - group.CreateScriptInstances(0, true, m_Scene.DefaultScriptEngine, 0); + group.CreateScriptInstances(0, true, m_Scene.DefaultScriptEngine, 1); rootPart.ParentGroup.ResumeScripts(); rootPart.ScheduleFullUpdate(); diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 2ac46e2..0674e62 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -1940,7 +1940,7 @@ namespace OpenSim.Region.Framework.Scenes // We can only call this after adding the scene object, since the scene object references the scene // to find out if scripts should be activated at all. - group.CreateScriptInstances(param, true, DefaultScriptEngine, 2); + group.CreateScriptInstances(param, true, DefaultScriptEngine, 3); group.ScheduleGroupForFullUpdate(); diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index db081cc..56ac2c2 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -2376,7 +2376,7 @@ namespace OpenSim.Region.Framework.Scenes return false; } - newObject.RootPart.ParentGroup.CreateScriptInstances(0, false, DefaultScriptEngine, 1); + newObject.RootPart.ParentGroup.CreateScriptInstances(0, false, DefaultScriptEngine, 2); newObject.ResumeScripts(); diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 2c242c9..e7175c5 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -1845,7 +1845,7 @@ namespace OpenSim.Region.Framework.Scenes copy.UpdateGroupRotationR(rot); } - copy.CreateScriptInstances(0, false, m_parentScene.DefaultScriptEngine, 0); + copy.CreateScriptInstances(0, false, m_parentScene.DefaultScriptEngine, 1); copy.HasGroupChanged = true; copy.ScheduleGroupForFullUpdate(); copy.ResumeScripts(); -- cgit v1.1 From 6cbf66827ba3cb878ab70b75fc4e3221b71d820e Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 1 Sep 2010 01:11:52 +0100 Subject: refactor: move SOG.AttachToAgent() into AttachmentsModule --- .../Avatar/Attachments/AttachmentsModule.cs | 81 ++++++++++++++++++++-- .../Region/Framework/Scenes/SceneObjectGroup.cs | 71 ------------------- 2 files changed, 74 insertions(+), 78 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index de65460..6555b54 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs @@ -192,12 +192,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments SetAttachmentInventoryStatus(remoteClient, AttachmentPt, itemID, group); - group.AttachToAgent(remoteClient.AgentId, AttachmentPt, attachPos, silent); - - // In case it is later dropped again, don't let - // it get cleaned up - group.RootPart.RemFlag(PrimFlags.TemporaryOnRez); - group.HasGroupChanged = false; + AttachToAgent(sp, group, AttachmentPt, attachPos, silent); } else { @@ -525,6 +520,78 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments remoteClient.SendInventoryItemCreateUpdate(item, 0); } } - } + } + + /// + /// Attach this scene object to the given avatar. + /// + /// + /// This isn't publicly available since attachments should always perform the corresponding inventory + /// operation (to show the attach in user inventory and update the asset with positional information). + /// + /// + /// + /// + /// + /// + protected void AttachToAgent(ScenePresence avatar, SceneObjectGroup so, uint attachmentpoint, Vector3 AttachOffset, bool silent) + { + // don't attach attachments to child agents + if (avatar.IsChildAgent) return; + +// m_log.DebugFormat("[ATTACHMENTS MODULE]: Adding attachment {0} to avatar {1}", Name, avatar.Name); + + so.DetachFromBackup(); + + // Remove from database and parcel prim count + m_scene.DeleteFromStorage(so.UUID); + m_scene.EventManager.TriggerParcelPrimCountTainted(); + + so.RootPart.AttachedAvatar = avatar.UUID; + + //Anakin Lohner bug #3839 + lock (so.Children) + { + foreach (SceneObjectPart p in so.Children.Values) + { + p.AttachedAvatar = avatar.UUID; + } + } + + if (so.RootPart.PhysActor != null) + { + m_scene.PhysicsScene.RemovePrim(so.RootPart.PhysActor); + so.RootPart.PhysActor = null; + } + + so.AbsolutePosition = AttachOffset; + so.RootPart.AttachedPos = AttachOffset; + so.RootPart.IsAttachment = true; + + so.RootPart.SetParentLocalId(avatar.LocalId); + so.SetAttachmentPoint(Convert.ToByte(attachmentpoint)); + + avatar.AddAttachment(so); + + if (!silent) + { + // Killing it here will cause the client to deselect it + // It then reappears on the avatar, deselected + // through the full update below + // + if (so.IsSelected) + { + m_scene.SendKillObject(so.RootPart.LocalId); + } + + so.IsSelected = false; // fudge.... + so.ScheduleGroupForFullUpdate(); + } + + // In case it is later dropped again, don't let + // it get cleaned up + so.RootPart.RemFlag(PrimFlags.TemporaryOnRez); + so.HasGroupChanged = false; + } } } \ No newline at end of file diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 40a8f83..64a6dd5 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -977,77 +977,6 @@ namespace OpenSim.Region.Framework.Scenes } } - /// - /// Attach this scene object to the given avatar. - /// - /// - /// - /// - public void AttachToAgent(UUID agentID, uint attachmentpoint, Vector3 AttachOffset, bool silent) - { - ScenePresence avatar = m_scene.GetScenePresence(agentID); - if (avatar != null) - { - // don't attach attachments to child agents - if (avatar.IsChildAgent) return; - -// m_log.DebugFormat("[SOG]: Adding attachment {0} to avatar {1}", Name, avatar.Name); - - DetachFromBackup(); - - // Remove from database and parcel prim count - m_scene.DeleteFromStorage(UUID); - m_scene.EventManager.TriggerParcelPrimCountTainted(); - - m_rootPart.AttachedAvatar = agentID; - - //Anakin Lohner bug #3839 - lock (m_parts) - { - foreach (SceneObjectPart p in m_parts.Values) - { - p.AttachedAvatar = agentID; - } - } - - if (m_rootPart.PhysActor != null) - { - m_scene.PhysicsScene.RemovePrim(m_rootPart.PhysActor); - m_rootPart.PhysActor = null; - } - - AbsolutePosition = AttachOffset; - m_rootPart.AttachedPos = AttachOffset; - m_rootPart.IsAttachment = true; - - m_rootPart.SetParentLocalId(avatar.LocalId); - SetAttachmentPoint(Convert.ToByte(attachmentpoint)); - - avatar.AddAttachment(this); - - if (!silent) - { - // Killing it here will cause the client to deselect it - // It then reappears on the avatar, deselected - // through the full update below - // - if (IsSelected) - { - m_scene.SendKillObject(m_rootPart.LocalId); - } - - IsSelected = false; // fudge.... - ScheduleGroupForFullUpdate(); - } - } - else - { - m_log.WarnFormat( - "[SOG]: Tried to add attachment {0} to avatar with UUID {1} in region {2} but the avatar is not present", - UUID, agentID, Scene.RegionInfo.RegionName); - } - } - public byte GetAttachmentPoint() { return m_rootPart.Shape.State; -- cgit v1.1 From ed72396d9b796b8bb084e0db68426eae432123d1 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Thu, 2 Sep 2010 19:49:42 +0200 Subject: Show when appearance is sent to an avatar to help track down failure \to display avatars --- OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | 1 + 1 file changed, 1 insertion(+) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index fddb966..3d4269f 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -3408,6 +3408,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP avp.Sender.IsTrial = false; avp.Sender.ID = agentID; + m_log.DebugFormat("[CLIENT]: Sending appearance for {0} to {1}", agentID.ToString(), AgentId.ToString()); OutPacket(avp, ThrottleOutPacketType.Task); } -- cgit v1.1 From 7720419fc7e74758125dc401eb3258ba5bd9b4f8 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Thu, 2 Sep 2010 20:08:39 +0200 Subject: Experimentally comment the sending of unbaked avatars --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 339d0c4..facbc97 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -2464,7 +2464,9 @@ namespace OpenSim.Region.Framework.Scenes m_controllingClient.SendAvatarDataImmediate(this); SendInitialFullUpdateToAllClients(); - SendAppearanceToAllOtherAgents(); + // Experimentally commenting this. We don't have bakes at this time + // and 1.23 will not display an avatar without bakes. + //SendAppearanceToAllOtherAgents(); } /// -- cgit v1.1 From 1c8bc9b7b6a62b38d9378ec08853ab2237c7a53a Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Thu, 2 Sep 2010 20:51:27 +0200 Subject: Remove commented code and the comment, as the change has proven out --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 3 --- 1 file changed, 3 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index facbc97..cc9355e 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -2464,9 +2464,6 @@ namespace OpenSim.Region.Framework.Scenes m_controllingClient.SendAvatarDataImmediate(this); SendInitialFullUpdateToAllClients(); - // Experimentally commenting this. We don't have bakes at this time - // and 1.23 will not display an avatar without bakes. - //SendAppearanceToAllOtherAgents(); } /// -- cgit v1.1