diff options
author | Justin Clark-Casey (justincc) | 2011-09-01 02:09:41 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2011-09-01 02:11:00 +0100 |
commit | 7eca929686bd2db1cb42f5c9740fd1d186cdc8b1 (patch) | |
tree | 775f07f365acb56bc6043831d5832c2dac468ade | |
parent | refactor: use ParentGroup.UUID directly instead of SOP.GetRootPartUUID() (diff) | |
download | opensim-SC-7eca929686bd2db1cb42f5c9740fd1d186cdc8b1.zip opensim-SC-7eca929686bd2db1cb42f5c9740fd1d186cdc8b1.tar.gz opensim-SC-7eca929686bd2db1cb42f5c9740fd1d186cdc8b1.tar.bz2 opensim-SC-7eca929686bd2db1cb42f5c9740fd1d186cdc8b1.tar.xz |
Eliminate pointless checks of SOG.RootPart != null
It's never possible for SOG to have no RootPart, except in the first few picosends of the big bang when it's pulled from region persistence or deserialized
Diffstat (limited to '')
12 files changed, 119 insertions, 205 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/ObjectAdd.cs b/OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/ObjectAdd.cs index 15139a3..1c47f0e 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/ObjectAdd.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/ObjectAdd.cs | |||
@@ -322,8 +322,6 @@ namespace OpenSim.Region.ClientStack.Linden | |||
322 | rootpart.NextOwnerMask = next_owner_mask; | 322 | rootpart.NextOwnerMask = next_owner_mask; |
323 | rootpart.Material = (byte)material; | 323 | rootpart.Material = (byte)material; |
324 | 324 | ||
325 | |||
326 | |||
327 | m_scene.PhysicsScene.AddPhysicsActorTaint(rootpart.PhysActor); | 325 | m_scene.PhysicsScene.AddPhysicsActorTaint(rootpart.PhysActor); |
328 | 326 | ||
329 | responsedata["int_response_code"] = 200; //501; //410; //404; | 327 | responsedata["int_response_code"] = 200; //501; //410; //404; |
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index 587f35e..ffe76a8 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | |||
@@ -470,12 +470,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
470 | return; | 470 | return; |
471 | } | 471 | } |
472 | 472 | ||
473 | if (null == att.RootPart) | ||
474 | { | ||
475 | m_log.Error("[ATTACHMENTS MODULE]: Unable to save attachment for a prim without the rootpart!"); | ||
476 | return; | ||
477 | } | ||
478 | |||
479 | InventoryItemBase item = new InventoryItemBase(itemID, sp.UUID); | 473 | InventoryItemBase item = new InventoryItemBase(itemID, sp.UUID); |
480 | item = m_scene.InventoryService.GetItem(item); | 474 | item = m_scene.InventoryService.GetItem(item); |
481 | bool changed = sp.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID); | 475 | bool changed = sp.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID); |
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 82bdf20..766656c 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | |||
@@ -1772,7 +1772,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1772 | foreach (SceneObjectGroup gobj in m_attachments) | 1772 | foreach (SceneObjectGroup gobj in m_attachments) |
1773 | { | 1773 | { |
1774 | // If the prim group is null then something must have happened to it! | 1774 | // If the prim group is null then something must have happened to it! |
1775 | if (gobj != null && gobj.RootPart != null) | 1775 | if (gobj != null) |
1776 | { | 1776 | { |
1777 | // Set the parent localID to 0 so it transfers over properly. | 1777 | // Set the parent localID to 0 so it transfers over properly. |
1778 | gobj.RootPart.SetParentLocalId(0); | 1778 | gobj.RootPart.SetParentLocalId(0); |
diff --git a/OpenSim/Region/DataSnapshot/ObjectSnapshot.cs b/OpenSim/Region/DataSnapshot/ObjectSnapshot.cs index 5e75cae..0bb4044 100644 --- a/OpenSim/Region/DataSnapshot/ObjectSnapshot.cs +++ b/OpenSim/Region/DataSnapshot/ObjectSnapshot.cs | |||
@@ -118,59 +118,56 @@ namespace OpenSim.Region.DataSnapshot.Providers | |||
118 | { | 118 | { |
119 | SceneObjectPart m_rootPart = obj.RootPart; | 119 | SceneObjectPart m_rootPart = obj.RootPart; |
120 | 120 | ||
121 | if (m_rootPart != null) | 121 | ILandObject land = m_scene.LandChannel.GetLandObject(m_rootPart.AbsolutePosition.X, m_rootPart.AbsolutePosition.Y); |
122 | { | ||
123 | ILandObject land = m_scene.LandChannel.GetLandObject(m_rootPart.AbsolutePosition.X, m_rootPart.AbsolutePosition.Y); | ||
124 | 122 | ||
125 | XmlNode xmlobject = nodeFactory.CreateNode(XmlNodeType.Element, "object", ""); | 123 | XmlNode xmlobject = nodeFactory.CreateNode(XmlNodeType.Element, "object", ""); |
126 | node = nodeFactory.CreateNode(XmlNodeType.Element, "uuid", ""); | 124 | node = nodeFactory.CreateNode(XmlNodeType.Element, "uuid", ""); |
127 | node.InnerText = obj.UUID.ToString(); | 125 | node.InnerText = obj.UUID.ToString(); |
128 | xmlobject.AppendChild(node); | 126 | xmlobject.AppendChild(node); |
129 | 127 | ||
130 | node = nodeFactory.CreateNode(XmlNodeType.Element, "title", ""); | 128 | node = nodeFactory.CreateNode(XmlNodeType.Element, "title", ""); |
131 | node.InnerText = m_rootPart.Name; | 129 | node.InnerText = m_rootPart.Name; |
132 | xmlobject.AppendChild(node); | 130 | xmlobject.AppendChild(node); |
133 | |||
134 | node = nodeFactory.CreateNode(XmlNodeType.Element, "description", ""); | ||
135 | node.InnerText = m_rootPart.Description; | ||
136 | xmlobject.AppendChild(node); | ||
137 | 131 | ||
138 | node = nodeFactory.CreateNode(XmlNodeType.Element, "flags", ""); | 132 | node = nodeFactory.CreateNode(XmlNodeType.Element, "description", ""); |
139 | node.InnerText = String.Format("{0:x}", (uint)m_rootPart.Flags); | 133 | node.InnerText = m_rootPart.Description; |
140 | xmlobject.AppendChild(node); | 134 | xmlobject.AppendChild(node); |
141 | 135 | ||
142 | node = nodeFactory.CreateNode(XmlNodeType.Element, "regionuuid", ""); | 136 | node = nodeFactory.CreateNode(XmlNodeType.Element, "flags", ""); |
143 | node.InnerText = m_scene.RegionInfo.RegionSettings.RegionUUID.ToString(); | 137 | node.InnerText = String.Format("{0:x}", (uint)m_rootPart.Flags); |
144 | xmlobject.AppendChild(node); | 138 | xmlobject.AppendChild(node); |
145 | 139 | ||
146 | if (land != null && land.LandData != null) | 140 | node = nodeFactory.CreateNode(XmlNodeType.Element, "regionuuid", ""); |
147 | { | 141 | node.InnerText = m_scene.RegionInfo.RegionSettings.RegionUUID.ToString(); |
148 | node = nodeFactory.CreateNode(XmlNodeType.Element, "parceluuid", ""); | 142 | xmlobject.AppendChild(node); |
149 | node.InnerText = land.LandData.GlobalID.ToString(); | ||
150 | xmlobject.AppendChild(node); | ||
151 | } | ||
152 | else | ||
153 | { | ||
154 | // Something is wrong with this object. Let's not list it. | ||
155 | m_log.WarnFormat("[DATASNAPSHOT]: Bad data for object {0} ({1}) in region {2}", obj.Name, obj.UUID, m_scene.RegionInfo.RegionName); | ||
156 | continue; | ||
157 | } | ||
158 | 143 | ||
159 | node = nodeFactory.CreateNode(XmlNodeType.Element, "location", ""); | 144 | if (land != null && land.LandData != null) |
160 | Vector3 loc = obj.AbsolutePosition; | 145 | { |
161 | node.InnerText = loc.X.ToString() + "/" + loc.Y.ToString() + "/" + loc.Z.ToString(); | 146 | node = nodeFactory.CreateNode(XmlNodeType.Element, "parceluuid", ""); |
147 | node.InnerText = land.LandData.GlobalID.ToString(); | ||
162 | xmlobject.AppendChild(node); | 148 | xmlobject.AppendChild(node); |
149 | } | ||
150 | else | ||
151 | { | ||
152 | // Something is wrong with this object. Let's not list it. | ||
153 | m_log.WarnFormat("[DATASNAPSHOT]: Bad data for object {0} ({1}) in region {2}", obj.Name, obj.UUID, m_scene.RegionInfo.RegionName); | ||
154 | continue; | ||
155 | } | ||
163 | 156 | ||
164 | string bestImage = GuessImage(obj); | 157 | node = nodeFactory.CreateNode(XmlNodeType.Element, "location", ""); |
165 | if (bestImage != string.Empty) | 158 | Vector3 loc = obj.AbsolutePosition; |
166 | { | 159 | node.InnerText = loc.X.ToString() + "/" + loc.Y.ToString() + "/" + loc.Z.ToString(); |
167 | node = nodeFactory.CreateNode(XmlNodeType.Element, "image", ""); | 160 | xmlobject.AppendChild(node); |
168 | node.InnerText = bestImage; | ||
169 | xmlobject.AppendChild(node); | ||
170 | } | ||
171 | 161 | ||
172 | parent.AppendChild(xmlobject); | 162 | string bestImage = GuessImage(obj); |
163 | if (bestImage != string.Empty) | ||
164 | { | ||
165 | node = nodeFactory.CreateNode(XmlNodeType.Element, "image", ""); | ||
166 | node.InnerText = bestImage; | ||
167 | xmlobject.AppendChild(node); | ||
173 | } | 168 | } |
169 | |||
170 | parent.AppendChild(xmlobject); | ||
174 | } | 171 | } |
175 | #pragma warning disable 0612 | 172 | #pragma warning disable 0612 |
176 | } | 173 | } |
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) |
diff --git a/OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs b/OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs index 421da36..feca7d3 100644 --- a/OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs +++ b/OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs | |||
@@ -381,7 +381,6 @@ namespace OpenSim.Region.OptionalModules.World.TreePopulator | |||
381 | { | 381 | { |
382 | SceneObjectPart selectedTree = ((SceneObjectGroup)m_scene.Entities[tree]).RootPart; | 382 | SceneObjectPart selectedTree = ((SceneObjectGroup)m_scene.Entities[tree]).RootPart; |
383 | 383 | ||
384 | |||
385 | m_scene.DeleteSceneObject(selectedTree.ParentGroup, false); | 384 | m_scene.DeleteSceneObject(selectedTree.ParentGroup, false); |
386 | m_scene.ForEachClient(delegate(IClientAPI controller) | 385 | m_scene.ForEachClient(delegate(IClientAPI controller) |
387 | { | 386 | { |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 8d95546..2fd98f6 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -2767,8 +2767,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2767 | // If either of these are null, then there was an unknown error. | 2767 | // If either of these are null, then there was an unknown error. |
2768 | if (new_group == null) | 2768 | if (new_group == null) |
2769 | continue; | 2769 | continue; |
2770 | if (new_group.RootPart == null) | ||
2771 | continue; | ||
2772 | 2770 | ||
2773 | // objects rezzed with this method are die_at_edge by default. | 2771 | // objects rezzed with this method are die_at_edge by default. |
2774 | new_group.RootPart.SetDieAtEdge(true); | 2772 | new_group.RootPart.SetDieAtEdge(true); |
@@ -6983,10 +6981,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6983 | { | 6981 | { |
6984 | // we are a child. The rotation values will be set to the one of root modified by rot, as in SL. Don't ask. | 6982 | // we are a child. The rotation values will be set to the one of root modified by rot, as in SL. Don't ask. |
6985 | SceneObjectPart rootPart = part.ParentGroup.RootPart; | 6983 | SceneObjectPart rootPart = part.ParentGroup.RootPart; |
6986 | if (rootPart != null) // better safe than sorry | 6984 | SetRot(part, rootPart.RotationOffset * Rot2Quaternion(q)); |
6987 | { | ||
6988 | SetRot(part, rootPart.RotationOffset * Rot2Quaternion(q)); | ||
6989 | } | ||
6990 | } | 6985 | } |
6991 | 6986 | ||
6992 | break; | 6987 | break; |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 7f3d84d..3ddd79b 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | |||
@@ -673,8 +673,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
673 | 673 | ||
674 | m_host.AddScriptLPS(1); | 674 | m_host.AddScriptLPS(1); |
675 | 675 | ||
676 | if (m_host.ParentGroup.RootPart != null) | 676 | m_host.ParentGroup.RootPart.SetFloatOnWater(floatYN); |
677 | m_host.ParentGroup.RootPart.SetFloatOnWater(floatYN); | ||
678 | } | 677 | } |
679 | 678 | ||
680 | // Teleport functions | 679 | // Teleport functions |
diff --git a/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs b/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs index 08dc71e..5c4174e 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs | |||
@@ -99,11 +99,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
99 | m_log.Debug("Paid: " + objectID + " from " + agentID + ", amount " + amount); | 99 | m_log.Debug("Paid: " + objectID + " from " + agentID + ", amount " + amount); |
100 | 100 | ||
101 | part = part.ParentGroup.RootPart; | 101 | part = part.ParentGroup.RootPart; |
102 | 102 | money(part.LocalId, agentID, amount); | |
103 | if (part != null) | ||
104 | { | ||
105 | money(part.LocalId, agentID, amount); | ||
106 | } | ||
107 | } | 103 | } |
108 | 104 | ||
109 | /// <summary> | 105 | /// <summary> |