aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2010-08-10 20:15:44 +0100
committerJustin Clark-Casey (justincc)2010-08-10 20:15:44 +0100
commit2a1c11fda9b4ab948b7821ef2423270793a5e577 (patch)
treea8c3ea840817db72172eedec8e312509d4b08ec0 /OpenSim
parentReduce number of paths in SOP code by setting flags via Flags property rather... (diff)
downloadopensim-SC_OLD-2a1c11fda9b4ab948b7821ef2423270793a5e577.zip
opensim-SC_OLD-2a1c11fda9b4ab948b7821ef2423270793a5e577.tar.gz
opensim-SC_OLD-2a1c11fda9b4ab948b7821ef2423270793a5e577.tar.bz2
opensim-SC_OLD-2a1c11fda9b4ab948b7821ef2423270793a5e577.tar.xz
On shift-copy of an object, set up a new physics actor (as appropriate) for every copied prim, not just the root
This addresses http://opensimulator.org/mantis/view.php?id=4295
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs4
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs38
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs22
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs7
4 files changed, 48 insertions, 23 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index 87a5832..5473d23 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -4599,6 +4599,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4599 } 4599 }
4600 } 4600 }
4601 4601
4602// m_log.DebugFormat(
4603// "[LLCLIENTVIEW]: Constructing client update for part {0} {1} with flags {2}, localId {3}",
4604// data.Name, update.FullID, flags, update.ID);
4605
4602 update.UpdateFlags = (uint)flags; 4606 update.UpdateFlags = (uint)flags;
4603 4607
4604 #endregion PrimFlags 4608 #endregion PrimFlags
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 0d3f64c..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
@@ -1006,7 +1016,11 @@ namespace OpenSim.Region.Framework.Scenes
1006 public bool CreateSelected 1016 public bool CreateSelected
1007 { 1017 {
1008 get { return m_createSelected; } 1018 get { return m_createSelected; }
1009 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 }
1010 } 1024 }
1011 1025
1012 #endregion 1026 #endregion
@@ -1531,7 +1545,7 @@ namespace OpenSim.Region.Framework.Scenes
1531 } 1545 }
1532 else 1546 else
1533 { 1547 {
1534 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);
1535 } 1549 }
1536 } 1550 }
1537 } 1551 }
@@ -1801,7 +1815,7 @@ namespace OpenSim.Region.Framework.Scenes
1801 /// that's not wholesome. Had to make Scene public 1815 /// that's not wholesome. Had to make Scene public
1802 //PhysActor = null; 1816 //PhysActor = null;
1803 1817
1804 if ((ObjectFlags & (uint)PrimFlags.Phantom) == 0) 1818 if ((Flags & PrimFlags.Phantom) == 0)
1805 { 1819 {
1806 if (UsePhysics) 1820 if (UsePhysics)
1807 { 1821 {
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs
index d7da9cb..c9662ef 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs
@@ -77,6 +77,13 @@ namespace OpenSim.Region.Framework.Scenes.Tests
77 77
78 Assert.That(dupePart1.Flags, Is.EqualTo(part1.Flags)); 78 Assert.That(dupePart1.Flags, Is.EqualTo(part1.Flags));
79 Assert.That(dupePart2.Flags, Is.EqualTo(part2.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 */
80 } 87 }
81 } 88 }
82} \ No newline at end of file 89} \ No newline at end of file