From ae00623b6567eb328eb6249bf2f2f9ad08175844 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 31 Dec 2018 13:33:00 +0000 Subject: [PATCH] lost in updates --- .../ObjectCaps/UploadObjectAssetModule.cs | 2 +- .../Avatar/Attachments/AttachmentsModule.cs | 2 +- OpenSim/Region/Framework/Scenes/Scene.cs | 2 +- OpenSim/Region/Framework/Scenes/SceneGraph.cs | 13 ++-- .../Framework/Scenes/SceneObjectGroup.cs | 76 ++++++++++--------- .../Framework/Scenes/SceneObjectPart.cs | 38 +++++++++- .../Region/Framework/Scenes/ScenePresence.cs | 76 ++++++++++++++----- 7 files changed, 139 insertions(+), 70 deletions(-) diff --git a/OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/UploadObjectAssetModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/UploadObjectAssetModule.cs index 04d11cb625..bc3798d206 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/UploadObjectAssetModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/UploadObjectAssetModule.cs @@ -356,7 +356,7 @@ namespace OpenSim.Region.ClientStack.Linden rootGroup.LinkToGroup(allparts[j]); } - rootGroup.ScheduleGroupForFullUpdate(); + rootGroup.ScheduleGroupForFullAnimUpdate(); pos = m_scene.GetNewRezLocation( Vector3.Zero, rootpos, UUID.Zero, rot, (byte)1, 1, true, allparts[0].GroupScale, false); diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index d1a52cbb2d..d36d770152 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs @@ -1096,7 +1096,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments // will succeed, as that will not update if an attachment is selected. so.IsSelected = false; // fudge.... - so.ScheduleGroupForFullUpdate(); + so.ScheduleGroupForFullAnimUpdate(); } // In case it is later dropped again, don't let diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index c32e01bdba..79ad0e0dac 100755 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -2537,7 +2537,7 @@ namespace OpenSim.Region.Framework.Scenes sceneObject.RootPart.CreatorIdentification = UserManagementModule.GetUserUUI(ownerID); sceneObject.InvalidateDeepEffectivePerms();; - sceneObject.ScheduleGroupForFullUpdate(); + sceneObject.ScheduleGroupForFullAnimUpdate(); return sceneObject; } diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 6ba9d7a3ad..6d9844e5c2 100755 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -485,7 +485,7 @@ namespace OpenSim.Region.Framework.Scenes } if (sendClientUpdates) - sceneObject.ScheduleGroupForFullUpdate(); + sceneObject.ScheduleGroupForFullAnimUpdate(); if (attachToBackup) sceneObject.AttachToBackup(); @@ -1825,7 +1825,6 @@ namespace OpenSim.Region.Framework.Scenes try { - List childGroups = new List(); // We do this in reverse to get the link order of the prims correct @@ -1870,8 +1869,6 @@ namespace OpenSim.Region.Framework.Scenes { parentGroup.RootPart.CreateSelected = true; parentGroup.TriggerScriptChangedEvent(Changed.LINK); - parentGroup.HasGroupChanged = true; - parentGroup.ScheduleGroupForFullUpdate(); } } finally @@ -1886,7 +1883,7 @@ namespace OpenSim.Region.Framework.Scenes parentGroup.AdjustChildPrimPermissions(false); parentGroup.HasGroupChanged = true; parentGroup.ProcessBackup(m_parentScene.SimulationDataService, true); - parentGroup.ScheduleGroupForFullUpdate(); + parentGroup.ScheduleGroupForFullAnimUpdate(); Monitor.Exit(m_updateLock); } } @@ -1949,7 +1946,7 @@ namespace OpenSim.Region.Framework.Scenes child.ParentGroup.DelinkFromGroup(child, true); //child.ParentGroup is now other child.ParentGroup.HasGroupChanged = true; - child.ParentGroup.ScheduleGroupForFullUpdate(); + child.ParentGroup.ScheduleGroupForFullAnimUpdate(); } } @@ -1991,7 +1988,7 @@ namespace OpenSim.Region.Framework.Scenes newRoot.TriggerScriptChangedEvent(Changed.LINK); newRoot.ParentGroup.HasGroupChanged = true; newRoot.ParentGroup.InvalidatePartsLinkMaps(); - newRoot.ParentGroup.ScheduleGroupForFullUpdate(); + newRoot.ParentGroup.ScheduleGroupForFullAnimUpdate(); } } @@ -2131,7 +2128,7 @@ namespace OpenSim.Region.Framework.Scenes copy.ResumeScripts(); copy.HasGroupChanged = true; - copy.ScheduleGroupForFullUpdate(); + copy.ScheduleGroupForFullAnimUpdate(); return copy; } } diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 080faeb1ae..827413690a 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -950,7 +950,7 @@ namespace OpenSim.Region.Framework.Scenes sog.inTransit = false; AttachToBackup(); - sog.ScheduleGroupForFullUpdate(); + sog.ScheduleGroupForFullAnimUpdate(); } } @@ -2668,7 +2668,7 @@ namespace OpenSim.Region.Framework.Scenes dupe.HasGroupChanged = true; dupe.AttachToBackup(); - dupe.ScheduleGroupForFullUpdate(); + dupe.ScheduleGroupForFullAnimUpdate(); } dupe.InvalidatePartsLinkMaps(); @@ -3028,10 +3028,12 @@ namespace OpenSim.Region.Framework.Scenes /// public void ScheduleGroupForFullUpdate() { -// if (IsAttachment) -// m_log.DebugFormat("[SOG]: Scheduling full update for {0} {1}", Name, LocalId); - + // if (IsAttachment) + // m_log.DebugFormat("[SOG]: Scheduling full update for {0} {1}", Name, LocalId); checkAtTargets(); + if (Scene.GetNumberOfClients() == 0) + return; + RootPart.ScheduleFullUpdate(); SceneObjectPart[] parts = m_parts.GetArray(); @@ -3043,6 +3045,40 @@ namespace OpenSim.Region.Framework.Scenes } } + public void ScheduleGroupForFullAnimUpdate() + { + // if (IsAttachment) + // m_log.DebugFormat("[SOG]: Scheduling full update for {0} {1}", Name, LocalId); + checkAtTargets(); + + if (Scene.GetNumberOfClients() == 0) + return; + + SceneObjectPart[] parts = m_parts.GetArray(); + + if (!RootPart.Shape.MeshFlagEntry) + { + RootPart.ScheduleFullUpdate(); + + for (int i = 0; i < parts.Length; i++) + { + SceneObjectPart part = parts[i]; + if (part != RootPart) + part.ScheduleFullUpdate(); + } + return; + } + + RootPart.ScheduleFullAnimUpdate(); + + for (int i = 0; i < parts.Length; i++) + { + SceneObjectPart part = parts[i]; + if (part != RootPart) + part.ScheduleFullAnimUpdate(); + } + } + /// /// Schedule a terse update for this scene object to all interested viewers. /// @@ -3060,36 +3096,6 @@ namespace OpenSim.Region.Framework.Scenes parts[i].ScheduleTerseUpdate(); } - /// - /// Immediately send a full update for this scene object. - /// - public void SendGroupFullUpdate() - { - if (IsDeleted) - return; - -// m_log.DebugFormat("[SOG]: Sending immediate full group update for {0} {1}", Name, UUID); - - if (IsAttachment) - { - ScenePresence sp = m_scene.GetScenePresence(AttachedAvatar); - if (sp != null) - { - sp.SendAttachmentUpdate(this, PrimUpdateFlags.FullUpdate); - return; - } - } - - RootPart.SendFullUpdateToAllClientsNoAttachment(); - SceneObjectPart[] parts = m_parts.GetArray(); - for (int i = 0; i < parts.Length; i++) - { - SceneObjectPart part = parts[i]; - if (part != RootPart) - part.SendFullUpdateToAllClientsNoAttachment(); - } - } - /// /// Immediately send an update for this scene object's root prim only. /// This is for updates regarding the object as a whole, and none of its parts in particular. diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 651884fe48..4ab0f15dcf 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -3297,6 +3297,26 @@ namespace OpenSim.Region.Framework.Scenes ParentGroup.Scene.EventManager.TriggerSceneObjectPartUpdated(this, true); } + public void ScheduleFullAnimUpdate() + { + if (ParentGroup == null || ParentGroup.IsDeleted || ParentGroup.Scene == null) + return; + + if (ParentGroup.Scene.GetNumberOfClients() == 0) + return; + + PrimUpdateFlags update = PrimUpdateFlags.FullUpdatewithAnim; + if (Animations == null || !ParentGroup.RootPart.Shape.MeshFlagEntry) + update = PrimUpdateFlags.FullUpdate; + + ParentGroup.QueueForUpdateCheck(); // just in case + + lock (UpdateFlagLock) + UpdateFlag |= update; + + ParentGroup.Scene.EventManager.TriggerSceneObjectPartUpdated(this, true); + } + /// /// Schedule a terse update for this prim. Terse updates only send position, /// rotation, velocity and rotational velocity information. @@ -3334,6 +3354,11 @@ namespace OpenSim.Region.Framework.Scenes if (ParentGroup == null || ParentGroup.IsDeleted || ParentGroup.Scene == null) return; + if (Animations == null) + update &= ~PrimUpdateFlags.Animations; + if (update == PrimUpdateFlags.None) + return; + ParentGroup.HasGroupChanged = true; if (ParentGroup.Scene.GetNumberOfClients() == 0) @@ -4571,7 +4596,7 @@ namespace OpenSim.Region.Framework.Scenes if (ParentGroup != null) { ParentGroup.HasGroupChanged = true; - ScheduleFullUpdate(); + ScheduleFullAnimUpdate(); } } @@ -5367,16 +5392,23 @@ namespace OpenSim.Region.Framework.Scenes #endregion Public Methods - public void SendUpdateToClient(IClientAPI remoteClient, PrimUpdateFlags PrimUpdateFlags) + public void SendUpdateToClient(IClientAPI remoteClient, PrimUpdateFlags update) { if (ParentGroup.IsDeleted) return; + if (Animations == null) + { + update &= ~PrimUpdateFlags.Animations; + if (update == PrimUpdateFlags.None) + return; + } + if (ParentGroup.IsAttachment && (ParentGroup.RootPart != this || ParentGroup.AttachedAvatar != remoteClient.AgentId && ParentGroup.HasPrivateAttachmentPoint)) return; - remoteClient.SendEntityUpdate(this, PrimUpdateFlags); + remoteClient.SendEntityUpdate(this, update); ParentGroup.Scene.StatsReporter.AddObjectUpdates(1); } diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 5bd1cf1c3e..2b6c5e6505 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -5364,7 +5364,7 @@ namespace OpenSim.Region.Framework.Scenes return validated; } - +/* public void SendAttachmentsToAllAgents() { lock (m_attachments) @@ -5385,7 +5385,7 @@ namespace OpenSim.Region.Framework.Scenes } } } - +*/ // send attachments to a client without filters except for huds // for now they are checked in several places down the line... public void SendAttachmentsToAgentNF(ScenePresence p) @@ -5429,14 +5429,18 @@ namespace OpenSim.Region.Framework.Scenes if (IsChildAgent || IsInTransit) return; + SceneObjectPart[] origparts = sog.Parts; SceneObjectPart[] parts = new SceneObjectPart[origparts.Length]; PrimUpdateFlags[] flags = new PrimUpdateFlags[origparts.Length]; SceneObjectPart rootpart = sog.RootPart; PrimUpdateFlags cur = sog.RootPart.GetAndClearUpdateFlag(); + bool noanim = !rootpart.Shape.MeshFlagEntry; int nparts = 0; + if (noanim || rootpart.Animations == null) + cur &= ~PrimUpdateFlags.Animations; if (cur != PrimUpdateFlags.None) { flags[nparts] = cur; @@ -5450,7 +5454,9 @@ namespace OpenSim.Region.Framework.Scenes continue; cur = origparts[i].GetAndClearUpdateFlag(); - if(cur == PrimUpdateFlags.None) + if (noanim || origparts[i].Animations == null) + cur &= ~PrimUpdateFlags.Animations; + if (cur == PrimUpdateFlags.None) continue; flags[nparts] = cur; parts[nparts] = origparts[i]; @@ -5485,19 +5491,45 @@ namespace OpenSim.Region.Framework.Scenes if (IsChildAgent || IsInTransit) return; - SceneObjectPart[] parts = sog.Parts; + SceneObjectPart[] origparts = sog.Parts; + SceneObjectPart[] parts = new SceneObjectPart[origparts.Length]; + PrimUpdateFlags[] flags = new PrimUpdateFlags[origparts.Length]; + SceneObjectPart rootpart = sog.RootPart; + bool noanim = !rootpart.Shape.MeshFlagEntry; - ControllingClient.SendEntityUpdate(rootpart, update); - - for (int i = 0; i < parts.Length; i++) + int nparts = 0; + PrimUpdateFlags cur = update; + if (noanim || rootpart.Animations == null) + cur &= ~PrimUpdateFlags.Animations; + if (cur != PrimUpdateFlags.None) { - SceneObjectPart part = parts[i]; - if (part == rootpart) - continue; - ControllingClient.SendEntityUpdate(part, update); + flags[nparts] = cur; + parts[nparts] = rootpart; + ++nparts; } + for (int i = 0; i < origparts.Length; i++) + { + if (origparts[i] == rootpart) + continue; + + cur = update; + if (noanim || origparts[i].Animations == null) + cur &= ~PrimUpdateFlags.Animations; + if (cur == PrimUpdateFlags.None) + continue; + flags[nparts] = cur; + parts[nparts] = origparts[i]; + ++nparts; + } + + if (nparts == 0) + return; + + for(int i = 0; i < nparts; i++) + ControllingClient.SendEntityUpdate(parts[i], flags[i]); + if (sog.HasPrivateAttachmentPoint) return; @@ -5512,22 +5544,24 @@ namespace OpenSim.Region.Framework.Scenes p.ControllingClient.SendEntityUpdate(rootpart, update); - for (int i = 0; i < parts.Length; i++) - { - SceneObjectPart part = parts[i]; - if (part == rootpart) - continue; - p.ControllingClient.SendEntityUpdate(part, update); - } + for (int i = 0; i < nparts; i++) + p.ControllingClient.SendEntityUpdate(parts[i], flags[i]); } } - public void SendAttachmentUpdate(SceneObjectPart part, PrimUpdateFlags flag) + public void SendAttachmentUpdate(SceneObjectPart part, PrimUpdateFlags update) { if (IsChildAgent || IsInTransit) return; - ControllingClient.SendEntityUpdate(part, flag); + if ((update & PrimUpdateFlags.Animations) != 0 && part.Animations == null) + { + update &= ~PrimUpdateFlags.Animations; + if (update == PrimUpdateFlags.None) + return; + } + + ControllingClient.SendEntityUpdate(part, update); if (part.ParentGroup.HasPrivateAttachmentPoint) return; @@ -5540,7 +5574,7 @@ namespace OpenSim.Region.Framework.Scenes if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && !p.IsViewerUIGod) continue; - p.ControllingClient.SendEntityUpdate(part, flag); + p.ControllingClient.SendEntityUpdate(part, update); } }