diff options
author | Melanie | 2010-08-10 19:34:57 +0100 |
---|---|---|
committer | Melanie | 2010-08-10 19:34:57 +0100 |
commit | 75f92faeb4df65eaca9397a8b8370645bbb1018a (patch) | |
tree | 98a36c63a23bc7af569b06ff71a6630cf2e4ce9b /OpenSim/Region/Framework/Scenes | |
parent | Avoid truncation of error message during region creation. (diff) | |
parent | Merge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff) | |
download | opensim-SC_OLD-75f92faeb4df65eaca9397a8b8370645bbb1018a.zip opensim-SC_OLD-75f92faeb4df65eaca9397a8b8370645bbb1018a.tar.gz opensim-SC_OLD-75f92faeb4df65eaca9397a8b8370645bbb1018a.tar.bz2 opensim-SC_OLD-75f92faeb4df65eaca9397a8b8370645bbb1018a.tar.xz |
Merge branch 'master' of melanie@opensimulator.org:/var/git/opensim
Diffstat (limited to 'OpenSim/Region/Framework/Scenes')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 38 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 62 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs | 42 |
3 files changed, 92 insertions, 50 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index a2c3c07..6c1f3c2 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -1563,23 +1563,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1563 | if (userExposed) | 1563 | if (userExposed) |
1564 | dupe.m_rootPart.TrimPermissions(); | 1564 | dupe.m_rootPart.TrimPermissions(); |
1565 | 1565 | ||
1566 | /// may need to create a new Physics actor. | ||
1567 | if (dupe.RootPart.PhysActor != null && userExposed) | ||
1568 | { | ||
1569 | PrimitiveBaseShape pbs = dupe.RootPart.Shape; | ||
1570 | |||
1571 | dupe.RootPart.PhysActor = m_scene.PhysicsScene.AddPrimShape( | ||
1572 | dupe.RootPart.Name, | ||
1573 | pbs, | ||
1574 | dupe.RootPart.AbsolutePosition, | ||
1575 | dupe.RootPart.Scale, | ||
1576 | dupe.RootPart.RotationOffset, | ||
1577 | dupe.RootPart.PhysActor.IsPhysical); | ||
1578 | |||
1579 | dupe.RootPart.PhysActor.LocalID = dupe.RootPart.LocalId; | ||
1580 | dupe.RootPart.DoPhysicsPropertyUpdate(dupe.RootPart.PhysActor.IsPhysical, true); | ||
1581 | } | ||
1582 | |||
1583 | List<SceneObjectPart> partList; | 1566 | List<SceneObjectPart> partList; |
1584 | 1567 | ||
1585 | lock (m_parts) | 1568 | lock (m_parts) |
@@ -1598,11 +1581,28 @@ namespace OpenSim.Region.Framework.Scenes | |||
1598 | if (part.UUID != m_rootPart.UUID) | 1581 | if (part.UUID != m_rootPart.UUID) |
1599 | { | 1582 | { |
1600 | SceneObjectPart newPart = dupe.CopyPart(part, OwnerID, GroupID, userExposed); | 1583 | SceneObjectPart newPart = dupe.CopyPart(part, OwnerID, GroupID, userExposed); |
1601 | |||
1602 | newPart.LinkNum = part.LinkNum; | 1584 | newPart.LinkNum = part.LinkNum; |
1603 | } | 1585 | } |
1604 | } | ||
1605 | 1586 | ||
1587 | // Need to duplicate the physics actor as well | ||
1588 | if (part.PhysActor != null && userExposed) | ||
1589 | { | ||
1590 | PrimitiveBaseShape pbs = part.Shape; | ||
1591 | |||
1592 | part.PhysActor | ||
1593 | = m_scene.PhysicsScene.AddPrimShape( | ||
1594 | part.Name, | ||
1595 | pbs, | ||
1596 | part.AbsolutePosition, | ||
1597 | part.Scale, | ||
1598 | part.RotationOffset, | ||
1599 | part.PhysActor.IsPhysical); | ||
1600 | |||
1601 | part.PhysActor.LocalID = part.LocalId; | ||
1602 | part.DoPhysicsPropertyUpdate(part.PhysActor.IsPhysical, true); | ||
1603 | } | ||
1604 | } | ||
1605 | |||
1606 | if (userExposed) | 1606 | if (userExposed) |
1607 | { | 1607 | { |
1608 | dupe.UpdateParentIDs(); | 1608 | dupe.UpdateParentIDs(); |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 0c35eec..cf718cb 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -150,8 +150,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
150 | // TODO: This needs to be persisted in next XML version update! | 150 | // TODO: This needs to be persisted in next XML version update! |
151 | [XmlIgnore] | 151 | [XmlIgnore] |
152 | public readonly int[] PayPrice = {-2,-2,-2,-2,-2}; | 152 | public readonly int[] PayPrice = {-2,-2,-2,-2,-2}; |
153 | |||
153 | [XmlIgnore] | 154 | [XmlIgnore] |
154 | public PhysicsActor PhysActor; | 155 | public PhysicsActor PhysActor |
156 | { | ||
157 | get { return m_physActor; } | ||
158 | set | ||
159 | { | ||
160 | // m_log.DebugFormat("[SOP]: PhysActor set to {0} for {1} {2}", value, Name, UUID); | ||
161 | m_physActor = value; | ||
162 | } | ||
163 | } | ||
155 | 164 | ||
156 | //Xantor 20080528 Sound stuff: | 165 | //Xantor 20080528 Sound stuff: |
157 | // Note: This isn't persisted in the database right now, as the fields for that aren't just there yet. | 166 | // Note: This isn't persisted in the database right now, as the fields for that aren't just there yet. |
@@ -297,6 +306,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
297 | /// </summary> | 306 | /// </summary> |
298 | private byte m_updateFlag; | 307 | private byte m_updateFlag; |
299 | 308 | ||
309 | private PhysicsActor m_physActor; | ||
300 | protected Vector3 m_acceleration; | 310 | protected Vector3 m_acceleration; |
301 | protected Vector3 m_angularVelocity; | 311 | protected Vector3 m_angularVelocity; |
302 | 312 | ||
@@ -396,7 +406,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
396 | // this appears to have the same UUID (!) as the prim. If this isn't the case, one can't drag items from | 406 | // this appears to have the same UUID (!) as the prim. If this isn't the case, one can't drag items from |
397 | // the prim into an agent inventory (Linden client reports that the "Object not found for drop" in its log | 407 | // the prim into an agent inventory (Linden client reports that the "Object not found for drop" in its log |
398 | 408 | ||
399 | _flags = 0; | 409 | Flags = 0; |
400 | CreateSelected = true; | 410 | CreateSelected = true; |
401 | 411 | ||
402 | TrimPermissions(); | 412 | TrimPermissions(); |
@@ -424,7 +434,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
424 | private uint _groupMask = (uint)PermissionMask.None; | 434 | private uint _groupMask = (uint)PermissionMask.None; |
425 | private uint _everyoneMask = (uint)PermissionMask.None; | 435 | private uint _everyoneMask = (uint)PermissionMask.None; |
426 | private uint _nextOwnerMask = (uint)PermissionMask.All; | 436 | private uint _nextOwnerMask = (uint)PermissionMask.All; |
427 | private PrimFlags _flags = 0; | 437 | private PrimFlags _flags = PrimFlags.None; |
428 | private DateTime m_expires; | 438 | private DateTime m_expires; |
429 | private DateTime m_rezzed; | 439 | private DateTime m_rezzed; |
430 | private bool m_createSelected = false; | 440 | private bool m_createSelected = false; |
@@ -471,10 +481,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
471 | set { m_inventory.Items = value; } | 481 | set { m_inventory.Items = value; } |
472 | } | 482 | } |
473 | 483 | ||
484 | /// <summary> | ||
485 | /// This is idential to the Flags property, except that the returned value is uint rather than PrimFlags | ||
486 | /// </summary> | ||
487 | [Obsolete("Use Flags property instead")] | ||
474 | public uint ObjectFlags | 488 | public uint ObjectFlags |
475 | { | 489 | { |
476 | get { return (uint)_flags; } | 490 | get { return (uint)Flags; } |
477 | set { _flags = (PrimFlags)value; } | 491 | set { Flags = (PrimFlags)value; } |
478 | } | 492 | } |
479 | 493 | ||
480 | public UUID UUID | 494 | public UUID UUID |
@@ -1002,7 +1016,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
1002 | public bool CreateSelected | 1016 | public bool CreateSelected |
1003 | { | 1017 | { |
1004 | get { return m_createSelected; } | 1018 | get { return m_createSelected; } |
1005 | set { m_createSelected = value; } | 1019 | set |
1020 | { | ||
1021 | // m_log.DebugFormat("[SOP]: Setting CreateSelected to {0} for {1} {2}", value, Name, UUID); | ||
1022 | m_createSelected = value; | ||
1023 | } | ||
1006 | } | 1024 | } |
1007 | 1025 | ||
1008 | #endregion | 1026 | #endregion |
@@ -1169,7 +1187,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
1169 | public PrimFlags Flags | 1187 | public PrimFlags Flags |
1170 | { | 1188 | { |
1171 | get { return _flags; } | 1189 | get { return _flags; } |
1172 | set { _flags = value; } | 1190 | set |
1191 | { | ||
1192 | // m_log.DebugFormat("[SOP]: Setting flags for {0} {1} to {2}", UUID, Name, value); | ||
1193 | _flags = value; | ||
1194 | } | ||
1173 | } | 1195 | } |
1174 | 1196 | ||
1175 | [XmlIgnore] | 1197 | [XmlIgnore] |
@@ -1305,7 +1327,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1305 | if ((ObjectFlags & (uint) flag) == 0) | 1327 | if ((ObjectFlags & (uint) flag) == 0) |
1306 | { | 1328 | { |
1307 | //m_log.Debug("Adding flag: " + ((PrimFlags) flag).ToString()); | 1329 | //m_log.Debug("Adding flag: " + ((PrimFlags) flag).ToString()); |
1308 | _flags |= flag; | 1330 | Flags |= flag; |
1309 | 1331 | ||
1310 | if (flag == PrimFlags.TemporaryOnRez) | 1332 | if (flag == PrimFlags.TemporaryOnRez) |
1311 | ResetExpire(); | 1333 | ResetExpire(); |
@@ -1523,7 +1545,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1523 | } | 1545 | } |
1524 | else | 1546 | else |
1525 | { | 1547 | { |
1526 | m_log.DebugFormat("[SPEW]: physics actor is null for {0} with parent {1}", UUID, this.ParentGroup.UUID); | 1548 | m_log.DebugFormat("[SOP]: physics actor is null for {0} with parent {1}", UUID, this.ParentGroup.UUID); |
1527 | } | 1549 | } |
1528 | } | 1550 | } |
1529 | } | 1551 | } |
@@ -1793,7 +1815,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1793 | /// that's not wholesome. Had to make Scene public | 1815 | /// that's not wholesome. Had to make Scene public |
1794 | //PhysActor = null; | 1816 | //PhysActor = null; |
1795 | 1817 | ||
1796 | if ((ObjectFlags & (uint)PrimFlags.Phantom) == 0) | 1818 | if ((Flags & PrimFlags.Phantom) == 0) |
1797 | { | 1819 | { |
1798 | if (UsePhysics) | 1820 | if (UsePhysics) |
1799 | { | 1821 | { |
@@ -1940,12 +1962,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
1940 | } | 1962 | } |
1941 | 1963 | ||
1942 | public uint GetEffectiveObjectFlags() | 1964 | public uint GetEffectiveObjectFlags() |
1943 | { | 1965 | { |
1944 | PrimFlags f = _flags; | 1966 | // Commenting this section of code out since it doesn't actually do anything, as enums are handled by |
1945 | if (m_parentGroup == null || m_parentGroup.RootPart == this) | 1967 | // value rather than reference |
1946 | f &= ~(PrimFlags.Touch | PrimFlags.Money); | 1968 | // PrimFlags f = _flags; |
1969 | // if (m_parentGroup == null || m_parentGroup.RootPart == this) | ||
1970 | // f &= ~(PrimFlags.Touch | PrimFlags.Money); | ||
1947 | 1971 | ||
1948 | return (uint)_flags | (uint)LocalFlags; | 1972 | return (uint)Flags | (uint)LocalFlags; |
1949 | } | 1973 | } |
1950 | 1974 | ||
1951 | public Vector3 GetGeometricCenter() | 1975 | public Vector3 GetGeometricCenter() |
@@ -2696,10 +2720,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
2696 | public void RemFlag(PrimFlags flag) | 2720 | public void RemFlag(PrimFlags flag) |
2697 | { | 2721 | { |
2698 | // PrimFlags prevflag = Flags; | 2722 | // PrimFlags prevflag = Flags; |
2699 | if ((ObjectFlags & (uint) flag) != 0) | 2723 | if ((Flags & flag) != 0) |
2700 | { | 2724 | { |
2701 | //m_log.Debug("Removing flag: " + ((PrimFlags)flag).ToString()); | 2725 | //m_log.Debug("Removing flag: " + ((PrimFlags)flag).ToString()); |
2702 | _flags &= ~flag; | 2726 | Flags &= ~flag; |
2703 | } | 2727 | } |
2704 | //m_log.Debug("prev: " + prevflag.ToString() + " curr: " + Flags.ToString()); | 2728 | //m_log.Debug("prev: " + prevflag.ToString() + " curr: " + Flags.ToString()); |
2705 | //ScheduleFullUpdate(); | 2729 | //ScheduleFullUpdate(); |
@@ -2990,10 +3014,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
2990 | 3014 | ||
2991 | if (remoteClient.AgentId == _ownerID) | 3015 | if (remoteClient.AgentId == _ownerID) |
2992 | { | 3016 | { |
2993 | if ((uint) (_flags & PrimFlags.CreateSelected) != 0) | 3017 | if ((Flags & PrimFlags.CreateSelected) != 0) |
2994 | { | 3018 | { |
2995 | clientFlags |= (uint) PrimFlags.CreateSelected; | 3019 | clientFlags |= (uint) PrimFlags.CreateSelected; |
2996 | _flags &= ~PrimFlags.CreateSelected; | 3020 | Flags &= ~PrimFlags.CreateSelected; |
2997 | } | 3021 | } |
2998 | } | 3022 | } |
2999 | //bool isattachment = IsAttachment; | 3023 | //bool isattachment = IsAttachment; |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs index 8a103d7..c9662ef 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs | |||
@@ -48,24 +48,42 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
48 | TestHelper.InMethod(); | 48 | TestHelper.InMethod(); |
49 | Scene scene = SceneSetupHelpers.SetupScene(); | 49 | Scene scene = SceneSetupHelpers.SetupScene(); |
50 | 50 | ||
51 | UUID ownerUuid = new UUID("00000000-0000-0000-0000-000000000010"); | 51 | UUID ownerId = new UUID("00000000-0000-0000-0000-000000000010"); |
52 | string objName = "obj1"; | 52 | string part1Name = "part1"; |
53 | UUID objUuid = new UUID("00000000-0000-0000-0000-000000000001"); | 53 | UUID part1Id = new UUID("00000000-0000-0000-0000-000000000001"); |
54 | string part2Name = "part2"; | ||
55 | UUID part2Id = new UUID("00000000-0000-0000-0000-000000000002"); | ||
54 | 56 | ||
55 | SceneObjectPart part | 57 | SceneObjectPart part1 |
56 | = new SceneObjectPart(ownerUuid, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero) | 58 | = new SceneObjectPart(ownerId, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero) |
57 | { Name = objName, UUID = objUuid }; | 59 | { Name = part1Name, UUID = part1Id }; |
60 | SceneObjectGroup so = new SceneObjectGroup(part1); | ||
61 | SceneObjectPart part2 | ||
62 | = new SceneObjectPart(ownerId, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero) | ||
63 | { Name = part2Name, UUID = part2Id }; | ||
64 | so.AddPart(part2); | ||
58 | 65 | ||
59 | scene.AddNewSceneObject(new SceneObjectGroup(part), false); | 66 | scene.AddNewSceneObject(so, false); |
60 | 67 | ||
61 | SceneObjectGroup duplicatedSo | 68 | SceneObjectGroup dupeSo |
62 | = scene.SceneGraph.DuplicateObject( | 69 | = scene.SceneGraph.DuplicateObject( |
63 | part.LocalId, new Vector3(10, 0, 0), 0, ownerUuid, UUID.Zero, Quaternion.Identity); | 70 | part1.LocalId, new Vector3(10, 0, 0), 0, ownerId, UUID.Zero, Quaternion.Identity); |
71 | Assert.That(dupeSo.Children.Count, Is.EqualTo(2)); | ||
64 | 72 | ||
65 | Assert.That(duplicatedSo.Children.Count, Is.EqualTo(1)); | 73 | SceneObjectPart dupePart1 = dupeSo.GetLinkNumPart(1); |
66 | Assert.That(duplicatedSo.RootPart.LocalId, Is.Not.EqualTo(part.LocalId)); | 74 | SceneObjectPart dupePart2 = dupeSo.GetLinkNumPart(2); |
75 | Assert.That(dupePart1.LocalId, Is.Not.EqualTo(part1.LocalId)); | ||
76 | Assert.That(dupePart2.LocalId, Is.Not.EqualTo(part2.LocalId)); | ||
67 | 77 | ||
68 | //SceneObjectPart retrievedPart = scene.GetSceneObjectPart(objUuid); | 78 | Assert.That(dupePart1.Flags, Is.EqualTo(part1.Flags)); |
79 | Assert.That(dupePart2.Flags, Is.EqualTo(part2.Flags)); | ||
80 | |||
81 | /* | ||
82 | Assert.That(part1.PhysActor, Is.Not.Null); | ||
83 | Assert.That(part2.PhysActor, Is.Not.Null); | ||
84 | Assert.That(dupePart1.PhysActor, Is.Not.Null); | ||
85 | Assert.That(dupePart2.PhysActor, Is.Not.Null); | ||
86 | */ | ||
69 | } | 87 | } |
70 | } | 88 | } |
71 | } \ No newline at end of file | 89 | } \ No newline at end of file |