aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorUbitUmarov2016-08-25 06:56:13 +0100
committerUbitUmarov2016-08-25 06:56:25 +0100
commit991dd5f4712f7f6b61b4953f3f388f85992db67b (patch)
treed83792fc1645b5a9b49d8c42bdf921645d44bd87
parent fix missing PhysicsProprieties sending on Object select. This is a temporary... (diff)
downloadopensim-SC_OLD-991dd5f4712f7f6b61b4953f3f388f85992db67b.zip
opensim-SC_OLD-991dd5f4712f7f6b61b4953f3f388f85992db67b.tar.gz
opensim-SC_OLD-991dd5f4712f7f6b61b4953f3f388f85992db67b.tar.bz2
opensim-SC_OLD-991dd5f4712f7f6b61b4953f3f388f85992db67b.tar.xz
first step changing Object Select code
-rw-r--r--OpenSim/Framework/IClientAPI.cs2
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs117
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs51
3 files changed, 62 insertions, 108 deletions
diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs
index c046010..6f2f834 100644
--- a/OpenSim/Framework/IClientAPI.cs
+++ b/OpenSim/Framework/IClientAPI.cs
@@ -117,7 +117,7 @@ namespace OpenSim.Framework
117 117
118 public delegate void ObjectExtraParams(UUID agentID, uint localID, ushort type, bool inUse, byte[] data); 118 public delegate void ObjectExtraParams(UUID agentID, uint localID, ushort type, bool inUse, byte[] data);
119 119
120 public delegate void ObjectSelect(uint localID, IClientAPI remoteClient); 120 public delegate void ObjectSelect(List<uint> localID, IClientAPI remoteClient);
121 121
122 public delegate void ObjectRequest(uint localID, IClientAPI remoteClient); 122 public delegate void ObjectRequest(uint localID, IClientAPI remoteClient);
123 123
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
index 78043bd..5b39cc5 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
2882 2882
2883 public void SendAsset(AssetRequestToClient req) 2883 public void SendAsset(AssetRequestToClient req)
2884 { 2884 {
2885 if (req.AssetInf == null)
2886 {
2887 m_log.ErrorFormat("{0} Cannot send asset {1} ({2}), asset is null",
2888 LogHeader);
2889 return;
2890 }
2891
2885 if (req.AssetInf.Data == null) 2892 if (req.AssetInf.Data == null)
2886 { 2893 {
2887 m_log.ErrorFormat("{0} Cannot send asset {1} ({2}), asset data is null", 2894 m_log.ErrorFormat("{0} Cannot send asset {1} ({2}), asset data is null",
2888 LogHeader, req.AssetInf.ID, req.AssetInf.Metadata.ContentType); 2895 LogHeader, req.AssetInf.ID, req.AssetInf.Metadata.ContentType);
2889 return; 2896 return;
2890 } 2897 }
2898
2891 int WearableOut = 0; 2899 int WearableOut = 0;
2892 bool isWearable = false; 2900 bool isWearable = false;
2893 2901
2894 if (req.AssetInf != null) 2902 isWearable = ((AssetType) req.AssetInf.Type ==
2895 isWearable =
2896 ((AssetType) req.AssetInf.Type ==
2897 AssetType.Bodypart || (AssetType) req.AssetInf.Type == AssetType.Clothing); 2903 AssetType.Bodypart || (AssetType) req.AssetInf.Type == AssetType.Clothing);
2898 2904
2899 2905
@@ -3013,7 +3019,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3013 reply.Data.ParcelID = parcelID; 3019 reply.Data.ParcelID = parcelID;
3014 reply.Data.OwnerID = land.OwnerID; 3020 reply.Data.OwnerID = land.OwnerID;
3015 reply.Data.Name = Utils.StringToBytes(land.Name); 3021 reply.Data.Name = Utils.StringToBytes(land.Name);
3016 if (land != null && land.Description != null && land.Description != String.Empty) 3022 if (land.Description != null && land.Description != String.Empty)
3017 reply.Data.Desc = Utils.StringToBytes(land.Description.Substring(0, land.Description.Length > 254 ? 254: land.Description.Length)); 3023 reply.Data.Desc = Utils.StringToBytes(land.Description.Substring(0, land.Description.Length > 254 ? 254: land.Description.Length));
3018 else 3024 else
3019 reply.Data.Desc = new Byte[0]; 3025 reply.Data.Desc = new Byte[0];
@@ -4241,24 +4247,22 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4241 } 4247 }
4242 else 4248 else
4243 { 4249 {
4250 ImprovedTerseObjectUpdatePacket.ObjectDataBlock ablock;
4244 if (update.Entity is ScenePresence) 4251 if (update.Entity is ScenePresence)
4245 { 4252 {
4246 // ALL presence updates go into a special list 4253 // ALL presence updates go into a special list
4247 ImprovedTerseObjectUpdatePacket.ObjectDataBlock ablock = 4254 ablock = CreateImprovedTerseBlock(update.Entity, updateFlags.HasFlag(PrimUpdateFlags.Textures));
4248 CreateImprovedTerseBlock(update.Entity, updateFlags.HasFlag(PrimUpdateFlags.Textures));
4249 terseAgentUpdateBlocks.Value.Add(ablock); 4255 terseAgentUpdateBlocks.Value.Add(ablock);
4250 terseAgentUpdates.Value.Add(update); 4256 terseAgentUpdates.Value.Add(update);
4251 maxUpdatesBytes -= ablock.Length;
4252 } 4257 }
4253 else 4258 else
4254 { 4259 {
4255 // Everything else goes here 4260 // Everything else goes here
4256 ImprovedTerseObjectUpdatePacket.ObjectDataBlock ablock = 4261 ablock = CreateImprovedTerseBlock(update.Entity, updateFlags.HasFlag(PrimUpdateFlags.Textures));
4257 CreateImprovedTerseBlock(update.Entity, updateFlags.HasFlag(PrimUpdateFlags.Textures));
4258 terseUpdateBlocks.Value.Add(ablock); 4262 terseUpdateBlocks.Value.Add(ablock);
4259 terseUpdates.Value.Add(update); 4263 terseUpdates.Value.Add(update);
4260 maxUpdatesBytes -= ablock.Length;
4261 } 4264 }
4265 maxUpdatesBytes -= ablock.Length;
4262 } 4266 }
4263 4267
4264 #endregion Block Construction 4268 #endregion Block Construction
@@ -5442,22 +5446,21 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5442 Quaternion rotation; 5446 Quaternion rotation;
5443 byte[] textureEntry; 5447 byte[] textureEntry;
5444 5448
5445 if (entity is ScenePresence) 5449 if (avatar)
5446 { 5450 {
5447 ScenePresence presence = (ScenePresence)entity; 5451 ScenePresence presence = (ScenePresence)entity;
5448 5452
5449 position = presence.OffsetPosition; 5453 position = presence.OffsetPosition;
5454 velocity = presence.Velocity;
5455 acceleration = Vector3.Zero;
5450 rotation = presence.Rotation; 5456 rotation = presence.Rotation;
5451 angularVelocity = presence.AngularVelocity; 5457 angularVelocity = presence.AngularVelocity;
5452 rotation = presence.Rotation;
5453 5458
5454// m_log.DebugFormat( 5459// m_log.DebugFormat(
5455// "[LLCLIENTVIEW]: Sending terse update to {0} with position {1} in {2}", Name, presence.OffsetPosition, m_scene.Name); 5460// "[LLCLIENTVIEW]: Sending terse update to {0} with position {1} in {2}", Name, presence.OffsetPosition, m_scene.Name);
5456 5461
5457 attachPoint = presence.State; 5462 attachPoint = presence.State;
5458 collisionPlane = presence.CollisionPlane; 5463 collisionPlane = presence.CollisionPlane;
5459 velocity = presence.Velocity;
5460 acceleration = Vector3.Zero;
5461 5464
5462 if (sendTexture) 5465 if (sendTexture)
5463 { 5466 {
@@ -7708,20 +7711,21 @@ namespace OpenSim.Region.ClientStack.LindenUDP
7708 return true; 7711 return true;
7709 } 7712 }
7710 #endregion 7713 #endregion
7711 7714 List<uint> thisSelection = new List<uint>();
7712 ObjectSelect handlerObjectSelect = null; 7715 ObjectSelect handlerObjectSelect = null;
7713 uint objID; 7716 uint objID;
7714 for (int i = 0; i < incomingselect.ObjectData.Length; i++) 7717 handlerObjectSelect = OnObjectSelect;
7718 if (handlerObjectSelect != null)
7715 { 7719 {
7716 objID = incomingselect.ObjectData[i].ObjectLocalID; 7720 for (int i = 0; i < incomingselect.ObjectData.Length; i++)
7717 if (!SelectedObjects.Contains(objID))
7718 SelectedObjects.Add(objID);
7719
7720 handlerObjectSelect = OnObjectSelect;
7721 if (handlerObjectSelect != null)
7722 { 7721 {
7723 handlerObjectSelect(objID, this); 7722 objID = incomingselect.ObjectData[i].ObjectLocalID;
7723 if (!SelectedObjects.Contains(objID))
7724 SelectedObjects.Add(objID);
7725 thisSelection.Add(objID);
7724 } 7726 }
7727
7728 handlerObjectSelect(thisSelection, this);
7725 } 7729 }
7726 return true; 7730 return true;
7727 } 7731 }
@@ -7967,6 +7971,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
7967 touchArgs.Add(arg); 7971 touchArgs.Add(arg);
7968 } 7972 }
7969 } 7973 }
7974
7970 handlerGrabUpdate(grabUpdate.ObjectData.ObjectID, grabUpdate.ObjectData.GrabOffsetInitial, 7975 handlerGrabUpdate(grabUpdate.ObjectData.ObjectID, grabUpdate.ObjectData.GrabOffsetInitial,
7971 grabUpdate.ObjectData.GrabPosition, this, touchArgs); 7976 grabUpdate.ObjectData.GrabPosition, this, touchArgs);
7972 } 7977 }
@@ -12407,72 +12412,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
12407 /// <param name="simclient"></param> 12412 /// <param name="simclient"></param>
12408 /// <param name="packet"></param> 12413 /// <param name="packet"></param>
12409 /// <returns></returns> 12414 /// <returns></returns>
12410 // TODO: Convert old handler to use new method
12411/*
12412 protected bool HandleAgentTextureCached(IClientAPI simclient, Packet packet)
12413 {
12414 AgentCachedTexturePacket cachedtex = (AgentCachedTexturePacket)packet;
12415 AgentCachedTextureResponsePacket cachedresp = (AgentCachedTextureResponsePacket)PacketPool.Instance.GetPacket(PacketType.AgentCachedTextureResponse);
12416
12417 if (cachedtex.AgentData.SessionID != SessionId)
12418 return false;
12419
12420
12421
12422 // TODO: don't create new blocks if recycling an old packet
12423 cachedresp.AgentData.AgentID = AgentId;
12424 cachedresp.AgentData.SessionID = m_sessionId;
12425 cachedresp.AgentData.SerialNum = m_cachedTextureSerial;
12426 m_cachedTextureSerial++;
12427 cachedresp.WearableData =
12428 new AgentCachedTextureResponsePacket.WearableDataBlock[cachedtex.WearableData.Length];
12429
12430 int maxWearablesLoop = cachedtex.WearableData.Length;
12431 if (maxWearablesLoop > AvatarWearable.MAX_WEARABLES)
12432 maxWearablesLoop = AvatarWearable.MAX_WEARABLES;
12433
12434 // Find the cached baked textures for this user, if they're available
12435
12436 IAssetService cache = m_scene.AssetService;
12437 IBakedTextureModule bakedTextureModule = m_scene.RequestModuleInterface<IBakedTextureModule>();
12438
12439 WearableCacheItem[] cacheItems = null;
12440
12441 if (bakedTextureModule != null && cache != null)
12442 {
12443 ScenePresence p = m_scene.GetScenePresence(AgentId);
12444 if (p.Appearance != null)
12445 {
12446 if (p.Appearance.WearableCacheItems == null || p.Appearance.WearableCacheItemsDirty)
12447 {
12448 try
12449 {
12450 cacheItems = bakedTextureModule.Get(AgentId);
12451 p.Appearance.WearableCacheItems = cacheItems;
12452 p.Appearance.WearableCacheItemsDirty = false;
12453 }
12454 catch (Exception)
12455 {
12456 cacheItems = null;
12457 }
12458
12459 }
12460 else if (p.Appearance.WearableCacheItems != null)
12461 {
12462 cacheItems = p.Appearance.WearableCacheItems;
12463 }
12464 }
12465 }
12466
12467 CachedTextureRequest handlerCachedTextureRequest = OnCachedTextureRequest;
12468 if (handlerCachedTextureRequest != null)
12469 {
12470 handlerCachedTextureRequest(simclient,cachedtex.AgentData.SerialNum,requestArgs);
12471 }
12472
12473 return true;
12474 }
12475*/
12476 12415
12477 protected bool HandleAgentTextureCached(IClientAPI simclient, Packet packet) 12416 protected bool HandleAgentTextureCached(IClientAPI simclient, Packet packet)
12478 { 12417 {
diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
index 1aa8087..f8996d0 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
164 /// </summary> 164 /// </summary>
165 /// <param name="primLocalID"></param> 165 /// <param name="primLocalID"></param>
166 /// <param name="remoteClient"></param> 166 /// <param name="remoteClient"></param>
167 public void SelectPrim(uint primLocalID, IClientAPI remoteClient) 167 public void SelectPrim(List<uint> primIDs, IClientAPI remoteClient)
168 { 168 {
169 SceneObjectPart part = GetSceneObjectPart(primLocalID); 169 List<SceneObjectPart> needUpdates = new List<SceneObjectPart>();
170 170
171 if (null == part) 171 foreach(uint primLocalID in primIDs)
172 return; 172 {
173 SceneObjectPart part = GetSceneObjectPart(primLocalID);
173 174
174 SceneObjectGroup sog = part.ParentGroup; 175 if (part == null)
175 if (sog == null) 176 continue;
176 return; 177
178 SceneObjectGroup sog = part.ParentGroup;
179 if (sog == null)
180 continue;
181
182 needUpdates.Add(part);
177 183
178 part.SendPropertiesToClient(remoteClient); 184 // waste of time because properties do not send prim flags as they should
179 remoteClient.SendPartPhysicsProprieties(part); 185 // if a friend got or lost edit rights after login, a full update is needed
186 if(sog.OwnerID != remoteClient.AgentId)
187 part.SendFullUpdate(remoteClient);
180 188
181 // waste of time because properties do not send prim flags as they should 189 // A prim is only tainted if it's allowed to be edited by the person clicking it.
182 // if a friend got or lost edit rights after login, a full update is needed 190 if (Permissions.CanEditObject(sog.UUID, remoteClient.AgentId)
183 if(sog.OwnerID != remoteClient.AgentId) 191 || Permissions.CanMoveObject(sog.UUID, remoteClient.AgentId))
184 part.SendFullUpdate(remoteClient); 192 {
193 part.IsSelected = true;
194 EventManager.TriggerParcelPrimCountTainted();
195 }
196 }
185 197
186 // A prim is only tainted if it's allowed to be edited by the person clicking it. 198 if(needUpdates.Count > 0)
187 if (Permissions.CanEditObject(sog.UUID, remoteClient.AgentId)
188 || Permissions.CanMoveObject(sog.UUID, remoteClient.AgentId))
189 { 199 {
190 part.IsSelected = true; 200 // this will be replaced by single client function
191 EventManager.TriggerParcelPrimCountTainted(); 201 // that will send the UDP and Caps part
202 foreach(SceneObjectPart part in needUpdates)
203 {
204 part.SendPropertiesToClient(remoteClient);
205 remoteClient.SendPartPhysicsProprieties(part);
206 }
192 } 207 }
193 } 208 }
194 209