aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework
diff options
context:
space:
mode:
authorUbitUmarov2019-03-23 02:18:32 +0000
committerUbitUmarov2019-03-23 02:18:32 +0000
commitd0052c817486a1691fc4e2e7027ac41240b966aa (patch)
tree2308b3c6c3bd9dd6da9b18d7cca806cec05341b1 /OpenSim/Region/Framework
parentoops send flag PrimFlags.InventoryEmpty but do not override others (diff)
downloadopensim-SC-d0052c817486a1691fc4e2e7027ac41240b966aa.zip
opensim-SC-d0052c817486a1691fc4e2e7027ac41240b966aa.tar.gz
opensim-SC-d0052c817486a1691fc4e2e7027ac41240b966aa.tar.bz2
opensim-SC-d0052c817486a1691fc4e2e7027ac41240b966aa.tar.xz
add more test code to make usage od compressed updates etc. Should be disable, but well many things can go wrong.
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs19
-rwxr-xr-xOpenSim/Region/Framework/Scenes/Scene.cs35
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs66
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs16
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs399
5 files changed, 308 insertions, 227 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
index 0c080d2..2995091 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
@@ -153,10 +153,23 @@ namespace OpenSim.Region.Framework.Scenes
153 /// <param name="remoteClient"></param> 153 /// <param name="remoteClient"></param>
154 public void RequestPrim(uint primLocalID, IClientAPI remoteClient) 154 public void RequestPrim(uint primLocalID, IClientAPI remoteClient)
155 { 155 {
156 SceneObjectGroup sog = GetGroupByPrim(primLocalID); 156 SceneObjectPart part = GetSceneObjectPart(primLocalID);
157 if (part != null)
158 {
159 SceneObjectGroup sog = part.ParentGroup;
160 if(!sog.IsDeleted)
161 {
162 PrimUpdateFlags update = PrimUpdateFlags.FullUpdate;
163 if (sog.RootPart.Shape.MeshFlagEntry)
164 update = PrimUpdateFlags.FullUpdatewithAnim;
165 part.SendUpdate(remoteClient, update);
166 }
167 }
168
169 //SceneObjectGroup sog = GetGroupByPrim(primLocalID);
157 170
158 if (sog != null) 171 //if (sog != null)
159 sog.SendFullAnimUpdateToClient(remoteClient); 172 //sog.SendFullAnimUpdateToClient(remoteClient);
160 } 173 }
161 174
162 /// <summary> 175 /// <summary>
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 7668a87..7d312e9 100755
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -170,8 +170,6 @@ namespace OpenSim.Region.Framework.Scenes
170 } 170 }
171 private bool m_scripts_enabled; 171 private bool m_scripts_enabled;
172 172
173 public SynchronizeSceneHandler SynchronizeScene;
174
175 public bool ClampNegativeZ 173 public bool ClampNegativeZ
176 { 174 {
177 get { return m_clampNegativeZ; } 175 get { return m_clampNegativeZ; }
@@ -1006,11 +1004,9 @@ namespace OpenSim.Region.Framework.Scenes
1006 m_useTrashOnDelete = startupConfig.GetBoolean("UseTrashOnDelete",m_useTrashOnDelete); 1004 m_useTrashOnDelete = startupConfig.GetBoolean("UseTrashOnDelete",m_useTrashOnDelete);
1007 m_trustBinaries = startupConfig.GetBoolean("TrustBinaries", m_trustBinaries); 1005 m_trustBinaries = startupConfig.GetBoolean("TrustBinaries", m_trustBinaries);
1008 m_allowScriptCrossings = startupConfig.GetBoolean("AllowScriptCrossing", m_allowScriptCrossings); 1006 m_allowScriptCrossings = startupConfig.GetBoolean("AllowScriptCrossing", m_allowScriptCrossings);
1009 m_dontPersistBefore = 1007 m_dontPersistBefore = startupConfig.GetLong("MinimumTimeBeforePersistenceConsidered", DEFAULT_MIN_TIME_FOR_PERSISTENCE);
1010 startupConfig.GetLong("MinimumTimeBeforePersistenceConsidered", DEFAULT_MIN_TIME_FOR_PERSISTENCE);
1011 m_dontPersistBefore *= 10000000; 1008 m_dontPersistBefore *= 10000000;
1012 m_persistAfter = 1009 m_persistAfter = startupConfig.GetLong("MaximumTimeBeforePersistenceConsidered", DEFAULT_MAX_TIME_FOR_PERSISTENCE);
1013 startupConfig.GetLong("MaximumTimeBeforePersistenceConsidered", DEFAULT_MAX_TIME_FOR_PERSISTENCE);
1014 m_persistAfter *= 10000000; 1010 m_persistAfter *= 10000000;
1015 1011
1016 m_defaultScriptEngine = startupConfig.GetString("DefaultScriptEngine", "XEngine"); 1012 m_defaultScriptEngine = startupConfig.GetString("DefaultScriptEngine", "XEngine");
@@ -1695,9 +1691,6 @@ namespace OpenSim.Region.Framework.Scenes
1695 { 1691 {
1696 if (PhysicsEnabled) 1692 if (PhysicsEnabled)
1697 physicsFPS = m_sceneGraph.UpdatePhysics(FrameTime); 1693 physicsFPS = m_sceneGraph.UpdatePhysics(FrameTime);
1698
1699 if (SynchronizeScene != null)
1700 SynchronizeScene(this);
1701 } 1694 }
1702 1695
1703 tmpMS2 = Util.GetTimeStampMS(); 1696 tmpMS2 = Util.GetTimeStampMS();
@@ -1775,30 +1768,6 @@ namespace OpenSim.Region.Framework.Scenes
1775 1768
1776 // Region ready should always be set 1769 // Region ready should always be set
1777 Ready = true; 1770 Ready = true;
1778
1779
1780 IConfig restartConfig = m_config.Configs["RestartModule"];
1781 if (restartConfig != null)
1782 {
1783 string markerPath = restartConfig.GetString("MarkerPath", String.Empty);
1784
1785 if (markerPath != String.Empty)
1786 {
1787 string path = Path.Combine(markerPath, RegionInfo.RegionID.ToString() + ".ready");
1788 try
1789 {
1790 string pidstring = System.Diagnostics.Process.GetCurrentProcess().Id.ToString();
1791 FileStream fs = File.Create(path);
1792 System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding();
1793 Byte[] buf = enc.GetBytes(pidstring);
1794 fs.Write(buf, 0, buf.Length);
1795 fs.Close();
1796 }
1797 catch (Exception)
1798 {
1799 }
1800 }
1801 }
1802 } 1771 }
1803 else 1772 else
1804 { 1773 {
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 7d5bbbf..0b38179 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -119,6 +119,21 @@ namespace OpenSim.Region.Framework.Scenes
119 119
120 // private PrimCountTaintedDelegate handlerPrimCountTainted = null; 120 // private PrimCountTaintedDelegate handlerPrimCountTainted = null;
121 121
122 public bool IsViewerCachable
123 {
124 get
125 {
126 // needs more exclusion ?
127 return(Backup && !IsTemporary && !inTransit && !IsSelected && !UsesPhysics && !IsAttachmentCheckFull() &&
128 !RootPart.Shape.MeshFlagEntry && // animations are not sent correctly for now
129 RootPart.KeyframeMotion == null &&
130 (DateTime.UtcNow.Ticks - timeLastChanged > 36000000000) && //36000000000 is one hour
131 RootPart.Velocity.LengthSquared() < 1e8f && // should not be needed
132 RootPart.Acceleration.LengthSquared() < 1e4f // should not be needed
133 );
134 }
135 }
136
122 /// <summary> 137 /// <summary>
123 /// Signal whether the non-inventory attributes of any prims in the group have changed 138 /// Signal whether the non-inventory attributes of any prims in the group have changed
124 /// since the group's last persistent backup 139 /// since the group's last persistent backup
@@ -128,7 +143,8 @@ namespace OpenSim.Region.Framework.Scenes
128 private long timeLastChanged = 0; 143 private long timeLastChanged = 0;
129 private long m_maxPersistTime = 0; 144 private long m_maxPersistTime = 0;
130 private long m_minPersistTime = 0; 145 private long m_minPersistTime = 0;
131// private Random m_rand; 146
147 public int PseudoCRC;
132 148
133 /// <summary> 149 /// <summary>
134 /// This indicates whether the object has changed such that it needs to be repersisted to permenant storage 150 /// This indicates whether the object has changed such that it needs to be repersisted to permenant storage
@@ -145,40 +161,26 @@ namespace OpenSim.Region.Framework.Scenes
145 { 161 {
146 if (value) 162 if (value)
147 { 163 {
148
149 if (Backup) 164 if (Backup)
150 {
151 m_scene.SceneGraph.FireChangeBackup(this); 165 m_scene.SceneGraph.FireChangeBackup(this);
152 } 166
167 PseudoCRC = (int)(DateTime.UtcNow.Ticks); ;
153 timeLastChanged = DateTime.UtcNow.Ticks; 168 timeLastChanged = DateTime.UtcNow.Ticks;
154 if (!m_hasGroupChanged) 169 if (!m_hasGroupChanged)
155 timeFirstChanged = DateTime.UtcNow.Ticks; 170 timeFirstChanged = timeLastChanged;
156 if (m_rootPart != null && m_scene != null) 171 if (m_rootPart != null && m_scene != null)
157 { 172 {
158/*
159 if (m_rand == null)
160 {
161 byte[] val = new byte[16];
162 m_rootPart.UUID.ToBytes(val, 0);
163 m_rand = new Random(BitConverter.ToInt32(val, 0));
164 }
165 */
166 if (m_scene.GetRootAgentCount() == 0) 173 if (m_scene.GetRootAgentCount() == 0)
167 { 174 {
168 //If the region is empty, this change has been made by an automated process 175 //If the region is empty, this change has been made by an automated process
169 //and thus we delay the persist time by a random amount between 1.5 and 2.5. 176 //and thus we delay the persist time by a random amount between 1.5 and 2.5.
170 177
171// float factor = 1.5f + (float)(m_rand.NextDouble());
172 float factor = 2.0f; 178 float factor = 2.0f;
173 m_maxPersistTime = (long)((float)m_scene.m_persistAfter * factor); 179 m_maxPersistTime = (long)(m_scene.m_persistAfter * factor);
174 m_minPersistTime = (long)((float)m_scene.m_dontPersistBefore * factor); 180 m_minPersistTime = (long)(m_scene.m_dontPersistBefore * factor);
175 } 181 }
176 else 182 else
177 { 183 {
178 //If the region is not empty, we want to obey the minimum and maximum persist times
179 //but add a random factor so we stagger the object persistance a little
180// m_maxPersistTime = (long)((float)m_scene.m_persistAfter * (1.0d - (m_rand.NextDouble() / 5.0d))); //Multiply by 1.0-1.5
181// m_minPersistTime = (long)((float)m_scene.m_dontPersistBefore * (1.0d + (m_rand.NextDouble() / 2.0d))); //Multiply by 0.8-1.0
182 m_maxPersistTime = m_scene.m_persistAfter; 184 m_maxPersistTime = m_scene.m_persistAfter;
183 m_minPersistTime = m_scene.m_dontPersistBefore; 185 m_minPersistTime = m_scene.m_dontPersistBefore;
184 } 186 }
@@ -1330,6 +1332,7 @@ namespace OpenSim.Region.Framework.Scenes
1330 public SceneObjectGroup() 1332 public SceneObjectGroup()
1331 { 1333 {
1332 m_lastCollisionSoundMS = Util.GetTimeStampMS() + 1000.0; 1334 m_lastCollisionSoundMS = Util.GetTimeStampMS() + 1000.0;
1335 PseudoCRC = (int)(DateTime.UtcNow.Ticks);
1333 } 1336 }
1334 1337
1335 /// <summary> 1338 /// <summary>
@@ -2441,6 +2444,21 @@ namespace OpenSim.Region.Framework.Scenes
2441 } 2444 }
2442 } 2445 }
2443 2446
2447 public void SendUpdateProbes(IClientAPI remoteClient)
2448 {
2449 PrimUpdateFlags update = PrimUpdateFlags.UpdateProbe;
2450
2451 RootPart.SendUpdate(remoteClient, update);
2452
2453 SceneObjectPart[] parts = m_parts.GetArray();
2454 for (int i = 0; i < parts.Length; i++)
2455 {
2456 SceneObjectPart part = parts[i];
2457 if (part != RootPart)
2458 part.SendUpdate(remoteClient, update);
2459 }
2460 }
2461
2444 #region Copying 2462 #region Copying
2445 2463
2446 /// <summary> 2464 /// <summary>
@@ -2516,6 +2534,7 @@ namespace OpenSim.Region.Framework.Scenes
2516 } 2534 }
2517 2535
2518 dupe.InvalidatePartsLinkMaps(); 2536 dupe.InvalidatePartsLinkMaps();
2537 dupe.PseudoCRC = (int)(DateTime.UtcNow.Ticks);
2519 m_dupeInProgress = false; 2538 m_dupeInProgress = false;
2520 return dupe; 2539 return dupe;
2521 } 2540 }
@@ -2769,6 +2788,7 @@ namespace OpenSim.Region.Framework.Scenes
2769 } 2788 }
2770 } 2789 }
2771 2790
2791 PseudoCRC = (int)(DateTime.UtcNow.Ticks);
2772 rpart.ScheduleFullUpdate(); 2792 rpart.ScheduleFullUpdate();
2773 } 2793 }
2774 2794
@@ -2808,6 +2828,7 @@ namespace OpenSim.Region.Framework.Scenes
2808 part.ResetIDs(part.LinkNum); // Don't change link nums 2828 part.ResetIDs(part.LinkNum); // Don't change link nums
2809 m_parts.Add(part.UUID, part); 2829 m_parts.Add(part.UUID, part);
2810 } 2830 }
2831 PseudoCRC = (int)(DateTime.UtcNow.Ticks);
2811 } 2832 }
2812 } 2833 }
2813 2834
@@ -3117,7 +3138,6 @@ namespace OpenSim.Region.Framework.Scenes
3117 } 3138 }
3118 } 3139 }
3119 3140
3120
3121 // 'linkPart' == the root of the group being linked into this group 3141 // 'linkPart' == the root of the group being linked into this group
3122 SceneObjectPart linkPart = objectGroup.m_rootPart; 3142 SceneObjectPart linkPart = objectGroup.m_rootPart;
3123 3143
@@ -3160,7 +3180,6 @@ namespace OpenSim.Region.Framework.Scenes
3160 axPos *= Quaternion.Conjugate(parentRot); 3180 axPos *= Quaternion.Conjugate(parentRot);
3161 linkPart.OffsetPosition = axPos; 3181 linkPart.OffsetPosition = axPos;
3162 3182
3163
3164 // If there is only one SOP in a SOG, the LinkNum is zero. I.e., not a linkset. 3183 // If there is only one SOP in a SOG, the LinkNum is zero. I.e., not a linkset.
3165 // Now that we know this SOG has at least two SOPs in it, the new root 3184 // Now that we know this SOG has at least two SOPs in it, the new root
3166 // SOP becomes the first in the linkset. 3185 // SOP becomes the first in the linkset.
@@ -3193,8 +3212,7 @@ namespace OpenSim.Region.Framework.Scenes
3193 3212
3194 linkPart.CreateSelected = true; 3213 linkPart.CreateSelected = true;
3195 3214
3196 // let physics know preserve part volume dtc messy since UpdatePrimFlags doesn't look to parent changes for now 3215 linkPart.UpdatePrimFlags(grpusephys, grptemporary, (IsPhantom || (linkPart.Flags & PrimFlags.Phantom) != 0), linkPart.VolumeDetectActive || RootPart.VolumeDetectActive, true);
3197 linkPart.UpdatePrimFlags(grpusephys, grptemporary, (IsPhantom || (linkPart.Flags & PrimFlags.Phantom) != 0), linkPart.VolumeDetectActive, true);
3198 3216
3199 // If the added SOP is physical, also tell the physics engine about the link relationship. 3217 // If the added SOP is physical, also tell the physics engine about the link relationship.
3200 if (linkPart.PhysActor != null && m_rootPart.PhysActor != null && m_rootPart.PhysActor.IsPhysical) 3218 if (linkPart.PhysActor != null && m_rootPart.PhysActor != null && m_rootPart.PhysActor.IsPhysical)
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 5c38bf3..4f3f83a 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -1179,9 +1179,10 @@ namespace OpenSim.Region.Framework.Scenes
1179 1179
1180 set 1180 set
1181 { 1181 {
1182 string old = m_mediaUrl;
1182 m_mediaUrl = value; 1183 m_mediaUrl = value;
1183 1184
1184 if (ParentGroup != null) 1185 if (ParentGroup != null && old != m_mediaUrl)
1185 ParentGroup.HasGroupChanged = true; 1186 ParentGroup.HasGroupChanged = true;
1186 } 1187 }
1187 } 1188 }
@@ -1385,13 +1386,6 @@ namespace OpenSim.Region.Framework.Scenes
1385 } 1386 }
1386 } 1387 }
1387 1388
1388 [XmlIgnore]
1389 public bool IsOccupied // KF If an av is sittingon this prim
1390 {
1391 get { return m_occupied; }
1392 set { m_occupied = value; }
1393 }
1394
1395 /// <summary> 1389 /// <summary>
1396 /// ID of the avatar that is sat on us if we have a sit target. If there is no such avatar then is UUID.Zero 1390 /// ID of the avatar that is sat on us if we have a sit target. If there is no such avatar then is UUID.Zero
1397 /// </summary> 1391 /// </summary>
@@ -2472,12 +2466,6 @@ namespace OpenSim.Region.Framework.Scenes
2472 2466
2473 public uint GetEffectiveObjectFlags() 2467 public uint GetEffectiveObjectFlags()
2474 { 2468 {
2475 // Commenting this section of code out since it doesn't actually do anything, as enums are handled by
2476 // value rather than reference
2477// PrimFlags f = _flags;
2478// if (m_parentGroup == null || m_parentGroup.RootPart == this)
2479// f &= ~(PrimFlags.Touch | PrimFlags.Money);
2480
2481 uint eff = (uint)Flags | (uint)LocalFlags; 2469 uint eff = (uint)Flags | (uint)LocalFlags;
2482 if(m_inventory == null || m_inventory.Count == 0) 2470 if(m_inventory == null || m_inventory.Count == 0)
2483 eff |= (uint)PrimFlags.InventoryEmpty; 2471 eff |= (uint)PrimFlags.InventoryEmpty;
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index f010035..e635841 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -1212,7 +1212,9 @@ namespace OpenSim.Region.Framework.Scenes
1212 ControllingClient.OnForceReleaseControls += HandleForceReleaseControls; 1212 ControllingClient.OnForceReleaseControls += HandleForceReleaseControls;
1213 ControllingClient.OnAutoPilotGo += MoveToTargetHandle; 1213 ControllingClient.OnAutoPilotGo += MoveToTargetHandle;
1214 ControllingClient.OnUpdateThrottles += RaiseUpdateThrottles; 1214 ControllingClient.OnUpdateThrottles += RaiseUpdateThrottles;
1215// ControllingClient.OnAgentFOV += HandleAgentFOV; 1215 ControllingClient.OnRegionHandShakeReply += RegionHandShakeReply;
1216
1217 // ControllingClient.OnAgentFOV += HandleAgentFOV;
1216 1218
1217 // ControllingClient.OnChildAgentStatus += new StatusChange(this.ChildStatusChange); 1219 // ControllingClient.OnChildAgentStatus += new StatusChange(this.ChildStatusChange);
1218 // ControllingClient.OnStopMovement += new GenericCall2(this.StopMovement); 1220 // ControllingClient.OnStopMovement += new GenericCall2(this.StopMovement);
@@ -1232,7 +1234,9 @@ namespace OpenSim.Region.Framework.Scenes
1232 ControllingClient.OnForceReleaseControls -= HandleForceReleaseControls; 1234 ControllingClient.OnForceReleaseControls -= HandleForceReleaseControls;
1233 ControllingClient.OnAutoPilotGo -= MoveToTargetHandle; 1235 ControllingClient.OnAutoPilotGo -= MoveToTargetHandle;
1234 ControllingClient.OnUpdateThrottles -= RaiseUpdateThrottles; 1236 ControllingClient.OnUpdateThrottles -= RaiseUpdateThrottles;
1235// ControllingClient.OnAgentFOV += HandleAgentFOV; 1237 ControllingClient.OnRegionHandShakeReply -= RegionHandShakeReply;
1238
1239 // ControllingClient.OnAgentFOV += HandleAgentFOV;
1236 } 1240 }
1237 1241
1238 private void SetDirectionVectors() 1242 private void SetDirectionVectors()
@@ -2126,56 +2130,54 @@ namespace OpenSim.Region.Framework.Scenes
2126 return; 2130 return;
2127 } 2131 }
2128 2132
2129 2133 if(IsChildAgent)
2134 {
2135 return; // how?
2136 }
2130 //m_log.DebugFormat("[CompleteMovement] MakeRootAgent: {0}ms", Util.EnvironmentTickCountSubtract(ts)); 2137 //m_log.DebugFormat("[CompleteMovement] MakeRootAgent: {0}ms", Util.EnvironmentTickCountSubtract(ts));
2131 2138
2132 if(!haveGroupInformation && !IsChildAgent && !IsNPC) 2139 if (!IsNPC)
2133 { 2140 {
2134 IGroupsModule gm = m_scene.RequestModuleInterface<IGroupsModule>(); 2141 if (!haveGroupInformation && !IsNPC)
2135 if (gm != null) 2142 {
2136 Grouptitle = gm.GetGroupTitle(m_uuid); 2143 IGroupsModule gm = m_scene.RequestModuleInterface<IGroupsModule>();
2144 if (gm != null)
2145 Grouptitle = gm.GetGroupTitle(m_uuid);
2137 2146
2138 //m_log.DebugFormat("[CompleteMovement] Missing Grouptitle: {0}ms", Util.EnvironmentTickCountSubtract(ts)); 2147 //m_log.DebugFormat("[CompleteMovement] Missing Grouptitle: {0}ms", Util.EnvironmentTickCountSubtract(ts));
2139 2148
2140 InventoryFolderBase cof = m_scene.InventoryService.GetFolderForType(client.AgentId, (FolderType)46); 2149 InventoryFolderBase cof = m_scene.InventoryService.GetFolderForType(client.AgentId, (FolderType)46);
2141 if (cof == null) 2150 if (cof == null)
2142 COF = UUID.Zero; 2151 COF = UUID.Zero;
2143 else 2152 else
2144 COF = cof.ID; 2153 COF = cof.ID;
2145 2154
2146 m_log.DebugFormat("[CompleteMovement]: Missing COF for {0} is {1}", client.AgentId, COF); 2155 m_log.DebugFormat("[CompleteMovement]: Missing COF for {0} is {1}", client.AgentId, COF);
2147 } 2156 }
2148 2157
2149 if (!string.IsNullOrEmpty(m_callbackURI)) 2158 if (!string.IsNullOrEmpty(m_callbackURI))
2150 { 2159 {
2151 // We cannot sleep here since this would hold up the inbound packet processing thread, as 2160 // We cannot sleep here since this would hold up the inbound packet processing thread, as
2152 // CompleteMovement() is executed synchronously. However, it might be better to delay the release 2161 // CompleteMovement() is executed synchronously. However, it might be better to delay the release
2153 // here until we know for sure that the agent is active in this region. Sending AgentMovementComplete 2162 // here until we know for sure that the agent is active in this region. Sending AgentMovementComplete
2154 // is not enough for Imprudence clients - there appears to be a small delay (<200ms, <500ms) until they regard this 2163 // is not enough for Imprudence clients - there appears to be a small delay (<200ms, <500ms) until they regard this
2155 // region as the current region, meaning that a close sent before then will fail the teleport. 2164 // region as the current region, meaning that a close sent before then will fail the teleport.
2156 // System.Threading.Thread.Sleep(2000); 2165 // System.Threading.Thread.Sleep(2000);
2157 2166
2158 m_log.DebugFormat( 2167 m_log.DebugFormat(
2159 "[SCENE PRESENCE]: Releasing {0} {1} with callback to {2}", 2168 "[SCENE PRESENCE]: Releasing {0} {1} with callback to {2}",
2160 client.Name, client.AgentId, m_callbackURI); 2169 client.Name, client.AgentId, m_callbackURI);
2161 2170
2162 UUID originID; 2171 UUID originID;
2163 2172
2164 lock (m_originRegionIDAccessLock) 2173 lock (m_originRegionIDAccessLock)
2165 originID = m_originRegionID; 2174 originID = m_originRegionID;
2166 2175
2167 Scene.SimulationService.ReleaseAgent(originID, UUID, m_callbackURI); 2176 Scene.SimulationService.ReleaseAgent(originID, UUID, m_callbackURI);
2168 m_callbackURI = null; 2177 m_callbackURI = null;
2169 //m_log.DebugFormat("[CompleteMovement] ReleaseAgent: {0}ms", Util.EnvironmentTickCountSubtract(ts)); 2178 //m_log.DebugFormat("[CompleteMovement] ReleaseAgent: {0}ms", Util.EnvironmentTickCountSubtract(ts));
2179 }
2170 } 2180 }
2171// else
2172// {
2173// m_log.DebugFormat(
2174// "[SCENE PRESENCE]: No callback provided on CompleteMovement of {0} {1} to {2}",
2175// client.Name, client.AgentId, m_scene.RegionInfo.RegionName);
2176// }
2177
2178
2179 // Tell the client that we're totally ready 2181 // Tell the client that we're totally ready
2180 ControllingClient.MoveAgentIntoRegion(m_scene.RegionInfo, AbsolutePosition, look); 2182 ControllingClient.MoveAgentIntoRegion(m_scene.RegionInfo, AbsolutePosition, look);
2181 //m_log.DebugFormat("[CompleteMovement] MoveAgentIntoRegion: {0}ms", Util.EnvironmentTickCountSubtract(ts)); 2183 //m_log.DebugFormat("[CompleteMovement] MoveAgentIntoRegion: {0}ms", Util.EnvironmentTickCountSubtract(ts));
@@ -2187,32 +2189,29 @@ namespace OpenSim.Region.Framework.Scenes
2187 2189
2188 int delayctnr = Util.EnvironmentTickCount(); 2190 int delayctnr = Util.EnvironmentTickCount();
2189 2191
2190 if (!IsChildAgent) 2192 if( ParentPart != null && !IsNPC && (crossingFlags & 0x08) != 0)
2191 { 2193 {
2192 if( ParentPart != null && !IsNPC && (crossingFlags & 0x08) != 0) 2194 ParentPart.ParentGroup.SendFullAnimUpdateToClient(ControllingClient);
2193 { 2195 }
2194 ParentPart.ParentGroup.SendFullAnimUpdateToClient(ControllingClient);
2195 }
2196 2196
2197 // verify baked textures and cache 2197 // verify baked textures and cache
2198 bool cachedbaked = false; 2198 bool cachedbaked = false;
2199 2199
2200 if (IsNPC) 2200 if (IsNPC)
2201 cachedbaked = true; 2201 cachedbaked = true;
2202 else 2202 else
2203 { 2203 {
2204 if (m_scene.AvatarFactory != null && !isHGTP) 2204 if (m_scene.AvatarFactory != null && !isHGTP)
2205 cachedbaked = m_scene.AvatarFactory.ValidateBakedTextureCache(this); 2205 cachedbaked = m_scene.AvatarFactory.ValidateBakedTextureCache(this);
2206 2206
2207 // not sure we need this 2207 // not sure we need this
2208 if (!cachedbaked) 2208 if (!cachedbaked)
2209 { 2209 {
2210 if (m_scene.AvatarFactory != null) 2210 if (m_scene.AvatarFactory != null)
2211 m_scene.AvatarFactory.QueueAppearanceSave(UUID); 2211 m_scene.AvatarFactory.QueueAppearanceSave(UUID);
2212 }
2213 } 2212 }
2214 //m_log.DebugFormat("[CompleteMovement] Baked check: {0}ms", Util.EnvironmentTickCountSubtract(ts));
2215 } 2213 }
2214 //m_log.DebugFormat("[CompleteMovement] Baked check: {0}ms", Util.EnvironmentTickCountSubtract(ts));
2216 2215
2217 if(m_teleportFlags > 0) 2216 if(m_teleportFlags > 0)
2218 { 2217 {
@@ -2251,104 +2250,103 @@ namespace OpenSim.Region.Framework.Scenes
2251 landch.sendClientInitialLandInfo(client, !gotCrossUpdate); 2250 landch.sendClientInitialLandInfo(client, !gotCrossUpdate);
2252 } 2251 }
2253 2252
2254 if (!IsChildAgent) 2253 List<ScenePresence> allpresences = m_scene.GetScenePresences();
2255 {
2256 List<ScenePresence> allpresences = m_scene.GetScenePresences();
2257 2254
2258 // send avatar object to all presences including us, so they cross it into region 2255 // send avatar object to all presences including us, so they cross it into region
2259 // then hide if necessary 2256 // then hide if necessary
2260 2257
2261 SendInitialAvatarDataToAllAgents(allpresences); 2258 SendInitialAvatarDataToAllAgents(allpresences);
2262 2259
2263 // send this look 2260 // send this look
2264 SendAppearanceToAgent(this); 2261 SendAppearanceToAgent(this);
2265 2262
2266 // send this animations 2263 // send this animations
2267 2264
2268 UUID[] animIDs = null; 2265 UUID[] animIDs = null;
2269 int[] animseqs = null; 2266 int[] animseqs = null;
2270 UUID[] animsobjs = null; 2267 UUID[] animsobjs = null;
2271 2268
2272 if (Animator != null) 2269 if (Animator != null)
2273 Animator.GetArrays(out animIDs, out animseqs, out animsobjs); 2270 Animator.GetArrays(out animIDs, out animseqs, out animsobjs);
2274 2271
2275 bool haveAnims = (animIDs != null && animseqs != null && animsobjs != null); 2272 bool haveAnims = (animIDs != null && animseqs != null && animsobjs != null);
2276 2273
2277 if (haveAnims) 2274 if (haveAnims)
2278 SendAnimPackToAgent(this, animIDs, animseqs, animsobjs); 2275 SendAnimPackToAgent(this, animIDs, animseqs, animsobjs);
2279 2276
2280 // we should be able to receive updates, etc 2277 // we should be able to receive updates, etc
2281 // so release them 2278 // so release them
2282 m_inTransit = false; 2279 m_inTransit = false;
2283 2280
2284 // send look and animations to others 2281 // send look and animations to others
2285 // if not cached we send greys 2282 // if not cached we send greys
2286 // uncomented if will wait till avatar does baking 2283 // uncomented if will wait till avatar does baking
2287 //if (cachedbaked) 2284 //if (cachedbaked)
2285 {
2286 foreach (ScenePresence p in allpresences)
2288 { 2287 {
2289 foreach (ScenePresence p in allpresences) 2288 if (p == this)
2290 { 2289 continue;
2291 if (p == this)
2292 continue;
2293 2290
2294 if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && !p.IsViewerUIGod) 2291 if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && !p.IsViewerUIGod)
2295 continue; 2292 continue;
2296 2293
2297 SendAppearanceToAgentNF(p); 2294 SendAppearanceToAgentNF(p);
2298 if (haveAnims) 2295 if (haveAnims)
2299 SendAnimPackToAgentNF(p, animIDs, animseqs, animsobjs); 2296 SendAnimPackToAgentNF(p, animIDs, animseqs, animsobjs);
2300 } 2297 }
2301 } // greys if 2298 } // greys if
2302 2299
2303 //m_log.DebugFormat("[CompleteMovement] ValidateAndSendAppearanceAndAgentData: {0}ms", Util.EnvironmentTickCountSubtract(ts)); 2300 //m_log.DebugFormat("[CompleteMovement] ValidateAndSendAppearanceAndAgentData: {0}ms", Util.EnvironmentTickCountSubtract(ts));
2304 2301
2305 // attachments 2302 // attachments
2306 if (IsNPC || IsRealLogin(m_teleportFlags)) 2303 if (IsNPC || IsRealLogin(m_teleportFlags))
2307 { 2304 {
2308 if (Scene.AttachmentsModule != null) 2305 if (Scene.AttachmentsModule != null)
2309 // Util.FireAndForget( 2306 // Util.FireAndForget(
2310 // o => 2307 // o =>
2311 // { 2308 // {
2312 2309
2313 if (!IsNPC) 2310 if (!IsNPC)
2311 Scene.AttachmentsModule.RezAttachments(this);
2312 else
2313 Util.FireAndForget(x =>
2314 {
2314 Scene.AttachmentsModule.RezAttachments(this); 2315 Scene.AttachmentsModule.RezAttachments(this);
2315 else 2316 });
2316 Util.FireAndForget(x =>
2317 {
2318 Scene.AttachmentsModule.RezAttachments(this);
2319 });
2320 2317
2321 // }); 2318 // });
2322 } 2319 }
2323 else 2320 else
2321 {
2322 if (m_attachments.Count > 0)
2324 { 2323 {
2325 if (m_attachments.Count > 0)
2326 {
2327// m_log.DebugFormat( 2324// m_log.DebugFormat(
2328// "[SCENE PRESENCE]: Restarting scripts in attachments for {0} in {1}", Name, Scene.Name); 2325// "[SCENE PRESENCE]: Restarting scripts in attachments for {0} in {1}", Name, Scene.Name);
2329 2326
2330 foreach (SceneObjectGroup sog in m_attachments) 2327 foreach (SceneObjectGroup sog in m_attachments)
2331 { 2328 {
2332 sog.RootPart.ParentGroup.CreateScriptInstances(0, false, m_scene.DefaultScriptEngine, GetStateSource()); 2329 sog.RootPart.ParentGroup.CreateScriptInstances(0, false, m_scene.DefaultScriptEngine, GetStateSource());
2333 sog.ResumeScripts(); 2330 sog.ResumeScripts();
2334 } 2331 }
2335 2332
2336 foreach (ScenePresence p in allpresences) 2333 foreach (ScenePresence p in allpresences)
2334 {
2335 if (p == this)
2337 { 2336 {
2338 if (p == this) 2337 SendAttachmentsToAgentNF(this);
2339 { 2338 continue;
2340 SendAttachmentsToAgentNF(this); 2339 }
2341 continue;
2342 }
2343 2340
2344 if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && !p.IsViewerUIGod) 2341 if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && !p.IsViewerUIGod)
2345 continue; 2342 continue;
2346 2343
2347 SendAttachmentsToAgentNF(p); 2344 SendAttachmentsToAgentNF(p);
2348 }
2349 } 2345 }
2350 } 2346 }
2351 2347 }
2348 if(!IsNPC)
2349 {
2352 //m_log.DebugFormat("[CompleteMovement] attachments: {0}ms", Util.EnvironmentTickCountSubtract(ts)); 2350 //m_log.DebugFormat("[CompleteMovement] attachments: {0}ms", Util.EnvironmentTickCountSubtract(ts));
2353 if (openChildAgents) 2351 if (openChildAgents)
2354 { 2352 {
@@ -2366,34 +2364,33 @@ namespace OpenSim.Region.Framework.Scenes
2366 2364
2367 m_lastChildAgentUpdateGodLevel = GodController.ViwerUIGodLevel; 2365 m_lastChildAgentUpdateGodLevel = GodController.ViwerUIGodLevel;
2368 m_childUpdatesBusy = false; // allow them 2366 m_childUpdatesBusy = false; // allow them
2369 }
2370 2367
2371 //m_log.DebugFormat("[CompleteMovement] openChildAgents: {0}ms", Util.EnvironmentTickCountSubtract(ts)); 2368 //m_log.DebugFormat("[CompleteMovement] openChildAgents: {0}ms", Util.EnvironmentTickCountSubtract(ts));
2372 2369
2373 // send the rest of the world 2370 // send the rest of the world
2374 if (m_teleportFlags > 0 && !IsNPC || m_currentParcelHide) 2371 if (m_teleportFlags > 0 | m_currentParcelHide)
2375 SendInitialDataToMe(); 2372 SendInitialDataToMe();
2376 2373
2377 // priority uses avatar position only 2374 // priority uses avatar position only
2378// m_reprioritizationLastPosition = AbsolutePosition; 2375 // m_reprioritizationLastPosition = AbsolutePosition;
2379// m_reprioritizationLastDrawDistance = DrawDistance; 2376 // m_reprioritizationLastDrawDistance = DrawDistance;
2380// m_reprioritizationLastTime = Util.EnvironmentTickCount() + 15000; // delay it 2377 // m_reprioritizationLastTime = Util.EnvironmentTickCount() + 15000; // delay it
2381// m_reprioritizationBusy = false; 2378 // m_reprioritizationBusy = false;
2382 2379
2383 //m_log.DebugFormat("[CompleteMovement] SendInitialDataToMe: {0}ms", Util.EnvironmentTickCountSubtract(ts)); 2380 //m_log.DebugFormat("[CompleteMovement] SendInitialDataToMe: {0}ms", Util.EnvironmentTickCountSubtract(ts));
2384 2381
2385 if (!IsChildAgent && openChildAgents) 2382 if (openChildAgents)
2386 {
2387 IFriendsModule friendsModule = m_scene.RequestModuleInterface<IFriendsModule>();
2388 if (friendsModule != null)
2389 { 2383 {
2390 if(gotCrossUpdate) 2384 IFriendsModule friendsModule = m_scene.RequestModuleInterface<IFriendsModule>();
2391 friendsModule.IsNowRoot(this); 2385 if (friendsModule != null)
2392 else 2386 {
2393 friendsModule.SendFriendsOnlineIfNeeded(ControllingClient); 2387 if(gotCrossUpdate)
2388 friendsModule.IsNowRoot(this);
2389 else
2390 friendsModule.SendFriendsOnlineIfNeeded(ControllingClient);
2391 }
2392 //m_log.DebugFormat("[CompleteMovement] friendsModule: {0}ms", Util.EnvironmentTickCountSubtract(ts));
2394 } 2393 }
2395 //m_log.DebugFormat("[CompleteMovement] friendsModule: {0}ms", Util.EnvironmentTickCountSubtract(ts));
2396
2397 } 2394 }
2398 } 2395 }
2399 finally 2396 finally
@@ -4024,10 +4021,100 @@ namespace OpenSim.Region.Framework.Scenes
4024 ControllingClient.SendCoarseLocationUpdate(avatarUUIDs, coarseLocations); 4021 ControllingClient.SendCoarseLocationUpdate(avatarUUIDs, coarseLocations);
4025 } 4022 }
4026 4023
4024
4025 public void RegionHandShakeReply (IClientAPI client, uint flags)
4026 {
4027 if(IsNPC)
4028 return;
4029
4030 bool selfappearance = (flags & 4) != 0;
4031 bool cacheCulling = (flags & 1) != 0;
4032 bool cacheEmpty;
4033 if(cacheCulling)
4034 cacheEmpty = (flags & 2) != 0;
4035 else
4036 cacheEmpty = true;
4037
4038 if (m_teleportFlags > 0) // only doing for child for now
4039 return;
4040
4041 lock (m_completeMovementLock)
4042 {
4043 if (SentInitialData)
4044 return;
4045 SentInitialData = true;
4046 }
4047
4048 Util.FireAndForget(delegate
4049 {
4050 Scene.SendLayerData(ControllingClient);
4051
4052 ILandChannel landch = m_scene.LandChannel;
4053 if (landch != null)
4054 landch.sendClientInitialLandInfo(ControllingClient, true);
4055
4056 // recheck to reduce timing issues
4057 ControllingClient.CheckViewerCaps();
4058
4059 SendOtherAgentsAvatarFullToMe();
4060 /*
4061 if (m_scene.ObjectsCullingByDistance && cacheCulling)
4062 {
4063 m_reprioritizationBusy = true;
4064 m_reprioritizationLastPosition = AbsolutePosition;
4065 m_reprioritizationLastDrawDistance = DrawDistance;
4066
4067 ControllingClient.ReprioritizeUpdates();
4068 m_reprioritizationLastTime = Util.EnvironmentTickCount();
4069 m_reprioritizationBusy = false;
4070 return;
4071 }
4072 */
4073
4074 EntityBase[] entities = Scene.Entities.GetEntities();
4075 if(cacheEmpty)
4076 {
4077 foreach (EntityBase e in entities)
4078 {
4079 if (e != null && e is SceneObjectGroup && !((SceneObjectGroup)e).IsAttachment)
4080 ((SceneObjectGroup)e).SendFullAnimUpdateToClient(ControllingClient);
4081 }
4082 }
4083 else
4084 {
4085 foreach (EntityBase e in entities)
4086 {
4087 if (e != null && e is SceneObjectGroup && !((SceneObjectGroup)e).IsAttachment)
4088 {
4089 SceneObjectGroup grp = e as SceneObjectGroup;
4090 if(grp.IsViewerCachable)
4091 grp.SendUpdateProbes(ControllingClient);
4092 else
4093 grp.SendFullAnimUpdateToClient(ControllingClient);
4094 }
4095 }
4096 }
4097
4098 m_reprioritizationLastPosition = AbsolutePosition;
4099 m_reprioritizationLastDrawDistance = DrawDistance;
4100 m_reprioritizationLastTime = Util.EnvironmentTickCount() + 15000; // delay it
4101
4102 m_reprioritizationBusy = false;
4103
4104 });
4105
4106 }
4107
4027 public void SendInitialDataToMe() 4108 public void SendInitialDataToMe()
4028 { 4109 {
4029 // Send all scene object to the new client 4110 // Send all scene object to the new client
4030 SentInitialData = true; 4111 lock (m_completeMovementLock)
4112 {
4113 if (SentInitialData)
4114 return;
4115 SentInitialData = true;
4116 }
4117
4031 Util.FireAndForget(delegate 4118 Util.FireAndForget(delegate
4032 { 4119 {
4033 // we created a new ScenePresence (a new child agent) in a fresh region. 4120 // we created a new ScenePresence (a new child agent) in a fresh region.
@@ -4280,7 +4367,13 @@ namespace OpenSim.Region.Framework.Scenes
4280 if(IsDeleted || !ControllingClient.IsActive) 4367 if(IsDeleted || !ControllingClient.IsActive)
4281 return; 4368 return;
4282 4369
4283 if(!SentInitialData) 4370 bool needsendinitial = false;
4371 lock(m_completeMovementLock)
4372 {
4373 needsendinitial = SentInitialData;
4374 }
4375
4376 if(!needsendinitial)
4284 { 4377 {
4285 SendInitialDataToMe(); 4378 SendInitialDataToMe();
4286 return; 4379 return;