From 6510aea0ed33134c09d25be690a69e1fff4a3282 Mon Sep 17 00:00:00 2001 From: mingchen Date: Sun, 15 Jul 2007 21:02:13 +0000 Subject: *Added support for the "show" button that highlights objects over the selected Objects *Known bug, client does some weird "showing" when more than 255 objects are meant to be selected (linked objects count as one object) --- OpenSim/Region/Environment/ParcelManager.cs | 89 ++++++++++++++++++++---- OpenSim/Region/Environment/Scenes/Scene.cs | 3 +- OpenSim/Region/Environment/Scenes/SceneObject.cs | 3 +- 3 files changed, 80 insertions(+), 15 deletions(-) (limited to 'OpenSim/Region/Environment') diff --git a/OpenSim/Region/Environment/ParcelManager.cs b/OpenSim/Region/Environment/ParcelManager.cs index 4f836ef..838a003 100644 --- a/OpenSim/Region/Environment/ParcelManager.cs +++ b/OpenSim/Region/Environment/ParcelManager.cs @@ -66,6 +66,12 @@ namespace OpenSim.Region.Environment public const int PARCEL_RESULT_ONE_PARCEL = 0; // The request they made contained only one parcel public const int PARCEL_RESULT_MULTIPLE_PARCELS = 1; // The request they made contained more than one parcel + //ParcelSelectObjects + public const int PARCEL_SELECT_OBJECTS_OWNER = 2; + public const int PARCEL_SELECT_OBJECTS_GROUP = 4; + public const int PARCEL_SELECT_OBJECTS_OTHER = 8; + + //These are other constants. Yay! public const int START_PARCEL_LOCAL_ID = 1; #endregion @@ -490,6 +496,11 @@ namespace OpenSim.Region.Environment join(west, south, east, north, remote_client.AgentId); } + + public void handleParcelSelectObjectsRequest(int local_id, int request_type, IClientAPI remote_client) + { + parcelList[local_id].sendForceObjectSelect(local_id, request_type, remote_client); + } #endregion /// @@ -532,10 +543,14 @@ namespace OpenSim.Region.Environment p.resetParcelPrimCounts(); } } + public void setPrimsTainted() + { + this.parcelPrimCountTainted = true; + } public void addPrimToParcelCounts(SceneObject obj) { - LLVector3 position = obj.rootPrimitive.Pos; + LLVector3 position = obj.Pos; Parcel parcelUnderPrim = getParcel(position.X, position.Y); if (parcelUnderPrim != null) { @@ -551,13 +566,6 @@ namespace OpenSim.Region.Environment } } - public void setPrimsTainted() - { - this.parcelPrimCountTainted = true; - } - - - public void finalizeParcelPrimCountUpdate() { //Get Simwide prim count for owner @@ -1010,6 +1018,67 @@ namespace OpenSim.Region.Environment } #endregion + public void sendForceObjectSelect(int local_id, int request_type, IClientAPI remote_client) + { + List resultLocalIDs = new List(); + foreach (SceneObject obj in primsOverMe) + { + if (obj.rootLocalID > 0) + { + if (request_type == ParcelManager.PARCEL_SELECT_OBJECTS_OWNER && obj.rootPrimitive.OwnerID == this.parcelData.ownerID) + { + resultLocalIDs.Add(obj.rootLocalID); + } + else if (request_type == ParcelManager.PARCEL_SELECT_OBJECTS_GROUP && false) //TODO: change false to group support! + { + + } + else if (request_type == ParcelManager.PARCEL_SELECT_OBJECTS_OTHER && obj.rootPrimitive.OwnerID != remote_client.AgentId) + { + resultLocalIDs.Add(obj.rootLocalID); + } + } + } + + + bool firstCall = true; + int MAX_OBJECTS_PER_PACKET = 255; + ForceObjectSelectPacket pack = new ForceObjectSelectPacket(); + ForceObjectSelectPacket.DataBlock[] data; + while (resultLocalIDs.Count > 0) + { + if (firstCall) + { + pack._Header.ResetList = true; + firstCall = false; + } + else + { + pack._Header.ResetList = false; + } + + if (resultLocalIDs.Count > MAX_OBJECTS_PER_PACKET) + { + data = new ForceObjectSelectPacket.DataBlock[MAX_OBJECTS_PER_PACKET]; + } + else + { + data = new ForceObjectSelectPacket.DataBlock[resultLocalIDs.Count]; + } + + int i; + for (i = 0; i < MAX_OBJECTS_PER_PACKET && resultLocalIDs.Count > 0; i++) + { + data[i] = new ForceObjectSelectPacket.DataBlock(); + data[i].LocalID = Convert.ToUInt32(resultLocalIDs[0]); + resultLocalIDs.RemoveAt(0); + } + pack.Data = data; + + remote_client.OutPacket((Packet)pack); + } + + } public void resetParcelPrimCounts() { parcelData.groupPrims = 0; @@ -1027,10 +1096,6 @@ namespace OpenSim.Region.Environment { parcelData.ownerPrims += prim_count; } - else if (prim_owner == parcelData.groupID) - { - parcelData.groupPrims += prim_count; - } else { parcelData.otherPrims += prim_count; diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 0186ba8..a06679a 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -229,7 +229,7 @@ namespace OpenSim.Region.Environment.Scenes } this.parcelPrimCheckCount++; - if (this.parcelPrimCheckCount > 100) //check every 10 seconds for tainted prims + if (this.parcelPrimCheckCount > 50) //check every 5 seconds for tainted prims { if (m_parcelManager.parcelPrimCountTainted) { @@ -534,6 +534,7 @@ namespace OpenSim.Region.Environment.Scenes client.OnParcelDivideRequest += new ParcelDivideRequest(m_parcelManager.handleParcelDivideRequest); client.OnParcelJoinRequest += new ParcelJoinRequest(m_parcelManager.handleParcelJoinRequest); client.OnParcelPropertiesUpdateRequest += new ParcelPropertiesUpdateRequest(m_parcelManager.handleParcelPropertiesUpdateRequest); + client.OnParcelSelectObjects += new ParcelSelectObjects(m_parcelManager.handleParcelSelectObjectsRequest); client.OnEstateOwnerMessage += new EstateOwnerMessageRequest(m_estateManager.handleEstateOwnerMessage); } diff --git a/OpenSim/Region/Environment/Scenes/SceneObject.cs b/OpenSim/Region/Environment/Scenes/SceneObject.cs index 95db271..c925584 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObject.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObject.cs @@ -170,8 +170,7 @@ namespace OpenSim.Region.Environment.Scenes dupe.children.Add(dupe.rootPrimitive); dupe.rootPrimitive.Pos = this.Pos; dupe.Rotation = this.Rotation; - LLUUID rootu = dupe.rootUUID; - uint rooti = dupe.rootLocalID; + dupe.LocalId = m_world.PrimIDAllocate(); dupe.registerEvents(); return dupe; -- cgit v1.1