aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r--OpenSim/Region/Framework/Interfaces/IAvatarFactory.cs2
-rw-r--r--OpenSim/Region/Framework/Interfaces/IInventoryAccessModule.cs10
-rw-r--r--OpenSim/Region/Framework/Interfaces/INPCModule.cs40
-rw-r--r--OpenSim/Region/Framework/Scenes/AsyncInventorySender.cs156
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs23
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs25
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs13
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneGraph.cs17
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs49
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs117
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs6
-rw-r--r--OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/AttachmentTests.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs4
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/StandaloneTeleportTests.cs2
18 files changed, 371 insertions, 103 deletions
diff --git a/OpenSim/Region/Framework/Interfaces/IAvatarFactory.cs b/OpenSim/Region/Framework/Interfaces/IAvatarFactory.cs
index 22795fc..d0e5609 100644
--- a/OpenSim/Region/Framework/Interfaces/IAvatarFactory.cs
+++ b/OpenSim/Region/Framework/Interfaces/IAvatarFactory.cs
@@ -36,4 +36,4 @@ namespace OpenSim.Region.Framework.Interfaces
36 void QueueAppearanceSend(UUID agentid); 36 void QueueAppearanceSend(UUID agentid);
37 void QueueAppearanceSave(UUID agentid); 37 void QueueAppearanceSave(UUID agentid);
38 } 38 }
39} 39} \ No newline at end of file
diff --git a/OpenSim/Region/Framework/Interfaces/IInventoryAccessModule.cs b/OpenSim/Region/Framework/Interfaces/IInventoryAccessModule.cs
index 305975e..da11e61 100644
--- a/OpenSim/Region/Framework/Interfaces/IInventoryAccessModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IInventoryAccessModule.cs
@@ -59,7 +59,15 @@ namespace OpenSim.Region.Framework.Interfaces
59 UUID RayTargetID, byte BypassRayCast, bool RayEndIsIntersection, 59 UUID RayTargetID, byte BypassRayCast, bool RayEndIsIntersection,
60 bool RezSelected, bool RemoveItem, UUID fromTaskID, bool attachment); 60 bool RezSelected, bool RemoveItem, UUID fromTaskID, bool attachment);
61 void TransferInventoryAssets(InventoryItemBase item, UUID sender, UUID receiver); 61 void TransferInventoryAssets(InventoryItemBase item, UUID sender, UUID receiver);
62 bool GetAgentInventoryItem(IClientAPI remoteClient, UUID itemID, UUID requestID); 62
63 /// <summary>
64 /// Does the client have sufficient permissions to retrieve the inventory item?
65 /// </summary>
66 /// <param name="remoteClient"></param>
67 /// <param name="itemID"></param>
68 /// <param name="requestID"></param>
69 /// <returns></returns>
70 bool CanGetAgentInventoryItem(IClientAPI remoteClient, UUID itemID, UUID requestID);
63 71
64 // Must be here because of textures in user's inventory 72 // Must be here because of textures in user's inventory
65 bool IsForeignUser(UUID userID, out string assetServerURL); 73 bool IsForeignUser(UUID userID, out string assetServerURL);
diff --git a/OpenSim/Region/Framework/Interfaces/INPCModule.cs b/OpenSim/Region/Framework/Interfaces/INPCModule.cs
new file mode 100644
index 0000000..21a755f
--- /dev/null
+++ b/OpenSim/Region/Framework/Interfaces/INPCModule.cs
@@ -0,0 +1,40 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using OpenMetaverse;
29using OpenSim.Region.Framework.Scenes;
30
31namespace OpenSim.Region.Framework.Interfaces
32{
33 public interface INPCModule
34 {
35 UUID CreateNPC(string firstname, string lastname, Vector3 position, Scene scene, UUID cloneAppearanceFrom);
36 void Autopilot(UUID agentID, Scene scene, Vector3 pos);
37 void Say(UUID agentID, Scene scene, string text);
38 void DeleteNPC(UUID agentID, Scene scene);
39 }
40} \ No newline at end of file
diff --git a/OpenSim/Region/Framework/Scenes/AsyncInventorySender.cs b/OpenSim/Region/Framework/Scenes/AsyncInventorySender.cs
new file mode 100644
index 0000000..9cb5674
--- /dev/null
+++ b/OpenSim/Region/Framework/Scenes/AsyncInventorySender.cs
@@ -0,0 +1,156 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using System.Reflection;
31using System.Threading;
32using log4net;
33using OpenMetaverse;
34using OpenSim.Framework;
35using OpenSim.Region.Framework.Interfaces;
36
37namespace OpenSim.Region.Framework.Scenes
38{
39 class FetchHolder
40 {
41 public IClientAPI Client { get; private set; }
42 public UUID ItemID { get; private set; }
43
44 public FetchHolder(IClientAPI client, UUID itemID)
45 {
46 Client = client;
47 ItemID = itemID;
48 }
49 }
50
51 /// <summary>
52 /// Send FetchInventoryReply information to clients asynchronously on a single thread rather than asynchronously via
53 /// multiple threads.
54 /// </summary>
55 /// <remarks>
56 /// If the main root inventory is right-clicked on a version 1 viewer for a user with a large inventory, a very
57 /// very large number of FetchInventory requests are sent to the simulator. Each is handled on a separate thread
58 /// by the IClientAPI, but the sheer number of requests overwhelms the number of threads available and ends up
59 /// freezing the inbound packet handling.
60 ///
61 /// This class makes the first FetchInventory packet thread process the queue. If new requests come
62 /// in while it is processing, then the subsequent threads just add the requests and leave it to the original
63 /// thread to process them.
64 ///
65 /// This might slow down outbound packets but these are limited by the IClientAPI outbound queues
66 /// anyway.
67 ///
68 /// It might be possible to ignore FetchInventory requests altogether, particularly as they are redundant wrt to
69 /// FetchInventoryDescendents requests, but this would require more investigation.
70 /// </remarks>
71 public class AsyncInventorySender
72 {
73// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
74
75 protected Scene m_scene;
76
77 /// <summary>
78 /// Queues fetch requests
79 /// </summary>
80 Queue<FetchHolder> m_fetchHolder = new Queue<FetchHolder>();
81
82 /// <summary>
83 /// Signal whether a queue is currently being processed or not.
84 /// </summary>
85 protected volatile bool m_processing;
86
87 public AsyncInventorySender(Scene scene)
88 {
89 m_processing = false;
90 m_scene = scene;
91 }
92
93 /// <summary>
94 /// Handle a fetch inventory request from the client
95 /// </summary>
96 /// <param name="remoteClient"></param>
97 /// <param name="itemID"></param>
98 /// <param name="ownerID"></param>
99 public void HandleFetchInventory(IClientAPI remoteClient, UUID itemID, UUID ownerID)
100 {
101 lock (m_fetchHolder)
102 {
103// m_log.DebugFormat(
104// "[ASYNC INVENTORY SENDER]: Putting request from {0} for {1} on queue", remoteClient.Name, itemID);
105
106 m_fetchHolder.Enqueue(new FetchHolder(remoteClient, itemID));
107 }
108
109 if (!m_processing)
110 {
111 m_processing = true;
112 ProcessQueue();
113 }
114 }
115
116 /// <summary>
117 /// Process the queue of fetches
118 /// </summary>
119 protected void ProcessQueue()
120 {
121 FetchHolder fh = null;
122
123 while (true)
124 {
125 lock (m_fetchHolder)
126 {
127// m_log.DebugFormat("[ASYNC INVENTORY SENDER]: {0} items left to process", m_fetchHolder.Count);
128
129 if (m_fetchHolder.Count == 0)
130 {
131 m_processing = false;
132 return;
133 }
134 else
135 {
136 fh = m_fetchHolder.Dequeue();
137 }
138 }
139
140 if (fh.Client.IsLoggingOut)
141 continue;
142
143// m_log.DebugFormat(
144// "[ASYNC INVENTORY SENDER]: Handling request from {0} for {1} on queue", fh.Client.Name, fh.ItemID);
145
146 InventoryItemBase item = new InventoryItemBase(fh.ItemID, fh.Client.AgentId);
147 item = m_scene.InventoryService.GetItem(item);
148
149 if (item != null)
150 fh.Client.SendInventoryItemDetails(item.Owner, item);
151
152 // TODO: Possibly log any failure
153 }
154 }
155 }
156} \ No newline at end of file
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index f37f94a..30421d4 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -52,6 +52,11 @@ namespace OpenSim.Region.Framework.Scenes
52 protected AsyncSceneObjectGroupDeleter m_asyncSceneObjectDeleter; 52 protected AsyncSceneObjectGroupDeleter m_asyncSceneObjectDeleter;
53 53
54 /// <summary> 54 /// <summary>
55 /// Allows inventory details to be sent to clients asynchronously
56 /// </summary>
57 protected AsyncInventorySender m_asyncInventorySender;
58
59 /// <summary>
55 /// Start all the scripts in the scene which should be started. 60 /// Start all the scripts in the scene which should be started.
56 /// </summary> 61 /// </summary>
57 public void CreateScriptInstances() 62 public void CreateScriptInstances()
@@ -1328,7 +1333,7 @@ namespace OpenSim.Region.Framework.Scenes
1328// m_log.DebugFormat("[AGENT INVENTORY]: Sending inventory folder contents ({0} nodes) for \"{1}\" to {2} {3}", 1333// m_log.DebugFormat("[AGENT INVENTORY]: Sending inventory folder contents ({0} nodes) for \"{1}\" to {2} {3}",
1329// contents.Folders.Count + contents.Items.Count, containingFolder.Name, client.FirstName, client.LastName); 1334// contents.Folders.Count + contents.Items.Count, containingFolder.Name, client.FirstName, client.LastName);
1330 1335
1331 if (containingFolder != null && containingFolder != null) 1336 if (containingFolder != null)
1332 { 1337 {
1333 // If the folder requested contains links, then we need to send those folders first, otherwise the links 1338 // If the folder requested contains links, then we need to send those folders first, otherwise the links
1334 // will be broken in the viewer. 1339 // will be broken in the viewer.
@@ -1340,15 +1345,25 @@ namespace OpenSim.Region.Framework.Scenes
1340 InventoryItemBase linkedItem = InventoryService.GetItem(new InventoryItemBase(item.AssetID)); 1345 InventoryItemBase linkedItem = InventoryService.GetItem(new InventoryItemBase(item.AssetID));
1341 1346
1342 // Take care of genuinely broken links where the target doesn't exist 1347 // Take care of genuinely broken links where the target doesn't exist
1343 if (linkedItem != null) 1348 // HACK: Also, don't follow up links that just point to other links. In theory this is legitimate,
1344 linkedItemFolderIdsToSend.Add(linkedItem.Folder); 1349 // but no viewer has been observed to set these up and this is the lazy way of avoiding cycles
1350 // rather than having to keep track of every folder requested in the recursion.
1351 if (linkedItem != null && linkedItem.AssetType != (int)AssetType.Link)
1352 {
1353 // We don't need to send the folder if source and destination of the link are in the same
1354 // folder.
1355 if (linkedItem.Folder != containingFolder.ID)
1356 linkedItemFolderIdsToSend.Add(linkedItem.Folder);
1357 }
1345 } 1358 }
1346 } 1359 }
1347 1360
1348 foreach (UUID linkedItemFolderId in linkedItemFolderIdsToSend) 1361 foreach (UUID linkedItemFolderId in linkedItemFolderIdsToSend)
1349 SendInventoryUpdate(client, new InventoryFolderBase(linkedItemFolderId), false, true); 1362 SendInventoryUpdate(client, new InventoryFolderBase(linkedItemFolderId), false, true);
1350 1363
1351 client.SendInventoryFolderDetails(client.AgentId, folder.ID, contents.Items, contents.Folders, containingFolder.Version, fetchFolders, fetchItems); 1364 client.SendInventoryFolderDetails(
1365 client.AgentId, folder.ID, contents.Items, contents.Folders,
1366 containingFolder.Version, fetchFolders, fetchItems);
1352 } 1367 }
1353 } 1368 }
1354 1369
diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
index e2d7208..44472b2 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
@@ -461,31 +461,6 @@ namespace OpenSim.Region.Framework.Scenes
461 } 461 }
462 ); 462 );
463 } 463 }
464
465
466 /// <summary>
467 /// Handle a fetch inventory request from the client
468 /// </summary>
469 /// <param name="remoteClient"></param>
470 /// <param name="itemID"></param>
471 /// <param name="ownerID"></param>
472 public void HandleFetchInventory(IClientAPI remoteClient, UUID itemID, UUID ownerID)
473 {
474 if (LibraryService != null && LibraryService.LibraryRootFolder != null && ownerID == LibraryService.LibraryRootFolder.Owner)
475 {
476 //m_log.Debug("request info for library item");
477 return;
478 }
479
480 InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId);
481 item = InventoryService.GetItem(item);
482
483 if (item != null)
484 {
485 remoteClient.SendInventoryItemDetails(ownerID, item);
486 }
487 // else shouldn't we send an alert message?
488 }
489 464
490 /// <summary> 465 /// <summary>
491 /// Tell the client about the various child items and folders contained in the requested folder. 466 /// Tell the client about the various child items and folders contained in the requested folder.
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index bdf3d1d..8195a0d 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -583,6 +583,8 @@ namespace OpenSim.Region.Framework.Scenes
583 m_asyncSceneObjectDeleter = new AsyncSceneObjectGroupDeleter(this); 583 m_asyncSceneObjectDeleter = new AsyncSceneObjectGroupDeleter(this);
584 m_asyncSceneObjectDeleter.Enabled = true; 584 m_asyncSceneObjectDeleter.Enabled = true;
585 585
586 m_asyncInventorySender = new AsyncInventorySender(this);
587
586 #region Region Settings 588 #region Region Settings
587 589
588 // Load region settings 590 // Load region settings
@@ -1724,6 +1726,7 @@ namespace OpenSim.Region.Framework.Scenes
1724 /// <summary> 1726 /// <summary>
1725 /// Loads the World's objects 1727 /// Loads the World's objects
1726 /// </summary> 1728 /// </summary>
1729 /// <param name="regionID"></param>
1727 public virtual void LoadPrimsFromStorage(UUID regionID) 1730 public virtual void LoadPrimsFromStorage(UUID regionID)
1728 { 1731 {
1729 LoadingPrims = true; 1732 LoadingPrims = true;
@@ -2593,8 +2596,10 @@ namespace OpenSim.Region.Framework.Scenes
2593 { 2596 {
2594 string homeURL = string.Empty; 2597 string homeURL = string.Empty;
2595 string first = aCircuit.firstname, last = aCircuit.lastname; 2598 string first = aCircuit.firstname, last = aCircuit.lastname;
2599
2596 if (aCircuit.ServiceURLs.ContainsKey("HomeURI")) 2600 if (aCircuit.ServiceURLs.ContainsKey("HomeURI"))
2597 homeURL = aCircuit.ServiceURLs["HomeURI"].ToString(); 2601 homeURL = aCircuit.ServiceURLs["HomeURI"].ToString();
2602
2598 if (aCircuit.lastname.StartsWith("@")) 2603 if (aCircuit.lastname.StartsWith("@"))
2599 { 2604 {
2600 string[] parts = aCircuit.firstname.Split('.'); 2605 string[] parts = aCircuit.firstname.Split('.');
@@ -2604,6 +2609,7 @@ namespace OpenSim.Region.Framework.Scenes
2604 last = parts[1]; 2609 last = parts[1];
2605 } 2610 }
2606 } 2611 }
2612
2607 uMan.AddUser(aCircuit.AgentID, first, last, homeURL); 2613 uMan.AddUser(aCircuit.AgentID, first, last, homeURL);
2608 } 2614 }
2609 } 2615 }
@@ -2757,14 +2763,13 @@ namespace OpenSim.Region.Framework.Scenes
2757 2763
2758 public virtual void SubscribeToClientInventoryEvents(IClientAPI client) 2764 public virtual void SubscribeToClientInventoryEvents(IClientAPI client)
2759 { 2765 {
2760
2761 client.OnLinkInventoryItem += HandleLinkInventoryItem; 2766 client.OnLinkInventoryItem += HandleLinkInventoryItem;
2762 client.OnCreateNewInventoryFolder += HandleCreateInventoryFolder; 2767 client.OnCreateNewInventoryFolder += HandleCreateInventoryFolder;
2763 client.OnUpdateInventoryFolder += HandleUpdateInventoryFolder; 2768 client.OnUpdateInventoryFolder += HandleUpdateInventoryFolder;
2764 client.OnMoveInventoryFolder += HandleMoveInventoryFolder; // 2; //!! 2769 client.OnMoveInventoryFolder += HandleMoveInventoryFolder; // 2; //!!
2765 client.OnFetchInventoryDescendents += HandleFetchInventoryDescendents; 2770 client.OnFetchInventoryDescendents += HandleFetchInventoryDescendents;
2766 client.OnPurgeInventoryDescendents += HandlePurgeInventoryDescendents; // 2; //!! 2771 client.OnPurgeInventoryDescendents += HandlePurgeInventoryDescendents; // 2; //!!
2767 client.OnFetchInventory += HandleFetchInventory; 2772 client.OnFetchInventory += m_asyncInventorySender.HandleFetchInventory;
2768 client.OnUpdateInventoryItem += UpdateInventoryItemAsset; 2773 client.OnUpdateInventoryItem += UpdateInventoryItemAsset;
2769 client.OnCopyInventoryItem += CopyInventoryItem; 2774 client.OnCopyInventoryItem += CopyInventoryItem;
2770 client.OnMoveInventoryItem += MoveInventoryItem; 2775 client.OnMoveInventoryItem += MoveInventoryItem;
@@ -2883,13 +2888,12 @@ namespace OpenSim.Region.Framework.Scenes
2883 2888
2884 public virtual void UnSubscribeToClientInventoryEvents(IClientAPI client) 2889 public virtual void UnSubscribeToClientInventoryEvents(IClientAPI client)
2885 { 2890 {
2886
2887 client.OnCreateNewInventoryFolder -= HandleCreateInventoryFolder; 2891 client.OnCreateNewInventoryFolder -= HandleCreateInventoryFolder;
2888 client.OnUpdateInventoryFolder -= HandleUpdateInventoryFolder; 2892 client.OnUpdateInventoryFolder -= HandleUpdateInventoryFolder;
2889 client.OnMoveInventoryFolder -= HandleMoveInventoryFolder; // 2; //!! 2893 client.OnMoveInventoryFolder -= HandleMoveInventoryFolder; // 2; //!!
2890 client.OnFetchInventoryDescendents -= HandleFetchInventoryDescendents; 2894 client.OnFetchInventoryDescendents -= HandleFetchInventoryDescendents;
2891 client.OnPurgeInventoryDescendents -= HandlePurgeInventoryDescendents; // 2; //!! 2895 client.OnPurgeInventoryDescendents -= HandlePurgeInventoryDescendents; // 2; //!!
2892 client.OnFetchInventory -= HandleFetchInventory; 2896 client.OnFetchInventory -= m_asyncInventorySender.HandleFetchInventory;
2893 client.OnUpdateInventoryItem -= UpdateInventoryItemAsset; 2897 client.OnUpdateInventoryItem -= UpdateInventoryItemAsset;
2894 client.OnCopyInventoryItem -= CopyInventoryItem; 2898 client.OnCopyInventoryItem -= CopyInventoryItem;
2895 client.OnMoveInventoryItem -= MoveInventoryItem; 2899 client.OnMoveInventoryItem -= MoveInventoryItem;
@@ -3389,7 +3393,6 @@ namespace OpenSim.Region.Framework.Scenes
3389 } 3393 }
3390 } 3394 }
3391 3395
3392
3393 // In all cases, add or update the circuit data with the new agent circuit data and teleport flags 3396 // In all cases, add or update the circuit data with the new agent circuit data and teleport flags
3394 agent.teleportFlags = teleportFlags; 3397 agent.teleportFlags = teleportFlags;
3395 m_authenticateHandler.AddNewCircuit(agent.circuitcode, agent); 3398 m_authenticateHandler.AddNewCircuit(agent.circuitcode, agent);
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index a078291..7ec7ea3 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -1401,21 +1401,26 @@ namespace OpenSim.Region.Framework.Scenes
1401 } 1401 }
1402 1402
1403 /// <summary> 1403 /// <summary>
1404 /// 1404 /// Update the flags on a scene object. This covers properties such as phantom, physics and temporary.
1405 /// </summary> 1405 /// </summary>
1406 /// <remarks>
1407 /// This is currently handling the incoming call from the client stack (e.g. LLClientView).
1408 /// </remarks>
1406 /// <param name="localID"></param> 1409 /// <param name="localID"></param>
1407 /// <param name="packet"></param> 1410 /// <param name="UsePhysics"></param>
1411 /// <param name="SetTemporary"></param>
1412 /// <param name="SetPhantom"></param>
1408 /// <param name="remoteClient"></param> 1413 /// <param name="remoteClient"></param>
1409 /// This routine seems to get called when a user changes object settings in the viewer. 1414 protected internal void UpdatePrimFlags(
1410 /// If some one can confirm that, please change the comment according. 1415 uint localID, bool UsePhysics, bool SetTemporary, bool SetPhantom, IClientAPI remoteClient)
1411 protected internal void UpdatePrimFlags(uint localID, bool UsePhysics, bool IsTemporary, bool IsPhantom, IClientAPI remoteClient)
1412 { 1416 {
1413 SceneObjectGroup group = GetGroupByPrim(localID); 1417 SceneObjectGroup group = GetGroupByPrim(localID);
1414 if (group != null) 1418 if (group != null)
1415 { 1419 {
1416 if (m_parentScene.Permissions.CanEditObject(group.UUID, remoteClient.AgentId)) 1420 if (m_parentScene.Permissions.CanEditObject(group.UUID, remoteClient.AgentId))
1417 { 1421 {
1418 group.UpdatePrimFlags(localID, UsePhysics, IsTemporary, IsPhantom, false); // VolumeDetect can't be set via UI and will always be off when a change is made there 1422 // VolumeDetect can't be set via UI and will always be off when a change is made there
1423 group.UpdatePrimFlags(localID, UsePhysics, SetTemporary, SetPhantom, false);
1419 } 1424 }
1420 } 1425 }
1421 } 1426 }
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 42ac9aa..fa23fcd 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -2513,14 +2513,15 @@ namespace OpenSim.Region.Framework.Scenes
2513 /// Update prim flags for this group. 2513 /// Update prim flags for this group.
2514 /// </summary> 2514 /// </summary>
2515 /// <param name="localID"></param> 2515 /// <param name="localID"></param>
2516 /// <param name="type"></param> 2516 /// <param name="UsePhysics"></param>
2517 /// <param name="inUse"></param> 2517 /// <param name="SetTemporary"></param>
2518 /// <param name="data"></param> 2518 /// <param name="SetPhantom"></param>
2519 public void UpdatePrimFlags(uint localID, bool UsePhysics, bool IsTemporary, bool IsPhantom, bool IsVolumeDetect) 2519 /// <param name="SetVolumeDetect"></param>
2520 public void UpdatePrimFlags(uint localID, bool UsePhysics, bool SetTemporary, bool SetPhantom, bool SetVolumeDetect)
2520 { 2521 {
2521 SceneObjectPart selectionPart = GetChildPart(localID); 2522 SceneObjectPart selectionPart = GetChildPart(localID);
2522 2523
2523 if (IsTemporary) 2524 if (SetTemporary)
2524 { 2525 {
2525 DetachFromBackup(); 2526 DetachFromBackup();
2526 // Remove from database and parcel prim count 2527 // Remove from database and parcel prim count
@@ -2545,7 +2546,7 @@ namespace OpenSim.Region.Framework.Scenes
2545 } 2546 }
2546 2547
2547 for (int i = 0; i < parts.Length; i++) 2548 for (int i = 0; i < parts.Length; i++)
2548 parts[i].UpdatePrimFlags(UsePhysics, IsTemporary, IsPhantom, IsVolumeDetect); 2549 parts[i].UpdatePrimFlags(UsePhysics, SetTemporary, SetPhantom, SetVolumeDetect);
2549 } 2550 }
2550 } 2551 }
2551 2552
@@ -3287,34 +3288,36 @@ namespace OpenSim.Region.Framework.Scenes
3287 3288
3288 return retmass; 3289 return retmass;
3289 } 3290 }
3290 3291
3292 /// <summary>
3293 /// If the object is a sculpt/mesh, retrieve the mesh data for each part and reinsert it into each shape so that
3294 /// the physics engine can use it.
3295 /// </summary>
3296 /// <remarks>
3297 /// When the physics engine has finished with it, the sculpt data is discarded to save memory.
3298 /// </remarks>
3291 public void CheckSculptAndLoad() 3299 public void CheckSculptAndLoad()
3292 { 3300 {
3293 if (IsDeleted) 3301 if (IsDeleted)
3294 return; 3302 return;
3303
3295 if ((RootPart.GetEffectiveObjectFlags() & (uint)PrimFlags.Phantom) != 0) 3304 if ((RootPart.GetEffectiveObjectFlags() & (uint)PrimFlags.Phantom) != 0)
3296 return; 3305 return;
3297 3306
3307// m_log.Debug("Processing CheckSculptAndLoad for {0} {1}", Name, LocalId);
3308
3298 SceneObjectPart[] parts = m_parts.GetArray(); 3309 SceneObjectPart[] parts = m_parts.GetArray();
3310
3299 for (int i = 0; i < parts.Length; i++) 3311 for (int i = 0; i < parts.Length; i++)
3300 { 3312 parts[i].CheckSculptAndLoad();
3301 SceneObjectPart part = parts[i];
3302 if (part.Shape.SculptEntry && part.Shape.SculptTexture != UUID.Zero)
3303 {
3304 // check if a previously decoded sculpt map has been cached
3305 if (File.Exists(System.IO.Path.Combine("j2kDecodeCache", "smap_" + part.Shape.SculptTexture.ToString())))
3306 {
3307 part.SculptTextureCallback(part.Shape.SculptTexture, null);
3308 }
3309 else
3310 {
3311 m_scene.AssetService.Get(
3312 part.Shape.SculptTexture.ToString(), part, AssetReceived);
3313 }
3314 }
3315 }
3316 } 3313 }
3317 3314
3315 /// <summary>
3316 /// Handle an asset received asynchronously from the asset service.
3317 /// </summary>
3318 /// <param name="id"></param>
3319 /// <param name="sender"></param>
3320 /// <param name="asset"></param>
3318 protected void AssetReceived(string id, Object sender, AssetBase asset) 3321 protected void AssetReceived(string id, Object sender, AssetBase asset)
3319 { 3322 {
3320 SceneObjectPart sop = (SceneObjectPart)sender; 3323 SceneObjectPart sop = (SceneObjectPart)sender;
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index c6d8c73..2026c53 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -28,6 +28,7 @@
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Drawing; 30using System.Drawing;
31using System.IO;
31using System.Reflection; 32using System.Reflection;
32using System.Runtime.Serialization; 33using System.Runtime.Serialization;
33using System.Security.Permissions; 34using System.Security.Permissions;
@@ -800,7 +801,8 @@ namespace OpenSim.Region.Framework.Scenes
800 actor.Orientation = GetWorldRotation(); 801 actor.Orientation = GetWorldRotation();
801 802
802 // Tell the physics engines that this prim changed. 803 // Tell the physics engines that this prim changed.
803 m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor); 804 if (m_parentGroup.Scene != null)
805 m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor);
804 } 806 }
805 } 807 }
806 } 808 }
@@ -1067,7 +1069,6 @@ namespace OpenSim.Region.Framework.Scenes
1067 } 1069 }
1068 } 1070 }
1069 1071
1070
1071 public bool CreateSelected 1072 public bool CreateSelected
1072 { 1073 {
1073 get { return m_createSelected; } 1074 get { return m_createSelected; }
@@ -1085,11 +1086,13 @@ namespace OpenSim.Region.Framework.Scenes
1085 1086
1086 public Vector3 AbsolutePosition 1087 public Vector3 AbsolutePosition
1087 { 1088 {
1088 get { 1089 get
1090 {
1089 if (IsAttachment) 1091 if (IsAttachment)
1090 return GroupPosition; 1092 return GroupPosition;
1091 1093
1092 return m_offsetPosition + m_groupPosition; } 1094 return m_offsetPosition + m_groupPosition;
1095 }
1093 } 1096 }
1094 1097
1095 public SceneObjectGroup ParentGroup 1098 public SceneObjectGroup ParentGroup
@@ -1238,7 +1241,9 @@ namespace OpenSim.Region.Framework.Scenes
1238 /// <summary> 1241 /// <summary>
1239 /// Property flags. See OpenMetaverse.PrimFlags 1242 /// Property flags. See OpenMetaverse.PrimFlags
1240 /// </summary> 1243 /// </summary>
1244 /// <remarks>
1241 /// Example properties are PrimFlags.Phantom and PrimFlags.DieAtEdge 1245 /// Example properties are PrimFlags.Phantom and PrimFlags.DieAtEdge
1246 /// </remarks>
1242 public PrimFlags Flags 1247 public PrimFlags Flags
1243 { 1248 {
1244 get { return _flags; } 1249 get { return _flags; }
@@ -1561,6 +1566,8 @@ namespace OpenSim.Region.Framework.Scenes
1561 /// <param name="m_physicalPrim"></param> 1566 /// <param name="m_physicalPrim"></param>
1562 public void ApplyPhysics(uint rootObjectFlags, bool VolumeDetectActive, bool m_physicalPrim) 1567 public void ApplyPhysics(uint rootObjectFlags, bool VolumeDetectActive, bool m_physicalPrim)
1563 { 1568 {
1569// m_log.DebugFormat("[SCENE OBJECT PART]: Applying physics to {0} {1} {2}", Name, LocalId, UUID);
1570
1564 bool isPhysical = (((rootObjectFlags & (uint) PrimFlags.Physics) != 0) && m_physicalPrim); 1571 bool isPhysical = (((rootObjectFlags & (uint) PrimFlags.Physics) != 0) && m_physicalPrim);
1565 bool isPhantom = ((rootObjectFlags & (uint) PrimFlags.Phantom) != 0); 1572 bool isPhantom = ((rootObjectFlags & (uint) PrimFlags.Phantom) != 0);
1566 1573
@@ -1581,6 +1588,8 @@ namespace OpenSim.Region.Framework.Scenes
1581 // or flexible 1588 // or flexible
1582 if (!isPhantom && !IsAttachment && !(Shape.PathCurve == (byte) Extrusion.Flexible)) 1589 if (!isPhantom && !IsAttachment && !(Shape.PathCurve == (byte) Extrusion.Flexible))
1583 { 1590 {
1591// m_log.DebugFormat("[SCENE OBJECT PART]: Creating PhysActor for {0} {1} {2}", Name, LocalId, UUID);
1592
1584 PhysActor = m_parentGroup.Scene.PhysicsScene.AddPrimShape( 1593 PhysActor = m_parentGroup.Scene.PhysicsScene.AddPrimShape(
1585 LocalId, 1594 LocalId,
1586 string.Format("{0}/{1}", Name, UUID), 1595 string.Format("{0}/{1}", Name, UUID),
@@ -1802,7 +1811,6 @@ namespace OpenSim.Region.Framework.Scenes
1802 { 1811 {
1803 ParentGroup.Scene.jointErrorMessage(joint, "warning: tracked body name not found! joint location will not be updated properly. joint: " + Name); 1812 ParentGroup.Scene.jointErrorMessage(joint, "warning: tracked body name not found! joint location will not be updated properly. joint: " + Name);
1804 } 1813 }
1805
1806 } 1814 }
1807 else 1815 else
1808 { 1816 {
@@ -1864,7 +1872,6 @@ namespace OpenSim.Region.Framework.Scenes
1864 1872
1865 PhysActor.IsPhysical = UsePhysics; 1873 PhysActor.IsPhysical = UsePhysics;
1866 1874
1867
1868 // If we're not what we're supposed to be in the physics scene, recreate ourselves. 1875 // If we're not what we're supposed to be in the physics scene, recreate ourselves.
1869 //m_parentGroup.Scene.PhysicsScene.RemovePrim(PhysActor); 1876 //m_parentGroup.Scene.PhysicsScene.RemovePrim(PhysActor);
1870 /// that's not wholesome. Had to make Scene public 1877 /// that's not wholesome. Had to make Scene public
@@ -1888,6 +1895,7 @@ namespace OpenSim.Region.Framework.Scenes
1888 } 1895 }
1889 } 1896 }
1890 } 1897 }
1898
1891 m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor); 1899 m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor);
1892 } 1900 }
1893 } 1901 }
@@ -2823,6 +2831,12 @@ namespace OpenSim.Region.Framework.Scenes
2823 StoreUndoState(); 2831 StoreUndoState();
2824 m_shape.Scale = scale; 2832 m_shape.Scale = scale;
2825 2833
2834 // If we're a mesh/sculpt, then we need to tell the physics engine about our new size. To do this, we
2835 // need to reinsert the sculpt data into the shape, since the physics engine deletes it when done to
2836 // save memory
2837 if (PhysActor != null)
2838 CheckSculptAndLoad();
2839
2826 ParentGroup.HasGroupChanged = true; 2840 ParentGroup.HasGroupChanged = true;
2827 ScheduleFullUpdate(); 2841 ScheduleFullUpdate();
2828 } 2842 }
@@ -2951,7 +2965,6 @@ namespace OpenSim.Region.Framework.Scenes
2951 } 2965 }
2952 } 2966 }
2953 2967
2954
2955 public void SculptTextureCallback(UUID textureID, AssetBase texture) 2968 public void SculptTextureCallback(UUID textureID, AssetBase texture)
2956 { 2969 {
2957 if (m_shape.SculptEntry) 2970 if (m_shape.SculptEntry)
@@ -2960,14 +2973,17 @@ namespace OpenSim.Region.Framework.Scenes
2960 //if (texture != null) 2973 //if (texture != null)
2961 { 2974 {
2962 if (texture != null) 2975 if (texture != null)
2976 {
2977// m_log.DebugFormat(
2978// "[SCENE OBJECT PART]: Setting sculpt data for {0} on SculptTextureCallback()", Name);
2979
2963 m_shape.SculptData = texture.Data; 2980 m_shape.SculptData = texture.Data;
2981 }
2964 2982
2965 if (PhysActor != null) 2983 if (PhysActor != null)
2966 { 2984 {
2967 // Tricks physics engine into thinking we've changed the part shape. 2985 // Update the physics actor with the new loaded sculpt data and set the taint signal.
2968 PrimitiveBaseShape m_newshape = m_shape.Copy(); 2986 PhysActor.Shape = m_shape;
2969 PhysActor.Shape = m_newshape;
2970 m_shape = m_newshape;
2971 2987
2972 m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor); 2988 m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor);
2973 } 2989 }
@@ -3263,11 +3279,14 @@ namespace OpenSim.Region.Framework.Scenes
3263 { 3279 {
3264 m_parentGroup.SetAxisRotation(axis, rotate); 3280 m_parentGroup.SetAxisRotation(axis, rotate);
3265 } 3281 }
3282
3266 //Cannot use ScriptBaseClass constants as no referance to it currently. 3283 //Cannot use ScriptBaseClass constants as no referance to it currently.
3267 if (axis == 2)//STATUS_ROTATE_X 3284 if (axis == 2)//STATUS_ROTATE_X
3268 STATUS_ROTATE_X = rotate; 3285 STATUS_ROTATE_X = rotate;
3286
3269 if (axis == 4)//STATUS_ROTATE_Y 3287 if (axis == 4)//STATUS_ROTATE_Y
3270 STATUS_ROTATE_Y = rotate; 3288 STATUS_ROTATE_Y = rotate;
3289
3271 if (axis == 8)//STATUS_ROTATE_Z 3290 if (axis == 8)//STATUS_ROTATE_Z
3272 STATUS_ROTATE_Z = rotate; 3291 STATUS_ROTATE_Z = rotate;
3273 } 3292 }
@@ -4318,14 +4337,21 @@ namespace OpenSim.Region.Framework.Scenes
4318 } 4337 }
4319 } 4338 }
4320 4339
4321 public void UpdatePrimFlags(bool UsePhysics, bool IsTemporary, bool IsPhantom, bool IsVD) 4340 /// <summary>
4341 /// Update the flags on this prim. This covers properties such as phantom, physics and temporary.
4342 /// </summary>
4343 /// <param name="UsePhysics"></param>
4344 /// <param name="SetTemporary"></param>
4345 /// <param name="SetPhantom"></param>
4346 /// <param name="SetVD"></param>
4347 public void UpdatePrimFlags(bool UsePhysics, bool SetTemporary, bool SetPhantom, bool SetVD)
4322 { 4348 {
4323 bool wasUsingPhysics = ((Flags & PrimFlags.Physics) != 0); 4349 bool wasUsingPhysics = ((Flags & PrimFlags.Physics) != 0);
4324 bool wasTemporary = ((Flags & PrimFlags.TemporaryOnRez) != 0); 4350 bool wasTemporary = ((Flags & PrimFlags.TemporaryOnRez) != 0);
4325 bool wasPhantom = ((Flags & PrimFlags.Phantom) != 0); 4351 bool wasPhantom = ((Flags & PrimFlags.Phantom) != 0);
4326 bool wasVD = VolumeDetectActive; 4352 bool wasVD = VolumeDetectActive;
4327 4353
4328 if ((UsePhysics == wasUsingPhysics) && (wasTemporary == IsTemporary) && (wasPhantom == IsPhantom) && (IsVD==wasVD)) 4354 if ((UsePhysics == wasUsingPhysics) && (wasTemporary == SetTemporary) && (wasPhantom == SetPhantom) && (SetVD == wasVD))
4329 { 4355 {
4330 return; 4356 return;
4331 } 4357 }
@@ -4335,32 +4361,31 @@ namespace OpenSim.Region.Framework.Scenes
4335 // that... 4361 // that...
4336 // ... if VD is changed, all others are not. 4362 // ... if VD is changed, all others are not.
4337 // ... if one of the others is changed, VD is not. 4363 // ... if one of the others is changed, VD is not.
4338 if (IsVD) // VD is active, special logic applies 4364 if (SetVD) // VD is active, special logic applies
4339 { 4365 {
4340 // State machine logic for VolumeDetect 4366 // State machine logic for VolumeDetect
4341 // More logic below 4367 // More logic below
4342 bool phanReset = (IsPhantom != wasPhantom) && !IsPhantom; 4368 bool phanReset = (SetPhantom != wasPhantom) && !SetPhantom;
4343 4369
4344 if (phanReset) // Phantom changes from on to off switch VD off too 4370 if (phanReset) // Phantom changes from on to off switch VD off too
4345 { 4371 {
4346 IsVD = false; // Switch it of for the course of this routine 4372 SetVD = false; // Switch it of for the course of this routine
4347 VolumeDetectActive = false; // and also permanently 4373 VolumeDetectActive = false; // and also permanently
4348 if (PhysActor != null) 4374 if (PhysActor != null)
4349 PhysActor.SetVolumeDetect(0); // Let physics know about it too 4375 PhysActor.SetVolumeDetect(0); // Let physics know about it too
4350 } 4376 }
4351 else 4377 else
4352 { 4378 {
4353 IsPhantom = false;
4354 // If volumedetect is active we don't want phantom to be applied. 4379 // If volumedetect is active we don't want phantom to be applied.
4355 // If this is a new call to VD out of the state "phantom" 4380 // If this is a new call to VD out of the state "phantom"
4356 // this will also cause the prim to be visible to physics 4381 // this will also cause the prim to be visible to physics
4382 SetPhantom = false;
4357 } 4383 }
4358
4359 } 4384 }
4360 4385
4361 if (UsePhysics && IsJoint()) 4386 if (UsePhysics && IsJoint())
4362 { 4387 {
4363 IsPhantom = true; 4388 SetPhantom = true;
4364 } 4389 }
4365 4390
4366 if (UsePhysics) 4391 if (UsePhysics)
@@ -4390,8 +4415,7 @@ namespace OpenSim.Region.Framework.Scenes
4390 } 4415 }
4391 } 4416 }
4392 4417
4393 4418 if (SetPhantom || IsAttachment || (Shape.PathCurve == (byte)Extrusion.Flexible)) // note: this may have been changed above in the case of joints
4394 if (IsPhantom || IsAttachment || (Shape.PathCurve == (byte)Extrusion.Flexible)) // note: this may have been changed above in the case of joints
4395 { 4419 {
4396 AddFlag(PrimFlags.Phantom); 4420 AddFlag(PrimFlags.Phantom);
4397 if (PhysActor != null) 4421 if (PhysActor != null)
@@ -4406,6 +4430,7 @@ namespace OpenSim.Region.Framework.Scenes
4406 RemFlag(PrimFlags.Phantom); 4430 RemFlag(PrimFlags.Phantom);
4407 4431
4408 PhysicsActor pa = PhysActor; 4432 PhysicsActor pa = PhysActor;
4433
4409 if (pa == null) 4434 if (pa == null)
4410 { 4435 {
4411 // It's not phantom anymore. So make sure the physics engine get's knowledge of it 4436 // It's not phantom anymore. So make sure the physics engine get's knowledge of it
@@ -4422,6 +4447,7 @@ namespace OpenSim.Region.Framework.Scenes
4422 if (pa != null) 4447 if (pa != null)
4423 { 4448 {
4424 DoPhysicsPropertyUpdate(UsePhysics, true); 4449 DoPhysicsPropertyUpdate(UsePhysics, true);
4450
4425 if (m_parentGroup != null) 4451 if (m_parentGroup != null)
4426 { 4452 {
4427 if (!m_parentGroup.IsDeleted) 4453 if (!m_parentGroup.IsDeleted)
@@ -4432,6 +4458,7 @@ namespace OpenSim.Region.Framework.Scenes
4432 } 4458 }
4433 } 4459 }
4434 } 4460 }
4461
4435 if ( 4462 if (
4436 ((AggregateScriptEvents & scriptEvents.collision) != 0) || 4463 ((AggregateScriptEvents & scriptEvents.collision) != 0) ||
4437 ((AggregateScriptEvents & scriptEvents.collision_end) != 0) || 4464 ((AggregateScriptEvents & scriptEvents.collision_end) != 0) ||
@@ -4442,8 +4469,8 @@ namespace OpenSim.Region.Framework.Scenes
4442 (CollisionSound != UUID.Zero) 4469 (CollisionSound != UUID.Zero)
4443 ) 4470 )
4444 { 4471 {
4445 PhysActor.OnCollisionUpdate += PhysicsCollision; 4472 PhysActor.OnCollisionUpdate += PhysicsCollision;
4446 PhysActor.SubscribeEvents(1000); 4473 PhysActor.SubscribeEvents(1000);
4447 } 4474 }
4448 } 4475 }
4449 } 4476 }
@@ -4465,7 +4492,7 @@ namespace OpenSim.Region.Framework.Scenes
4465 } 4492 }
4466 } 4493 }
4467 4494
4468 if (IsVD) 4495 if (SetVD)
4469 { 4496 {
4470 // If the above logic worked (this is urgent candidate to unit tests!) 4497 // If the above logic worked (this is urgent candidate to unit tests!)
4471 // we now have a physicsactor. 4498 // we now have a physicsactor.
@@ -4480,18 +4507,19 @@ namespace OpenSim.Region.Framework.Scenes
4480 } 4507 }
4481 } 4508 }
4482 else 4509 else
4483 { // Remove VolumeDetect in any case. Note, it's safe to call SetVolumeDetect as often as you like 4510 {
4511 // Remove VolumeDetect in any case. Note, it's safe to call SetVolumeDetect as often as you like
4484 // (mumbles, well, at least if you have infinte CPU powers :-)) 4512 // (mumbles, well, at least if you have infinte CPU powers :-))
4485 PhysicsActor pa = this.PhysActor; 4513 PhysicsActor pa = this.PhysActor;
4486 if (pa != null) 4514 if (pa != null)
4487 { 4515 {
4488 PhysActor.SetVolumeDetect(0); 4516 PhysActor.SetVolumeDetect(0);
4489 } 4517 }
4518
4490 this.VolumeDetectActive = false; 4519 this.VolumeDetectActive = false;
4491 } 4520 }
4492 4521
4493 4522 if (SetTemporary)
4494 if (IsTemporary)
4495 { 4523 {
4496 AddFlag(PrimFlags.TemporaryOnRez); 4524 AddFlag(PrimFlags.TemporaryOnRez);
4497 } 4525 }
@@ -4542,6 +4570,7 @@ namespace OpenSim.Region.Framework.Scenes
4542 m_shape.PathTaperY = shapeBlock.PathTaperY; 4570 m_shape.PathTaperY = shapeBlock.PathTaperY;
4543 m_shape.PathTwist = shapeBlock.PathTwist; 4571 m_shape.PathTwist = shapeBlock.PathTwist;
4544 m_shape.PathTwistBegin = shapeBlock.PathTwistBegin; 4572 m_shape.PathTwistBegin = shapeBlock.PathTwistBegin;
4573
4545 if (PhysActor != null) 4574 if (PhysActor != null)
4546 { 4575 {
4547 PhysActor.Shape = m_shape; 4576 PhysActor.Shape = m_shape;
@@ -4563,11 +4592,44 @@ namespace OpenSim.Region.Framework.Scenes
4563 } 4592 }
4564 4593
4565 /// <summary> 4594 /// <summary>
4595 /// If the part is a sculpt/mesh, retrieve the mesh data and reinsert it into the shape so that the physics
4596 /// engine can use it.
4597 /// </summary>
4598 /// <remarks>
4599 /// When the physics engine has finished with it, the sculpt data is discarded to save memory.
4600 /// </remarks>
4601 public void CheckSculptAndLoad()
4602 {
4603// m_log.Debug("Processing CheckSculptAndLoad for {0} {1}", Name, LocalId);
4604
4605 if (ParentGroup.IsDeleted)
4606 return;
4607
4608 if ((ParentGroup.RootPart.GetEffectiveObjectFlags() & (uint)PrimFlags.Phantom) != 0)
4609 return;
4610
4611 if (Shape.SculptEntry && Shape.SculptTexture != UUID.Zero)
4612 {
4613 // check if a previously decoded sculpt map has been cached
4614 if (File.Exists(System.IO.Path.Combine("j2kDecodeCache", "smap_" + Shape.SculptTexture.ToString())))
4615 {
4616 SculptTextureCallback(Shape.SculptTexture, null);
4617 }
4618 else
4619 {
4620 ParentGroup.Scene.AssetService.Get(Shape.SculptTexture.ToString(), this, AssetReceived);
4621 }
4622 }
4623 }
4624
4625 /// <summary>
4566 /// Update the textures on the part. 4626 /// Update the textures on the part.
4567 /// </summary> 4627 /// </summary>
4628 /// <remarks>
4568 /// Added to handle bug in libsecondlife's TextureEntry.ToBytes() 4629 /// Added to handle bug in libsecondlife's TextureEntry.ToBytes()
4569 /// not handling RGBA properly. Cycles through, and "fixes" the color 4630 /// not handling RGBA properly. Cycles through, and "fixes" the color
4570 /// info 4631 /// info
4632 /// </remarks>
4571 /// <param name="tex"></param> 4633 /// <param name="tex"></param>
4572 public void UpdateTexture(Primitive.TextureEntry tex) 4634 public void UpdateTexture(Primitive.TextureEntry tex)
4573 { 4635 {
@@ -4798,6 +4860,7 @@ namespace OpenSim.Region.Framework.Scenes
4798 4860
4799 Inventory.ApplyNextOwnerPermissions(); 4861 Inventory.ApplyNextOwnerPermissions();
4800 } 4862 }
4863
4801 public void UpdateLookAt() 4864 public void UpdateLookAt()
4802 { 4865 {
4803 try 4866 try
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 80aafd0..83b761c 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -1944,10 +1944,9 @@ namespace OpenSim.Region.Framework.Scenes
1944 m_log.Warn("Sit requested on unknown object: " + targetID.ToString()); 1944 m_log.Warn("Sit requested on unknown object: " + targetID.ToString());
1945 } 1945 }
1946 1946
1947
1948
1949 SendSitResponse(remoteClient, targetID, offset, Quaternion.Identity); 1947 SendSitResponse(remoteClient, targetID, offset, Quaternion.Identity);
1950 } 1948 }
1949
1951 /* 1950 /*
1952 public void SitRayCastAvatarPosition(SceneObjectPart part) 1951 public void SitRayCastAvatarPosition(SceneObjectPart part)
1953 { 1952 {
@@ -2380,7 +2379,6 @@ namespace OpenSim.Region.Framework.Scenes
2380 /// <param name="remoteClient"></param> 2379 /// <param name="remoteClient"></param>
2381 public void SendTerseUpdateToClient(IClientAPI remoteClient) 2380 public void SendTerseUpdateToClient(IClientAPI remoteClient)
2382 { 2381 {
2383
2384 // If the client is inactive, it's getting its updates from another 2382 // If the client is inactive, it's getting its updates from another
2385 // server. 2383 // server.
2386 if (remoteClient.IsActive) 2384 if (remoteClient.IsActive)
@@ -2495,7 +2493,7 @@ namespace OpenSim.Region.Framework.Scenes
2495 } 2493 }
2496 2494
2497 // If we aren't using a cached appearance, then clear out the baked textures 2495 // If we aren't using a cached appearance, then clear out the baked textures
2498 if (! cachedappearance) 2496 if (!cachedappearance)
2499 { 2497 {
2500 m_appearance.ResetAppearance(); 2498 m_appearance.ResetAppearance();
2501 if (m_scene.AvatarFactory != null) 2499 if (m_scene.AvatarFactory != null)
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
index fcf7e0c..c18c93a 100644
--- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
+++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
@@ -1001,6 +1001,8 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1001 1001
1002 private static void ProcessShpSculptData(PrimitiveBaseShape shp, XmlTextReader reader) 1002 private static void ProcessShpSculptData(PrimitiveBaseShape shp, XmlTextReader reader)
1003 { 1003 {
1004// m_log.DebugFormat("[SCENE OBJECT SERIALIZER]: Setting sculpt data length {0}", shp.SculptData.Length);
1005
1004 shp.SculptData = Convert.FromBase64String(reader.ReadElementString("SculptData")); 1006 shp.SculptData = Convert.FromBase64String(reader.ReadElementString("SculptData"));
1005 } 1007 }
1006 1008
diff --git a/OpenSim/Region/Framework/Scenes/Tests/AttachmentTests.cs b/OpenSim/Region/Framework/Scenes/Tests/AttachmentTests.cs
index cff649b..5586c65 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/AttachmentTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/AttachmentTests.cs
@@ -83,7 +83,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
83 region1 = scene.RegionInfo.RegionHandle; 83 region1 = scene.RegionInfo.RegionHandle;
84 region2 = scene2.RegionInfo.RegionHandle; 84 region2 = scene2.RegionInfo.RegionHandle;
85 85
86 SceneSetupHelpers.AddRootAgent(scene, agent1); 86 SceneSetupHelpers.AddClient(scene, agent1);
87 } 87 }
88 88
89 [Test] 89 [Test]
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs
index 0a82c4f..260d1c0 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs
@@ -139,7 +139,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
139 139
140 SceneObjectPart part = SceneSetupHelpers.AddSceneObject(scene); 140 SceneObjectPart part = SceneSetupHelpers.AddSceneObject(scene);
141 141
142 IClientAPI client = SceneSetupHelpers.AddRootAgent(scene, agentId); 142 IClientAPI client = SceneSetupHelpers.AddClient(scene, agentId);
143 scene.DeRezObjects(client, new System.Collections.Generic.List<uint>() { part.LocalId }, UUID.Zero, DeRezAction.Delete, UUID.Zero); 143 scene.DeRezObjects(client, new System.Collections.Generic.List<uint>() { part.LocalId }, UUID.Zero, DeRezAction.Delete, UUID.Zero);
144 144
145 SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId); 145 SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId);
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs
index 5357a06..1b8c100 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs
@@ -66,7 +66,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
66 IConfig config = configSource.AddConfig("Startup"); 66 IConfig config = configSource.AddConfig("Startup");
67 config.Set("serverside_object_permissions", true); 67 config.Set("serverside_object_permissions", true);
68 SceneSetupHelpers.SetupSceneModules(scene, configSource, new object[] { new PermissionsModule() }); 68 SceneSetupHelpers.SetupSceneModules(scene, configSource, new object[] { new PermissionsModule() });
69 TestClient client = SceneSetupHelpers.AddRootAgent(scene, userId); 69 TestClient client = SceneSetupHelpers.AddClient(scene, userId);
70 70
71 // Turn off the timer on the async sog deleter - we'll crank it by hand for this test. 71 // Turn off the timer on the async sog deleter - we'll crank it by hand for this test.
72 AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter; 72 AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter;
@@ -105,7 +105,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
105 IConfig config = configSource.AddConfig("Startup"); 105 IConfig config = configSource.AddConfig("Startup");
106 config.Set("serverside_object_permissions", true); 106 config.Set("serverside_object_permissions", true);
107 SceneSetupHelpers.SetupSceneModules(scene, configSource, new object[] { new PermissionsModule() }); 107 SceneSetupHelpers.SetupSceneModules(scene, configSource, new object[] { new PermissionsModule() });
108 TestClient client = SceneSetupHelpers.AddRootAgent(scene, userId); 108 TestClient client = SceneSetupHelpers.AddClient(scene, userId);
109 109
110 // Turn off the timer on the async sog deleter - we'll crank it by hand for this test. 110 // Turn off the timer on the async sog deleter - we'll crank it by hand for this test.
111 AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter; 111 AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter;
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs
index 77bd4c2..8425d37 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs
@@ -75,7 +75,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
75 new GroupsModule(), 75 new GroupsModule(),
76 new MockGroupsServicesConnector() }); 76 new MockGroupsServicesConnector() });
77 77
78 TestClient client = SceneSetupHelpers.AddRootAgent(scene, userId); 78 TestClient client = SceneSetupHelpers.AddClient(scene, userId);
79 79
80 IGroupsModule groupsModule = scene.RequestModuleInterface<IGroupsModule>(); 80 IGroupsModule groupsModule = scene.RequestModuleInterface<IGroupsModule>();
81 81
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs
index 03ac252..a37b338 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs
@@ -212,7 +212,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
212 212
213 SceneSetupHelpers.SetupSceneModules(myScene1, configSource, etm); 213 SceneSetupHelpers.SetupSceneModules(myScene1, configSource, etm);
214 214
215 SceneSetupHelpers.AddRootAgent(myScene1, agent1Id); 215 SceneSetupHelpers.AddClient(myScene1, agent1Id);
216 ScenePresence childPresence = myScene2.GetScenePresence(agent1); 216 ScenePresence childPresence = myScene2.GetScenePresence(agent1);
217 217
218 // TODO: Need to do a fair amount of work to allow synchronous establishment of child agents 218 // TODO: Need to do a fair amount of work to allow synchronous establishment of child agents
diff --git a/OpenSim/Region/Framework/Scenes/Tests/StandaloneTeleportTests.cs b/OpenSim/Region/Framework/Scenes/Tests/StandaloneTeleportTests.cs
index 1b5a54e..4074f5d 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/StandaloneTeleportTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/StandaloneTeleportTests.cs
@@ -125,7 +125,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
125 sceneA.RegisterRegionWithGrid(); 125 sceneA.RegisterRegionWithGrid();
126 126
127 UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000041"); 127 UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000041");
128 TestClient client = SceneSetupHelpers.AddRootAgent(sceneA, agentId); 128 TestClient client = SceneSetupHelpers.AddClient(sceneA, agentId);
129 129
130 ICapabilitiesModule sceneACapsModule = sceneA.RequestModuleInterface<ICapabilitiesModule>(); 130 ICapabilitiesModule sceneACapsModule = sceneA.RequestModuleInterface<ICapabilitiesModule>();
131 131