From 35dde94f01ae8af6fbac4b48445c672a866b846b Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Sun, 17 Aug 2008 22:38:52 +0000 Subject: Change the deselect processing to prevent gratuituous full update when an attachment is deselected. --- .../Environment/Scenes/Scene.PacketHandlers.cs | 56 ++++++++++++++++------ 1 file changed, 42 insertions(+), 14 deletions(-) diff --git a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs index db05430..bdfe664 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs @@ -147,25 +147,53 @@ namespace OpenSim.Region.Environment.Scenes /// public void DeselectPrim(uint primLocalID, IClientAPI remoteClient) { - List EntityList = GetEntities(); + SceneObjectPart part = GetSceneObjectPart(primLocalID); + if(part == null) + return; - foreach (EntityBase ent in EntityList) + bool isAttachment = false; + + // If the parent group is null, we are in an inconsistent state + // try to recover gracefully by doing all that can be done on + // a lone prim + // + if (part.ParentGroup == null) { - if (ent is SceneObjectGroup) + if(part.IsAttachment) + isAttachment = true; + else + part.ScheduleFullUpdate(); + } + else + { + part.ParentGroup.IsSelected = false; + + // This is wrong, wrong, wrong. Selection should not be + // handled by group, but by prim. Legacy cruft. + // TODO: Make selection flagging per prim! + // + if (part.ParentGroup.RootPart != null) { - if (((SceneObjectGroup) ent).LocalId == primLocalID) - { - ((SceneObjectGroup) ent).IsSelected = false; - ((SceneObjectGroup)ent).ScheduleGroupForFullUpdate(); - if (ExternalChecks.ExternalChecksCanEditObject(((SceneObjectGroup)ent).UUID, remoteClient.AgentId) - || ExternalChecks.ExternalChecksCanMoveObject(((SceneObjectGroup)ent).UUID, remoteClient.AgentId)) - { - EventManager.TriggerParcelPrimCountTainted(); - break; - } - } + if (part.ParentGroup.RootPart.IsAttachment) + isAttachment = true; + else + part.ParentGroup.ScheduleGroupForFullUpdate(); } } + + // If it's not an attachment, and we are allowed to move it, + // then we might have done so. If we moved across a parcel + // boundary, we will need to recount prims on the parcels. + // For attachments, that makes no sense. + // + if (!isAttachment) + { + if (ExternalChecks.ExternalChecksCanEditObject( + part.UUID, remoteClient.AgentId) + || ExternalChecks.ExternalChecksCanMoveObject( + part.UUID, remoteClient.AgentId)) + EventManager.TriggerParcelPrimCountTainted(); + } } public virtual void ProcessMoneyTransferRequest(LLUUID source, LLUUID destination, int amount, -- cgit v1.1