From 8b16f7d976dc60b06f6d08e9d9d853ae69de5fc9 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 30 Mar 2011 00:13:07 +0100 Subject: (re)implement selected prim count. This does not currently count objects that are sat upon (which the viewer ui implies should be included in this count) --- .../Region/ClientStack/LindenUDP/LLClientView.cs | 46 +++++++++++----------- .../CoreModules/World/Land/PrimCountModule.cs | 43 ++++++++++++++++++-- .../World/Land/Tests/PrimCountModuleTests.cs | 6 +++ 3 files changed, 69 insertions(+), 26 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 8ebcabb..2faffae 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -4343,28 +4343,26 @@ namespace OpenSim.Region.ClientStack.LindenUDP } updateMessage.SnapSelection = snap_selection; - updateMessage.SnapshotID = landData.SnapshotID; - updateMessage.Status = (ParcelStatus) landData.Status; - updateMessage.UserLocation = landData.UserLocation; - updateMessage.UserLookAt = landData.UserLookAt; - - updateMessage.MediaType = landData.MediaType; - updateMessage.MediaDesc = landData.MediaDescription; - updateMessage.MediaWidth = landData.MediaWidth; - updateMessage.MediaHeight = landData.MediaHeight; - updateMessage.MediaLoop = landData.MediaLoop; - updateMessage.ObscureMusic = landData.ObscureMusic; - updateMessage.ObscureMedia = landData.ObscureMedia; + updateMessage.SnapshotID = landData.SnapshotID; + updateMessage.Status = (ParcelStatus) landData.Status; + updateMessage.UserLocation = landData.UserLocation; + updateMessage.UserLookAt = landData.UserLookAt; + + updateMessage.MediaType = landData.MediaType; + updateMessage.MediaDesc = landData.MediaDescription; + updateMessage.MediaWidth = landData.MediaWidth; + updateMessage.MediaHeight = landData.MediaHeight; + updateMessage.MediaLoop = landData.MediaLoop; + updateMessage.ObscureMusic = landData.ObscureMusic; + updateMessage.ObscureMedia = landData.ObscureMedia; IPrimCounts pc = lo.PrimCounts; - updateMessage.OwnerPrims = pc.Owner; - updateMessage.GroupPrims = pc.Group; - updateMessage.OtherPrims = pc.Others; - updateMessage.TotalPrims = pc.Total; - updateMessage.SimWideTotalPrims = pc.Simulator; - - // TODO: Need to transfer selected prims to new prim count structure. - updateMessage.SelectedPrims = landData.SelectedPrims; + updateMessage.OwnerPrims = pc.Owner; + updateMessage.GroupPrims = pc.Group; + updateMessage.OtherPrims = pc.Others; + updateMessage.SelectedPrims = pc.Selected; + updateMessage.TotalPrims = pc.Total; + updateMessage.SimWideTotalPrims = pc.Simulator; try { @@ -4372,13 +4370,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (eq != null) { eq.ParcelProperties(updateMessage, this.AgentId); - } else { - m_log.Warn("No EQ Interface when sending parcel data."); + } + else + { + m_log.Warn("[LLCLIENTVIEW]: No EQ Interface when sending parcel data."); } } catch (Exception ex) { - m_log.Error("Unable to send parcel data via eventqueue - exception: " + ex.ToString()); + m_log.Error("[LLCLIENTVIEW]: Unable to send parcel data via eventqueue - exception: " + ex.ToString()); } } diff --git a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs index d126b26..ab0e88e 100644 --- a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs @@ -45,13 +45,13 @@ namespace OpenSim.Region.CoreModules.World.Land public int Owner = 0; public int Group = 0; public int Others = 0; - public Dictionary Users = - new Dictionary (); + public int Selected = 0; + public Dictionary Users = new Dictionary (); } public class PrimCountModule : IPrimCountModule, INonSharedRegionModule { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); +// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private Scene m_Scene; private Dictionary m_PrimCounts = @@ -219,6 +219,9 @@ namespace OpenSim.Region.CoreModules.World.Land else parcelCounts.Others += partCount; } + + if (obj.IsSelected) + parcelCounts.Selected += partCount; } } @@ -328,6 +331,32 @@ namespace OpenSim.Region.CoreModules.World.Land } /// + /// Get the number of selected prims. + /// + /// + /// + public int GetSelectedCount(UUID parcelID) + { + int count = 0; + + lock (m_TaintLock) + { + if (m_Tainted) + Recount(); + + ParcelCounts counts; + if (m_ParcelCounts.TryGetValue(parcelID, out counts)) + count = counts.Selected; + } + +// m_log.DebugFormat( +// "[PRIM COUNT MODULE]: GetSelectedCount for parcel {0} in {1} returning {2}", +// parcelID, m_Scene.RegionInfo.RegionName, count); + + return count; + } + + /// /// Get the total count of owner, group and others prims on the parcel. /// FIXME: Need to do selected prims once this is reimplemented. /// @@ -491,6 +520,14 @@ namespace OpenSim.Region.CoreModules.World.Land } } + public int Selected + { + get + { + return m_Parent.GetSelectedCount(m_ParcelID); + } + } + public int Total { get diff --git a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs index 58bd841..5a60f22 100644 --- a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs +++ b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs @@ -79,6 +79,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests Assert.That(pc.Group, Is.EqualTo(0)); Assert.That(pc.Others, Is.EqualTo(0)); Assert.That(pc.Total, Is.EqualTo(0)); + Assert.That(pc.Selected, Is.EqualTo(0)); Assert.That(pc.Users[m_userId], Is.EqualTo(0)); Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(0)); Assert.That(pc.Simulator, Is.EqualTo(0)); @@ -90,6 +91,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests Assert.That(pc.Group, Is.EqualTo(0)); Assert.That(pc.Others, Is.EqualTo(0)); Assert.That(pc.Total, Is.EqualTo(3)); + Assert.That(pc.Selected, Is.EqualTo(0)); Assert.That(pc.Users[m_userId], Is.EqualTo(3)); Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(0)); Assert.That(pc.Simulator, Is.EqualTo(3)); @@ -102,6 +104,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests Assert.That(pc.Group, Is.EqualTo(0)); Assert.That(pc.Others, Is.EqualTo(0)); Assert.That(pc.Total, Is.EqualTo(5)); + Assert.That(pc.Selected, Is.EqualTo(0)); Assert.That(pc.Users[m_userId], Is.EqualTo(5)); Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(0)); Assert.That(pc.Simulator, Is.EqualTo(5)); @@ -126,6 +129,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests Assert.That(pc.Group, Is.EqualTo(0)); Assert.That(pc.Others, Is.EqualTo(0)); Assert.That(pc.Total, Is.EqualTo(6)); + Assert.That(pc.Selected, Is.EqualTo(0)); Assert.That(pc.Users[m_userId], Is.EqualTo(6)); Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(0)); Assert.That(pc.Simulator, Is.EqualTo(6)); @@ -151,6 +155,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests Assert.That(pc.Group, Is.EqualTo(0)); Assert.That(pc.Others, Is.EqualTo(0)); Assert.That(pc.Total, Is.EqualTo(1)); + Assert.That(pc.Selected, Is.EqualTo(0)); Assert.That(pc.Users[m_userId], Is.EqualTo(1)); Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(0)); Assert.That(pc.Simulator, Is.EqualTo(1)); @@ -174,6 +179,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests Assert.That(pc.Group, Is.EqualTo(0)); Assert.That(pc.Others, Is.EqualTo(0)); Assert.That(pc.Total, Is.EqualTo(3)); + Assert.That(pc.Selected, Is.EqualTo(0)); Assert.That(pc.Users[m_userId], Is.EqualTo(3)); Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(0)); Assert.That(pc.Simulator, Is.EqualTo(3)); -- cgit v1.1