diff options
author | UbitUmarov | 2014-10-25 23:00:41 +0100 |
---|---|---|
committer | UbitUmarov | 2014-10-25 23:00:41 +0100 |
commit | d9d58a7b33d07779c2034ec3a2978d716111f7c6 (patch) | |
tree | f22631a1c2e981d2178e1dbc3d5b316ff2022cad /OpenSim | |
parent | don't backup in transit SOGs (diff) | |
download | opensim-SC_OLD-d9d58a7b33d07779c2034ec3a2978d716111f7c6.zip opensim-SC_OLD-d9d58a7b33d07779c2034ec3a2978d716111f7c6.tar.gz opensim-SC_OLD-d9d58a7b33d07779c2034ec3a2978d716111f7c6.tar.bz2 opensim-SC_OLD-d9d58a7b33d07779c2034ec3a2978d716111f7c6.tar.xz |
some code reorder/minor changes
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneGraph.cs | 90 |
1 files changed, 40 insertions, 50 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index dbe0e57..92ce411 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs | |||
@@ -271,28 +271,40 @@ namespace OpenSim.Region.Framework.Scenes | |||
271 | { | 271 | { |
272 | if (!m_parentScene.CombineRegions) | 272 | if (!m_parentScene.CombineRegions) |
273 | { | 273 | { |
274 | // temporary checks to remove after varsize suport | ||
275 | float regionSizeX = m_parentScene.RegionInfo.RegionSizeX; | ||
276 | if (regionSizeX == 0) | ||
277 | regionSizeX = Constants.RegionSize; | ||
278 | float regionSizeY = m_parentScene.RegionInfo.RegionSizeY; | ||
279 | if (regionSizeY == 0) | ||
280 | regionSizeY = Constants.RegionSize; | ||
281 | |||
274 | // KF: Check for out-of-region, move inside and make static. | 282 | // KF: Check for out-of-region, move inside and make static. |
275 | Vector3 npos = new Vector3(sceneObject.RootPart.GroupPosition.X, | 283 | Vector3 npos = new Vector3(sceneObject.RootPart.GroupPosition.X, |
276 | sceneObject.RootPart.GroupPosition.Y, | 284 | sceneObject.RootPart.GroupPosition.Y, |
277 | sceneObject.RootPart.GroupPosition.Z); | 285 | sceneObject.RootPart.GroupPosition.Z); |
278 | if (!(((sceneObject.RootPart.Shape.PCode == (byte)PCode.Prim) && (sceneObject.RootPart.Shape.State != 0))) && (npos.X < 0.0 || npos.Y < 0.0 || npos.Z < 0.0 || | 286 | if (!(((sceneObject.RootPart.Shape.PCode == (byte)PCode.Prim) && (sceneObject.RootPart.Shape.State != 0))) && (npos.X < 0.0 || npos.Y < 0.0 || npos.Z < 0.0 || |
279 | npos.X > Constants.RegionSize || | 287 | npos.X > regionSizeX || |
280 | npos.Y > Constants.RegionSize)) | 288 | npos.Y > regionSizeY)) |
281 | { | 289 | { |
282 | if (npos.X < 0.0) npos.X = 1.0f; | 290 | if (npos.X < 0.0) npos.X = 1.0f; |
283 | if (npos.Y < 0.0) npos.Y = 1.0f; | 291 | if (npos.Y < 0.0) npos.Y = 1.0f; |
284 | if (npos.Z < 0.0) npos.Z = 0.0f; | 292 | if (npos.Z < 0.0) npos.Z = 0.0f; |
285 | if (npos.X > Constants.RegionSize) npos.X = Constants.RegionSize - 1.0f; | 293 | if (npos.X > regionSizeX) npos.X = regionSizeX - 1.0f; |
286 | if (npos.Y > Constants.RegionSize) npos.Y = Constants.RegionSize - 1.0f; | 294 | if (npos.Y > regionSizeY) npos.Y = regionSizeY - 1.0f; |
287 | 295 | ||
296 | SceneObjectPart rootpart = sceneObject.RootPart; | ||
297 | rootpart.GroupPosition = npos; | ||
298 | |||
288 | foreach (SceneObjectPart part in sceneObject.Parts) | 299 | foreach (SceneObjectPart part in sceneObject.Parts) |
289 | { | 300 | { |
301 | if (part == rootpart) | ||
302 | continue; | ||
290 | part.GroupPosition = npos; | 303 | part.GroupPosition = npos; |
291 | } | 304 | } |
292 | sceneObject.RootPart.Velocity = Vector3.Zero; | 305 | rootpart.Velocity = Vector3.Zero; |
293 | sceneObject.RootPart.AngularVelocity = Vector3.Zero; | 306 | rootpart.AngularVelocity = Vector3.Zero; |
294 | sceneObject.RootPart.Acceleration = Vector3.Zero; | 307 | rootpart.Acceleration = Vector3.Zero; |
295 | sceneObject.RootPart.Velocity = Vector3.Zero; | ||
296 | } | 308 | } |
297 | } | 309 | } |
298 | 310 | ||
@@ -321,7 +333,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
321 | /// </returns> | 333 | /// </returns> |
322 | protected internal bool AddNewSceneObject(SceneObjectGroup sceneObject, bool attachToBackup, bool sendClientUpdates) | 334 | protected internal bool AddNewSceneObject(SceneObjectGroup sceneObject, bool attachToBackup, bool sendClientUpdates) |
323 | { | 335 | { |
324 | |||
325 | 336 | ||
326 | bool ret = AddSceneObject(sceneObject, attachToBackup, sendClientUpdates); | 337 | bool ret = AddSceneObject(sceneObject, attachToBackup, sendClientUpdates); |
327 | 338 | ||
@@ -428,9 +439,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
428 | { | 439 | { |
429 | Vector3 scale = part.Shape.Scale; | 440 | Vector3 scale = part.Shape.Scale; |
430 | 441 | ||
431 | scale.X = Math.Max(m_parentScene.m_minNonphys, Math.Min(m_parentScene.m_maxNonphys, scale.X)); | 442 | scale.X = Util.Clamp(scale.X, m_parentScene.m_minNonphys, m_parentScene.m_maxNonphys); |
432 | scale.Y = Math.Max(m_parentScene.m_minNonphys, Math.Min(m_parentScene.m_maxNonphys, scale.Y)); | 443 | scale.Y = Util.Clamp(scale.Y, m_parentScene.m_minNonphys, m_parentScene.m_maxNonphys); |
433 | scale.Z = Math.Max(m_parentScene.m_minNonphys, Math.Min(m_parentScene.m_maxNonphys, scale.Z)); | 444 | scale.Z = Util.Clamp(scale.Z, m_parentScene.m_minNonphys, m_parentScene.m_maxNonphys); |
434 | 445 | ||
435 | part.Shape.Scale = scale; | 446 | part.Shape.Scale = scale; |
436 | } | 447 | } |
@@ -439,26 +450,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
439 | 450 | ||
440 | sceneObject.AttachToScene(m_parentScene); | 451 | sceneObject.AttachToScene(m_parentScene); |
441 | 452 | ||
442 | |||
443 | Entities.Add(sceneObject); | 453 | Entities.Add(sceneObject); |
444 | 454 | ||
445 | |||
446 | lock (SceneObjectGroupsByFullID) | 455 | lock (SceneObjectGroupsByFullID) |
447 | SceneObjectGroupsByFullID[sceneObject.UUID] = sceneObject; | 456 | SceneObjectGroupsByFullID[sceneObject.UUID] = sceneObject; |
448 | 457 | ||
449 | lock (SceneObjectGroupsByFullPartID) | 458 | foreach (SceneObjectPart part in parts) |
450 | { | 459 | { |
451 | foreach (SceneObjectPart part in parts) | 460 | lock (SceneObjectGroupsByFullPartID) |
452 | SceneObjectGroupsByFullPartID[part.UUID] = sceneObject; | 461 | SceneObjectGroupsByFullPartID[part.UUID] = sceneObject; |
453 | } | ||
454 | 462 | ||
455 | lock (SceneObjectGroupsByLocalPartID) | 463 | lock (SceneObjectGroupsByLocalPartID) |
456 | { | ||
457 | // m_log.DebugFormat( | ||
458 | // "[SCENE GRAPH]: Adding scene object {0} {1} {2} to SceneObjectGroupsByLocalPartID in {3}", | ||
459 | // sceneObject.Name, sceneObject.UUID, sceneObject.LocalId, m_parentScene.RegionInfo.RegionName); | ||
460 | |||
461 | foreach (SceneObjectPart part in parts) | ||
462 | SceneObjectGroupsByLocalPartID[part.LocalId] = sceneObject; | 464 | SceneObjectGroupsByLocalPartID[part.LocalId] = sceneObject; |
463 | } | 465 | } |
464 | 466 | ||
@@ -475,14 +477,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
475 | { | 477 | { |
476 | // no tests, caller has responsability... | 478 | // no tests, caller has responsability... |
477 | lock (SceneObjectGroupsByFullPartID) | 479 | lock (SceneObjectGroupsByFullPartID) |
478 | { | ||
479 | SceneObjectGroupsByFullPartID[part.UUID] = grp; | 480 | SceneObjectGroupsByFullPartID[part.UUID] = grp; |
480 | } | ||
481 | 481 | ||
482 | lock (SceneObjectGroupsByLocalPartID) | 482 | lock (SceneObjectGroupsByLocalPartID) |
483 | { | ||
484 | SceneObjectGroupsByLocalPartID[part.LocalId] = grp; | 483 | SceneObjectGroupsByLocalPartID[part.LocalId] = grp; |
485 | } | ||
486 | } | 484 | } |
487 | 485 | ||
488 | /// <summary> | 486 | /// <summary> |
@@ -511,25 +509,23 @@ namespace OpenSim.Region.Framework.Scenes | |||
511 | if ((grp.RootPart.Flags & PrimFlags.Physics) == PrimFlags.Physics) | 509 | if ((grp.RootPart.Flags & PrimFlags.Physics) == PrimFlags.Physics) |
512 | RemovePhysicalPrim(grp.PrimCount); | 510 | RemovePhysicalPrim(grp.PrimCount); |
513 | } | 511 | } |
514 | 512 | ||
513 | bool ret = Entities.Remove(uuid); | ||
514 | |||
515 | lock (SceneObjectGroupsByFullID) | 515 | lock (SceneObjectGroupsByFullID) |
516 | SceneObjectGroupsByFullID.Remove(grp.UUID); | 516 | SceneObjectGroupsByFullID.Remove(grp.UUID); |
517 | 517 | ||
518 | lock (SceneObjectGroupsByFullPartID) | 518 | SceneObjectPart[] parts = grp.Parts; |
519 | for (int i = 0; i < parts.Length; i++) | ||
519 | { | 520 | { |
520 | SceneObjectPart[] parts = grp.Parts; | 521 | lock (SceneObjectGroupsByFullPartID) |
521 | for (int i = 0; i < parts.Length; i++) | ||
522 | SceneObjectGroupsByFullPartID.Remove(parts[i].UUID); | 522 | SceneObjectGroupsByFullPartID.Remove(parts[i].UUID); |
523 | } | ||
524 | 523 | ||
525 | lock (SceneObjectGroupsByLocalPartID) | 524 | lock (SceneObjectGroupsByLocalPartID) |
526 | { | ||
527 | SceneObjectPart[] parts = grp.Parts; | ||
528 | for (int i = 0; i < parts.Length; i++) | ||
529 | SceneObjectGroupsByLocalPartID.Remove(parts[i].LocalId); | 525 | SceneObjectGroupsByLocalPartID.Remove(parts[i].LocalId); |
530 | } | 526 | } |
531 | 527 | ||
532 | return Entities.Remove(uuid); | 528 | return ret; |
533 | } | 529 | } |
534 | 530 | ||
535 | /// <summary> | 531 | /// <summary> |
@@ -2133,21 +2129,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
2133 | lock (SceneObjectGroupsByFullID) | 2129 | lock (SceneObjectGroupsByFullID) |
2134 | SceneObjectGroupsByFullID[copy.UUID] = copy; | 2130 | SceneObjectGroupsByFullID[copy.UUID] = copy; |
2135 | 2131 | ||
2136 | SceneObjectPart[] children = copy.Parts; | 2132 | SceneObjectPart[] parts = copy.Parts; |
2137 | 2133 | foreach (SceneObjectPart part in parts) | |
2138 | lock (SceneObjectGroupsByFullPartID) | ||
2139 | { | 2134 | { |
2140 | SceneObjectGroupsByFullPartID[copy.UUID] = copy; | 2135 | lock (SceneObjectGroupsByFullPartID) |
2141 | foreach (SceneObjectPart part in children) | ||
2142 | SceneObjectGroupsByFullPartID[part.UUID] = copy; | 2136 | SceneObjectGroupsByFullPartID[part.UUID] = copy; |
2143 | } | 2137 | lock (SceneObjectGroupsByLocalPartID) |
2144 | |||
2145 | lock (SceneObjectGroupsByLocalPartID) | ||
2146 | { | ||
2147 | SceneObjectGroupsByLocalPartID[copy.LocalId] = copy; | ||
2148 | foreach (SceneObjectPart part in children) | ||
2149 | SceneObjectGroupsByLocalPartID[part.LocalId] = copy; | 2138 | SceneObjectGroupsByLocalPartID[part.LocalId] = copy; |
2150 | } | 2139 | } |
2140 | |||
2151 | // PROBABLE END OF FIXME | 2141 | // PROBABLE END OF FIXME |
2152 | 2142 | ||
2153 | // Since we copy from a source group that is in selected | 2143 | // Since we copy from a source group that is in selected |