diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index c046010a3c..6f2f834907 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -117,7 +117,7 @@ namespace OpenSim.Framework public delegate void ObjectExtraParams(UUID agentID, uint localID, ushort type, bool inUse, byte[] data); - public delegate void ObjectSelect(uint localID, IClientAPI remoteClient); + public delegate void ObjectSelect(List localID, IClientAPI remoteClient); public delegate void ObjectRequest(uint localID, IClientAPI remoteClient); diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 78043bdfe4..5b39cc5c3d 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -2882,18 +2882,24 @@ namespace OpenSim.Region.ClientStack.LindenUDP public void SendAsset(AssetRequestToClient req) { + if (req.AssetInf == null) + { + m_log.ErrorFormat("{0} Cannot send asset {1} ({2}), asset is null", + LogHeader); + return; + } + if (req.AssetInf.Data == null) { m_log.ErrorFormat("{0} Cannot send asset {1} ({2}), asset data is null", LogHeader, req.AssetInf.ID, req.AssetInf.Metadata.ContentType); return; } + int WearableOut = 0; bool isWearable = false; - if (req.AssetInf != null) - isWearable = - ((AssetType) req.AssetInf.Type == + isWearable = ((AssetType) req.AssetInf.Type == AssetType.Bodypart || (AssetType) req.AssetInf.Type == AssetType.Clothing); @@ -3013,7 +3019,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP reply.Data.ParcelID = parcelID; reply.Data.OwnerID = land.OwnerID; reply.Data.Name = Utils.StringToBytes(land.Name); - if (land != null && land.Description != null && land.Description != String.Empty) + if (land.Description != null && land.Description != String.Empty) reply.Data.Desc = Utils.StringToBytes(land.Description.Substring(0, land.Description.Length > 254 ? 254: land.Description.Length)); else reply.Data.Desc = new Byte[0]; @@ -4241,24 +4247,22 @@ namespace OpenSim.Region.ClientStack.LindenUDP } else { + ImprovedTerseObjectUpdatePacket.ObjectDataBlock ablock; if (update.Entity is ScenePresence) { // ALL presence updates go into a special list - ImprovedTerseObjectUpdatePacket.ObjectDataBlock ablock = - CreateImprovedTerseBlock(update.Entity, updateFlags.HasFlag(PrimUpdateFlags.Textures)); + ablock = CreateImprovedTerseBlock(update.Entity, updateFlags.HasFlag(PrimUpdateFlags.Textures)); terseAgentUpdateBlocks.Value.Add(ablock); terseAgentUpdates.Value.Add(update); - maxUpdatesBytes -= ablock.Length; } else { // Everything else goes here - ImprovedTerseObjectUpdatePacket.ObjectDataBlock ablock = - CreateImprovedTerseBlock(update.Entity, updateFlags.HasFlag(PrimUpdateFlags.Textures)); + ablock = CreateImprovedTerseBlock(update.Entity, updateFlags.HasFlag(PrimUpdateFlags.Textures)); terseUpdateBlocks.Value.Add(ablock); terseUpdates.Value.Add(update); - maxUpdatesBytes -= ablock.Length; } + maxUpdatesBytes -= ablock.Length; } #endregion Block Construction @@ -5442,22 +5446,21 @@ namespace OpenSim.Region.ClientStack.LindenUDP Quaternion rotation; byte[] textureEntry; - if (entity is ScenePresence) + if (avatar) { ScenePresence presence = (ScenePresence)entity; position = presence.OffsetPosition; + velocity = presence.Velocity; + acceleration = Vector3.Zero; rotation = presence.Rotation; angularVelocity = presence.AngularVelocity; - rotation = presence.Rotation; // m_log.DebugFormat( // "[LLCLIENTVIEW]: Sending terse update to {0} with position {1} in {2}", Name, presence.OffsetPosition, m_scene.Name); attachPoint = presence.State; collisionPlane = presence.CollisionPlane; - velocity = presence.Velocity; - acceleration = Vector3.Zero; if (sendTexture) { @@ -7708,20 +7711,21 @@ namespace OpenSim.Region.ClientStack.LindenUDP return true; } #endregion - + List thisSelection = new List(); ObjectSelect handlerObjectSelect = null; uint objID; - for (int i = 0; i < incomingselect.ObjectData.Length; i++) + handlerObjectSelect = OnObjectSelect; + if (handlerObjectSelect != null) { - objID = incomingselect.ObjectData[i].ObjectLocalID; - if (!SelectedObjects.Contains(objID)) - SelectedObjects.Add(objID); - - handlerObjectSelect = OnObjectSelect; - if (handlerObjectSelect != null) + for (int i = 0; i < incomingselect.ObjectData.Length; i++) { - handlerObjectSelect(objID, this); + objID = incomingselect.ObjectData[i].ObjectLocalID; + if (!SelectedObjects.Contains(objID)) + SelectedObjects.Add(objID); + thisSelection.Add(objID); } + + handlerObjectSelect(thisSelection, this); } return true; } @@ -7967,6 +7971,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP touchArgs.Add(arg); } } + handlerGrabUpdate(grabUpdate.ObjectData.ObjectID, grabUpdate.ObjectData.GrabOffsetInitial, grabUpdate.ObjectData.GrabPosition, this, touchArgs); } @@ -12407,72 +12412,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// /// /// - // TODO: Convert old handler to use new method -/* - protected bool HandleAgentTextureCached(IClientAPI simclient, Packet packet) - { - AgentCachedTexturePacket cachedtex = (AgentCachedTexturePacket)packet; - AgentCachedTextureResponsePacket cachedresp = (AgentCachedTextureResponsePacket)PacketPool.Instance.GetPacket(PacketType.AgentCachedTextureResponse); - - if (cachedtex.AgentData.SessionID != SessionId) - return false; - - - - // TODO: don't create new blocks if recycling an old packet - cachedresp.AgentData.AgentID = AgentId; - cachedresp.AgentData.SessionID = m_sessionId; - cachedresp.AgentData.SerialNum = m_cachedTextureSerial; - m_cachedTextureSerial++; - cachedresp.WearableData = - new AgentCachedTextureResponsePacket.WearableDataBlock[cachedtex.WearableData.Length]; - - int maxWearablesLoop = cachedtex.WearableData.Length; - if (maxWearablesLoop > AvatarWearable.MAX_WEARABLES) - maxWearablesLoop = AvatarWearable.MAX_WEARABLES; - - // Find the cached baked textures for this user, if they're available - - IAssetService cache = m_scene.AssetService; - IBakedTextureModule bakedTextureModule = m_scene.RequestModuleInterface(); - - WearableCacheItem[] cacheItems = null; - - if (bakedTextureModule != null && cache != null) - { - ScenePresence p = m_scene.GetScenePresence(AgentId); - if (p.Appearance != null) - { - if (p.Appearance.WearableCacheItems == null || p.Appearance.WearableCacheItemsDirty) - { - try - { - cacheItems = bakedTextureModule.Get(AgentId); - p.Appearance.WearableCacheItems = cacheItems; - p.Appearance.WearableCacheItemsDirty = false; - } - catch (Exception) - { - cacheItems = null; - } - - } - else if (p.Appearance.WearableCacheItems != null) - { - cacheItems = p.Appearance.WearableCacheItems; - } - } - } - - CachedTextureRequest handlerCachedTextureRequest = OnCachedTextureRequest; - if (handlerCachedTextureRequest != null) - { - handlerCachedTextureRequest(simclient,cachedtex.AgentData.SerialNum,requestArgs); - } - - return true; - } -*/ protected bool HandleAgentTextureCached(IClientAPI simclient, Packet packet) { diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs index 1aa8087c92..f8996d0505 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs @@ -164,31 +164,46 @@ namespace OpenSim.Region.Framework.Scenes /// /// /// - public void SelectPrim(uint primLocalID, IClientAPI remoteClient) + public void SelectPrim(List primIDs, IClientAPI remoteClient) { - SceneObjectPart part = GetSceneObjectPart(primLocalID); + List needUpdates = new List(); - if (null == part) - return; - - SceneObjectGroup sog = part.ParentGroup; - if (sog == null) - return; - - part.SendPropertiesToClient(remoteClient); - remoteClient.SendPartPhysicsProprieties(part); - - // waste of time because properties do not send prim flags as they should - // if a friend got or lost edit rights after login, a full update is needed - if(sog.OwnerID != remoteClient.AgentId) - part.SendFullUpdate(remoteClient); - - // A prim is only tainted if it's allowed to be edited by the person clicking it. - if (Permissions.CanEditObject(sog.UUID, remoteClient.AgentId) - || Permissions.CanMoveObject(sog.UUID, remoteClient.AgentId)) + foreach(uint primLocalID in primIDs) { - part.IsSelected = true; - EventManager.TriggerParcelPrimCountTainted(); + SceneObjectPart part = GetSceneObjectPart(primLocalID); + + if (part == null) + continue; + + SceneObjectGroup sog = part.ParentGroup; + if (sog == null) + continue; + + needUpdates.Add(part); + + // waste of time because properties do not send prim flags as they should + // if a friend got or lost edit rights after login, a full update is needed + if(sog.OwnerID != remoteClient.AgentId) + part.SendFullUpdate(remoteClient); + + // A prim is only tainted if it's allowed to be edited by the person clicking it. + if (Permissions.CanEditObject(sog.UUID, remoteClient.AgentId) + || Permissions.CanMoveObject(sog.UUID, remoteClient.AgentId)) + { + part.IsSelected = true; + EventManager.TriggerParcelPrimCountTainted(); + } + } + + if(needUpdates.Count > 0) + { + // this will be replaced by single client function + // that will send the UDP and Caps part + foreach(SceneObjectPart part in needUpdates) + { + part.SendPropertiesToClient(remoteClient); + remoteClient.SendPartPhysicsProprieties(part); + } } }