fix merge

This commit is contained in:
UbitUmarov
2017-04-25 17:59:53 +01:00
111 changed files with 17583 additions and 2491 deletions

View File

@@ -946,17 +946,26 @@ namespace OpenSim.Region.ClientStack.Linden
continue;
}
PrimitiveBaseShape pbs = PrimitiveBaseShape.CreateBox();
OSDArray face_list = (OSDArray)inner_instance_list["face_list"];
PrimitiveBaseShape pbs = null;
if (inner_instance_list.ContainsKey("mesh")) // seems to happen always but ...
{
int meshindx = inner_instance_list["mesh"].AsInteger();
if (meshAssets.Count > meshindx)
pbs = PrimitiveBaseShape.CreateMesh(face_list.Count, meshAssets[meshindx]);
}
if(pbs == null) // fallback
pbs = PrimitiveBaseShape.CreateBox();
Primitive.TextureEntry textureEntry
= new Primitive.TextureEntry(Primitive.TextureEntry.WHITE_TEXTURE);
OSDArray face_list = (OSDArray)inner_instance_list["face_list"];
for (uint face = 0; face < face_list.Count; face++)
{
OSDMap faceMap = (OSDMap)face_list[(int)face];
Primitive.TextureEntryFace f = pbs.Textures.CreateFace(face);
Primitive.TextureEntryFace f = textureEntry.CreateFace(face); //clone the default
if (faceMap.ContainsKey("fullbright"))
f.Fullbright = faceMap["fullbright"].AsBoolean();
if (faceMap.ContainsKey("diffuse_color"))
@@ -986,51 +995,11 @@ namespace OpenSim.Region.ClientStack.Linden
if (textures.Count > textureNum)
f.TextureID = textures[textureNum];
else
f.TextureID = Primitive.TextureEntry.WHITE_TEXTURE;
textureEntry.FaceTextures[face] = f;
}
pbs.TextureEntry = textureEntry.GetBytes();
if (inner_instance_list.ContainsKey("mesh")) // seems to happen always but ...
{
int meshindx = inner_instance_list["mesh"].AsInteger();
if (meshAssets.Count > meshindx)
{
pbs.SculptEntry = true;
pbs.SculptType = (byte)SculptType.Mesh;
pbs.SculptTexture = meshAssets[meshindx]; // actual asset UUID after meshs suport introduction
// data will be requested from asset on rez (i hope)
}
}
// faces number to pbs shape
switch(face_list.Count)
{
case 1:
case 2:
pbs.ProfileCurve = (byte)ProfileCurve.Circle;
pbs.PathCurve = (byte)PathCurve.Circle;
break;
case 3:
case 4:
pbs.ProfileCurve = (byte)ProfileCurve.Circle;
pbs.PathCurve = (byte)PathCurve.Line;
break;
case 5:
pbs.ProfileCurve = (byte)ProfileCurve.EqualTriangle;
pbs.PathCurve = (byte)PathCurve.Line;
break;
default:
pbs.ProfileCurve = (byte)ProfileCurve.Square;
pbs.PathCurve = (byte)PathCurve.Line;
break;
}
Vector3 position = inner_instance_list["position"].AsVector3();
Quaternion rotation = inner_instance_list["rotation"].AsQuaternion();

View File

@@ -121,6 +121,9 @@ namespace OpenSim.Region.ClientStack.Linden
OSD r = OSDParser.DeserializeLLSDXml((string)request["requestbody"]);
if (r.Type != OSDType.Map) // not a proper req
return responsedata;
//UUID session_id = UUID.Zero;
bool bypass_raycast = false;
uint everyone_mask = 0;
@@ -157,9 +160,6 @@ namespace OpenSim.Region.ClientStack.Linden
int state = 0;
int lastattach = 0;
if (r.Type != OSDType.Map) // not a proper req
return responsedata;
OSDMap rm = (OSDMap)r;
if (rm.ContainsKey("ObjectData")) //v2
@@ -307,8 +307,6 @@ namespace OpenSim.Region.ClientStack.Linden
}
}
Vector3 pos = m_scene.GetNewRezLocation(ray_start, ray_end, ray_target_id, rotation, (bypass_raycast) ? (byte)1 : (byte)0, (ray_end_is_intersection) ? (byte)1 : (byte)0, true, scale, false);
PrimitiveBaseShape pbs = PrimitiveBaseShape.CreateBox();
@@ -359,6 +357,8 @@ namespace OpenSim.Region.ClientStack.Linden
rootpart.NextOwnerMask = next_owner_mask;
rootpart.Material = (byte)material;
obj.AggregatePerms();
m_scene.PhysicsScene.AddPhysicsActorTaint(rootpart.PhysActor);
responsedata["int_response_code"] = 200; //501; //410; //404;

