From 32438ab1b9a5c270e0a4a2d708f8c7730dc7e617 Mon Sep 17 00:00:00 2001 From: Teravus Ovares Date: Sun, 30 Dec 2007 06:18:17 +0000 Subject: * This update rolls back the packetpool and LibSL changes. Please retest and then patch these changes back in. Currently it's not quite ready for 0.5. The down side to this action, is that we loose some performance to the garbage collector for now. Given that the target date for 0.5 is *Two days* from now, I'm taking the initiative to work towards a real stable version. * This update also fixes scripting and some weird physics reactions --- OpenSim/Region/Environment/LandManagement/Land.cs | 10 +-- .../Environment/LandManagement/LandManager.cs | 2 +- .../Region/Environment/Scenes/Scene.Inventory.cs | 4 +- .../Environment/Scenes/Scene.PacketHandlers.cs | 2 +- OpenSim/Region/Environment/Scenes/Scene.cs | 76 +++++++++++----------- .../Region/Environment/Scenes/SceneObjectGroup.cs | 17 ++--- .../Region/Environment/Scenes/SimStatsReporter.cs | 2 +- 7 files changed, 53 insertions(+), 60 deletions(-) (limited to 'OpenSim/Region/Environment') diff --git a/OpenSim/Region/Environment/LandManagement/Land.cs b/OpenSim/Region/Environment/LandManagement/Land.cs index 5c99ffd..bd26fdf 100644 --- a/OpenSim/Region/Environment/LandManagement/Land.cs +++ b/OpenSim/Region/Environment/LandManagement/Land.cs @@ -111,7 +111,7 @@ namespace OpenSim.Region.Environment.LandManagement public void sendLandProperties(int sequence_id, bool snap_selection, int request_result, IClientAPI remote_client) { - ParcelPropertiesPacket updatePacket = (ParcelPropertiesPacket) PacketPool.Instance.GetPacket(PacketType.ParcelProperties); + ParcelPropertiesPacket updatePacket = new ParcelPropertiesPacket(); // TODO: don't create new blocks if recycling an old packet updatePacket.ParcelData.AABBMax = landData.AABBMax; @@ -337,7 +337,7 @@ namespace OpenSim.Region.Environment.LandManagement if (flags == (uint) ParcelManager.AccessList.Access || flags == (uint) ParcelManager.AccessList.Both) { - replyPacket = (ParcelAccessListReplyPacket) PacketPool.Instance.GetPacket(PacketType.ParcelAccessListReply); + replyPacket = new ParcelAccessListReplyPacket(); replyPacket.Data.AgentID = agentID; replyPacket.Data.Flags = (uint) ParcelManager.AccessList.Access; replyPacket.Data.LocalID = landData.localID; @@ -349,7 +349,7 @@ namespace OpenSim.Region.Environment.LandManagement if (flags == (uint) ParcelManager.AccessList.Ban || flags == (uint) ParcelManager.AccessList.Both) { - replyPacket = (ParcelAccessListReplyPacket) PacketPool.Instance.GetPacket(PacketType.ParcelAccessListReply); + replyPacket = new ParcelAccessListReplyPacket(); replyPacket.Data.AgentID = agentID; replyPacket.Data.Flags = (uint) ParcelManager.AccessList.Ban; replyPacket.Data.LocalID = landData.localID; @@ -660,7 +660,7 @@ namespace OpenSim.Region.Environment.LandManagement bool firstCall = true; int MAX_OBJECTS_PER_PACKET = 251; - ForceObjectSelectPacket pack = (ForceObjectSelectPacket) PacketPool.Instance.GetPacket(PacketType.ForceObjectSelect); + ForceObjectSelectPacket pack = new ForceObjectSelectPacket(); // TODO: don't create new blocks if recycling an old packet ForceObjectSelectPacket.DataBlock[] data; while (resultLocalIDs.Count > 0) @@ -699,7 +699,7 @@ namespace OpenSim.Region.Environment.LandManagement public void sendLandObjectOwners(IClientAPI remote_client) { Dictionary ownersAndCount = new Dictionary(); - ParcelObjectOwnersReplyPacket pack = (ParcelObjectOwnersReplyPacket) PacketPool.Instance.GetPacket(PacketType.ParcelObjectOwnersReply); + ParcelObjectOwnersReplyPacket pack = new ParcelObjectOwnersReplyPacket(); // TODO: don't create new blocks if recycling an old packet foreach (SceneObjectGroup obj in primsOverMe) diff --git a/OpenSim/Region/Environment/LandManagement/LandManager.cs b/OpenSim/Region/Environment/LandManagement/LandManager.cs index 22e7fc9..d463964 100644 --- a/OpenSim/Region/Environment/LandManagement/LandManager.cs +++ b/OpenSim/Region/Environment/LandManagement/LandManager.cs @@ -494,7 +494,7 @@ namespace OpenSim.Region.Environment.LandManagement if (byteArrayCount >= LAND_BLOCKS_PER_PACKET) { byteArrayCount = 0; - packet = (ParcelOverlayPacket) PacketPool.Instance.GetPacket(PacketType.ParcelOverlay); + packet = new ParcelOverlayPacket(); packet.ParcelData.Data = byteArray; packet.ParcelData.SequenceID = sequenceID; remote_client.OutPacket((Packet) packet, ThrottleOutPacketType.Task); diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs index 1a77565..5b46040 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs @@ -557,7 +557,7 @@ namespace OpenSim.Region.Environment.Scenes if (rezAsset != null) { - string script = Util.FieldToString(rezAsset.Data); + string script = Helpers.FieldToUTF8String(rezAsset.Data); EventManager.TriggerRezScript(localID, copyID, script); rezzed = true; } @@ -733,7 +733,7 @@ namespace OpenSim.Region.Environment.Scenes if (rezAsset != null) { - AddRezObject(Util.FieldToString(rezAsset.Data), pos); + AddRezObject(Helpers.FieldToUTF8String(rezAsset.Data), pos); //userInfo.DeleteItem(remoteClient.AgentId, item); //remoteClient.SendRemoveInventoryItem(itemID); } diff --git a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs index 647fbf4..af4573b 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs @@ -166,7 +166,7 @@ namespace OpenSim.Region.Environment.Scenes List AvatarResponses = new List(); AvatarResponses = CommsManager.GenerateAgentPickerRequestResponse(RequestID, query); - AvatarPickerReplyPacket replyPacket = (AvatarPickerReplyPacket) PacketPool.Instance.GetPacket(PacketType.AvatarPickerReply); + AvatarPickerReplyPacket replyPacket = new AvatarPickerReplyPacket(); // TODO: don't create new blocks if recycling an old packet AvatarPickerReplyPacket.DataBlock[] searchData = diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 89b68de..d710e49 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -931,7 +931,6 @@ namespace OpenSim.Region.Environment.Scenes if (RayEndIsIntersection == (byte)1) { pos = RayEnd; - pos.Z += 0.25F; return pos; } if (RayTargetID != LLUUID.Zero) @@ -987,14 +986,13 @@ namespace OpenSim.Region.Environment.Scenes - pos.Z += 0.25F; + return pos; } else { // fall back to our stupid functionality pos = RayEnd; - pos.Z += 0.25F; return pos; } } @@ -1002,7 +1000,6 @@ namespace OpenSim.Region.Environment.Scenes { // fall back to our stupid functionality pos = RayEnd; - pos.Z += 0.25F; return pos; } @@ -1012,7 +1009,12 @@ namespace OpenSim.Region.Environment.Scenes byte bypassRaycast, LLVector3 RayStart, LLUUID RayTargetID, byte RayEndIsIntersection) { - + // What we're *supposed* to do is raytrace from the camera position given by the client to the nearest collision + // in the direction the client supplies (the ground level that we clicked) + // This function is pretty crappy right now.. so we're not affecting where the newly rezzed objects go + // Test it if you like. The console will write where it guesses a collision took place. if it thinks one did. + // It's wrong many times though. + LLVector3 pos = GetNewRezLocation(RayStart, RayEnd, RayTargetID, rot, bypassRaycast, RayEndIsIntersection); @@ -1020,40 +1022,36 @@ namespace OpenSim.Region.Environment.Scenes if (PermissionsMngr.CanRezObject(ownerID, pos)) { - // rez ON the ground, not IN the ground - - - AddNewPrim(ownerID, pos, rot, shape); - } - } - - public virtual void AddNewPrim(LLUUID ownerID, LLVector3 pos, LLQuaternion rot, PrimitiveBaseShape shape) - { - SceneObjectGroup sceneOb = - new SceneObjectGroup(this, m_regionHandle, ownerID, PrimIDAllocate(), pos, rot, shape); - AddEntity(sceneOb); - SceneObjectPart rootPart = sceneOb.GetChildPart(sceneOb.UUID); - // if grass or tree, make phantom - //rootPart.ApplySanePermissions(); - if ((rootPart.Shape.PCode == 95) || (rootPart.Shape.PCode == 255) || (rootPart.Shape.PCode == 111)) - { - rootPart.AddFlag(LLObject.ObjectFlags.Phantom); - //rootPart.ObjectFlags += (uint)LLObject.ObjectFlags.Phantom; - } - // if not phantom, add to physics - bool UsePhysics = (((rootPart.ObjectFlags & (uint) LLObject.ObjectFlags.Physics) > 0) && m_physicalPrim); - if ((rootPart.ObjectFlags & (uint) LLObject.ObjectFlags.Phantom) == 0) - { - rootPart.PhysActor = - PhysicsScene.AddPrimShape( - rootPart.Name, - rootPart.Shape, - new PhysicsVector(pos.X, pos.Y, pos.Z), - new PhysicsVector(shape.Scale.X, shape.Scale.Y, shape.Scale.Z), - new Quaternion(), UsePhysics); - // subscribe to physics events. - rootPart.DoPhysicsPropertyUpdate(UsePhysics, true); + // rez ON the ground, not IN the ground + pos.Z += 0.25F; + + + SceneObjectGroup sceneOb = + new SceneObjectGroup(this, m_regionHandle, ownerID, PrimIDAllocate(), pos, rot, shape); + AddEntity(sceneOb); + SceneObjectPart rootPart = sceneOb.GetChildPart(sceneOb.UUID); + // if grass or tree, make phantom + //rootPart.ApplySanePermissions(); + if ((rootPart.Shape.PCode == 95) || (rootPart.Shape.PCode == 255) || (rootPart.Shape.PCode == 111)) + { + rootPart.AddFlag(LLObject.ObjectFlags.Phantom); + //rootPart.ObjectFlags += (uint)LLObject.ObjectFlags.Phantom; + } + // if not phantom, add to physics + bool UsePhysics = (((rootPart.ObjectFlags & (uint) LLObject.ObjectFlags.Physics) > 0) && m_physicalPrim); + if ((rootPart.ObjectFlags & (uint) LLObject.ObjectFlags.Phantom) == 0) + { + rootPart.PhysActor = + PhysicsScene.AddPrimShape( + rootPart.Name, + rootPart.Shape, + new PhysicsVector(pos.X, pos.Y, pos.Z), + new PhysicsVector(shape.Scale.X, shape.Scale.Y, shape.Scale.Z), + new Quaternion(), UsePhysics); + // subscribe to physics events. + rootPart.DoPhysicsPropertyUpdate(UsePhysics, true); + } } } @@ -1500,7 +1498,7 @@ namespace OpenSim.Region.Environment.Scenes m_innerScene.removeUserCount(true); } // Tell a single agent to disconnect from the region. - libsecondlife.Packets.DisableSimulatorPacket disable = (libsecondlife.Packets.DisableSimulatorPacket) PacketPool.Instance.GetPacket(libsecondlife.Packets.PacketType.DisableSimulator); + DisableSimulatorPacket disable = new DisableSimulatorPacket(); presence.ControllingClient.OutPacket(disable, ThrottleOutPacketType.Task); } } diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs index 0f8ce0b..3fc7aec 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs @@ -636,7 +636,7 @@ namespace OpenSim.Region.Environment.Scenes public void ServiceObjectPropertiesFamilyRequest(IClientAPI remoteClient, LLUUID AgentID, uint RequestFlags) { //RootPart.ServiceObjectPropertiesFamilyRequest(remoteClient, AgentID, RequestFlags); - ObjectPropertiesFamilyPacket objPropFamilyPack = (ObjectPropertiesFamilyPacket) PacketPool.Instance.GetPacket(PacketType.ObjectPropertiesFamily); + ObjectPropertiesFamilyPacket objPropFamilyPack = new ObjectPropertiesFamilyPacket(); // TODO: don't create new blocks if recycling an old packet ObjectPropertiesFamilyPacket.ObjectDataBlock objPropDB = new ObjectPropertiesFamilyPacket.ObjectDataBlock(); @@ -677,32 +677,26 @@ namespace OpenSim.Region.Environment.Scenes /// public override void Update() { - List parts = new List(m_parts.Values); - if (Util.GetDistanceTo(lastPhysGroupPos, AbsolutePosition) > 0.02) { - foreach (SceneObjectPart part in parts) + foreach (SceneObjectPart part in m_parts.Values) { if (part.UpdateFlag == 0) part.UpdateFlag = 1; } - lastPhysGroupPos = AbsolutePosition; } - if ((Math.Abs(lastPhysGroupRot.W - GroupRotation.W) > 0.1) || (Math.Abs(lastPhysGroupRot.X - GroupRotation.X) > 0.1) || (Math.Abs(lastPhysGroupRot.Y - GroupRotation.Y) > 0.1) || (Math.Abs(lastPhysGroupRot.Z - GroupRotation.Z) > 0.1)) { - foreach (SceneObjectPart part in parts) + foreach (SceneObjectPart part in m_parts.Values) { if (part.UpdateFlag == 0) part.UpdateFlag = 1; } - lastPhysGroupRot = GroupRotation; } - - foreach (SceneObjectPart part in parts) + foreach (SceneObjectPart part in m_parts.Values) { part.SendScheduledUpdates(); } @@ -1051,7 +1045,7 @@ namespace OpenSim.Region.Environment.Scenes /// public void GetProperites(IClientAPI client) { - ObjectPropertiesPacket proper = (ObjectPropertiesPacket) PacketPool.Instance.GetPacket(PacketType.ObjectProperties); + ObjectPropertiesPacket proper = new ObjectPropertiesPacket(); // TODO: don't create new blocks if recycling an old packet proper.ObjectData = new ObjectPropertiesPacket.ObjectDataBlock[1]; @@ -1086,6 +1080,7 @@ namespace OpenSim.Region.Environment.Scenes /// public void SetPartName(string name, uint localID) { + name = name.Remove(name.Length - 1, 1); SceneObjectPart part = GetChildPart(localID); if (part != null) { diff --git a/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs b/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs index 5033965..d955fe7 100644 --- a/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs +++ b/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs @@ -83,7 +83,7 @@ namespace OpenSim.Region.Environment.Scenes private void statsHeartBeat(object sender, EventArgs e) { m_report.Enabled = false; - SimStatsPacket statpack = (SimStatsPacket) PacketPool.Instance.GetPacket(PacketType.SimStats); + SimStatsPacket statpack = new SimStatsPacket(); // TODO: don't create new blocks if recycling an old packet SimStatsPacket.StatBlock[] sb = new SimStatsPacket.StatBlock[11]; -- cgit v1.1