aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes')
-rwxr-xr-xOpenSim/Region/Framework/Scenes/Scene.cs3
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs180
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs5
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs23
-rw-r--r--OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs1
5 files changed, 203 insertions, 9 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index c349369..09f0b19 100755
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -5454,6 +5454,7 @@ Label_GroupsDone:
5454 5454
5455 public void CleanTempObjects() 5455 public void CleanTempObjects()
5456 { 5456 {
5457 DateTime now = DateTime.UtcNow;
5457 EntityBase[] entities = GetEntities(); 5458 EntityBase[] entities = GetEntities();
5458 foreach (EntityBase obj in entities) 5459 foreach (EntityBase obj in entities)
5459 { 5460 {
@@ -5465,7 +5466,7 @@ Label_GroupsDone:
5465 { 5466 {
5466 if ((grp.RootPart.Flags & PrimFlags.TemporaryOnRez) != 0) 5467 if ((grp.RootPart.Flags & PrimFlags.TemporaryOnRez) != 0)
5467 { 5468 {
5468 if (grp.GetSittingAvatarsCount() == 0 && grp.RootPart.Expires <= DateTime.Now) 5469 if (grp.GetSittingAvatarsCount() == 0 && grp.RootPart.Expires <= now)
5469 DeleteSceneObject(grp, false); 5470 DeleteSceneObject(grp, false);
5470 } 5471 }
5471 } 5472 }
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index e643db7..6cdbac5 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -153,9 +153,9 @@ namespace OpenSim.Region.Framework.Scenes
153 { 153 {
154 m_scene.SceneGraph.FireChangeBackup(this); 154 m_scene.SceneGraph.FireChangeBackup(this);
155 } 155 }
156 timeLastChanged = DateTime.Now.Ticks; 156 timeLastChanged = DateTime.UtcNow.Ticks;
157 if (!m_hasGroupChanged) 157 if (!m_hasGroupChanged)
158 timeFirstChanged = DateTime.Now.Ticks; 158 timeFirstChanged = DateTime.UtcNow.Ticks;
159 if (m_rootPart != null && m_rootPart.UUID != null && m_scene != null) 159 if (m_rootPart != null && m_rootPart.UUID != null && m_scene != null)
160 { 160 {
161/* 161/*
@@ -233,7 +233,7 @@ namespace OpenSim.Region.Framework.Scenes
233 m_minPersistTime = m_scene.m_dontPersistBefore; 233 m_minPersistTime = m_scene.m_dontPersistBefore;
234 } 234 }
235 235
236 long currentTime = DateTime.Now.Ticks; 236 long currentTime = DateTime.UtcNow.Ticks;
237 237
238 if (timeLastChanged == 0) timeLastChanged = currentTime; 238 if (timeLastChanged == 0) timeLastChanged = currentTime;
239 if (timeFirstChanged == 0) timeFirstChanged = currentTime; 239 if (timeFirstChanged == 0) timeFirstChanged = currentTime;
@@ -4161,6 +4161,180 @@ namespace OpenSim.Region.Framework.Scenes
4161 4161
4162 } 4162 }
4163 4163
4164 public bool GroupResize(double fscale)
4165 {
4166// m_log.DebugFormat(
4167// "[SCENE OBJECT GROUP]: Group resizing {0} {1} from {2} to {3}", Name, LocalId, RootPart.Scale, fscale);
4168
4169 if (Scene == null || IsDeleted || inTransit || fscale < 0)
4170 return false;
4171
4172 // ignore lsl restrictions. let them be done a LSL
4173 PhysicsActor pa = m_rootPart.PhysActor;
4174
4175 if(RootPart.KeyframeMotion != null)
4176 RootPart.KeyframeMotion.Suspend();
4177
4178 float minsize = Scene.m_minNonphys;
4179 float maxsize = Scene.m_maxNonphys;
4180
4181 // assuming physics is more restrictive
4182 if (pa != null && pa.IsPhysical)
4183 {
4184 minsize = Scene.m_minPhys;
4185 maxsize = Scene.m_maxPhys;
4186 }
4187
4188 SceneObjectPart[] parts = m_parts.GetArray();
4189 float tmp;
4190 // check scaling factor so parts don't violate dimensions
4191 for(int i = 0; i < parts.Length; i++)
4192 {
4193 SceneObjectPart obPart = parts[i];
4194 Vector3 oldSize = new Vector3(obPart.Scale);
4195 tmp = (float)(oldSize.X * fscale);
4196 if(tmp > maxsize)
4197 return false;
4198 if(tmp < minsize)
4199 return false;
4200
4201 tmp = (float)(oldSize.Y * fscale);
4202 if(tmp > maxsize)
4203 return false;
4204 if(tmp < minsize)
4205 return false;
4206
4207 tmp = (float)(oldSize.Z * fscale);
4208 if(tmp > maxsize)
4209 return false;
4210 if(tmp < minsize)
4211 return false;
4212 }
4213
4214 Vector3 newSize = RootPart.Scale;
4215 newSize.X = (float)(newSize.X * fscale);
4216 newSize.Y = (float)(newSize.Y * fscale);
4217 newSize.Z = (float)(newSize.Z * fscale);
4218
4219 if(pa != null)
4220 pa.Building = true;
4221
4222 RootPart.Scale = newSize;
4223
4224 Vector3 currentpos;
4225 for (int i = 0; i < parts.Length; i++)
4226 {
4227 SceneObjectPart obPart = parts[i];
4228
4229 if (obPart.UUID != m_rootPart.UUID)
4230 {
4231 currentpos = obPart.OffsetPosition;
4232 currentpos.X = (float)(currentpos.X * fscale);
4233 currentpos.Y = (float)(currentpos.Y * fscale);
4234 currentpos.Z = (float)(currentpos.Z * fscale);
4235
4236 newSize = obPart.Scale;
4237 newSize.X = (float)(newSize.X * fscale);
4238 newSize.Y = (float)(newSize.Y * fscale);
4239 newSize.Z = (float)(newSize.Z * fscale);
4240
4241 obPart.Scale = newSize;
4242 obPart.UpdateOffSet(currentpos);
4243 }
4244 }
4245
4246 if(pa != null)
4247 pa.Building = false;
4248
4249 InvalidBoundsRadius();
4250
4251 HasGroupChanged = true;
4252 m_rootPart.TriggerScriptChangedEvent(Changed.SCALE);
4253 ScheduleGroupForFullUpdate();
4254
4255 if(RootPart.KeyframeMotion != null)
4256 RootPart.KeyframeMotion.Resume();
4257
4258 return true;
4259 }
4260
4261 public float GetMaxGroupResizeScale()
4262 {
4263 if (Scene == null || IsDeleted || inTransit)
4264 return 1.0f;
4265
4266 float maxsize = Scene.m_maxNonphys;
4267 PhysicsActor pa = m_rootPart.PhysActor;
4268 // assuming physics is more restrictive
4269 if (pa != null && pa.IsPhysical)
4270 maxsize = Scene.m_maxPhys;
4271
4272 SceneObjectPart[] parts = m_parts.GetArray();
4273 float larger = float.MinValue;
4274
4275 for(int i = 0; i < parts.Length; i++)
4276 {
4277 SceneObjectPart obPart = parts[i];
4278 Vector3 oldSize = new Vector3(obPart.Scale);
4279 if(larger < oldSize.X)
4280 larger = oldSize.X;
4281
4282 if(larger < oldSize.Y)
4283 larger = oldSize.Y;
4284
4285 if(larger < oldSize.Z)
4286 larger = oldSize.Z;
4287 }
4288
4289 if(larger >= maxsize)
4290 return 1.0f;
4291
4292 larger += 1e-3f;
4293 float fscale = maxsize / larger;
4294
4295 return fscale;
4296 }
4297
4298 public float GetMinGroupResizeScale()
4299 {
4300 if (Scene == null || IsDeleted || inTransit)
4301 return 1.0f;
4302
4303 float minsize = Scene.m_minNonphys;
4304 PhysicsActor pa = m_rootPart.PhysActor;
4305 // assuming physics is more restrictive
4306 if (pa != null && pa.IsPhysical)
4307 minsize = Scene.m_minPhys;
4308
4309 SceneObjectPart[] parts = m_parts.GetArray();
4310 float smaller = float.MaxValue;
4311
4312 for(int i = 0; i < parts.Length; i++)
4313 {
4314 SceneObjectPart obPart = parts[i];
4315 Vector3 oldSize = new Vector3(obPart.Scale);
4316 if(smaller > oldSize.X)
4317 smaller = oldSize.X;
4318
4319 if(smaller > oldSize.Y)
4320 smaller = oldSize.Y;
4321
4322 if(smaller > oldSize.Z)
4323 smaller = oldSize.Z;
4324 }
4325
4326 if(smaller <= minsize)
4327 return 1.0f;
4328
4329 if(smaller > 2e-3f)
4330 smaller -= 1e-3f;
4331 float fscale = minsize / smaller;
4332 if(fscale < 1e-8f)
4333 fscale = 1e-8f;
4334
4335 return fscale;
4336 }
4337
4164 #endregion 4338 #endregion
4165 4339
4166 #region Position 4340 #region Position
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 9d1dca2..3a06e7d 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -185,8 +185,7 @@ namespace OpenSim.Region.Framework.Scenes
185 return 185 return
186 !(SitTargetPosition == Vector3.Zero 186 !(SitTargetPosition == Vector3.Zero
187 && (SitTargetOrientation == Quaternion.Identity // Valid Zero Rotation quaternion 187 && (SitTargetOrientation == Quaternion.Identity // Valid Zero Rotation quaternion
188 || SitTargetOrientation.X == 0f && SitTargetOrientation.Y == 0f && SitTargetOrientation.Z == 1f && SitTargetOrientation.W == 0f // W-Z Mapping was invalid at one point 188 || (SitTargetOrientation.W == 0f && SitTargetOrientation.X == 0f && SitTargetOrientation.Y == 0f && SitTargetOrientation.Z == 0f ))); // Invalid Quaternion
189 || SitTargetOrientation.X == 0f && SitTargetOrientation.Y == 0f && SitTargetOrientation.Z == 0f && SitTargetOrientation.W == 0f)); // Invalid Quaternion
190 } 189 }
191 } 190 }
192 191
@@ -1909,7 +1908,7 @@ namespace OpenSim.Region.Framework.Scenes
1909 1908
1910 public void ResetExpire() 1909 public void ResetExpire()
1911 { 1910 {
1912 Expires = DateTime.Now + new TimeSpan(600000000); 1911 Expires = DateTime.UtcNow + new TimeSpan(600000000);
1913 } 1912 }
1914 1913
1915 public void AddFlag(PrimFlags flag) 1914 public void AddFlag(PrimFlags flag)
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 2cfdd94..2cf0e9d 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -2043,6 +2043,10 @@ namespace OpenSim.Region.Framework.Scenes
2043 look = new Vector3(0.99f, 0.042f, 0); 2043 look = new Vector3(0.99f, 0.042f, 0);
2044 } 2044 }
2045 2045
2046 // Check Default Location (Also See EntityTransferModule.TeleportAgentWithinRegion)
2047 if (AbsolutePosition.X == 128f && AbsolutePosition.Y == 128f)
2048 AbsolutePosition = Scene.RegionInfo.DefaultLandingPoint;
2049
2046 if (!MakeRootAgent(AbsolutePosition, flying, ref look)) 2050 if (!MakeRootAgent(AbsolutePosition, flying, ref look))
2047 { 2051 {
2048 m_log.DebugFormat( 2052 m_log.DebugFormat(
@@ -2071,14 +2075,13 @@ namespace OpenSim.Region.Framework.Scenes
2071 m_log.DebugFormat("[CompleteMovement]: Missing COF for {0} is {1}", client.AgentId, COF); 2075 m_log.DebugFormat("[CompleteMovement]: Missing COF for {0} is {1}", client.AgentId, COF);
2072 } 2076 }
2073 2077
2074 if(!gotCrossUpdate)
2075 RotateToLookAt(look);
2076 2078
2077 // Tell the client that we're totally ready 2079 // Tell the client that we're totally ready
2078 ControllingClient.MoveAgentIntoRegion(m_scene.RegionInfo, AbsolutePosition, look); 2080 ControllingClient.MoveAgentIntoRegion(m_scene.RegionInfo, AbsolutePosition, look);
2079 2081
2080 m_log.DebugFormat("[CompleteMovement] MoveAgentIntoRegion: {0}ms", Util.EnvironmentTickCountSubtract(ts)); 2082 m_log.DebugFormat("[CompleteMovement] MoveAgentIntoRegion: {0}ms", Util.EnvironmentTickCountSubtract(ts));
2081 2083
2084
2082 if (!string.IsNullOrEmpty(m_callbackURI)) 2085 if (!string.IsNullOrEmpty(m_callbackURI))
2083 { 2086 {
2084 // We cannot sleep here since this would hold up the inbound packet processing thread, as 2087 // We cannot sleep here since this would hold up the inbound packet processing thread, as
@@ -2107,12 +2110,28 @@ namespace OpenSim.Region.Framework.Scenes
2107// client.Name, client.AgentId, m_scene.RegionInfo.RegionName); 2110// client.Name, client.AgentId, m_scene.RegionInfo.RegionName);
2108// } 2111// }
2109 2112
2113
2110 m_log.DebugFormat("[CompleteMovement] ReleaseAgent: {0}ms", Util.EnvironmentTickCountSubtract(ts)); 2114 m_log.DebugFormat("[CompleteMovement] ReleaseAgent: {0}ms", Util.EnvironmentTickCountSubtract(ts));
2111 2115
2116
2117 if(m_teleportFlags > 0) //sanity check
2118 gotCrossUpdate = false;
2119
2120 if(!gotCrossUpdate)
2121 RotateToLookAt(look);
2122
2123
2112// start sending terrain patchs 2124// start sending terrain patchs
2113 if (!gotCrossUpdate && !isNPC) 2125 if (!gotCrossUpdate && !isNPC)
2114 Scene.SendLayerData(ControllingClient); 2126 Scene.SendLayerData(ControllingClient);
2115 2127
2128 // HG delay
2129 if((m_teleportFlags & TeleportFlags.ViaHGLogin) != 0)
2130 {
2131 Thread.Sleep(500);
2132 m_log.DebugFormat("[CompleteMovement] HG delay: {0}ms", Util.EnvironmentTickCountSubtract(ts));
2133 }
2134
2116 m_previusParcelHide = false; 2135 m_previusParcelHide = false;
2117 m_previusParcelUUID = UUID.Zero; 2136 m_previusParcelUUID = UUID.Zero;
2118 m_currentParcelHide = false; 2137 m_currentParcelHide = false;
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs
index 3c03130..01bc491 100644
--- a/OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs
+++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs
@@ -265,6 +265,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
265 foreach (XmlNode aPrimNode in rootNode.ChildNodes) 265 foreach (XmlNode aPrimNode in rootNode.ChildNodes)
266 { 266 {
267 SceneObjectGroup obj = DeserializeGroupFromXml2(aPrimNode.OuterXml); 267 SceneObjectGroup obj = DeserializeGroupFromXml2(aPrimNode.OuterXml);
268 scene.AddNewSceneObject(obj, true);
268 if (startScripts) 269 if (startScripts)
269 sceneObjects.Add(obj); 270 sceneObjects.Add(obj);
270 } 271 }