View File

@@ -335,6 +335,7 @@ namespace OpenSim.Region.ClientStack.Linden
grp.AbsolutePosition = obj.Position;
prim.RotationOffset = obj.Rotation;
// Required for linking
grp.RootPart.ClearUpdateSchedule();

View File

@@ -3950,24 +3950,68 @@ namespace OpenSim.Region.ClientStack.LindenUDP
/// <summary>
/// Send an ObjectUpdate packet with information about an avatar
/// </summary>
public void SendAvatarDataImmediate(ISceneEntity avatar)
public void SendEntityFullUpdateImmediate(ISceneEntity ent)
{
// m_log.DebugFormat(
// "[LLCLIENTVIEW]: Sending immediate object update for avatar {0} {1} to {2} {3}",
// avatar.Name, avatar.UUID, Name, AgentId);
ScenePresence presence = avatar as ScenePresence;
if (presence == null)
if (ent == null)
return;
ObjectUpdatePacket objupdate = (ObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdate);
objupdate.Header.Zerocoded = true;
objupdate.RegionData.RegionHandle = presence.RegionHandle;
// objupdate.RegionData.TimeDilation = ushort.MaxValue;
objupdate.RegionData.TimeDilation = Utils.FloatToUInt16(m_scene.TimeDilation, 0.0f, 1.0f);
objupdate.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[1];
objupdate.ObjectData[0] = CreateAvatarUpdateBlock(presence);
if(ent is ScenePresence)
{
ScenePresence presence = ent as ScenePresence;
objupdate.RegionData.RegionHandle = presence.RegionHandle;
objupdate.ObjectData[0] = CreateAvatarUpdateBlock(presence);
}
else if(ent is SceneObjectPart)
{
SceneObjectPart part = ent as SceneObjectPart;
objupdate.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle;
objupdate.ObjectData[0] = CreatePrimUpdateBlock(part, (ScenePresence)SceneAgent);
}
OutPacket(objupdate, ThrottleOutPacketType.Task | ThrottleOutPacketType.HighPriority);
// We need to record the avatar local id since the root prim of an attachment points to this.
// m_attachmentsSent.Add(avatar.LocalId);
}
public void SendEntityTerseUpdateImmediate(ISceneEntity ent)
{
// m_log.DebugFormat(
// "[LLCLIENTVIEW]: Sending immediate object update for avatar {0} {1} to {2} {3}",
// avatar.Name, avatar.UUID, Name, AgentId);
if (ent == null)
return;
ImprovedTerseObjectUpdatePacket objupdate =
(ImprovedTerseObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ImprovedTerseObjectUpdate);
objupdate.Header.Zerocoded = true;
objupdate.RegionData.TimeDilation = Utils.FloatToUInt16(m_scene.TimeDilation, 0.0f, 1.0f);
objupdate.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1];
if(ent is ScenePresence)
{
ScenePresence presence = ent as ScenePresence;
objupdate.RegionData.RegionHandle = presence.RegionHandle;
objupdate.ObjectData[0] = CreateImprovedTerseBlock(ent, false);
}
else if(ent is SceneObjectPart)
{
SceneObjectPart part = ent as SceneObjectPart;
objupdate.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle;
objupdate.ObjectData[0] = CreateImprovedTerseBlock(ent, false);
}
OutPacket(objupdate, ThrottleOutPacketType.Task | ThrottleOutPacketType.HighPriority);
@@ -4021,7 +4065,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
#region Primitive Packet/Data Sending Methods
/// <summary>
/// Generate one of the object update packets based on PrimUpdateFlags
/// and broadcast the packet to clients
@@ -4044,10 +4087,20 @@ namespace OpenSim.Region.ClientStack.LindenUDP
*/
if (entity is SceneObjectPart)
{
SceneObjectPart e = (SceneObjectPart)entity;
SceneObjectGroup g = e.ParentGroup;
SceneObjectPart p = (SceneObjectPart)entity;
SceneObjectGroup g = p.ParentGroup;
if (g.HasPrivateAttachmentPoint && g.OwnerID != AgentId)
return; // Don't send updates for other people's HUDs
if((updateFlags ^ PrimUpdateFlags.SendInTransit) == 0)
{
List<uint> partIDs = (new List<uint> {p.LocalId});
lock (m_entityProps.SyncRoot)
m_entityProps.Remove(partIDs);
lock (m_entityUpdates.SyncRoot)
m_entityUpdates.Remove(partIDs);
return;
}
}
//double priority = m_prioritizer.GetUpdatePriority(this, entity);
@@ -4126,14 +4179,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// Vector3 mycamera = Vector3.Zero;
Vector3 mypos = Vector3.Zero;
ScenePresence mysp = (ScenePresence)SceneAgent;
if(mysp != null && !mysp.IsDeleted)
// we should have a presence
if(mysp == null)
return;
if(doCulling)
{
cullingrange = mysp.DrawDistance + m_scene.ReprioritizationDistance + 16f;
// mycamera = mysp.CameraPosition;
mypos = mysp.AbsolutePosition;
}
else
doCulling = false;
while (maxUpdatesBytes > 0)
{
@@ -4154,9 +4210,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{
SceneObjectPart part = (SceneObjectPart)update.Entity;
SceneObjectGroup grp = part.ParentGroup;
if (grp.inTransit)
if (grp.inTransit && !update.Flags.HasFlag(PrimUpdateFlags.SendInTransit))
continue;
/* debug
if (update.Flags.HasFlag(PrimUpdateFlags.SendInTransit))
{
}
*/
if (grp.IsDeleted)
{
// Don't send updates for objects that have been marked deleted.
@@ -4213,14 +4275,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{
part.Shape.LightEntry = false;
}
if (part.Shape != null && (part.Shape.SculptType == (byte)SculptType.Mesh))
{
// Ensure that mesh has at least 8 valid faces
part.Shape.ProfileBegin = 12500;
part.Shape.ProfileEnd = 0;
part.Shape.ProfileHollow = 27500;
}
}
if(doCulling && !grp.IsAttachment)
@@ -4248,14 +4302,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
continue;
}
}
if (part.Shape != null && (part.Shape.SculptType == (byte)SculptType.Mesh))
{
// Ensure that mesh has at least 8 valid faces
part.Shape.ProfileBegin = 12500;
part.Shape.ProfileEnd = 0;
part.Shape.ProfileHollow = 27500;
}
}
else if (update.Entity is ScenePresence)
{
@@ -4330,7 +4376,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if (update.Entity is ScenePresence)
ablock = CreateAvatarUpdateBlock((ScenePresence)update.Entity);
else
ablock = CreatePrimUpdateBlock((SceneObjectPart)update.Entity, this.m_agentId);
ablock = CreatePrimUpdateBlock((SceneObjectPart)update.Entity, mysp);
objectUpdateBlocks.Add(ablock);
objectUpdates.Value.Add(update);
maxUpdatesBytes -= ablock.Length;
@@ -4462,6 +4508,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
// hack.. dont use
/*
public void SendPartFullUpdate(ISceneEntity ent, uint? parentID)
{
if (ent is SceneObjectPart)
@@ -4472,7 +4519,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
packet.RegionData.TimeDilation = Utils.FloatToUInt16(m_scene.TimeDilation, 0.0f, 1.0f);
packet.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[1];
ObjectUpdatePacket.ObjectDataBlock blk = CreatePrimUpdateBlock(part, this.m_agentId);
ObjectUpdatePacket.ObjectDataBlock blk = CreatePrimUpdateBlock(part, mysp);
if (parentID.HasValue)
{
blk.ParentID = parentID.Value;
@@ -4488,7 +4535,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// updatesThisCall, Name, SceneAgent.IsChildAgent ? "child" : "root", Scene.Name);
//
}
*/
public void ReprioritizeUpdates()
{
lock (m_entityUpdates.SyncRoot)
@@ -5726,28 +5773,29 @@ namespace OpenSim.Region.ClientStack.LindenUDP
return update;
}
protected ObjectUpdatePacket.ObjectDataBlock CreatePrimUpdateBlock(SceneObjectPart data, UUID recipientID)
// protected ObjectUpdatePacket.ObjectDataBlock CreatePrimUpdateBlock(SceneObjectPart data, UUID recipientID)
protected ObjectUpdatePacket.ObjectDataBlock CreatePrimUpdateBlock(SceneObjectPart part, ScenePresence sp)
{
byte[] objectData = new byte[60];
data.RelativePosition.ToBytes(objectData, 0);
data.Velocity.ToBytes(objectData, 12);
data.Acceleration.ToBytes(objectData, 24);
part.RelativePosition.ToBytes(objectData, 0);
part.Velocity.ToBytes(objectData, 12);
part.Acceleration.ToBytes(objectData, 24);
Quaternion rotation = data.RotationOffset;
Quaternion rotation = part.RotationOffset;
rotation.Normalize();
rotation.ToBytes(objectData, 36);
data.AngularVelocity.ToBytes(objectData, 48);
part.AngularVelocity.ToBytes(objectData, 48);
ObjectUpdatePacket.ObjectDataBlock update = new ObjectUpdatePacket.ObjectDataBlock();
update.ClickAction = (byte)data.ClickAction;
update.ClickAction = (byte)part.ClickAction;
update.CRC = 0;
update.ExtraParams = data.Shape.ExtraParams ?? Utils.EmptyBytes;
update.FullID = data.UUID;
update.ID = data.LocalId;
update.ExtraParams = part.Shape.ExtraParams ?? Utils.EmptyBytes;
update.FullID = part.UUID;
update.ID = part.LocalId;
//update.JointAxisOrAnchor = Vector3.Zero; // These are deprecated
//update.JointPivot = Vector3.Zero;
//update.JointType = 0;
update.Material = data.Material;
update.Material = part.Material;
update.MediaURL = Utils.EmptyBytes; // FIXME: Support this in OpenSim
/*
if (data.ParentGroup.IsAttachment)
@@ -5776,68 +5824,74 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
*/
if (data.ParentGroup.IsAttachment)
if (part.ParentGroup.IsAttachment)
{
if (data.IsRoot)
if (part.IsRoot)
{
update.NameValue = Util.StringToBytes256("AttachItemID STRING RW SV " + data.ParentGroup.FromItemID);
update.NameValue = Util.StringToBytes256("AttachItemID STRING RW SV " + part.ParentGroup.FromItemID);
}
else
update.NameValue = Utils.EmptyBytes;
int st = (int)data.ParentGroup.AttachmentPoint;
int st = (int)part.ParentGroup.AttachmentPoint;
update.State = (byte)(((st & 0xf0) >> 4) + ((st & 0x0f) << 4)); ;
}
else
{
update.NameValue = Utils.EmptyBytes;
update.State = data.Shape.State; // not sure about this
update.State = part.Shape.State; // not sure about this
}
update.ObjectData = objectData;
update.ParentID = data.ParentID;
update.PathBegin = data.Shape.PathBegin;
update.PathCurve = data.Shape.PathCurve;
update.PathEnd = data.Shape.PathEnd;
update.PathRadiusOffset = data.Shape.PathRadiusOffset;
update.PathRevolutions = data.Shape.PathRevolutions;
update.PathScaleX = data.Shape.PathScaleX;
update.PathScaleY = data.Shape.PathScaleY;
update.PathShearX = data.Shape.PathShearX;
update.PathShearY = data.Shape.PathShearY;
update.PathSkew = data.Shape.PathSkew;
update.PathTaperX = data.Shape.PathTaperX;
update.PathTaperY = data.Shape.PathTaperY;
update.PathTwist = data.Shape.PathTwist;
update.PathTwistBegin = data.Shape.PathTwistBegin;
update.PCode = data.Shape.PCode;
update.ProfileBegin = data.Shape.ProfileBegin;
update.ProfileCurve = data.Shape.ProfileCurve;
update.ProfileEnd = data.Shape.ProfileEnd;
update.ProfileHollow = data.Shape.ProfileHollow;
update.PSBlock = data.ParticleSystem ?? Utils.EmptyBytes;
update.TextColor = data.GetTextColor().GetBytes(false);
update.TextureAnim = data.TextureAnimation ?? Utils.EmptyBytes;
update.TextureEntry = data.Shape.TextureEntry ?? Utils.EmptyBytes;
update.Scale = data.Shape.Scale;
update.Text = Util.StringToBytes256(data.Text);
update.MediaURL = Util.StringToBytes256(data.MediaUrl);
update.ParentID = part.ParentID;
update.PathBegin = part.Shape.PathBegin;
update.PathCurve = part.Shape.PathCurve;
update.PathEnd = part.Shape.PathEnd;
update.PathRadiusOffset = part.Shape.PathRadiusOffset;
update.PathRevolutions = part.Shape.PathRevolutions;
update.PathScaleX = part.Shape.PathScaleX;
update.PathScaleY = part.Shape.PathScaleY;
update.PathShearX = part.Shape.PathShearX;
update.PathShearY = part.Shape.PathShearY;
update.PathSkew = part.Shape.PathSkew;
update.PathTaperX = part.Shape.PathTaperX;
update.PathTaperY = part.Shape.PathTaperY;
update.PathTwist = part.Shape.PathTwist;
update.PathTwistBegin = part.Shape.PathTwistBegin;
update.PCode = part.Shape.PCode;
update.ProfileBegin = part.Shape.ProfileBegin;
update.ProfileCurve = part.Shape.ProfileCurve;
if(part.Shape.SculptType == (byte)SculptType.Mesh) // filter out hack
update.ProfileCurve = (byte)(part.Shape.ProfileCurve & 0x0f);
else
update.ProfileCurve = part.Shape.ProfileCurve;
update.ProfileEnd = part.Shape.ProfileEnd;
update.ProfileHollow = part.Shape.ProfileHollow;
update.PSBlock = part.ParticleSystem ?? Utils.EmptyBytes;
update.TextColor = part.GetTextColor().GetBytes(false);
update.TextureAnim = part.TextureAnimation ?? Utils.EmptyBytes;
update.TextureEntry = part.Shape.TextureEntry ?? Utils.EmptyBytes;
update.Scale = part.Shape.Scale;
update.Text = Util.StringToBytes256(part.Text);
update.MediaURL = Util.StringToBytes256(part.MediaUrl);
#region PrimFlags
PrimFlags flags = (PrimFlags)m_scene.Permissions.GenerateClientFlags(recipientID, data.UUID);
PrimFlags flags = (PrimFlags)m_scene.Permissions.GenerateClientFlags(part, sp);
// Don't send the CreateSelected flag to everyone
flags &= ~PrimFlags.CreateSelected;
if (recipientID == data.OwnerID)
if (sp.UUID == part.OwnerID)
{
if (data.CreateSelected)
if (part.CreateSelected)
{
// Only send this flag once, then unset it
flags |= PrimFlags.CreateSelected;
data.CreateSelected = false;
part.CreateSelected = false;
}
}
@@ -5849,21 +5903,21 @@ namespace OpenSim.Region.ClientStack.LindenUDP
#endregion PrimFlags
if (data.Sound != UUID.Zero)
if (part.Sound != UUID.Zero)
{
update.Sound = data.Sound;
update.OwnerID = data.OwnerID;
update.Gain = (float)data.SoundGain;
update.Radius = (float)data.SoundRadius;
update.Flags = data.SoundFlags;
update.Sound = part.Sound;
update.OwnerID = part.OwnerID;
update.Gain = (float)part.SoundGain;
update.Radius = (float)part.SoundRadius;
update.Flags = part.SoundFlags;
}
switch ((PCode)data.Shape.PCode)
switch ((PCode)part.Shape.PCode)
{
case PCode.Grass:
case PCode.Tree:
case PCode.NewTree:
update.Data = new byte[] { data.Shape.State };
update.Data = new byte[] { part.Shape.State };
break;
default:
update.Data = Utils.EmptyBytes;
@@ -7753,10 +7807,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
ObjectDuplicate handlerObjectDuplicate = null;
for (int i = 0; i < dupe.ObjectData.Length; i++)
handlerObjectDuplicate = OnObjectDuplicate;
if (handlerObjectDuplicate != null)
{
handlerObjectDuplicate = OnObjectDuplicate;
if (handlerObjectDuplicate != null)
for (int i = 0; i < dupe.ObjectData.Length; i++)
{
UUID rezGroupID = dupe.AgentData.GroupID;
if(!IsGroupMember(rezGroupID))