diff options
author | David Walter Seikel | 2016-11-03 21:44:39 +1000 |
---|---|---|
committer | David Walter Seikel | 2016-11-03 21:44:39 +1000 |
commit | 134f86e8d5c414409631b25b8c6f0ee45fbd8631 (patch) | |
tree | 216b89d3fb89acfb81be1e440c25c41ab09fa96d /OpenSim/Region/Framework/Scenes/SceneGraph.cs | |
parent | More changing to production grid. Double oops. (diff) | |
download | opensim-SC-134f86e8d5c414409631b25b8c6f0ee45fbd8631.zip opensim-SC-134f86e8d5c414409631b25b8c6f0ee45fbd8631.tar.gz opensim-SC-134f86e8d5c414409631b25b8c6f0ee45fbd8631.tar.bz2 opensim-SC-134f86e8d5c414409631b25b8c6f0ee45fbd8631.tar.xz |
Initial update to OpenSim 0.8.2.1 source code.
Diffstat (limited to '')
-rwxr-xr-x[-rw-r--r--] | OpenSim/Region/Framework/Scenes/SceneGraph.cs | 175 |
1 files changed, 127 insertions, 48 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index a4383fd..e0080f2 100644..100755 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs | |||
@@ -34,7 +34,7 @@ using OpenMetaverse.Packets; | |||
34 | using log4net; | 34 | using log4net; |
35 | using OpenSim.Framework; | 35 | using OpenSim.Framework; |
36 | using OpenSim.Region.Framework.Scenes.Types; | 36 | using OpenSim.Region.Framework.Scenes.Types; |
37 | using OpenSim.Region.Physics.Manager; | 37 | using OpenSim.Region.PhysicsModules.SharedBase; |
38 | using OpenSim.Region.Framework.Interfaces; | 38 | using OpenSim.Region.Framework.Interfaces; |
39 | 39 | ||
40 | namespace OpenSim.Region.Framework.Scenes | 40 | namespace OpenSim.Region.Framework.Scenes |
@@ -67,7 +67,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
67 | protected Scene m_parentScene; | 67 | protected Scene m_parentScene; |
68 | protected Dictionary<UUID, SceneObjectGroup> m_updateList = new Dictionary<UUID, SceneObjectGroup>(); | 68 | protected Dictionary<UUID, SceneObjectGroup> m_updateList = new Dictionary<UUID, SceneObjectGroup>(); |
69 | protected int m_numRootAgents = 0; | 69 | protected int m_numRootAgents = 0; |
70 | protected int m_numTotalPrim = 0; | ||
70 | protected int m_numPrim = 0; | 71 | protected int m_numPrim = 0; |
72 | protected int m_numMesh = 0; | ||
71 | protected int m_numChildAgents = 0; | 73 | protected int m_numChildAgents = 0; |
72 | protected int m_physicalPrim = 0; | 74 | protected int m_physicalPrim = 0; |
73 | 75 | ||
@@ -109,7 +111,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
109 | 111 | ||
110 | public PhysicsScene PhysicsScene | 112 | public PhysicsScene PhysicsScene |
111 | { | 113 | { |
112 | get { return _PhyScene; } | 114 | get |
115 | { | ||
116 | if (_PhyScene == null) | ||
117 | _PhyScene = m_parentScene.RequestModuleInterface<PhysicsScene>(); | ||
118 | return _PhyScene; | ||
119 | } | ||
113 | set | 120 | set |
114 | { | 121 | { |
115 | // If we're not doing the initial set | 122 | // If we're not doing the initial set |
@@ -155,9 +162,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
155 | 162 | ||
156 | // PhysX does this (runs in the background). | 163 | // PhysX does this (runs in the background). |
157 | 164 | ||
158 | if (_PhyScene.IsThreaded) | 165 | if (PhysicsScene.IsThreaded) |
159 | { | 166 | { |
160 | _PhyScene.GetResults(); | 167 | PhysicsScene.GetResults(); |
161 | } | 168 | } |
162 | } | 169 | } |
163 | 170 | ||
@@ -197,7 +204,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
197 | // position). | 204 | // position). |
198 | // | 205 | // |
199 | // Therefore, JointMoved and JointDeactivated events will be fired as a result of the following Simulate(). | 206 | // Therefore, JointMoved and JointDeactivated events will be fired as a result of the following Simulate(). |
200 | return _PhyScene.Simulate((float)elapsed); | 207 | return PhysicsScene.Simulate((float)elapsed); |
201 | } | 208 | } |
202 | 209 | ||
203 | protected internal void UpdateScenePresenceMovement() | 210 | protected internal void UpdateScenePresenceMovement() |
@@ -368,7 +375,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
368 | 375 | ||
369 | SceneObjectPart[] parts = sceneObject.Parts; | 376 | SceneObjectPart[] parts = sceneObject.Parts; |
370 | 377 | ||
371 | // Clamp child prim sizes and add child prims to the m_numPrim count | 378 | // Clamp the sizes (scales) of the child prims and add the child prims to the count of all primitives |
379 | // (meshes and geometric primitives) in the scene; add child prims to m_numTotalPrim count | ||
372 | if (m_parentScene.m_clampPrimSize) | 380 | if (m_parentScene.m_clampPrimSize) |
373 | { | 381 | { |
374 | foreach (SceneObjectPart part in parts) | 382 | foreach (SceneObjectPart part in parts) |
@@ -382,7 +390,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
382 | part.Shape.Scale = scale; | 390 | part.Shape.Scale = scale; |
383 | } | 391 | } |
384 | } | 392 | } |
385 | m_numPrim += parts.Length; | 393 | m_numTotalPrim += parts.Length; |
394 | |||
395 | // Go through all parts (geometric primitives and meshes) of this Scene Object | ||
396 | foreach (SceneObjectPart part in parts) | ||
397 | { | ||
398 | // Keep track of the total number of meshes or geometric primitives now in the scene; | ||
399 | // determine which object this is based on its primitive type: sculpted (sculpt) prim refers to | ||
400 | // a mesh and all other prims (i.e. box, sphere, etc) are geometric primitives | ||
401 | if (part.GetPrimType() == PrimType.SCULPT) | ||
402 | m_numMesh++; | ||
403 | else | ||
404 | m_numPrim++; | ||
405 | } | ||
386 | 406 | ||
387 | sceneObject.AttachToScene(m_parentScene); | 407 | sceneObject.AttachToScene(m_parentScene); |
388 | 408 | ||
@@ -437,7 +457,21 @@ namespace OpenSim.Region.Framework.Scenes | |||
437 | 457 | ||
438 | if (!resultOfObjectLinked) | 458 | if (!resultOfObjectLinked) |
439 | { | 459 | { |
440 | m_numPrim -= grp.PrimCount; | 460 | // Decrement the total number of primitives (meshes and geometric primitives) |
461 | // that are part of the Scene Object being removed | ||
462 | m_numTotalPrim -= grp.PrimCount; | ||
463 | |||
464 | // Go through all parts (primitives and meshes) of this Scene Object | ||
465 | foreach (SceneObjectPart part in grp.Parts) | ||
466 | { | ||
467 | // Keep track of the total number of meshes or geometric primitives left in the scene; | ||
468 | // determine which object this is based on its primitive type: sculpted (sculpt) prim refers to | ||
469 | // a mesh and all other prims (i.e. box, sphere, etc) are geometric primitives | ||
470 | if (part.GetPrimType() == PrimType.SCULPT) | ||
471 | m_numMesh--; | ||
472 | else | ||
473 | m_numPrim--; | ||
474 | } | ||
441 | 475 | ||
442 | if ((grp.RootPart.Flags & PrimFlags.Physics) == PrimFlags.Physics) | 476 | if ((grp.RootPart.Flags & PrimFlags.Physics) == PrimFlags.Physics) |
443 | RemovePhysicalPrim(grp.PrimCount); | 477 | RemovePhysicalPrim(grp.PrimCount); |
@@ -519,12 +553,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
519 | 553 | ||
520 | protected internal void AddPhysicalPrim(int number) | 554 | protected internal void AddPhysicalPrim(int number) |
521 | { | 555 | { |
522 | m_physicalPrim++; | 556 | m_physicalPrim += number; |
523 | } | 557 | } |
524 | 558 | ||
525 | protected internal void RemovePhysicalPrim(int number) | 559 | protected internal void RemovePhysicalPrim(int number) |
526 | { | 560 | { |
527 | m_physicalPrim--; | 561 | m_physicalPrim -= number; |
528 | } | 562 | } |
529 | 563 | ||
530 | protected internal void AddToScriptLPS(int number) | 564 | protected internal void AddToScriptLPS(int number) |
@@ -561,39 +595,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
561 | protected internal ScenePresence CreateAndAddChildScenePresence( | 595 | protected internal ScenePresence CreateAndAddChildScenePresence( |
562 | IClientAPI client, AvatarAppearance appearance, PresenceType type) | 596 | IClientAPI client, AvatarAppearance appearance, PresenceType type) |
563 | { | 597 | { |
564 | ScenePresence newAvatar = null; | ||
565 | |||
566 | // ScenePresence always defaults to child agent | 598 | // ScenePresence always defaults to child agent |
567 | newAvatar = new ScenePresence(client, m_parentScene, appearance, type); | 599 | ScenePresence presence = new ScenePresence(client, m_parentScene, appearance, type); |
568 | |||
569 | AddScenePresence(newAvatar); | ||
570 | |||
571 | return newAvatar; | ||
572 | } | ||
573 | |||
574 | /// <summary> | ||
575 | /// Add a presence to the scene | ||
576 | /// </summary> | ||
577 | /// <param name="presence"></param> | ||
578 | protected internal void AddScenePresence(ScenePresence presence) | ||
579 | { | ||
580 | // Always a child when added to the scene | ||
581 | bool child = presence.IsChildAgent; | ||
582 | |||
583 | if (child) | ||
584 | { | ||
585 | m_numChildAgents++; | ||
586 | } | ||
587 | else | ||
588 | { | ||
589 | m_numRootAgents++; | ||
590 | presence.AddToPhysicalScene(false); | ||
591 | } | ||
592 | 600 | ||
593 | Entities[presence.UUID] = presence; | 601 | Entities[presence.UUID] = presence; |
594 | 602 | ||
595 | lock (m_presenceLock) | 603 | lock (m_presenceLock) |
596 | { | 604 | { |
605 | m_numChildAgents++; | ||
606 | |||
597 | Dictionary<UUID, ScenePresence> newmap = new Dictionary<UUID, ScenePresence>(m_scenePresenceMap); | 607 | Dictionary<UUID, ScenePresence> newmap = new Dictionary<UUID, ScenePresence>(m_scenePresenceMap); |
598 | List<ScenePresence> newlist = new List<ScenePresence>(m_scenePresenceArray); | 608 | List<ScenePresence> newlist = new List<ScenePresence>(m_scenePresenceArray); |
599 | 609 | ||
@@ -604,7 +614,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
604 | } | 614 | } |
605 | else | 615 | else |
606 | { | 616 | { |
607 | // Remember the old presene reference from the dictionary | 617 | // Remember the old presence reference from the dictionary |
608 | ScenePresence oldref = newmap[presence.UUID]; | 618 | ScenePresence oldref = newmap[presence.UUID]; |
609 | // Replace the presence reference in the dictionary with the new value | 619 | // Replace the presence reference in the dictionary with the new value |
610 | newmap[presence.UUID] = presence; | 620 | newmap[presence.UUID] = presence; |
@@ -616,6 +626,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
616 | m_scenePresenceMap = newmap; | 626 | m_scenePresenceMap = newmap; |
617 | m_scenePresenceArray = newlist; | 627 | m_scenePresenceArray = newlist; |
618 | } | 628 | } |
629 | |||
630 | return presence; | ||
619 | } | 631 | } |
620 | 632 | ||
621 | /// <summary> | 633 | /// <summary> |
@@ -709,9 +721,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
709 | 721 | ||
710 | public int GetTotalObjectsCount() | 722 | public int GetTotalObjectsCount() |
711 | { | 723 | { |
724 | return m_numTotalPrim; | ||
725 | } | ||
726 | |||
727 | public int GetTotalPrimObjectsCount() | ||
728 | { | ||
712 | return m_numPrim; | 729 | return m_numPrim; |
713 | } | 730 | } |
714 | 731 | ||
732 | public int GetTotalMeshObjectsCount() | ||
733 | { | ||
734 | return m_numMesh; | ||
735 | } | ||
736 | |||
715 | public int GetActiveObjectsCount() | 737 | public int GetActiveObjectsCount() |
716 | { | 738 | { |
717 | return m_physicalPrim; | 739 | return m_physicalPrim; |
@@ -794,7 +816,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
794 | List<ScenePresence> presences = GetScenePresences(); | 816 | List<ScenePresence> presences = GetScenePresences(); |
795 | foreach (ScenePresence presence in presences) | 817 | foreach (ScenePresence presence in presences) |
796 | { | 818 | { |
797 | if (presence.Firstname == firstName && presence.Lastname == lastName) | 819 | if (string.Equals(presence.Firstname, firstName, StringComparison.CurrentCultureIgnoreCase) |
820 | && string.Equals(presence.Lastname, lastName, StringComparison.CurrentCultureIgnoreCase)) | ||
798 | return presence; | 821 | return presence; |
799 | } | 822 | } |
800 | return null; | 823 | return null; |
@@ -1348,12 +1371,23 @@ namespace OpenSim.Region.Framework.Scenes | |||
1348 | /// <summary> | 1371 | /// <summary> |
1349 | /// Update the position of the given group. | 1372 | /// Update the position of the given group. |
1350 | /// </summary> | 1373 | /// </summary> |
1351 | /// <param name="localID"></param> | 1374 | /// <param name="localId"></param> |
1352 | /// <param name="pos"></param> | 1375 | /// <param name="pos"></param> |
1353 | /// <param name="remoteClient"></param> | 1376 | /// <param name="remoteClient"></param> |
1354 | public void UpdatePrimGroupPosition(uint localID, Vector3 pos, IClientAPI remoteClient) | 1377 | public void UpdatePrimGroupPosition(uint localId, Vector3 pos, IClientAPI remoteClient) |
1355 | { | 1378 | { |
1356 | SceneObjectGroup group = GetGroupByPrim(localID); | 1379 | UpdatePrimGroupPosition(localId, pos, remoteClient.AgentId); |
1380 | } | ||
1381 | |||
1382 | /// <summary> | ||
1383 | /// Update the position of the given group. | ||
1384 | /// </summary> | ||
1385 | /// <param name="localId"></param> | ||
1386 | /// <param name="pos"></param> | ||
1387 | /// <param name="updatingAgentId"></param> | ||
1388 | public void UpdatePrimGroupPosition(uint localId, Vector3 pos, UUID updatingAgentId) | ||
1389 | { | ||
1390 | SceneObjectGroup group = GetGroupByPrim(localId); | ||
1357 | 1391 | ||
1358 | if (group != null) | 1392 | if (group != null) |
1359 | { | 1393 | { |
@@ -1364,7 +1398,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1364 | } | 1398 | } |
1365 | else | 1399 | else |
1366 | { | 1400 | { |
1367 | if (m_parentScene.Permissions.CanMoveObject(group.UUID, remoteClient.AgentId) | 1401 | if (m_parentScene.Permissions.CanMoveObject(group.UUID, updatingAgentId) |
1368 | && m_parentScene.Permissions.CanObjectEntry(group.UUID, false, pos)) | 1402 | && m_parentScene.Permissions.CanObjectEntry(group.UUID, false, pos)) |
1369 | { | 1403 | { |
1370 | group.UpdateGroupPosition(pos); | 1404 | group.UpdateGroupPosition(pos); |
@@ -1408,7 +1442,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1408 | /// <param name="SetPhantom"></param> | 1442 | /// <param name="SetPhantom"></param> |
1409 | /// <param name="remoteClient"></param> | 1443 | /// <param name="remoteClient"></param> |
1410 | protected internal void UpdatePrimFlags( | 1444 | protected internal void UpdatePrimFlags( |
1411 | uint localID, bool UsePhysics, bool SetTemporary, bool SetPhantom, IClientAPI remoteClient) | 1445 | uint localID, bool UsePhysics, bool SetTemporary, bool SetPhantom, ExtraPhysicsData PhysData, IClientAPI remoteClient) |
1412 | { | 1446 | { |
1413 | SceneObjectGroup group = GetGroupByPrim(localID); | 1447 | SceneObjectGroup group = GetGroupByPrim(localID); |
1414 | if (group != null) | 1448 | if (group != null) |
@@ -1416,7 +1450,28 @@ namespace OpenSim.Region.Framework.Scenes | |||
1416 | if (m_parentScene.Permissions.CanEditObject(group.UUID, remoteClient.AgentId)) | 1450 | if (m_parentScene.Permissions.CanEditObject(group.UUID, remoteClient.AgentId)) |
1417 | { | 1451 | { |
1418 | // VolumeDetect can't be set via UI and will always be off when a change is made there | 1452 | // VolumeDetect can't be set via UI and will always be off when a change is made there |
1419 | group.UpdatePrimFlags(localID, UsePhysics, SetTemporary, SetPhantom, false); | 1453 | // now only change volume dtc if phantom off |
1454 | |||
1455 | if (PhysData.PhysShapeType == PhysShapeType.invalid) // check for extraPhysics data | ||
1456 | { | ||
1457 | bool vdtc; | ||
1458 | if (SetPhantom) // if phantom keep volumedtc | ||
1459 | vdtc = group.RootPart.VolumeDetectActive; | ||
1460 | else // else turn it off | ||
1461 | vdtc = false; | ||
1462 | |||
1463 | group.UpdatePrimFlags(localID, UsePhysics, SetTemporary, SetPhantom, vdtc); | ||
1464 | } | ||
1465 | else | ||
1466 | { | ||
1467 | SceneObjectPart part = GetSceneObjectPart(localID); | ||
1468 | if (part != null) | ||
1469 | { | ||
1470 | part.UpdateExtraPhysics(PhysData); | ||
1471 | if (part.UpdatePhysRequired) | ||
1472 | remoteClient.SendPartPhysicsProprieties(part); | ||
1473 | } | ||
1474 | } | ||
1420 | } | 1475 | } |
1421 | } | 1476 | } |
1422 | } | 1477 | } |
@@ -1435,8 +1490,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
1435 | { | 1490 | { |
1436 | if (m_parentScene.Permissions.CanMoveObject(group.UUID, remoteClient.AgentId))// && PermissionsMngr.) | 1491 | if (m_parentScene.Permissions.CanMoveObject(group.UUID, remoteClient.AgentId))// && PermissionsMngr.) |
1437 | { | 1492 | { |
1438 | group.GrabMovement(offset, pos, remoteClient); | 1493 | group.GrabMovement(objectID, offset, pos, remoteClient); |
1439 | } | 1494 | } |
1495 | |||
1440 | // This is outside the above permissions condition | 1496 | // This is outside the above permissions condition |
1441 | // so that if the object is locked the client moving the object | 1497 | // so that if the object is locked the client moving the object |
1442 | // get's it's position on the simulator even if it was the same as before | 1498 | // get's it's position on the simulator even if it was the same as before |
@@ -1624,6 +1680,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
1624 | /// <param name="childPrims"></param> | 1680 | /// <param name="childPrims"></param> |
1625 | protected internal void LinkObjects(SceneObjectPart root, List<SceneObjectPart> children) | 1681 | protected internal void LinkObjects(SceneObjectPart root, List<SceneObjectPart> children) |
1626 | { | 1682 | { |
1683 | if (root.KeyframeMotion != null) | ||
1684 | { | ||
1685 | root.KeyframeMotion.Stop(); | ||
1686 | root.KeyframeMotion = null; | ||
1687 | } | ||
1688 | |||
1627 | SceneObjectGroup parentGroup = root.ParentGroup; | 1689 | SceneObjectGroup parentGroup = root.ParentGroup; |
1628 | if (parentGroup == null) return; | 1690 | if (parentGroup == null) return; |
1629 | 1691 | ||
@@ -1701,6 +1763,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
1701 | { | 1763 | { |
1702 | if (part != null) | 1764 | if (part != null) |
1703 | { | 1765 | { |
1766 | if (part.KeyframeMotion != null) | ||
1767 | { | ||
1768 | part.KeyframeMotion.Stop(); | ||
1769 | part.KeyframeMotion = null; | ||
1770 | } | ||
1704 | if (part.ParentGroup.PrimCount != 1) // Skip single | 1771 | if (part.ParentGroup.PrimCount != 1) // Skip single |
1705 | { | 1772 | { |
1706 | if (part.LinkNum < 2) // Root | 1773 | if (part.LinkNum < 2) // Root |
@@ -1884,7 +1951,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1884 | if (original == null) | 1951 | if (original == null) |
1885 | { | 1952 | { |
1886 | m_log.WarnFormat( | 1953 | m_log.WarnFormat( |
1887 | "[SCENEGRAPH]: Attempt to duplicate nonexistant prim id {0} by {1}", originalPrimID, AgentID); | 1954 | "[SCENEGRAPH]: Attempt to duplicate nonexistent prim id {0} by {1}", originalPrimID, AgentID); |
1888 | 1955 | ||
1889 | return null; | 1956 | return null; |
1890 | } | 1957 | } |
@@ -1947,7 +2014,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
1947 | // think it's selected, so it will never send a deselect... | 2014 | // think it's selected, so it will never send a deselect... |
1948 | copy.IsSelected = false; | 2015 | copy.IsSelected = false; |
1949 | 2016 | ||
1950 | m_numPrim += copy.Parts.Length; | 2017 | m_numTotalPrim += copy.Parts.Length; |
2018 | |||
2019 | // Go through all parts (primitives and meshes) of this Scene Object | ||
2020 | foreach (SceneObjectPart part in copy.Parts) | ||
2021 | { | ||
2022 | // Keep track of the total number of meshes or geometric primitives now in the scene; | ||
2023 | // determine which object this is based on its primitive type: sculpted (sculpt) prim refers to | ||
2024 | // a mesh and all other prims (i.e. box, sphere, etc) are geometric primitives | ||
2025 | if (part.GetPrimType() == PrimType.SCULPT) | ||
2026 | m_numMesh++; | ||
2027 | else | ||
2028 | m_numPrim++; | ||
2029 | } | ||
1951 | 2030 | ||
1952 | if (rot != Quaternion.Identity) | 2031 | if (rot != Quaternion.Identity) |
1953 | { | 2032 | { |