aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorDiva Canto2012-04-06 20:35:01 -0700
committerDiva Canto2012-04-06 20:35:01 -0700
commit806082cd6eef607791aced965056eb4ce24ac5ce (patch)
treebda5bbedd106638459f2e6674a674b0d0a25ab73
parentMoved the inventory manipulation from HGEntityTransferModule to HGInventoryAc... (diff)
parentRather than having a FromFolderID property on every single prim and only ever... (diff)
downloadopensim-SC_OLD-806082cd6eef607791aced965056eb4ce24ac5ce.zip
opensim-SC_OLD-806082cd6eef607791aced965056eb4ce24ac5ce.tar.gz
opensim-SC_OLD-806082cd6eef607791aced965056eb4ce24ac5ce.tar.bz2
opensim-SC_OLD-806082cd6eef607791aced965056eb4ce24ac5ce.tar.xz
Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs4
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs20
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs5
-rw-r--r--OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs8
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs8
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs39
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs162
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs16
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs124
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs10
10 files changed, 268 insertions, 128 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
index 9395233..ae5cbff 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
@@ -4271,7 +4271,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4271 block.OwnerID = sop.OwnerID; 4271 block.OwnerID = sop.OwnerID;
4272 4272
4273 block.ItemID = sop.FromUserInventoryItemID; 4273 block.ItemID = sop.FromUserInventoryItemID;
4274 block.FolderID = UUID.Zero; // sop.FromFolderID ?? 4274 block.FolderID = UUID.Zero; // sog.FromFolderID ??
4275 block.FromTaskID = UUID.Zero; // ??? 4275 block.FromTaskID = UUID.Zero; // ???
4276 block.InventorySerial = (short)sop.InventorySerial; 4276 block.InventorySerial = (short)sop.InventorySerial;
4277 4277
@@ -4957,7 +4957,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4957 update.MediaURL = Utils.EmptyBytes; // FIXME: Support this in OpenSim 4957 update.MediaURL = Utils.EmptyBytes; // FIXME: Support this in OpenSim
4958 if (data.ParentGroup.IsAttachment) 4958 if (data.ParentGroup.IsAttachment)
4959 { 4959 {
4960 update.NameValue = Util.StringToBytes256("AttachItemID STRING RW SV " + data.FromItemID); 4960 update.NameValue = Util.StringToBytes256("AttachItemID STRING RW SV " + data.ParentGroup.FromItemID);
4961 update.State = (byte)((data.ParentGroup.AttachmentPoint % 16) * 16 + (data.ParentGroup.AttachmentPoint / 16)); 4961 update.State = (byte)((data.ParentGroup.AttachmentPoint % 16) * 16 + (data.ParentGroup.AttachmentPoint / 16));
4962 } 4962 }
4963 else 4963 else
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
index 7086e6c..faa413e 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
@@ -239,7 +239,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
239 // At the moment we can only deal with a single attachment 239 // At the moment we can only deal with a single attachment
240 if (attachments.Count != 0) 240 if (attachments.Count != 0)
241 { 241 {
242 UUID oldAttachmentItemID = attachments[0].GetFromItemID(); 242 UUID oldAttachmentItemID = attachments[0].FromItemID;
243 243
244 if (oldAttachmentItemID != UUID.Zero) 244 if (oldAttachmentItemID != UUID.Zero)
245 DetachSingleAttachmentToInvInternal(sp, oldAttachmentItemID); 245 DetachSingleAttachmentToInvInternal(sp, oldAttachmentItemID);
@@ -250,7 +250,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
250 } 250 }
251 251
252 // Add the new attachment to inventory if we don't already have it. 252 // Add the new attachment to inventory if we don't already have it.
253 UUID newAttachmentItemID = group.GetFromItemID(); 253 UUID newAttachmentItemID = group.FromItemID;
254 if (newAttachmentItemID == UUID.Zero) 254 if (newAttachmentItemID == UUID.Zero)
255 newAttachmentItemID = AddSceneObjectAsNewAttachmentInInv(sp, group).ID; 255 newAttachmentItemID = AddSceneObjectAsNewAttachmentInInv(sp, group).ID;
256 256
@@ -285,7 +285,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
285 List<SceneObjectGroup> existingAttachments = sp.GetAttachments(); 285 List<SceneObjectGroup> existingAttachments = sp.GetAttachments();
286 foreach (SceneObjectGroup so in existingAttachments) 286 foreach (SceneObjectGroup so in existingAttachments)
287 { 287 {
288 if (so.GetFromItemID() == itemID) 288 if (so.FromItemID == itemID)
289 { 289 {
290 alreadyOn = true; 290 alreadyOn = true;
291 break; 291 break;
@@ -342,7 +342,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
342 if (so.AttachedAvatar != sp.UUID) 342 if (so.AttachedAvatar != sp.UUID)
343 return; 343 return;
344 344
345 UUID inventoryID = so.GetFromItemID(); 345 UUID inventoryID = so.FromItemID;
346 346
347// m_log.DebugFormat( 347// m_log.DebugFormat(
348// "[ATTACHMENTS MODULE]: In DetachSingleAttachmentToGround(), object is {0} {1}, associated item is {2}", 348// "[ATTACHMENTS MODULE]: In DetachSingleAttachmentToGround(), object is {0} {1}, associated item is {2}",
@@ -359,9 +359,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
359 m_scene.AvatarFactory.QueueAppearanceSave(sp.UUID); 359 m_scene.AvatarFactory.QueueAppearanceSave(sp.UUID);
360 360
361 sp.RemoveAttachment(so); 361 sp.RemoveAttachment(so);
362 so.FromItemID = UUID.Zero;
362 363
363 SceneObjectPart rootPart = so.RootPart; 364 SceneObjectPart rootPart = so.RootPart;
364 rootPart.FromItemID = UUID.Zero;
365 so.AbsolutePosition = sp.AbsolutePosition; 365 so.AbsolutePosition = sp.AbsolutePosition;
366 so.AttachedAvatar = UUID.Zero; 366 so.AttachedAvatar = UUID.Zero;
367 rootPart.SetParentLocalId(0); 367 rootPart.SetParentLocalId(0);
@@ -475,7 +475,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
475 475
476 string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(grp); 476 string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(grp);
477 477
478 InventoryItemBase item = new InventoryItemBase(grp.GetFromItemID(), sp.UUID); 478 InventoryItemBase item = new InventoryItemBase(grp.FromItemID, sp.UUID);
479 item = m_scene.InventoryService.GetItem(item); 479 item = m_scene.InventoryService.GetItem(item);
480 480
481 if (item != null) 481 if (item != null)
@@ -647,7 +647,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
647 item.CreationDate = Util.UnixTimeSinceEpoch(); 647 item.CreationDate = Util.UnixTimeSinceEpoch();
648 648
649 // sets itemID so client can show item as 'attached' in inventory 649 // sets itemID so client can show item as 'attached' in inventory
650 grp.SetFromItemID(item.ID); 650 grp.FromItemID = item.ID;
651 651
652 if (m_scene.AddInventoryItem(item)) 652 if (m_scene.AddInventoryItem(item))
653 { 653 {
@@ -683,7 +683,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
683 if (entity is SceneObjectGroup) 683 if (entity is SceneObjectGroup)
684 { 684 {
685 group = (SceneObjectGroup)entity; 685 group = (SceneObjectGroup)entity;
686 if (group.GetFromItemID() == itemID) 686 if (group.FromItemID == itemID)
687 { 687 {
688 m_scene.EventManager.TriggerOnAttach(group.LocalId, itemID, UUID.Zero); 688 m_scene.EventManager.TriggerOnAttach(group.LocalId, itemID, UUID.Zero);
689 sp.RemoveAttachment(group); 689 sp.RemoveAttachment(group);
@@ -889,7 +889,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
889 // Calls attach with a Zero position 889 // Calls attach with a Zero position
890 if (AttachObject(sp, part.ParentGroup, AttachmentPt, false)) 890 if (AttachObject(sp, part.ParentGroup, AttachmentPt, false))
891 { 891 {
892 m_scene.EventManager.TriggerOnAttach(objectLocalID, part.ParentGroup.GetFromItemID(), remoteClient.AgentId); 892 m_scene.EventManager.TriggerOnAttach(objectLocalID, part.ParentGroup.FromItemID, remoteClient.AgentId);
893 893
894 // Save avatar attachment information 894 // Save avatar attachment information
895 m_log.Debug( 895 m_log.Debug(
@@ -912,7 +912,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
912 ScenePresence sp = m_scene.GetScenePresence(remoteClient.AgentId); 912 ScenePresence sp = m_scene.GetScenePresence(remoteClient.AgentId);
913 SceneObjectGroup group = m_scene.GetGroupByPrim(objectLocalID); 913 SceneObjectGroup group = m_scene.GetGroupByPrim(objectLocalID);
914 if (sp != null && group != null) 914 if (sp != null && group != null)
915 DetachSingleAttachmentToInv(sp, group.GetFromItemID()); 915 DetachSingleAttachmentToInv(sp, group.FromItemID);
916 } 916 }
917 917
918 private void Client_OnDetachAttachmentIntoInv(UUID itemID, IClientAPI remoteClient) 918 private void Client_OnDetachAttachmentIntoInv(UUID itemID, IClientAPI remoteClient)
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs
index 86cfb32..bfe5e4a 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs
@@ -120,8 +120,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
120 Assert.That(attSo.IsTemporary, Is.False); 120 Assert.That(attSo.IsTemporary, Is.False);
121 121
122 // Check item status 122 // Check item status
123 Assert.That(m_presence.Appearance.GetAttachpoint( 123 Assert.That(
124 attSo.GetFromItemID()), Is.EqualTo((int)AttachmentPoint.Chest)); 124 m_presence.Appearance.GetAttachpoint(attSo.FromItemID),
125 Is.EqualTo((int)AttachmentPoint.Chest));
125 } 126 }
126 127
127 [Test] 128 [Test]
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
index 4dd89d2..8171487 100644
--- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
@@ -654,9 +654,9 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
654 // 654 //
655 if (action == DeRezAction.Take || action == DeRezAction.TakeCopy) 655 if (action == DeRezAction.Take || action == DeRezAction.TakeCopy)
656 { 656 {
657 if (so.RootPart.FromFolderID != UUID.Zero && userID == remoteClient.AgentId) 657 if (so.FromFolderID != UUID.Zero && userID == remoteClient.AgentId)
658 { 658 {
659 InventoryFolderBase f = new InventoryFolderBase(so.RootPart.FromFolderID, userID); 659 InventoryFolderBase f = new InventoryFolderBase(so.FromFolderID, userID);
660 folder = m_Scene.InventoryService.GetFolder(f); 660 folder = m_Scene.InventoryService.GetFolder(f);
661 } 661 }
662 } 662 }
@@ -962,7 +962,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
962 rootPart.SalePrice = item.SalePrice; 962 rootPart.SalePrice = item.SalePrice;
963 } 963 }
964 964
965 rootPart.FromFolderID = item.Folder; 965 so.FromFolderID = item.Folder;
966 966
967// Console.WriteLine("rootPart.OwnedID {0}, item.Owner {1}, item.CurrentPermissions {2:X}", 967// Console.WriteLine("rootPart.OwnedID {0}, item.Owner {1}, item.CurrentPermissions {2:X}",
968// rootPart.OwnerID, item.Owner, item.CurrentPermissions); 968// rootPart.OwnerID, item.Owner, item.CurrentPermissions);
@@ -1008,7 +1008,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
1008 rootPart.TrimPermissions(); 1008 rootPart.TrimPermissions();
1009 1009
1010 if (isAttachment) 1010 if (isAttachment)
1011 so.SetFromItemID(item.ID); 1011 so.FromItemID = item.ID;
1012 } 1012 }
1013 1013
1014 return true; 1014 return true;
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 29825a2..e488fe1 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -2163,12 +2163,6 @@ namespace OpenSim.Region.Framework.Scenes
2163 part.RemoveFromPhysics(); 2163 part.RemoveFromPhysics();
2164 } 2164 }
2165 } 2165 }
2166
2167// if (rootPart.PhysActor != null)
2168// {
2169// PhysicsScene.RemovePrim(rootPart.PhysActor);
2170// rootPart.PhysActor = null;
2171// }
2172 2166
2173 if (UnlinkSceneObject(group, false)) 2167 if (UnlinkSceneObject(group, false))
2174 { 2168 {
@@ -2572,7 +2566,7 @@ namespace OpenSim.Region.Framework.Scenes
2572 SceneObjectGroup grp = sceneObject; 2566 SceneObjectGroup grp = sceneObject;
2573 2567
2574 m_log.DebugFormat( 2568 m_log.DebugFormat(
2575 "[ATTACHMENT]: Received attachment {0}, inworld asset id {1}", grp.GetFromItemID(), grp.UUID); 2569 "[ATTACHMENT]: Received attachment {0}, inworld asset id {1}", grp.FromItemID, grp.UUID);
2576 m_log.DebugFormat( 2570 m_log.DebugFormat(
2577 "[ATTACHMENT]: Attach to avatar {0} at position {1}", sp.UUID, grp.AbsolutePosition); 2571 "[ATTACHMENT]: Attach to avatar {0} at position {1}", sp.UUID, grp.AbsolutePosition);
2578 2572
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 87fdc41..17f3be7 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -571,7 +571,9 @@ namespace OpenSim.Region.Framework.Scenes
571 set { m_LoopSoundSlavePrims = value; } 571 set { m_LoopSoundSlavePrims = value; }
572 } 572 }
573 573
574 // The UUID for the Region this Object is in. 574 /// <summary>
575 /// The UUID for the region this object is in.
576 /// </summary>
575 public UUID RegionUUID 577 public UUID RegionUUID
576 { 578 {
577 get 579 get
@@ -584,6 +586,22 @@ namespace OpenSim.Region.Framework.Scenes
584 } 586 }
585 } 587 }
586 588
589 /// <summary>
590 /// The item ID that this object was rezzed from, if applicable.
591 /// </summary>
592 /// <remarks>
593 /// If not applicable will be UUID.Zero
594 /// </remarks>
595 public UUID FromItemID { get; set; }
596
597 /// <summary>
598 /// The folder ID that this object was rezzed from, if applicable.
599 /// </summary>
600 /// <remarks>
601 /// If not applicable will be UUID.Zero
602 /// </remarks>
603 public UUID FromFolderID { get; set; }
604
587 #endregion 605 #endregion
588 606
589// ~SceneObjectGroup() 607// ~SceneObjectGroup()
@@ -646,18 +664,6 @@ namespace OpenSim.Region.Framework.Scenes
646 } 664 }
647 } 665 }
648 666
649 public void SetFromItemID(UUID AssetId)
650 {
651 SceneObjectPart[] parts = m_parts.GetArray();
652 for (int i = 0; i < parts.Length; i++)
653 parts[i].FromItemID = AssetId;
654 }
655
656 public UUID GetFromItemID()
657 {
658 return m_rootPart.FromItemID;
659 }
660
661 /// <summary> 667 /// <summary>
662 /// Hooks this object up to the backup event so that it is persisted to the database when the update thread executes. 668 /// Hooks this object up to the backup event so that it is persisted to the database when the update thread executes.
663 /// </summary> 669 /// </summary>
@@ -2687,6 +2693,7 @@ namespace OpenSim.Region.Framework.Scenes
2687 { 2693 {
2688 m_rootPart.AttachedPos = pos; 2694 m_rootPart.AttachedPos = pos;
2689 } 2695 }
2696
2690 if (RootPart.GetStatusSandbox()) 2697 if (RootPart.GetStatusSandbox())
2691 { 2698 {
2692 if (Util.GetDistanceTo(RootPart.StatusSandboxPos, pos) > 10) 2699 if (Util.GetDistanceTo(RootPart.StatusSandboxPos, pos) > 10)
@@ -2697,8 +2704,8 @@ namespace OpenSim.Region.Framework.Scenes
2697 ChatTypeEnum.DebugChannel, 0x7FFFFFFF, RootPart.AbsolutePosition, Name, UUID, false); 2704 ChatTypeEnum.DebugChannel, 0x7FFFFFFF, RootPart.AbsolutePosition, Name, UUID, false);
2698 } 2705 }
2699 } 2706 }
2700 AbsolutePosition = pos;
2701 2707
2708 AbsolutePosition = pos;
2702 HasGroupChanged = true; 2709 HasGroupChanged = true;
2703 } 2710 }
2704 2711
@@ -3270,7 +3277,7 @@ namespace OpenSim.Region.Framework.Scenes
3270 3277
3271 public virtual string ExtraToXmlString() 3278 public virtual string ExtraToXmlString()
3272 { 3279 {
3273 return "<ExtraFromItemID>" + GetFromItemID().ToString() + "</ExtraFromItemID>"; 3280 return "<ExtraFromItemID>" + FromItemID.ToString() + "</ExtraFromItemID>";
3274 } 3281 }
3275 3282
3276 public virtual void ExtraFromXmlString(string xmlstr) 3283 public virtual void ExtraFromXmlString(string xmlstr)
@@ -3282,7 +3289,7 @@ namespace OpenSim.Region.Framework.Scenes
3282 UUID uuid = UUID.Zero; 3289 UUID uuid = UUID.Zero;
3283 UUID.TryParse(id, out uuid); 3290 UUID.TryParse(id, out uuid);
3284 3291
3285 SetFromItemID(uuid); 3292 FromItemID = uuid;
3286 } 3293 }
3287 3294
3288 #endregion 3295 #endregion
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 2b1fba0..046553b 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -125,12 +125,14 @@ namespace OpenSim.Region.Framework.Scenes
125 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 125 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
126 126
127 /// <value> 127 /// <value>
128 /// Is this sop a root part? 128 /// Is this a root part?
129 /// </value> 129 /// </value>
130 130 /// <remarks>
131 /// This will return true even if the whole object is attached to an avatar.
132 /// </remarks>
131 public bool IsRoot 133 public bool IsRoot
132 { 134 {
133 get { return ParentGroup.RootPart == this; } 135 get { return ParentGroup.RootPart == this; }
134 } 136 }
135 137
136 #region Fields 138 #region Fields
@@ -159,15 +161,7 @@ namespace OpenSim.Region.Framework.Scenes
159 /// If another thread is simultaneously turning physics off on this part then this refernece could become 161 /// If another thread is simultaneously turning physics off on this part then this refernece could become
160 /// null at any time. 162 /// null at any time.
161 /// </remarks> 163 /// </remarks>
162 public PhysicsActor PhysActor 164 public PhysicsActor PhysActor { get; set; }
163 {
164 get { return m_physActor; }
165 set
166 {
167// m_log.DebugFormat("[SOP]: PhysActor set to {0} for {1} {2}", value, Name, UUID);
168 m_physActor = value;
169 }
170 }
171 165
172 //Xantor 20080528 Sound stuff: 166 //Xantor 20080528 Sound stuff:
173 // Note: This isn't persisted in the database right now, as the fields for that aren't just there yet. 167 // Note: This isn't persisted in the database right now, as the fields for that aren't just there yet.
@@ -187,10 +181,6 @@ namespace OpenSim.Region.Framework.Scenes
187 public uint TimeStampLastActivity; // Will be used for AutoReturn 181 public uint TimeStampLastActivity; // Will be used for AutoReturn
188 182
189 public uint TimeStampTerse; 183 public uint TimeStampTerse;
190
191 public UUID FromItemID;
192
193 public UUID FromFolderID;
194 184
195 public int STATUS_ROTATE_X; 185 public int STATUS_ROTATE_X;
196 186
@@ -266,7 +256,6 @@ namespace OpenSim.Region.Framework.Scenes
266 256
267 private bool m_passTouches; 257 private bool m_passTouches;
268 258
269 private PhysicsActor m_physActor;
270 protected Vector3 m_acceleration; 259 protected Vector3 m_acceleration;
271 protected Vector3 m_angularVelocity; 260 protected Vector3 m_angularVelocity;
272 261
@@ -1112,6 +1101,14 @@ namespace OpenSim.Region.Framework.Scenes
1112 } 1101 }
1113 } 1102 }
1114 1103
1104 /// <summary>
1105 /// The parent ID of this part.
1106 /// </summary>
1107 /// <remarks>
1108 /// If this is a root part which is not attached to an avatar then the value will be 0.
1109 /// If this is a root part which is attached to an avatar then the value is the local id of that avatar.
1110 /// If this is a child part then the value is the local ID of the root part.
1111 /// </remarks>
1115 public uint ParentID 1112 public uint ParentID
1116 { 1113 {
1117 get { return _parentID; } 1114 get { return _parentID; }
@@ -1488,40 +1485,17 @@ namespace OpenSim.Region.Framework.Scenes
1488 if (VolumeDetectActive) 1485 if (VolumeDetectActive)
1489 isPhantom = false; 1486 isPhantom = false;
1490 1487
1491 // Added clarification.. since A rigid body is an object that you can kick around, etc.
1492 bool RigidBody = isPhysical && !isPhantom;
1493
1494 // The only time the physics scene shouldn't know about the prim is if it's phantom or an attachment, which is phantom by definition 1488 // The only time the physics scene shouldn't know about the prim is if it's phantom or an attachment, which is phantom by definition
1495 // or flexible 1489 // or flexible
1496 if (!isPhantom && !ParentGroup.IsAttachment && !(Shape.PathCurve == (byte)Extrusion.Flexible)) 1490 if (!isPhantom && !ParentGroup.IsAttachment && !(Shape.PathCurve == (byte)Extrusion.Flexible))
1497 { 1491 {
1498 try 1492 // Added clarification.. since A rigid body is an object that you can kick around, etc.
1499 { 1493 bool rigidBody = isPhysical && !isPhantom;
1500 PhysActor = ParentGroup.Scene.PhysicsScene.AddPrimShape(
1501 string.Format("{0}/{1}", Name, UUID),
1502 Shape,
1503 AbsolutePosition,
1504 Scale,
1505 RotationOffset,
1506 RigidBody,
1507 m_localId);
1508 }
1509 catch
1510 {
1511 m_log.ErrorFormat("[SCENE]: caught exception meshing object {0}. Object set to phantom.", m_uuid);
1512 PhysActor = null;
1513 }
1514 1494
1515 // Basic Physics can also return null as well as an exception catch. 1495 PhysicsActor pa = AddToPhysics(rigidBody);
1516 PhysicsActor pa = PhysActor;
1517 1496
1518 if (pa != null) 1497 if (pa != null)
1519 {
1520 pa.SOPName = this.Name; // save object into the PhysActor so ODE internals know the joint/body info
1521 pa.SetMaterial(Material);
1522 DoPhysicsPropertyUpdate(RigidBody, true);
1523 pa.SetVolumeDetect(VolumeDetectActive ? 1 : 0); 1498 pa.SetVolumeDetect(VolumeDetectActive ? 1 : 0);
1524 }
1525 } 1499 }
1526 } 1500 }
1527 } 1501 }
@@ -4322,41 +4296,36 @@ namespace OpenSim.Region.Framework.Scenes
4322 if (ParentGroup.Scene == null) 4296 if (ParentGroup.Scene == null)
4323 return; 4297 return;
4324 4298
4325 if (ParentGroup.Scene.CollidablePrims && PhysActor == null) 4299 if (ParentGroup.Scene.CollidablePrims && pa == null)
4326 { 4300 {
4327 // It's not phantom anymore. So make sure the physics engine get's knowledge of it 4301 pa = AddToPhysics(UsePhysics);
4328 PhysActor = ParentGroup.Scene.PhysicsScene.AddPrimShape(
4329 string.Format("{0}/{1}", Name, UUID),
4330 Shape,
4331 AbsolutePosition,
4332 Scale,
4333 RotationOffset,
4334 UsePhysics,
4335 m_localId);
4336 4302
4337 PhysActor.SetMaterial(Material); 4303 if (pa != null)
4338 DoPhysicsPropertyUpdate(UsePhysics, true);
4339
4340 if (!ParentGroup.IsDeleted)
4341 { 4304 {
4342 if (LocalId == ParentGroup.RootPart.LocalId) 4305 pa.SetMaterial(Material);
4306 DoPhysicsPropertyUpdate(UsePhysics, true);
4307
4308 if (!ParentGroup.IsDeleted)
4343 { 4309 {
4344 ParentGroup.CheckSculptAndLoad(); 4310 if (LocalId == ParentGroup.RootPart.LocalId)
4311 {
4312 ParentGroup.CheckSculptAndLoad();
4313 }
4314 }
4315
4316 if (
4317 ((AggregateScriptEvents & scriptEvents.collision) != 0) ||
4318 ((AggregateScriptEvents & scriptEvents.collision_end) != 0) ||
4319 ((AggregateScriptEvents & scriptEvents.collision_start) != 0) ||
4320 ((AggregateScriptEvents & scriptEvents.land_collision_start) != 0) ||
4321 ((AggregateScriptEvents & scriptEvents.land_collision) != 0) ||
4322 ((AggregateScriptEvents & scriptEvents.land_collision_end) != 0) ||
4323 (CollisionSound != UUID.Zero)
4324 )
4325 {
4326 pa.OnCollisionUpdate += PhysicsCollision;
4327 pa.SubscribeEvents(1000);
4345 } 4328 }
4346 }
4347
4348 if (
4349 ((AggregateScriptEvents & scriptEvents.collision) != 0) ||
4350 ((AggregateScriptEvents & scriptEvents.collision_end) != 0) ||
4351 ((AggregateScriptEvents & scriptEvents.collision_start) != 0) ||
4352 ((AggregateScriptEvents & scriptEvents.land_collision_start) != 0) ||
4353 ((AggregateScriptEvents & scriptEvents.land_collision) != 0) ||
4354 ((AggregateScriptEvents & scriptEvents.land_collision_end) != 0) ||
4355 (CollisionSound != UUID.Zero)
4356 )
4357 {
4358 PhysActor.OnCollisionUpdate += PhysicsCollision;
4359 PhysActor.SubscribeEvents(1000);
4360 } 4329 }
4361 } 4330 }
4362 else // it already has a physical representation 4331 else // it already has a physical representation
@@ -4418,7 +4387,52 @@ namespace OpenSim.Region.Framework.Scenes
4418 } 4387 }
4419 4388
4420 /// <summary> 4389 /// <summary>
4421 /// This removes the part from physics 4390 /// Adds this part to the physics scene.
4391 /// </summary>
4392 /// <remarks>This method also sets the PhysActor property.</remarks>
4393 /// <param name="rigidBody">Add this prim with a rigid body.</param>
4394 /// <returns>
4395 /// The physics actor. null if there was a failure.
4396 /// </returns>
4397 private PhysicsActor AddToPhysics(bool rigidBody)
4398 {
4399 PhysicsActor pa;
4400
4401 try
4402 {
4403 pa = ParentGroup.Scene.PhysicsScene.AddPrimShape(
4404 string.Format("{0}/{1}", Name, UUID),
4405 Shape,
4406 AbsolutePosition,
4407 Scale,
4408 RotationOffset,
4409 rigidBody,
4410 m_localId);
4411 }
4412 catch
4413 {
4414 m_log.ErrorFormat("[SCENE]: caught exception meshing object {0}. Object set to phantom.", m_uuid);
4415 pa = null;
4416 }
4417
4418 // FIXME: Ideally we wouldn't set the property here to reduce situations where threads changing physical
4419 // properties can stop on each other. However, DoPhysicsPropertyUpdate() currently relies on PhysActor
4420 // being set.
4421 PhysActor = pa;
4422
4423 // Basic Physics can also return null as well as an exception catch.
4424 if (pa != null)
4425 {
4426 pa.SOPName = this.Name; // save object into the PhysActor so ODE internals know the joint/body info
4427 pa.SetMaterial(Material);
4428 DoPhysicsPropertyUpdate(rigidBody, true);
4429 }
4430
4431 return pa;
4432 }
4433
4434 /// <summary>
4435 /// This removes the part from the physics scene.
4422 /// </summary> 4436 /// </summary>
4423 /// <remarks> 4437 /// <remarks>
4424 /// This isn't the same as turning off physical, since even without being physical the prim has a physics 4438 /// This isn't the same as turning off physical, since even without being physical the prim has a physics
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 19dab32..a21c66f 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -3514,6 +3514,22 @@ namespace OpenSim.Region.Framework.Scenes
3514 }); 3514 });
3515 } 3515 }
3516 3516
3517 /// <summary>
3518 /// Gets the mass.
3519 /// </summary>
3520 /// <returns>
3521 /// The mass.
3522 /// </returns>
3523 public float GetMass()
3524 {
3525 PhysicsActor pa = PhysicsActor;
3526
3527 if (pa != null)
3528 return pa.Mass;
3529 else
3530 return 0;
3531 }
3532
3517 internal void PushForce(Vector3 impulse) 3533 internal void PushForce(Vector3 impulse)
3518 { 3534 {
3519 if (PhysicsActor != null) 3535 if (PhysicsActor != null)
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 8d25a62..291f52e 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -2022,27 +2022,28 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2022 protected LSL_Vector GetPartLocalPos(SceneObjectPart part) 2022 protected LSL_Vector GetPartLocalPos(SceneObjectPart part)
2023 { 2023 {
2024 m_host.AddScriptLPS(1); 2024 m_host.AddScriptLPS(1);
2025 if (part.ParentID == 0) 2025
2026 Vector3 pos;
2027
2028 if (!part.IsRoot)
2026 { 2029 {
2027 return new LSL_Vector(part.AbsolutePosition.X, 2030 pos = part.OffsetPosition;
2028 part.AbsolutePosition.Y,
2029 part.AbsolutePosition.Z);
2030 } 2031 }
2031 else 2032 else
2032 { 2033 {
2033 if (m_host.IsRoot) 2034 if (part.ParentGroup.IsAttachment)
2034 { 2035 {
2035 return new LSL_Vector(m_host.AttachedPos.X, 2036 pos = part.AttachedPos;
2036 m_host.AttachedPos.Y,
2037 m_host.AttachedPos.Z);
2038 } 2037 }
2039 else 2038 else
2040 { 2039 {
2041 return new LSL_Vector(part.OffsetPosition.X, 2040 pos = part.AbsolutePosition;
2042 part.OffsetPosition.Y,
2043 part.OffsetPosition.Z);
2044 } 2041 }
2045 } 2042 }
2043
2044// m_log.DebugFormat("[LSL API]: Returning {0} in GetPartLocalPos()", pos);
2045
2046 return new LSL_Vector(pos.X, pos.Y, pos.Z);
2046 } 2047 }
2047 2048
2048 public void llSetRot(LSL_Rotation rot) 2049 public void llSetRot(LSL_Rotation rot)
@@ -2907,7 +2908,31 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2907 public LSL_Float llGetMass() 2908 public LSL_Float llGetMass()
2908 { 2909 {
2909 m_host.AddScriptLPS(1); 2910 m_host.AddScriptLPS(1);
2910 return m_host.GetMass(); 2911
2912 if (m_host.ParentGroup.IsAttachment)
2913 {
2914 ScenePresence attachedAvatar = World.GetScenePresence(m_host.ParentGroup.AttachedAvatar);
2915
2916 if (attachedAvatar != null)
2917 {
2918 return attachedAvatar.GetMass();
2919 }
2920 else
2921 {
2922 return 0;
2923 }
2924 }
2925 else
2926 {
2927 if (m_host.IsRoot)
2928 {
2929 return m_host.ParentGroup.GetMass();
2930 }
2931 else
2932 {
2933 return m_host.GetMass();
2934 }
2935 }
2911 } 2936 }
2912 2937
2913 public void llCollisionFilter(string name, string id, int accept) 2938 public void llCollisionFilter(string name, string id, int accept)
@@ -3055,7 +3080,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3055 SceneObjectPart host = (SceneObjectPart)o; 3080 SceneObjectPart host = (SceneObjectPart)o;
3056 3081
3057 SceneObjectGroup grp = host.ParentGroup; 3082 SceneObjectGroup grp = host.ParentGroup;
3058 UUID itemID = grp.GetFromItemID(); 3083 UUID itemID = grp.FromItemID;
3059 ScenePresence presence = World.GetScenePresence(host.OwnerID); 3084 ScenePresence presence = World.GetScenePresence(host.OwnerID);
3060 3085
3061 IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule; 3086 IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule;
@@ -7146,6 +7171,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7146 switch (code) 7171 switch (code)
7147 { 7172 {
7148 case (int)ScriptBaseClass.PRIM_POSITION: 7173 case (int)ScriptBaseClass.PRIM_POSITION:
7174 case (int)ScriptBaseClass.PRIM_POS_LOCAL:
7149 if (remain < 1) 7175 if (remain < 1)
7150 return; 7176 return;
7151 7177
@@ -10330,6 +10356,35 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
10330 case ScriptBaseClass.OBJECT_CREATOR: 10356 case ScriptBaseClass.OBJECT_CREATOR:
10331 ret.Add(new LSL_String(UUID.Zero.ToString())); 10357 ret.Add(new LSL_String(UUID.Zero.ToString()));
10332 break; 10358 break;
10359 // For the following 8 see the Object version below
10360 case ScriptBaseClass.OBJECT_RUNNING_SCRIPT_COUNT:
10361 ret.Add(new LSL_Integer(0));
10362 break;
10363 case ScriptBaseClass.OBJECT_TOTAL_SCRIPT_COUNT:
10364 ret.Add(new LSL_Integer(0));
10365 break;
10366 case ScriptBaseClass.OBJECT_SCRIPT_MEMORY:
10367 ret.Add(new LSL_Integer(0));
10368 break;
10369 case ScriptBaseClass.OBJECT_SCRIPT_TIME:
10370 ret.Add(new LSL_Float(0));
10371 break;
10372 case ScriptBaseClass.OBJECT_PRIM_EQUIVALENCE:
10373 ret.Add(new LSL_Integer(0));
10374 break;
10375 case ScriptBaseClass.OBJECT_SERVER_COST:
10376 ret.Add(new LSL_Float(0));
10377 break;
10378 case ScriptBaseClass.OBJECT_STREAMING_COST:
10379 ret.Add(new LSL_Float(0));
10380 break;
10381 case ScriptBaseClass.OBJECT_PHYSICS_COST:
10382 ret.Add(new LSL_Float(0));
10383 break;
10384 default:
10385 // Invalid or unhandled constant.
10386 ret.Add(new LSL_Integer(ScriptBaseClass.OBJECT_UNKNOWN_DETAIL));
10387 break;
10333 } 10388 }
10334 } 10389 }
10335 10390
@@ -10367,6 +10422,49 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
10367 case ScriptBaseClass.OBJECT_CREATOR: 10422 case ScriptBaseClass.OBJECT_CREATOR:
10368 ret.Add(new LSL_String(obj.CreatorID.ToString())); 10423 ret.Add(new LSL_String(obj.CreatorID.ToString()));
10369 break; 10424 break;
10425 // The following 8 I have intentionaly coded to return zero. They are part of
10426 // "Land Impact" calculations. These calculations are probably not applicable
10427 // to OpenSim, required figures (cpu/memory usage) are not currently tracked
10428 // I have intentionally left these all at zero rather than return possibly
10429 // missleading numbers
10430 case ScriptBaseClass.OBJECT_RUNNING_SCRIPT_COUNT:
10431 // in SL this currently includes crashed scripts
10432 ret.Add(new LSL_Integer(0));
10433 break;
10434 case ScriptBaseClass.OBJECT_TOTAL_SCRIPT_COUNT:
10435 ret.Add(new LSL_Integer(0));
10436 break;
10437 case ScriptBaseClass.OBJECT_SCRIPT_MEMORY:
10438 // The value returned in SL for mono scripts is 65536 * number of active scripts
10439 ret.Add(new LSL_Integer(0));
10440 break;
10441 case ScriptBaseClass.OBJECT_SCRIPT_TIME:
10442 // Average cpu time per simulator frame expended on all scripts in the objetc
10443 ret.Add(new LSL_Float(0));
10444 break;
10445 case ScriptBaseClass.OBJECT_PRIM_EQUIVALENCE:
10446 // according to the SL wiki A prim or linkset will have prim
10447 // equivalent of the number of prims in a linkset if it does not
10448 // contain a mesh anywhere in the link set or is not a normal prim
10449 // The value returned in SL for normal prims is prim count
10450 ret.Add(new LSL_Integer(0));
10451 break;
10452 case ScriptBaseClass.OBJECT_SERVER_COST:
10453 // The value returned in SL for normal prims is prim count
10454 ret.Add(new LSL_Float(0));
10455 break;
10456 case ScriptBaseClass.OBJECT_STREAMING_COST:
10457 // The value returned in SL for normal prims is prim count * 0.06
10458 ret.Add(new LSL_Float(0));
10459 break;
10460 case ScriptBaseClass.OBJECT_PHYSICS_COST:
10461 // The value returned in SL for normal prims is prim count
10462 ret.Add(new LSL_Float(0));
10463 break;
10464 default:
10465 // Invalid or unhandled constant.
10466 ret.Add(new LSL_Integer(ScriptBaseClass.OBJECT_UNKNOWN_DETAIL));
10467 break;
10370 } 10468 }
10371 } 10469 }
10372 10470
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
index 5a53e15..f58f9d6 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
@@ -479,6 +479,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
479 public const int DEBUG_CHANNEL = 0x7FFFFFFF; 479 public const int DEBUG_CHANNEL = 0x7FFFFFFF;
480 public const int PUBLIC_CHANNEL = 0x00000000; 480 public const int PUBLIC_CHANNEL = 0x00000000;
481 481
482 // Constants for llGetObjectDetails
483 public const int OBJECT_UNKNOWN_DETAIL = -1;
482 public const int OBJECT_NAME = 1; 484 public const int OBJECT_NAME = 1;
483 public const int OBJECT_DESC = 2; 485 public const int OBJECT_DESC = 2;
484 public const int OBJECT_POS = 3; 486 public const int OBJECT_POS = 3;
@@ -487,6 +489,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
487 public const int OBJECT_OWNER = 6; 489 public const int OBJECT_OWNER = 6;
488 public const int OBJECT_GROUP = 7; 490 public const int OBJECT_GROUP = 7;
489 public const int OBJECT_CREATOR = 8; 491 public const int OBJECT_CREATOR = 8;
492 public const int OBJECT_RUNNING_SCRIPT_COUNT = 9;
493 public const int OBJECT_TOTAL_SCRIPT_COUNT = 10;
494 public const int OBJECT_SCRIPT_MEMORY = 11;
495 public const int OBJECT_SCRIPT_TIME = 12;
496 public const int OBJECT_PRIM_EQUIVALENCE = 13;
497 public const int OBJECT_SERVER_COST = 14;
498 public const int OBJECT_STREAMING_COST = 15;
499 public const int OBJECT_PHYSICS_COST = 16;
490 500
491 // Can not be public const? 501 // Can not be public const?
492 public static readonly vector ZERO_VECTOR = new vector(0.0, 0.0, 0.0); 502 public static readonly vector ZERO_VECTOR = new vector(0.0, 0.0, 0.0);