From b1563788198dae9e10531802a55e7a6e6dbc39ed Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 29 Dec 2018 19:04:39 +0000 Subject: changes on updates --- .../Framework/Scenes/Scene.PacketHandlers.cs | 2 +- OpenSim/Region/Framework/Scenes/SceneGraph.cs | 2 + .../Region/Framework/Scenes/SceneObjectGroup.cs | 67 ++------------ OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 103 ++++++--------------- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 71 ++++---------- 5 files changed, 54 insertions(+), 191 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs index 04605a2..0c080d2 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs @@ -156,7 +156,7 @@ namespace OpenSim.Region.Framework.Scenes SceneObjectGroup sog = GetGroupByPrim(primLocalID); if (sog != null) - sog.SendFullUpdateToClient(remoteClient); + sog.SendFullAnimUpdateToClient(remoteClient); } /// diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 68864cc..6ba9d7a 100755 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -626,6 +626,8 @@ namespace OpenSim.Region.Framework.Scenes for (int i = 0; i < updates.Count; i++) { SceneObjectGroup sog = updates[i]; + if (sog.IsDeleted) + continue; // Don't abort the whole update if one entity happens to give us an exception. try diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index b5c8cf2..080faeb 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -2506,24 +2506,6 @@ namespace OpenSim.Region.Framework.Scenes // don't backup while it's selected or you're asking for changes mid stream. if (isTimeToPersist() || forcedBackup) { - if (m_rootPart.PhysActor != null && - (!m_rootPart.PhysActor.IsPhysical)) - { - // Possible ghost prim - if (m_rootPart.PhysActor.Position != m_rootPart.GroupPosition) - { - foreach (SceneObjectPart part in m_parts.GetArray()) - { - // Re-set physics actor positions and - // orientations - part.GroupPosition = m_rootPart.GroupPosition; - } - } - } -// m_log.DebugFormat( -// "[SCENE]: Storing {0}, {1} in {2}", -// Name, UUID, m_scene.RegionInfo.RegionName); - if (RootPart.Shape.PCode == 9 && RootPart.Shape.State != 0) { RootPart.Shape.LastAttachPoint = RootPart.Shape.State; @@ -2557,12 +2539,6 @@ namespace OpenSim.Region.Framework.Scenes backup_group.Clear(); backup_group = null; } -// else -// { -// m_log.DebugFormat( -// "[SCENE]: Did not update persistence of object {0} {1}, selected = {2}", -// Name, UUID, IsSelected); -// } } } catch (Exception e) @@ -2582,35 +2558,20 @@ namespace OpenSim.Region.Framework.Scenes /// Used when the client initially connects and when client sends RequestPrim packet /// /// - public void SendFullUpdateToClient(IClientAPI remoteClient) - { - PrimUpdateFlags update = PrimUpdateFlags.FullUpdate; - - RootPart.SendFullUpdate(remoteClient, update); - - SceneObjectPart[] parts = m_parts.GetArray(); - for (int i = 0; i < parts.Length; i++) - { - SceneObjectPart part = parts[i]; - if (part != RootPart) - part.SendFullUpdate(remoteClient, update); - } - } - public void SendFullAnimUpdateToClient(IClientAPI remoteClient) { PrimUpdateFlags update = PrimUpdateFlags.FullUpdate; if (RootPart.Shape.MeshFlagEntry) update = PrimUpdateFlags.FullUpdatewithAnim; - RootPart.SendFullUpdate(remoteClient, update); + RootPart.SendUpdate(remoteClient, update); SceneObjectPart[] parts = m_parts.GetArray(); for (int i = 0; i < parts.Length; i++) { SceneObjectPart part = parts[i]; if (part != RootPart) - part.SendFullUpdate(remoteClient, update); + part.SendUpdate(remoteClient, update); } } @@ -3033,28 +2994,13 @@ namespace OpenSim.Region.Framework.Scenes // the race conditions. if (IsDeleted || inTransit) return; - - // Even temporary objects take part in physics (e.g. temp-on-rez bullets) - //if ((RootPart.Flags & PrimFlags.TemporaryOnRez) != 0) - // return; - - // If we somehow got here to updating the SOG and its root part is not scheduled for update, - // check to see if the physical position or rotation warrant an update. -/* - if (m_rootPart.UpdateFlag == UpdateRequired.NONE) - { - // rootpart SendScheduledUpdates will check if a update is needed - m_rootPart.UpdateFlag = UpdateRequired.TERSE; - } -*/ + if (IsAttachment) { ScenePresence sp = m_scene.GetScenePresence(AttachedAvatar); if (sp != null) - { sp.SendAttachmentScheduleUpdate(this); - return; - } + return; } // while physics doesn't suports LookAt, we do it in RootPart @@ -3134,13 +3080,13 @@ namespace OpenSim.Region.Framework.Scenes } } - RootPart.SendFullUpdateToAllClientsInternal(); + RootPart.SendFullUpdateToAllClientsNoAttachment(); SceneObjectPart[] parts = m_parts.GetArray(); for (int i = 0; i < parts.Length; i++) { SceneObjectPart part = parts[i]; if (part != RootPart) - part.SendFullUpdateToAllClientsInternal(); + part.SendFullUpdateToAllClientsNoAttachment(); } } @@ -5465,7 +5411,6 @@ namespace OpenSim.Region.Framework.Scenes private string GetLinkNumber_lastname; private int GetLinkNumber_lastnumber; - // this scales bad but so does GetLinkNumPart public int GetLinkNumber(string name) { if(String.IsNullOrEmpty(name) || name == "Object" || name == "Primitive") diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index b427c1a..fd3a96b 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -660,7 +660,6 @@ namespace OpenSim.Region.Framework.Scenes } } - public Dictionary CollisionFilter { get { return m_CollisionFilter; } @@ -3282,8 +3281,6 @@ namespace OpenSim.Region.Framework.Scenes /// public void ScheduleFullUpdate() { -// m_log.DebugFormat("[SCENE OBJECT PART]: Scheduling full update for {0} {1}", Name, LocalId); - if (ParentGroup == null || ParentGroup.IsDeleted || ParentGroup.Scene == null) return; @@ -3315,16 +3312,18 @@ namespace OpenSim.Region.Framework.Scenes ParentGroup.QueueForUpdateCheck(); bool isfull = false; - lock (UpdateFlagLock) + PrimUpdateFlags update; + if (ParentGroup.IsAttachment) { - if (ParentGroup.IsAttachment) - { - UpdateFlag |= PrimUpdateFlags.FullUpdate; - isfull = true; - } - else - UpdateFlag |= PrimUpdateFlags.TerseUpdate; + update = PrimUpdateFlags.FullUpdate; + isfull = true; } + else + update = PrimUpdateFlags.TerseUpdate; + + lock (UpdateFlagLock) + UpdateFlag |= update; + ParentGroup.Scene.EventManager.TriggerSceneObjectPartUpdated(this, isfull); } @@ -3341,17 +3340,15 @@ namespace OpenSim.Region.Framework.Scenes ParentGroup.QueueForUpdateCheck(); bool isfull = false; - lock (UpdateFlagLock) + if (ParentGroup.IsAttachment) { - if (ParentGroup.IsAttachment) - { - UpdateFlag |= update | PrimUpdateFlags.FullUpdate; - isfull = true; - } - else - UpdateFlag |= update; + update |= PrimUpdateFlags.FullUpdate; + isfull = true; } + lock (UpdateFlagLock) + UpdateFlag |= update; + ParentGroup.Scene.EventManager.TriggerSceneObjectPartUpdated(this, isfull); } @@ -3369,40 +3366,28 @@ namespace OpenSim.Region.Framework.Scenes if (ParentGroup == null) return; -// m_log.DebugFormat( -// "[SOG]: Sendinging part full update to {0} for {1} {2}", remoteClient.Name, part.Name, part.LocalId); - - if (ParentGroup.IsAttachment) { ScenePresence sp = ParentGroup.Scene.GetScenePresence(ParentGroup.AttachedAvatar); if (sp != null) - { sp.SendAttachmentUpdate(this, PrimUpdateFlags.FullUpdate); - } } else { - SendFullUpdateToClient(remoteClient); + SendUpdateToClient(remoteClient, PrimUpdateFlags.FullUpdate); } } - protected internal void SendFullUpdate(IClientAPI remoteClient, PrimUpdateFlags update) + protected internal void SendUpdate(IClientAPI remoteClient, PrimUpdateFlags update) { if (ParentGroup == null) return; - // m_log.DebugFormat( - // "[SOG]: Sendinging part full update to {0} for {1} {2}", remoteClient.Name, part.Name, part.LocalId); - - if (ParentGroup.IsAttachment) { ScenePresence sp = ParentGroup.Scene.GetScenePresence(ParentGroup.AttachedAvatar); if (sp != null) - { sp.SendAttachmentUpdate(this, update); - } } else { @@ -3413,7 +3398,7 @@ namespace OpenSim.Region.Framework.Scenes /// /// Send a full update for this part to all clients. /// - public void SendFullUpdateToAllClientsInternal() + public void SendFullUpdateToAllClientsNoAttachment() { if (ParentGroup == null) return; @@ -3427,11 +3412,12 @@ namespace OpenSim.Region.Framework.Scenes m_lastAcceleration = Acceleration; m_lastAngularVelocity = AngularVelocity; m_lastUpdateSentTime = Util.GetTimeStampMS(); + UpdateFlag &= ~PrimUpdateFlags.FullUpdate; } ParentGroup.Scene.ForEachScenePresence(delegate(ScenePresence avatar) { - SendFullUpdate(avatar.ControllingClient); + SendUpdateToClient(avatar.ControllingClient, PrimUpdateFlags.FullUpdate); }); } @@ -3449,52 +3435,24 @@ namespace OpenSim.Region.Framework.Scenes m_lastAcceleration = Acceleration; m_lastAngularVelocity = AngularVelocity; m_lastUpdateSentTime = Util.GetTimeStampMS(); + UpdateFlag &= ~PrimUpdateFlags.FullUpdate; } if (ParentGroup.IsAttachment) { ScenePresence sp = ParentGroup.Scene.GetScenePresence(ParentGroup.AttachedAvatar); if (sp != null) - { sp.SendAttachmentUpdate(this, PrimUpdateFlags.FullUpdate); - } } else { ParentGroup.Scene.ForEachScenePresence(delegate(ScenePresence avatar) { - SendFullUpdate(avatar.ControllingClient); + SendUpdateToClient(avatar.ControllingClient, PrimUpdateFlags.FullUpdate); }); } } - /// - /// Sends a full update to the client - /// - /// - public void SendFullUpdateToClient(IClientAPI remoteClient) - { - if (ParentGroup == null || ParentGroup.IsDeleted) - return; - - if (ParentGroup.IsAttachment - && ParentGroup.AttachedAvatar != remoteClient.AgentId - && ParentGroup.HasPrivateAttachmentPoint) - return; - - if (remoteClient.AgentId == OwnerID) - { - if ((Flags & PrimFlags.CreateSelected) != 0) - Flags &= ~PrimFlags.CreateSelected; - } - //bool isattachment = IsAttachment; - //if (LocalId != ParentGroup.RootPart.LocalId) - //isattachment = ParentGroup.RootPart.IsAttachment; - - remoteClient.SendEntityUpdate(this, PrimUpdateFlags.FullUpdate); - ParentGroup.Scene.StatsReporter.AddObjectUpdates(1); - } - private const float ROTATION_TOLERANCE = 0.01f; private const float VELOCITY_TOLERANCE = 0.1f; private const float ANGVELOCITY_TOLERANCE = 0.005f; @@ -3546,17 +3504,12 @@ namespace OpenSim.Region.Framework.Scenes if(vz > 128.0) break; - if( - vx < VELOCITY_TOLERANCE && - vy < VELOCITY_TOLERANCE && - vz < VELOCITY_TOLERANCE + if(vx < VELOCITY_TOLERANCE && vy < VELOCITY_TOLERANCE && vz < VELOCITY_TOLERANCE ) { if(!AbsolutePosition.ApproxEquals(m_lastPosition, POSITION_TOLERANCE)) break; - if(vx < 1e-4 && - vy < 1e-4 && - vz < 1e-4 && + if(vx < 1e-4 && vy < 1e-4 && vz < 1e-4 && ( Math.Abs(m_lastVelocity.X) > 1e-4 || Math.Abs(m_lastVelocity.Y) > 1e-4 || @@ -4750,10 +4703,8 @@ namespace OpenSim.Region.Framework.Scenes AggregateInnerPerms(); - if (OwnerMask != prevOwnerMask || - GroupMask != prevGroupMask || - EveryoneMask != prevEveryoneMask || - NextOwnerMask != prevNextOwnerMask) + if (OwnerMask != prevOwnerMask || GroupMask != prevGroupMask || + EveryoneMask != prevEveryoneMask || NextOwnerMask != prevNextOwnerMask) SendFullUpdateToAllClients(); } diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index a308abb..5bd1cf1 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -2168,11 +2168,6 @@ namespace OpenSim.Region.Framework.Scenes { if( ParentPart != null && !IsNPC && (crossingFlags & 0x08) != 0) { - -// SceneObjectPart root = ParentPart.ParentGroup.RootPart; -// if(root.LocalId != ParentPart.LocalId) -// ControllingClient.SendEntityTerseUpdateImmediate(root); -// ControllingClient.SendEntityTerseUpdateImmediate(ParentPart); ParentPart.ParentGroup.SendFullAnimUpdateToClient(ControllingClient); } @@ -5439,35 +5434,34 @@ namespace OpenSim.Region.Framework.Scenes PrimUpdateFlags[] flags = new PrimUpdateFlags[origparts.Length]; SceneObjectPart rootpart = sog.RootPart; - PrimUpdateFlags rootreq = sog.RootPart.GetAndClearUpdateFlag(); + PrimUpdateFlags cur = sog.RootPart.GetAndClearUpdateFlag(); - int j = 0; + int nparts = 0; + if (cur != PrimUpdateFlags.None) + { + flags[nparts] = cur; + parts[nparts] = rootpart; + ++nparts; + } - PrimUpdateFlags cur; for (int i = 0; i < origparts.Length; i++) { - if (origparts[i] != rootpart) - { - cur = origparts[i].GetAndClearUpdateFlag(); - if(cur == PrimUpdateFlags.None) - continue; - flags[j] = cur; - parts[j] = origparts[i]; - j++; - } + if (origparts[i] == rootpart) + continue; + + cur = origparts[i].GetAndClearUpdateFlag(); + if(cur == PrimUpdateFlags.None) + continue; + flags[nparts] = cur; + parts[nparts] = origparts[i]; + ++nparts; } - if (j == 0 && rootreq == PrimUpdateFlags.None) + if (nparts == 0) return; - int nparts = j; - - ControllingClient.SendEntityUpdate(rootpart, rootreq); - for (int i = 0; i < nparts; i++) - { ControllingClient.SendEntityUpdate(parts[i], flags[i]); - } if (sog.HasPrivateAttachmentPoint) return; @@ -5481,12 +5475,8 @@ namespace OpenSim.Region.Framework.Scenes if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && !p.IsViewerUIGod) continue; - p.ControllingClient.SendEntityUpdate(rootpart, rootreq); - for (int i = 0; i < nparts; i++) - { p.ControllingClient.SendEntityUpdate(parts[i], flags[i]); - } } } @@ -5532,31 +5522,6 @@ namespace OpenSim.Region.Framework.Scenes } } - public void SendAttachmentScheduleUpdate(SceneObjectPart part) - { - if (IsChildAgent || IsInTransit) - return; - - PrimUpdateFlags flag = part.GetAndClearUpdateFlag(); - - ControllingClient.SendEntityUpdate(part, flag); - - if (part.ParentGroup.HasPrivateAttachmentPoint) - return; - - List allPresences = m_scene.GetScenePresences(); - foreach (ScenePresence p in allPresences) - { - if (p == this) - continue; - - if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && !p.IsViewerUIGod) - continue; - - p.ControllingClient.SendEntityUpdate(part, flag); - } - } - public void SendAttachmentUpdate(SceneObjectPart part, PrimUpdateFlags flag) { if (IsChildAgent || IsInTransit) -- cgit v1.1