mirror of
https://github.com/opensim/opensim.git
synced 2026-08-07 09:45:47 +08:00
Merge branch 'master' into httptests
This commit is contained in:
@@ -2801,6 +2801,48 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
SendAgentGroupDataUpdate(AgentId,GroupMembership);
|
||||
}
|
||||
|
||||
public void SendSelectedPartsProprieties(List<ISceneEntity> parts)
|
||||
{
|
||||
// udp part
|
||||
ObjectPropertiesPacket packet =
|
||||
(ObjectPropertiesPacket)PacketPool.Instance.GetPacket(PacketType.ObjectProperties);
|
||||
ObjectPropertiesPacket.ObjectDataBlock[] ObjectData = new ObjectPropertiesPacket.ObjectDataBlock[parts.Count];
|
||||
|
||||
int i = 0;
|
||||
foreach(SceneObjectPart sop in parts)
|
||||
ObjectData[i++] = CreateObjectPropertiesBlock(sop);
|
||||
|
||||
packet.ObjectData = ObjectData;
|
||||
packet.Header.Zerocoded = true;
|
||||
// udp send splits this mega packets correctly
|
||||
// mb later will avoid that to reduce gc stress
|
||||
OutPacket(packet, ThrottleOutPacketType.Task, true);
|
||||
|
||||
// caps physics part
|
||||
IEventQueue eq = Scene.RequestModuleInterface<IEventQueue>();
|
||||
if(eq == null)
|
||||
return;
|
||||
|
||||
OSDArray array = new OSDArray();
|
||||
foreach(SceneObjectPart sop in parts)
|
||||
{
|
||||
OSDMap physinfo = new OSDMap(6);
|
||||
physinfo["LocalID"] = sop.LocalId;
|
||||
physinfo["Density"] = sop.Density;
|
||||
physinfo["Friction"] = sop.Friction;
|
||||
physinfo["GravityMultiplier"] = sop.GravityModifier;
|
||||
physinfo["Restitution"] = sop.Restitution;
|
||||
physinfo["PhysicsShapeType"] = (int)sop.PhysicsShapeType;
|
||||
array.Add(physinfo);
|
||||
}
|
||||
|
||||
OSDMap llsdBody = new OSDMap(1);
|
||||
llsdBody.Add("ObjectData", array);
|
||||
|
||||
eq.Enqueue(BuildEvent("ObjectPhysicsProperties", llsdBody),AgentId);
|
||||
}
|
||||
|
||||
|
||||
public void SendPartPhysicsProprieties(ISceneEntity entity)
|
||||
{
|
||||
SceneObjectPart part = (SceneObjectPart)entity;
|
||||
@@ -2882,18 +2924,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 +3061,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];
|
||||
@@ -4221,46 +4269,42 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
|
||||
if (!canUseImproved && !canUseCompressed)
|
||||
{
|
||||
ObjectUpdatePacket.ObjectDataBlock ablock;
|
||||
if (update.Entity is ScenePresence)
|
||||
{
|
||||
ObjectUpdatePacket.ObjectDataBlock ablock =
|
||||
CreateAvatarUpdateBlock((ScenePresence)update.Entity);
|
||||
objectUpdateBlocks.Value.Add(ablock);
|
||||
maxUpdatesBytes -= ablock.Length;
|
||||
}
|
||||
ablock = CreateAvatarUpdateBlock((ScenePresence)update.Entity);
|
||||
else
|
||||
{
|
||||
ObjectUpdatePacket.ObjectDataBlock ablock =
|
||||
CreatePrimUpdateBlock((SceneObjectPart)update.Entity, this.m_agentId);
|
||||
objectUpdateBlocks.Value.Add(ablock);
|
||||
maxUpdatesBytes -= ablock.Length;
|
||||
}
|
||||
ablock = CreatePrimUpdateBlock((SceneObjectPart)update.Entity, this.m_agentId);
|
||||
objectUpdateBlocks.Value.Add(ablock);
|
||||
objectUpdates.Value.Add(update);
|
||||
maxUpdatesBytes -= ablock.Length;
|
||||
|
||||
}
|
||||
else if (!canUseImproved)
|
||||
{
|
||||
ObjectUpdateCompressedPacket.ObjectDataBlock ablock =
|
||||
CreateCompressedUpdateBlock((SceneObjectPart)update.Entity, updateFlags);
|
||||
compressedUpdateBlocks.Value.Add(ablock);
|
||||
compressedUpdates.Value.Add(update);
|
||||
maxUpdatesBytes -= ablock.Length;
|
||||
}
|
||||
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);
|
||||
maxUpdatesBytes -= ablock.Length;
|
||||
terseAgentUpdates.Value.Add(update);
|
||||
}
|
||||
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);
|
||||
maxUpdatesBytes -= ablock.Length;
|
||||
terseUpdates.Value.Add(update);
|
||||
}
|
||||
maxUpdatesBytes -= ablock.Length;
|
||||
}
|
||||
|
||||
#endregion Block Construction
|
||||
@@ -4290,7 +4334,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
for (int i = 0; i < blocks.Count; i++)
|
||||
packet.ObjectData[i] = blocks[i];
|
||||
|
||||
OutPacket(packet, ThrottleOutPacketType.Unknown, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(terseUpdates.Value, oPacket); });
|
||||
OutPacket(packet, ThrottleOutPacketType.Unknown, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(terseAgentUpdates.Value, oPacket); });
|
||||
}
|
||||
|
||||
if (objectUpdateBlocks.IsValueCreated)
|
||||
@@ -4305,7 +4349,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
for (int i = 0; i < blocks.Count; i++)
|
||||
packet.ObjectData[i] = blocks[i];
|
||||
|
||||
OutPacket(packet, ThrottleOutPacketType.Task, true);
|
||||
OutPacket(packet, ThrottleOutPacketType.Task, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(objectUpdates.Value, oPacket); });
|
||||
}
|
||||
|
||||
if (compressedUpdateBlocks.IsValueCreated)
|
||||
@@ -4320,7 +4364,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
for (int i = 0; i < blocks.Count; i++)
|
||||
packet.ObjectData[i] = blocks[i];
|
||||
|
||||
OutPacket(packet, ThrottleOutPacketType.Task, true);
|
||||
OutPacket(packet, ThrottleOutPacketType.Task, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(compressedUpdates.Value, oPacket); });
|
||||
}
|
||||
|
||||
if (terseUpdateBlocks.IsValueCreated)
|
||||
@@ -5444,22 +5488,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)
|
||||
{
|
||||
@@ -7710,20 +7753,19 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
return true;
|
||||
}
|
||||
#endregion
|
||||
|
||||
List<uint> thisSelection = new List<uint>();
|
||||
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;
|
||||
thisSelection.Add(objID);
|
||||
}
|
||||
|
||||
handlerObjectSelect(thisSelection, this);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -7746,8 +7788,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
for (int i = 0; i < incomingdeselect.ObjectData.Length; i++)
|
||||
{
|
||||
objID = incomingdeselect.ObjectData[i].ObjectLocalID;
|
||||
if (SelectedObjects.Contains(objID))
|
||||
SelectedObjects.Remove(objID);
|
||||
|
||||
handlerObjectDeselect = OnObjectDeselect;
|
||||
if (handlerObjectDeselect != null)
|
||||
@@ -7969,6 +8009,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
touchArgs.Add(arg);
|
||||
}
|
||||
}
|
||||
|
||||
handlerGrabUpdate(grabUpdate.ObjectData.ObjectID, grabUpdate.ObjectData.GrabOffsetInitial,
|
||||
grabUpdate.ObjectData.GrabPosition, this, touchArgs);
|
||||
}
|
||||
@@ -12409,72 +12450,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
/// <param name="simclient"></param>
|
||||
/// <param name="packet"></param>
|
||||
/// <returns></returns>
|
||||
// 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<IBakedTextureModule>();
|
||||
|
||||
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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user