*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)
afrisby
mingchen 2007-07-15 21:02:13 +00:00
parent 61446c0cd8
commit 6510aea0ed
7 changed files with 91 additions and 17 deletions

View File

@ -69,7 +69,8 @@ namespace OpenSim.Framework.Interfaces
public delegate void ParcelPropertiesRequest(int start_x, int start_y, int end_x, int end_y, int sequence_id, bool snap_selection, IClientAPI remote_client);
public delegate void ParcelDivideRequest(int west, int south, int east, int north, IClientAPI remote_client);
public delegate void ParcelJoinRequest(int west, int south, int east, int north, IClientAPI remote_client);
public delegate void ParcelPropertiesUpdateRequest(ParcelPropertiesUpdatePacket packet, IClientAPI remote_client); // NOTETOSELFremove the packet part
public delegate void ParcelPropertiesUpdateRequest(ParcelPropertiesUpdatePacket packet, IClientAPI remote_client);
public delegate void ParcelSelectObjects(int parcel_local_id, int request_type, IClientAPI remote_client);
public delegate void EstateOwnerMessageRequest(EstateOwnerMessagePacket packet, IClientAPI remote_client);
@ -126,6 +127,7 @@ namespace OpenSim.Framework.Interfaces
event ParcelDivideRequest OnParcelDivideRequest;
event ParcelJoinRequest OnParcelJoinRequest;
event ParcelPropertiesUpdateRequest OnParcelPropertiesUpdateRequest;
event ParcelSelectObjects OnParcelSelectObjects;
event EstateOwnerMessageRequest OnEstateOwnerMessage;

View File

@ -84,6 +84,7 @@ namespace OpenSim.Region.ClientStack
public event ParcelDivideRequest OnParcelDivideRequest;
public event ParcelJoinRequest OnParcelJoinRequest;
public event ParcelPropertiesUpdateRequest OnParcelPropertiesUpdateRequest;
public event ParcelSelectObjects OnParcelSelectObjects;
public event EstateOwnerMessageRequest OnEstateOwnerMessage;

View File

@ -594,6 +594,13 @@ namespace OpenSim.Region.ClientStack
}
break;
case PacketType.ParcelSelectObjects:
ParcelSelectObjectsPacket selectPacket = (ParcelSelectObjectsPacket)Pack;
if (OnParcelSelectObjects != null)
{
OnParcelSelectObjects(selectPacket.ParcelData.LocalID, Convert.ToInt32(selectPacket.ParcelData.ReturnType), this);
}
break;
#endregion
#region Estate Packets

View File

@ -1,4 +1,3 @@
/*
* Copyright (c) Contributors, http://www.openmetaverse.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.

View File

@ -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
/// <summary>
@ -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<uint> resultLocalIDs = new List<uint>();
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;

View File

@ -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);
}

View File

@ -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;