aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack
diff options
context:
space:
mode:
authorUbitUmarov2017-04-25 17:59:53 +0100
committerUbitUmarov2017-04-25 17:59:53 +0100
commita680d8b8d700f78beb1a9eea98b52d59118efe2e (patch)
treedd084e74fb61400c704a14dcfa8689670acb9ec2 /OpenSim/Region/ClientStack
parentMerge branch 'master' into httptests (diff)
parentmove mesh pbs creation code out of mesh upload code into to PrimitiveBaseShap... (diff)
downloadopensim-SC-a680d8b8d700f78beb1a9eea98b52d59118efe2e.zip
opensim-SC-a680d8b8d700f78beb1a9eea98b52d59118efe2e.tar.gz
opensim-SC-a680d8b8d700f78beb1a9eea98b52d59118efe2e.tar.bz2
opensim-SC-a680d8b8d700f78beb1a9eea98b52d59118efe2e.tar.xz
fix merge
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs59
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/ObjectAdd.cs10
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/UploadObjectAssetModule.cs1
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs234
4 files changed, 164 insertions, 140 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
index 58b7b00..e1b9e08 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
@@ -946,17 +946,26 @@ namespace OpenSim.Region.ClientStack.Linden
946 continue; 946 continue;
947 } 947 }
948 948
949 PrimitiveBaseShape pbs = PrimitiveBaseShape.CreateBox(); 949 OSDArray face_list = (OSDArray)inner_instance_list["face_list"];
950
951 PrimitiveBaseShape pbs = null;
952 if (inner_instance_list.ContainsKey("mesh")) // seems to happen always but ...
953 {
954 int meshindx = inner_instance_list["mesh"].AsInteger();
955 if (meshAssets.Count > meshindx)
956 pbs = PrimitiveBaseShape.CreateMesh(face_list.Count, meshAssets[meshindx]);
957 }
958 if(pbs == null) // fallback
959 pbs = PrimitiveBaseShape.CreateBox();
950 960
951 Primitive.TextureEntry textureEntry 961 Primitive.TextureEntry textureEntry
952 = new Primitive.TextureEntry(Primitive.TextureEntry.WHITE_TEXTURE); 962 = new Primitive.TextureEntry(Primitive.TextureEntry.WHITE_TEXTURE);
953 963
954
955 OSDArray face_list = (OSDArray)inner_instance_list["face_list"];
956 for (uint face = 0; face < face_list.Count; face++) 964 for (uint face = 0; face < face_list.Count; face++)
957 { 965 {
958 OSDMap faceMap = (OSDMap)face_list[(int)face]; 966 OSDMap faceMap = (OSDMap)face_list[(int)face];
959 Primitive.TextureEntryFace f = pbs.Textures.CreateFace(face); 967
968 Primitive.TextureEntryFace f = textureEntry.CreateFace(face); //clone the default
960 if (faceMap.ContainsKey("fullbright")) 969 if (faceMap.ContainsKey("fullbright"))
961 f.Fullbright = faceMap["fullbright"].AsBoolean(); 970 f.Fullbright = faceMap["fullbright"].AsBoolean();
962 if (faceMap.ContainsKey("diffuse_color")) 971 if (faceMap.ContainsKey("diffuse_color"))
@@ -986,51 +995,11 @@ namespace OpenSim.Region.ClientStack.Linden
986 995
987 if (textures.Count > textureNum) 996 if (textures.Count > textureNum)
988 f.TextureID = textures[textureNum]; 997 f.TextureID = textures[textureNum];
989 else 998
990 f.TextureID = Primitive.TextureEntry.WHITE_TEXTURE;
991
992 textureEntry.FaceTextures[face] = f; 999 textureEntry.FaceTextures[face] = f;
993 } 1000 }
994
995 pbs.TextureEntry = textureEntry.GetBytes(); 1001 pbs.TextureEntry = textureEntry.GetBytes();
996 1002
997 if (inner_instance_list.ContainsKey("mesh")) // seems to happen always but ...
998 {
999 int meshindx = inner_instance_list["mesh"].AsInteger();
1000 if (meshAssets.Count > meshindx)
1001 {
1002 pbs.SculptEntry = true;
1003 pbs.SculptType = (byte)SculptType.Mesh;
1004 pbs.SculptTexture = meshAssets[meshindx]; // actual asset UUID after meshs suport introduction
1005 // data will be requested from asset on rez (i hope)
1006 }
1007 }
1008
1009 // faces number to pbs shape
1010 switch(face_list.Count)
1011 {
1012 case 1:
1013 case 2:
1014 pbs.ProfileCurve = (byte)ProfileCurve.Circle;
1015 pbs.PathCurve = (byte)PathCurve.Circle;
1016 break;
1017
1018 case 3:
1019 case 4:
1020 pbs.ProfileCurve = (byte)ProfileCurve.Circle;
1021 pbs.PathCurve = (byte)PathCurve.Line;
1022 break;
1023 case 5:
1024 pbs.ProfileCurve = (byte)ProfileCurve.EqualTriangle;
1025 pbs.PathCurve = (byte)PathCurve.Line;
1026 break;
1027
1028 default:
1029 pbs.ProfileCurve = (byte)ProfileCurve.Square;
1030 pbs.PathCurve = (byte)PathCurve.Line;
1031 break;
1032 }
1033
1034 Vector3 position = inner_instance_list["position"].AsVector3(); 1003 Vector3 position = inner_instance_list["position"].AsVector3();
1035 Quaternion rotation = inner_instance_list["rotation"].AsQuaternion(); 1004 Quaternion rotation = inner_instance_list["rotation"].AsQuaternion();
1036 1005
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/ObjectAdd.cs b/OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/ObjectAdd.cs
index 189fa36..69fcb7d 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/ObjectAdd.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/ObjectAdd.cs
@@ -121,6 +121,9 @@ namespace OpenSim.Region.ClientStack.Linden
121 121
122 122
123 OSD r = OSDParser.DeserializeLLSDXml((string)request["requestbody"]); 123 OSD r = OSDParser.DeserializeLLSDXml((string)request["requestbody"]);
124 if (r.Type != OSDType.Map) // not a proper req
125 return responsedata;
126
124 //UUID session_id = UUID.Zero; 127 //UUID session_id = UUID.Zero;
125 bool bypass_raycast = false; 128 bool bypass_raycast = false;
126 uint everyone_mask = 0; 129 uint everyone_mask = 0;
@@ -157,9 +160,6 @@ namespace OpenSim.Region.ClientStack.Linden
157 int state = 0; 160 int state = 0;
158 int lastattach = 0; 161 int lastattach = 0;
159 162
160 if (r.Type != OSDType.Map) // not a proper req
161 return responsedata;
162
163 OSDMap rm = (OSDMap)r; 163 OSDMap rm = (OSDMap)r;
164 164
165 if (rm.ContainsKey("ObjectData")) //v2 165 if (rm.ContainsKey("ObjectData")) //v2
@@ -307,8 +307,6 @@ namespace OpenSim.Region.ClientStack.Linden
307 } 307 }
308 } 308 }
309 309
310
311
312 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); 310 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);
313 311
314 PrimitiveBaseShape pbs = PrimitiveBaseShape.CreateBox(); 312 PrimitiveBaseShape pbs = PrimitiveBaseShape.CreateBox();
@@ -359,6 +357,8 @@ namespace OpenSim.Region.ClientStack.Linden
359 rootpart.NextOwnerMask = next_owner_mask; 357 rootpart.NextOwnerMask = next_owner_mask;
360 rootpart.Material = (byte)material; 358 rootpart.Material = (byte)material;
361 359
360 obj.AggregatePerms();
361
362 m_scene.PhysicsScene.AddPhysicsActorTaint(rootpart.PhysActor); 362 m_scene.PhysicsScene.AddPhysicsActorTaint(rootpart.PhysActor);
363 363
364 responsedata["int_response_code"] = 200; //501; //410; //404; 364 responsedata["int_response_code"] = 200; //501; //410; //404;
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/UploadObjectAssetModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/UploadObjectAssetModule.cs
index 6874662..116c51f 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/UploadObjectAssetModule.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/UploadObjectAssetModule.cs
@@ -335,6 +335,7 @@ namespace OpenSim.Region.ClientStack.Linden
335 grp.AbsolutePosition = obj.Position; 335 grp.AbsolutePosition = obj.Position;
336 prim.RotationOffset = obj.Rotation; 336 prim.RotationOffset = obj.Rotation;
337 337
338
338 // Required for linking 339 // Required for linking
339 grp.RootPart.ClearUpdateSchedule(); 340 grp.RootPart.ClearUpdateSchedule();
340 341
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
index df34668..cf96a8b 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
@@ -3950,24 +3950,68 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3950 /// <summary> 3950 /// <summary>
3951 /// Send an ObjectUpdate packet with information about an avatar 3951 /// Send an ObjectUpdate packet with information about an avatar
3952 /// </summary> 3952 /// </summary>
3953 public void SendAvatarDataImmediate(ISceneEntity avatar) 3953 public void SendEntityFullUpdateImmediate(ISceneEntity ent)
3954 { 3954 {
3955// m_log.DebugFormat( 3955// m_log.DebugFormat(
3956// "[LLCLIENTVIEW]: Sending immediate object update for avatar {0} {1} to {2} {3}", 3956// "[LLCLIENTVIEW]: Sending immediate object update for avatar {0} {1} to {2} {3}",
3957// avatar.Name, avatar.UUID, Name, AgentId); 3957// avatar.Name, avatar.UUID, Name, AgentId);
3958 3958
3959 ScenePresence presence = avatar as ScenePresence; 3959 if (ent == null)
3960 if (presence == null)
3961 return; 3960 return;
3962 3961
3963 ObjectUpdatePacket objupdate = (ObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdate); 3962 ObjectUpdatePacket objupdate = (ObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdate);
3964 objupdate.Header.Zerocoded = true; 3963 objupdate.Header.Zerocoded = true;
3965 3964
3966 objupdate.RegionData.RegionHandle = presence.RegionHandle;
3967// objupdate.RegionData.TimeDilation = ushort.MaxValue;
3968 objupdate.RegionData.TimeDilation = Utils.FloatToUInt16(m_scene.TimeDilation, 0.0f, 1.0f); 3965 objupdate.RegionData.TimeDilation = Utils.FloatToUInt16(m_scene.TimeDilation, 0.0f, 1.0f);
3969 objupdate.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[1]; 3966 objupdate.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[1];
3970 objupdate.ObjectData[0] = CreateAvatarUpdateBlock(presence); 3967
3968 if(ent is ScenePresence)
3969 {
3970 ScenePresence presence = ent as ScenePresence;
3971 objupdate.RegionData.RegionHandle = presence.RegionHandle;
3972 objupdate.ObjectData[0] = CreateAvatarUpdateBlock(presence);
3973 }
3974 else if(ent is SceneObjectPart)
3975 {
3976 SceneObjectPart part = ent as SceneObjectPart;
3977 objupdate.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle;
3978 objupdate.ObjectData[0] = CreatePrimUpdateBlock(part, (ScenePresence)SceneAgent);
3979 }
3980
3981 OutPacket(objupdate, ThrottleOutPacketType.Task | ThrottleOutPacketType.HighPriority);
3982
3983 // We need to record the avatar local id since the root prim of an attachment points to this.
3984// m_attachmentsSent.Add(avatar.LocalId);
3985 }
3986
3987 public void SendEntityTerseUpdateImmediate(ISceneEntity ent)
3988 {
3989// m_log.DebugFormat(
3990// "[LLCLIENTVIEW]: Sending immediate object update for avatar {0} {1} to {2} {3}",
3991// avatar.Name, avatar.UUID, Name, AgentId);
3992
3993 if (ent == null)
3994 return;
3995
3996 ImprovedTerseObjectUpdatePacket objupdate =
3997 (ImprovedTerseObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ImprovedTerseObjectUpdate);
3998 objupdate.Header.Zerocoded = true;
3999
4000 objupdate.RegionData.TimeDilation = Utils.FloatToUInt16(m_scene.TimeDilation, 0.0f, 1.0f);
4001 objupdate.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1];
4002
4003 if(ent is ScenePresence)
4004 {
4005 ScenePresence presence = ent as ScenePresence;
4006 objupdate.RegionData.RegionHandle = presence.RegionHandle;
4007 objupdate.ObjectData[0] = CreateImprovedTerseBlock(ent, false);
4008 }
4009 else if(ent is SceneObjectPart)
4010 {
4011 SceneObjectPart part = ent as SceneObjectPart;
4012 objupdate.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle;
4013 objupdate.ObjectData[0] = CreateImprovedTerseBlock(ent, false);
4014 }
3971 4015
3972 OutPacket(objupdate, ThrottleOutPacketType.Task | ThrottleOutPacketType.HighPriority); 4016 OutPacket(objupdate, ThrottleOutPacketType.Task | ThrottleOutPacketType.HighPriority);
3973 4017
@@ -4021,7 +4065,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4021 4065
4022 #region Primitive Packet/Data Sending Methods 4066 #region Primitive Packet/Data Sending Methods
4023 4067
4024
4025 /// <summary> 4068 /// <summary>
4026 /// Generate one of the object update packets based on PrimUpdateFlags 4069 /// Generate one of the object update packets based on PrimUpdateFlags
4027 /// and broadcast the packet to clients 4070 /// and broadcast the packet to clients
@@ -4044,10 +4087,20 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4044*/ 4087*/
4045 if (entity is SceneObjectPart) 4088 if (entity is SceneObjectPart)
4046 { 4089 {
4047 SceneObjectPart e = (SceneObjectPart)entity; 4090 SceneObjectPart p = (SceneObjectPart)entity;
4048 SceneObjectGroup g = e.ParentGroup; 4091 SceneObjectGroup g = p.ParentGroup;
4049 if (g.HasPrivateAttachmentPoint && g.OwnerID != AgentId) 4092 if (g.HasPrivateAttachmentPoint && g.OwnerID != AgentId)
4050 return; // Don't send updates for other people's HUDs 4093 return; // Don't send updates for other people's HUDs
4094
4095 if((updateFlags ^ PrimUpdateFlags.SendInTransit) == 0)
4096 {
4097 List<uint> partIDs = (new List<uint> {p.LocalId});
4098 lock (m_entityProps.SyncRoot)
4099 m_entityProps.Remove(partIDs);
4100 lock (m_entityUpdates.SyncRoot)
4101 m_entityUpdates.Remove(partIDs);
4102 return;
4103 }
4051 } 4104 }
4052 4105
4053 //double priority = m_prioritizer.GetUpdatePriority(this, entity); 4106 //double priority = m_prioritizer.GetUpdatePriority(this, entity);
@@ -4126,14 +4179,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4126// Vector3 mycamera = Vector3.Zero; 4179// Vector3 mycamera = Vector3.Zero;
4127 Vector3 mypos = Vector3.Zero; 4180 Vector3 mypos = Vector3.Zero;
4128 ScenePresence mysp = (ScenePresence)SceneAgent; 4181 ScenePresence mysp = (ScenePresence)SceneAgent;
4129 if(mysp != null && !mysp.IsDeleted) 4182
4183 // we should have a presence
4184 if(mysp == null)
4185 return;
4186
4187 if(doCulling)
4130 { 4188 {
4131 cullingrange = mysp.DrawDistance + m_scene.ReprioritizationDistance + 16f; 4189 cullingrange = mysp.DrawDistance + m_scene.ReprioritizationDistance + 16f;
4132// mycamera = mysp.CameraPosition; 4190// mycamera = mysp.CameraPosition;
4133 mypos = mysp.AbsolutePosition; 4191 mypos = mysp.AbsolutePosition;
4134 } 4192 }
4135 else
4136 doCulling = false;
4137 4193
4138 while (maxUpdatesBytes > 0) 4194 while (maxUpdatesBytes > 0)
4139 { 4195 {
@@ -4154,9 +4210,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4154 { 4210 {
4155 SceneObjectPart part = (SceneObjectPart)update.Entity; 4211 SceneObjectPart part = (SceneObjectPart)update.Entity;
4156 SceneObjectGroup grp = part.ParentGroup; 4212 SceneObjectGroup grp = part.ParentGroup;
4157 if (grp.inTransit) 4213 if (grp.inTransit && !update.Flags.HasFlag(PrimUpdateFlags.SendInTransit))
4158 continue; 4214 continue;
4215/* debug
4216 if (update.Flags.HasFlag(PrimUpdateFlags.SendInTransit))
4217 {
4218
4159 4219
4220 }
4221*/
4160 if (grp.IsDeleted) 4222 if (grp.IsDeleted)
4161 { 4223 {
4162 // Don't send updates for objects that have been marked deleted. 4224 // Don't send updates for objects that have been marked deleted.
@@ -4213,14 +4275,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4213 { 4275 {
4214 part.Shape.LightEntry = false; 4276 part.Shape.LightEntry = false;
4215 } 4277 }
4216
4217 if (part.Shape != null && (part.Shape.SculptType == (byte)SculptType.Mesh))
4218 {
4219 // Ensure that mesh has at least 8 valid faces
4220 part.Shape.ProfileBegin = 12500;
4221 part.Shape.ProfileEnd = 0;
4222 part.Shape.ProfileHollow = 27500;
4223 }
4224 } 4278 }
4225 4279
4226 if(doCulling && !grp.IsAttachment) 4280 if(doCulling && !grp.IsAttachment)
@@ -4248,14 +4302,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4248 continue; 4302 continue;
4249 } 4303 }
4250 } 4304 }
4251
4252 if (part.Shape != null && (part.Shape.SculptType == (byte)SculptType.Mesh))
4253 {
4254 // Ensure that mesh has at least 8 valid faces
4255 part.Shape.ProfileBegin = 12500;
4256 part.Shape.ProfileEnd = 0;
4257 part.Shape.ProfileHollow = 27500;
4258 }
4259 } 4305 }
4260 else if (update.Entity is ScenePresence) 4306 else if (update.Entity is ScenePresence)
4261 { 4307 {
@@ -4330,7 +4376,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4330 if (update.Entity is ScenePresence) 4376 if (update.Entity is ScenePresence)
4331 ablock = CreateAvatarUpdateBlock((ScenePresence)update.Entity); 4377 ablock = CreateAvatarUpdateBlock((ScenePresence)update.Entity);
4332 else 4378 else
4333 ablock = CreatePrimUpdateBlock((SceneObjectPart)update.Entity, this.m_agentId); 4379 ablock = CreatePrimUpdateBlock((SceneObjectPart)update.Entity, mysp);
4334 objectUpdateBlocks.Add(ablock); 4380 objectUpdateBlocks.Add(ablock);
4335 objectUpdates.Value.Add(update); 4381 objectUpdates.Value.Add(update);
4336 maxUpdatesBytes -= ablock.Length; 4382 maxUpdatesBytes -= ablock.Length;
@@ -4462,6 +4508,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4462 } 4508 }
4463 4509
4464 // hack.. dont use 4510 // hack.. dont use
4511/*
4465 public void SendPartFullUpdate(ISceneEntity ent, uint? parentID) 4512 public void SendPartFullUpdate(ISceneEntity ent, uint? parentID)
4466 { 4513 {
4467 if (ent is SceneObjectPart) 4514 if (ent is SceneObjectPart)
@@ -4472,7 +4519,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4472 packet.RegionData.TimeDilation = Utils.FloatToUInt16(m_scene.TimeDilation, 0.0f, 1.0f); 4519 packet.RegionData.TimeDilation = Utils.FloatToUInt16(m_scene.TimeDilation, 0.0f, 1.0f);
4473 packet.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[1]; 4520 packet.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[1];
4474 4521
4475 ObjectUpdatePacket.ObjectDataBlock blk = CreatePrimUpdateBlock(part, this.m_agentId); 4522 ObjectUpdatePacket.ObjectDataBlock blk = CreatePrimUpdateBlock(part, mysp);
4476 if (parentID.HasValue) 4523 if (parentID.HasValue)
4477 { 4524 {
4478 blk.ParentID = parentID.Value; 4525 blk.ParentID = parentID.Value;
@@ -4488,7 +4535,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4488// updatesThisCall, Name, SceneAgent.IsChildAgent ? "child" : "root", Scene.Name); 4535// updatesThisCall, Name, SceneAgent.IsChildAgent ? "child" : "root", Scene.Name);
4489// 4536//
4490 } 4537 }
4491 4538*/
4492 public void ReprioritizeUpdates() 4539 public void ReprioritizeUpdates()
4493 { 4540 {
4494 lock (m_entityUpdates.SyncRoot) 4541 lock (m_entityUpdates.SyncRoot)
@@ -5726,28 +5773,29 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5726 return update; 5773 return update;
5727 } 5774 }
5728 5775
5729 protected ObjectUpdatePacket.ObjectDataBlock CreatePrimUpdateBlock(SceneObjectPart data, UUID recipientID) 5776// protected ObjectUpdatePacket.ObjectDataBlock CreatePrimUpdateBlock(SceneObjectPart data, UUID recipientID)
5777 protected ObjectUpdatePacket.ObjectDataBlock CreatePrimUpdateBlock(SceneObjectPart part, ScenePresence sp)
5730 { 5778 {
5731 byte[] objectData = new byte[60]; 5779 byte[] objectData = new byte[60];
5732 data.RelativePosition.ToBytes(objectData, 0); 5780 part.RelativePosition.ToBytes(objectData, 0);
5733 data.Velocity.ToBytes(objectData, 12); 5781 part.Velocity.ToBytes(objectData, 12);
5734 data.Acceleration.ToBytes(objectData, 24); 5782 part.Acceleration.ToBytes(objectData, 24);
5735 5783
5736 Quaternion rotation = data.RotationOffset; 5784 Quaternion rotation = part.RotationOffset;
5737 rotation.Normalize(); 5785 rotation.Normalize();
5738 rotation.ToBytes(objectData, 36); 5786 rotation.ToBytes(objectData, 36);
5739 data.AngularVelocity.ToBytes(objectData, 48); 5787 part.AngularVelocity.ToBytes(objectData, 48);
5740 5788
5741 ObjectUpdatePacket.ObjectDataBlock update = new ObjectUpdatePacket.ObjectDataBlock(); 5789 ObjectUpdatePacket.ObjectDataBlock update = new ObjectUpdatePacket.ObjectDataBlock();
5742 update.ClickAction = (byte)data.ClickAction; 5790 update.ClickAction = (byte)part.ClickAction;
5743 update.CRC = 0; 5791 update.CRC = 0;
5744 update.ExtraParams = data.Shape.ExtraParams ?? Utils.EmptyBytes; 5792 update.ExtraParams = part.Shape.ExtraParams ?? Utils.EmptyBytes;
5745 update.FullID = data.UUID; 5793 update.FullID = part.UUID;
5746 update.ID = data.LocalId; 5794 update.ID = part.LocalId;
5747 //update.JointAxisOrAnchor = Vector3.Zero; // These are deprecated 5795 //update.JointAxisOrAnchor = Vector3.Zero; // These are deprecated
5748 //update.JointPivot = Vector3.Zero; 5796 //update.JointPivot = Vector3.Zero;
5749 //update.JointType = 0; 5797 //update.JointType = 0;
5750 update.Material = data.Material; 5798 update.Material = part.Material;
5751 update.MediaURL = Utils.EmptyBytes; // FIXME: Support this in OpenSim 5799 update.MediaURL = Utils.EmptyBytes; // FIXME: Support this in OpenSim
5752/* 5800/*
5753 if (data.ParentGroup.IsAttachment) 5801 if (data.ParentGroup.IsAttachment)
@@ -5776,68 +5824,74 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5776 } 5824 }
5777*/ 5825*/
5778 5826
5779 if (data.ParentGroup.IsAttachment) 5827 if (part.ParentGroup.IsAttachment)
5780 { 5828 {
5781 if (data.IsRoot) 5829 if (part.IsRoot)
5782 { 5830 {
5783 update.NameValue = Util.StringToBytes256("AttachItemID STRING RW SV " + data.ParentGroup.FromItemID); 5831 update.NameValue = Util.StringToBytes256("AttachItemID STRING RW SV " + part.ParentGroup.FromItemID);
5784 } 5832 }
5785 else 5833 else
5786 update.NameValue = Utils.EmptyBytes; 5834 update.NameValue = Utils.EmptyBytes;
5787 5835
5788 int st = (int)data.ParentGroup.AttachmentPoint; 5836 int st = (int)part.ParentGroup.AttachmentPoint;
5789 update.State = (byte)(((st & 0xf0) >> 4) + ((st & 0x0f) << 4)); ; 5837 update.State = (byte)(((st & 0xf0) >> 4) + ((st & 0x0f) << 4)); ;
5790 } 5838 }
5791 else 5839 else
5792 { 5840 {
5793 update.NameValue = Utils.EmptyBytes; 5841 update.NameValue = Utils.EmptyBytes;
5794 update.State = data.Shape.State; // not sure about this 5842 update.State = part.Shape.State; // not sure about this
5795 } 5843 }
5796 5844
5797 5845
5798 update.ObjectData = objectData; 5846 update.ObjectData = objectData;
5799 update.ParentID = data.ParentID; 5847 update.ParentID = part.ParentID;
5800 update.PathBegin = data.Shape.PathBegin; 5848 update.PathBegin = part.Shape.PathBegin;
5801 update.PathCurve = data.Shape.PathCurve; 5849 update.PathCurve = part.Shape.PathCurve;
5802 update.PathEnd = data.Shape.PathEnd; 5850 update.PathEnd = part.Shape.PathEnd;
5803 update.PathRadiusOffset = data.Shape.PathRadiusOffset; 5851 update.PathRadiusOffset = part.Shape.PathRadiusOffset;
5804 update.PathRevolutions = data.Shape.PathRevolutions; 5852 update.PathRevolutions = part.Shape.PathRevolutions;
5805 update.PathScaleX = data.Shape.PathScaleX; 5853 update.PathScaleX = part.Shape.PathScaleX;
5806 update.PathScaleY = data.Shape.PathScaleY; 5854 update.PathScaleY = part.Shape.PathScaleY;
5807 update.PathShearX = data.Shape.PathShearX; 5855 update.PathShearX = part.Shape.PathShearX;
5808 update.PathShearY = data.Shape.PathShearY; 5856 update.PathShearY = part.Shape.PathShearY;
5809 update.PathSkew = data.Shape.PathSkew; 5857 update.PathSkew = part.Shape.PathSkew;
5810 update.PathTaperX = data.Shape.PathTaperX; 5858 update.PathTaperX = part.Shape.PathTaperX;
5811 update.PathTaperY = data.Shape.PathTaperY; 5859 update.PathTaperY = part.Shape.PathTaperY;
5812 update.PathTwist = data.Shape.PathTwist; 5860 update.PathTwist = part.Shape.PathTwist;
5813 update.PathTwistBegin = data.Shape.PathTwistBegin; 5861 update.PathTwistBegin = part.Shape.PathTwistBegin;
5814 update.PCode = data.Shape.PCode; 5862 update.PCode = part.Shape.PCode;
5815 update.ProfileBegin = data.Shape.ProfileBegin; 5863 update.ProfileBegin = part.Shape.ProfileBegin;
5816 update.ProfileCurve = data.Shape.ProfileCurve; 5864 update.ProfileCurve = part.Shape.ProfileCurve;
5817 update.ProfileEnd = data.Shape.ProfileEnd; 5865
5818 update.ProfileHollow = data.Shape.ProfileHollow; 5866 if(part.Shape.SculptType == (byte)SculptType.Mesh) // filter out hack
5819 update.PSBlock = data.ParticleSystem ?? Utils.EmptyBytes; 5867 update.ProfileCurve = (byte)(part.Shape.ProfileCurve & 0x0f);
5820 update.TextColor = data.GetTextColor().GetBytes(false); 5868 else
5821 update.TextureAnim = data.TextureAnimation ?? Utils.EmptyBytes; 5869 update.ProfileCurve = part.Shape.ProfileCurve;
5822 update.TextureEntry = data.Shape.TextureEntry ?? Utils.EmptyBytes; 5870
5823 update.Scale = data.Shape.Scale; 5871 update.ProfileEnd = part.Shape.ProfileEnd;
5824 update.Text = Util.StringToBytes256(data.Text); 5872 update.ProfileHollow = part.Shape.ProfileHollow;
5825 update.MediaURL = Util.StringToBytes256(data.MediaUrl); 5873 update.PSBlock = part.ParticleSystem ?? Utils.EmptyBytes;
5874 update.TextColor = part.GetTextColor().GetBytes(false);
5875 update.TextureAnim = part.TextureAnimation ?? Utils.EmptyBytes;
5876 update.TextureEntry = part.Shape.TextureEntry ?? Utils.EmptyBytes;
5877 update.Scale = part.Shape.Scale;
5878 update.Text = Util.StringToBytes256(part.Text);
5879 update.MediaURL = Util.StringToBytes256(part.MediaUrl);
5826 5880
5827 #region PrimFlags 5881 #region PrimFlags
5828 5882
5829 PrimFlags flags = (PrimFlags)m_scene.Permissions.GenerateClientFlags(recipientID, data.UUID); 5883 PrimFlags flags = (PrimFlags)m_scene.Permissions.GenerateClientFlags(part, sp);
5830 5884
5831 // Don't send the CreateSelected flag to everyone 5885 // Don't send the CreateSelected flag to everyone
5832 flags &= ~PrimFlags.CreateSelected; 5886 flags &= ~PrimFlags.CreateSelected;
5833 5887
5834 if (recipientID == data.OwnerID) 5888 if (sp.UUID == part.OwnerID)
5835 { 5889 {
5836 if (data.CreateSelected) 5890 if (part.CreateSelected)
5837 { 5891 {
5838 // Only send this flag once, then unset it 5892 // Only send this flag once, then unset it
5839 flags |= PrimFlags.CreateSelected; 5893 flags |= PrimFlags.CreateSelected;
5840 data.CreateSelected = false; 5894 part.CreateSelected = false;
5841 } 5895 }
5842 } 5896 }
5843 5897
@@ -5849,21 +5903,21 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5849 5903
5850 #endregion PrimFlags 5904 #endregion PrimFlags
5851 5905
5852 if (data.Sound != UUID.Zero) 5906 if (part.Sound != UUID.Zero)
5853 { 5907 {
5854 update.Sound = data.Sound; 5908 update.Sound = part.Sound;
5855 update.OwnerID = data.OwnerID; 5909 update.OwnerID = part.OwnerID;
5856 update.Gain = (float)data.SoundGain; 5910 update.Gain = (float)part.SoundGain;
5857 update.Radius = (float)data.SoundRadius; 5911 update.Radius = (float)part.SoundRadius;
5858 update.Flags = data.SoundFlags; 5912 update.Flags = part.SoundFlags;
5859 } 5913 }
5860 5914
5861 switch ((PCode)data.Shape.PCode) 5915 switch ((PCode)part.Shape.PCode)
5862 { 5916 {
5863 case PCode.Grass: 5917 case PCode.Grass:
5864 case PCode.Tree: 5918 case PCode.Tree:
5865 case PCode.NewTree: 5919 case PCode.NewTree:
5866 update.Data = new byte[] { data.Shape.State }; 5920 update.Data = new byte[] { part.Shape.State };
5867 break; 5921 break;
5868 default: 5922 default:
5869 update.Data = Utils.EmptyBytes; 5923 update.Data = Utils.EmptyBytes;
@@ -7753,10 +7807,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
7753 7807
7754 ObjectDuplicate handlerObjectDuplicate = null; 7808 ObjectDuplicate handlerObjectDuplicate = null;
7755 7809
7756 for (int i = 0; i < dupe.ObjectData.Length; i++) 7810 handlerObjectDuplicate = OnObjectDuplicate;
7811 if (handlerObjectDuplicate != null)
7757 { 7812 {
7758 handlerObjectDuplicate = OnObjectDuplicate; 7813 for (int i = 0; i < dupe.ObjectData.Length; i++)
7759 if (handlerObjectDuplicate != null)
7760 { 7814 {
7761 UUID rezGroupID = dupe.AgentData.GroupID; 7815 UUID rezGroupID = dupe.AgentData.GroupID;
7762 if(!IsGroupMember(rezGroupID)) 7816 if(!IsGroupMember(rezGroupID))