aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs4
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs14
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneGraph.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs194
4 files changed, 75 insertions, 139 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
index 44472b2..29d01d6 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
@@ -191,10 +191,6 @@ namespace OpenSim.Region.Framework.Scenes
191 if (part == null) 191 if (part == null)
192 return; 192 return;
193 193
194 // The prim is in the process of being deleted.
195 if (null == part.ParentGroup.RootPart)
196 return;
197
198 // A deselect packet contains all the local prims being deselected. However, since selection is still 194 // A deselect packet contains all the local prims being deselected. However, since selection is still
199 // group based we only want the root prim to trigger a full update - otherwise on objects with many prims 195 // group based we only want the root prim to trigger a full update - otherwise on objects with many prims
200 // we end up sending many duplicate ObjectUpdates 196 // we end up sending many duplicate ObjectUpdates
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 7f5aea7..9794a34 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -1743,14 +1743,6 @@ namespace OpenSim.Region.Framework.Scenes
1743 foreach (SceneObjectGroup group in PrimsFromDB) 1743 foreach (SceneObjectGroup group in PrimsFromDB)
1744 { 1744 {
1745 EventManager.TriggerOnSceneObjectLoaded(group); 1745 EventManager.TriggerOnSceneObjectLoaded(group);
1746
1747 if (group.RootPart == null)
1748 {
1749 m_log.ErrorFormat(
1750 "[SCENE]: Found a SceneObjectGroup with m_rootPart == null and {0} children",
1751 group.Parts == null ? 0 : group.PrimCount);
1752 }
1753
1754 AddRestoredSceneObject(group, true, true); 1746 AddRestoredSceneObject(group, true, true);
1755 SceneObjectPart rootPart = group.GetChildPart(group.UUID); 1747 SceneObjectPart rootPart = group.GetChildPart(group.UUID);
1756 rootPart.Flags &= ~PrimFlags.Scripted; 1748 rootPart.Flags &= ~PrimFlags.Scripted;
@@ -4215,7 +4207,7 @@ namespace OpenSim.Region.Framework.Scenes
4215 // their scripts will actually run. 4207 // their scripts will actually run.
4216 // -- Leaf, Tue Aug 12 14:17:05 EDT 2008 4208 // -- Leaf, Tue Aug 12 14:17:05 EDT 2008
4217 SceneObjectPart parent = part.ParentGroup.RootPart; 4209 SceneObjectPart parent = part.ParentGroup.RootPart;
4218 if (parent != null && part.ParentGroup.IsAttachment) 4210 if (part.ParentGroup.IsAttachment)
4219 return ScriptDanger(parent, parent.GetWorldPosition()); 4211 return ScriptDanger(parent, parent.GetWorldPosition());
4220 else 4212 else
4221 return ScriptDanger(part, part.GetWorldPosition()); 4213 return ScriptDanger(part, part.GetWorldPosition());
@@ -5015,7 +5007,9 @@ namespace OpenSim.Region.Framework.Scenes
5015 if (rootPart.GroupPosition.Z < 0.0 || rootPart.GroupPosition.Z > 10000.0) 5007 if (rootPart.GroupPosition.Z < 0.0 || rootPart.GroupPosition.Z > 10000.0)
5016 { 5008 {
5017 delete = true; 5009 delete = true;
5018 } else { 5010 }
5011 else
5012 {
5019 ILandObject parcel = LandChannel.GetLandObject(rootPart.GroupPosition.X, rootPart.GroupPosition.Y); 5013 ILandObject parcel = LandChannel.GetLandObject(rootPart.GroupPosition.X, rootPart.GroupPosition.Y);
5020 5014
5021 if (parcel == null || parcel.LandData.Name == "NO LAND") 5015 if (parcel == null || parcel.LandData.Name == "NO LAND")
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index 17a1bcc..6f963ac 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -362,7 +362,7 @@ namespace OpenSim.Region.Framework.Scenes
362 /// </returns> 362 /// </returns>
363 protected bool AddSceneObject(SceneObjectGroup sceneObject, bool attachToBackup, bool sendClientUpdates) 363 protected bool AddSceneObject(SceneObjectGroup sceneObject, bool attachToBackup, bool sendClientUpdates)
364 { 364 {
365 if (sceneObject == null || sceneObject.RootPart == null || sceneObject.RootPart.UUID == UUID.Zero) 365 if (sceneObject == null || sceneObject.RootPart.UUID == UUID.Zero)
366 return false; 366 return false;
367 367
368 if (Entities.ContainsKey(sceneObject.UUID)) 368 if (Entities.ContainsKey(sceneObject.UUID))
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 74e8783..fca42c8 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -254,14 +254,7 @@ namespace OpenSim.Region.Framework.Scenes
254 /// </summary> 254 /// </summary>
255 public override string Name 255 public override string Name
256 { 256 {
257 get 257 get { return RootPart.Name; }
258 {
259 if (RootPart == null)
260 return String.Empty;
261 else
262 return RootPart.Name;
263 }
264
265 set { RootPart.Name = value; } 258 set { RootPart.Name = value; }
266 } 259 }
267 260
@@ -1054,7 +1047,7 @@ namespace OpenSim.Region.Framework.Scenes
1054 { 1047 {
1055 part.SetParent(this); 1048 part.SetParent(this);
1056 part.LinkNum = m_parts.Add(part.UUID, part); 1049 part.LinkNum = m_parts.Add(part.UUID, part);
1057 if (part.LinkNum == 2 && RootPart != null) 1050 if (part.LinkNum == 2)
1058 RootPart.LinkNum = 1; 1051 RootPart.LinkNum = 1;
1059 } 1052 }
1060 1053
@@ -1537,137 +1530,93 @@ namespace OpenSim.Region.Framework.Scenes
1537 1530
1538 public void applyImpulse(Vector3 impulse) 1531 public void applyImpulse(Vector3 impulse)
1539 { 1532 {
1540 // We check if rootpart is null here because scripts don't delete if you delete the host. 1533 if (IsAttachment)
1541 // This means that unfortunately, we can pass a null physics actor to Simulate!
1542 // Make sure we don't do that!
1543 SceneObjectPart rootpart = m_rootPart;
1544 if (rootpart != null)
1545 { 1534 {
1546 if (IsAttachment) 1535 ScenePresence avatar = m_scene.GetScenePresence(AttachedAvatar);
1536 if (avatar != null)
1547 { 1537 {
1548 ScenePresence avatar = m_scene.GetScenePresence(AttachedAvatar); 1538 avatar.PushForce(impulse);
1549 if (avatar != null)
1550 {
1551 avatar.PushForce(impulse);
1552 }
1553 } 1539 }
1554 else 1540 }
1541 else
1542 {
1543 if (RootPart.PhysActor != null)
1555 { 1544 {
1556 if (rootpart.PhysActor != null) 1545 RootPart.PhysActor.AddForce(impulse, true);
1557 { 1546 m_scene.PhysicsScene.AddPhysicsActorTaint(RootPart.PhysActor);
1558 rootpart.PhysActor.AddForce(impulse, true);
1559 m_scene.PhysicsScene.AddPhysicsActorTaint(rootpart.PhysActor);
1560 }
1561 } 1547 }
1562 } 1548 }
1563 } 1549 }
1564 1550
1565 public void applyAngularImpulse(Vector3 impulse) 1551 public void applyAngularImpulse(Vector3 impulse)
1566 { 1552 {
1567 // We check if rootpart is null here because scripts don't delete if you delete the host. 1553 if (RootPart.PhysActor != null)
1568 // This means that unfortunately, we can pass a null physics actor to Simulate!
1569 // Make sure we don't do that!
1570 SceneObjectPart rootpart = m_rootPart;
1571 if (rootpart != null)
1572 { 1554 {
1573 if (rootpart.PhysActor != null) 1555 if (!IsAttachment)
1574 { 1556 {
1575 if (!IsAttachment) 1557 RootPart.PhysActor.AddAngularForce(impulse, true);
1576 { 1558 m_scene.PhysicsScene.AddPhysicsActorTaint(RootPart.PhysActor);
1577 rootpart.PhysActor.AddAngularForce(impulse, true);
1578 m_scene.PhysicsScene.AddPhysicsActorTaint(rootpart.PhysActor);
1579 }
1580 } 1559 }
1581 } 1560 }
1582 } 1561 }
1583 1562
1584 public void setAngularImpulse(Vector3 impulse) 1563 public void setAngularImpulse(Vector3 impulse)
1585 { 1564 {
1586 // We check if rootpart is null here because scripts don't delete if you delete the host. 1565 if (RootPart.PhysActor != null)
1587 // This means that unfortunately, we can pass a null physics actor to Simulate!
1588 // Make sure we don't do that!
1589 SceneObjectPart rootpart = m_rootPart;
1590 if (rootpart != null)
1591 { 1566 {
1592 if (rootpart.PhysActor != null) 1567 if (!IsAttachment)
1593 { 1568 {
1594 if (!IsAttachment) 1569 RootPart.PhysActor.Torque = impulse;
1595 { 1570 m_scene.PhysicsScene.AddPhysicsActorTaint(RootPart.PhysActor);
1596 rootpart.PhysActor.Torque = impulse;
1597 m_scene.PhysicsScene.AddPhysicsActorTaint(rootpart.PhysActor);
1598 }
1599 } 1571 }
1600 } 1572 }
1601 } 1573 }
1602 1574
1603 public Vector3 GetTorque() 1575 public Vector3 GetTorque()
1604 { 1576 {
1605 // We check if rootpart is null here because scripts don't delete if you delete the host. 1577 if (RootPart.PhysActor != null)
1606 // This means that unfortunately, we can pass a null physics actor to Simulate!
1607 // Make sure we don't do that!
1608 SceneObjectPart rootpart = m_rootPart;
1609 if (rootpart != null)
1610 { 1578 {
1611 if (rootpart.PhysActor != null) 1579 if (!IsAttachment)
1612 { 1580 {
1613 if (!IsAttachment) 1581 Vector3 torque = RootPart.PhysActor.Torque;
1614 { 1582 return torque;
1615 Vector3 torque = rootpart.PhysActor.Torque;
1616 return torque;
1617 }
1618 } 1583 }
1619 } 1584 }
1585
1620 return Vector3.Zero; 1586 return Vector3.Zero;
1621 } 1587 }
1622 1588
1623 public void moveToTarget(Vector3 target, float tau) 1589 public void moveToTarget(Vector3 target, float tau)
1624 { 1590 {
1625 SceneObjectPart rootpart = m_rootPart; 1591 if (IsAttachment)
1626 if (rootpart != null)
1627 { 1592 {
1628 if (IsAttachment) 1593 ScenePresence avatar = m_scene.GetScenePresence(AttachedAvatar);
1594 if (avatar != null)
1629 { 1595 {
1630 ScenePresence avatar = m_scene.GetScenePresence(AttachedAvatar); 1596 avatar.MoveToTarget(target, false);
1631 if (avatar != null)
1632 {
1633 avatar.MoveToTarget(target, false);
1634 }
1635 } 1597 }
1636 else 1598 }
1599 else
1600 {
1601 if (RootPart.PhysActor != null)
1637 { 1602 {
1638 if (rootpart.PhysActor != null) 1603 RootPart.PhysActor.PIDTarget = target;
1639 { 1604 RootPart.PhysActor.PIDTau = tau;
1640 rootpart.PhysActor.PIDTarget = target; 1605 RootPart.PhysActor.PIDActive = true;
1641 rootpart.PhysActor.PIDTau = tau;
1642 rootpart.PhysActor.PIDActive = true;
1643 }
1644 } 1606 }
1645 } 1607 }
1646 } 1608 }
1647 1609
1648 public void stopMoveToTarget() 1610 public void stopMoveToTarget()
1649 { 1611 {
1650 SceneObjectPart rootpart = m_rootPart; 1612 if (RootPart.PhysActor != null)
1651 if (rootpart != null) 1613 RootPart.PhysActor.PIDActive = false;
1652 {
1653 if (rootpart.PhysActor != null)
1654 {
1655 rootpart.PhysActor.PIDActive = false;
1656 }
1657 }
1658 } 1614 }
1659 1615
1660 public void stopLookAt() 1616 public void stopLookAt()
1661 { 1617 {
1662 SceneObjectPart rootpart = m_rootPart; 1618 if (RootPart.PhysActor != null)
1663 if (rootpart != null) 1619 RootPart.PhysActor.APIDActive = false;
1664 {
1665 if (rootpart.PhysActor != null)
1666 {
1667 rootpart.PhysActor.APIDActive = false;
1668 }
1669 }
1670
1671 } 1620 }
1672 1621
1673 /// <summary> 1622 /// <summary>
@@ -1678,22 +1627,18 @@ namespace OpenSim.Region.Framework.Scenes
1678 /// <param name="tau">Number of seconds over which to reach target</param> 1627 /// <param name="tau">Number of seconds over which to reach target</param>
1679 public void SetHoverHeight(float height, PIDHoverType hoverType, float tau) 1628 public void SetHoverHeight(float height, PIDHoverType hoverType, float tau)
1680 { 1629 {
1681 SceneObjectPart rootpart = m_rootPart; 1630 if (RootPart.PhysActor != null)
1682 if (rootpart != null)
1683 { 1631 {
1684 if (rootpart.PhysActor != null) 1632 if (height != 0f)
1685 { 1633 {
1686 if (height != 0f) 1634 RootPart.PhysActor.PIDHoverHeight = height;
1687 { 1635 RootPart.PhysActor.PIDHoverType = hoverType;
1688 rootpart.PhysActor.PIDHoverHeight = height; 1636 RootPart.PhysActor.PIDTau = tau;
1689 rootpart.PhysActor.PIDHoverType = hoverType; 1637 RootPart.PhysActor.PIDHoverActive = true;
1690 rootpart.PhysActor.PIDTau = tau; 1638 }
1691 rootpart.PhysActor.PIDHoverActive = true; 1639 else
1692 } 1640 {
1693 else 1641 RootPart.PhysActor.PIDHoverActive = false;
1694 {
1695 rootpart.PhysActor.PIDHoverActive = false;
1696 }
1697 } 1642 }
1698 } 1643 }
1699 } 1644 }
@@ -3056,28 +3001,23 @@ namespace OpenSim.Region.Framework.Scenes
3056 int yaxis = 4; 3001 int yaxis = 4;
3057 int zaxis = 8; 3002 int zaxis = 8;
3058 3003
3059 if (m_rootPart != null) 3004 setX = ((axis & xaxis) != 0) ? true : false;
3060 { 3005 setY = ((axis & yaxis) != 0) ? true : false;
3061 setX = ((axis & xaxis) != 0) ? true : false; 3006 setZ = ((axis & zaxis) != 0) ? true : false;
3062 setY = ((axis & yaxis) != 0) ? true : false;
3063 setZ = ((axis & zaxis) != 0) ? true : false;
3064
3065 float setval = (rotate10 > 0) ? 1f : 0f;
3066 3007
3067 if (setX) 3008 float setval = (rotate10 > 0) ? 1f : 0f;
3068 m_rootPart.RotationAxis.X = setval;
3069 if (setY)
3070 m_rootPart.RotationAxis.Y = setval;
3071 if (setZ)
3072 m_rootPart.RotationAxis.Z = setval;
3073 3009
3074 if (setX || setY || setZ) 3010 if (setX)
3075 { 3011 RootPart.RotationAxis.X = setval;
3076 m_rootPart.SetPhysicsAxisRotation(); 3012 if (setY)
3077 } 3013 RootPart.RotationAxis.Y = setval;
3014 if (setZ)
3015 RootPart.RotationAxis.Z = setval;
3078 3016
3079 } 3017 if (setX || setY || setZ)
3018 RootPart.SetPhysicsAxisRotation();
3080 } 3019 }
3020
3081 public int registerRotTargetWaypoint(Quaternion target, float tolerance) 3021 public int registerRotTargetWaypoint(Quaternion target, float tolerance)
3082 { 3022 {
3083 scriptRotTarget waypoint = new scriptRotTarget(); 3023 scriptRotTarget waypoint = new scriptRotTarget();
@@ -3205,7 +3145,13 @@ namespace OpenSim.Region.Framework.Scenes
3205 foreach (uint idx in m_rotTargets.Keys) 3145 foreach (uint idx in m_rotTargets.Keys)
3206 { 3146 {
3207 scriptRotTarget target = m_rotTargets[idx]; 3147 scriptRotTarget target = m_rotTargets[idx];
3208 double angle = Math.Acos(target.targetRot.X * m_rootPart.RotationOffset.X + target.targetRot.Y * m_rootPart.RotationOffset.Y + target.targetRot.Z * m_rootPart.RotationOffset.Z + target.targetRot.W * m_rootPart.RotationOffset.W) * 2; 3148 double angle
3149 = Math.Acos(
3150 target.targetRot.X * m_rootPart.RotationOffset.X
3151 + target.targetRot.Y * m_rootPart.RotationOffset.Y
3152 + target.targetRot.Z * m_rootPart.RotationOffset.Z
3153 + target.targetRot.W * m_rootPart.RotationOffset.W)
3154 * 2;
3209 if (angle < 0) angle = -angle; 3155 if (angle < 0) angle = -angle;
3210 if (angle > Math.PI) angle = (Math.PI * 2 - angle); 3156 if (angle > Math.PI) angle = (Math.PI * 2 - angle);
3211 if (angle <= target.tolerance) 3157 if (angle <= target.tolerance)