aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r--OpenSim/Region/Framework/Interfaces/IFriendsModule.cs2
-rw-r--r--OpenSim/Region/Framework/Interfaces/ILandObject.cs1
-rw-r--r--OpenSim/Region/Framework/Interfaces/IScriptModuleComms.cs44
-rw-r--r--OpenSim/Region/Framework/Scenes/EntityBase.cs14
-rw-r--r--OpenSim/Region/Framework/Scenes/Hypergrid/HGAssetMapper.cs16
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs28
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs126
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs30
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs6
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs26
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs88
-rw-r--r--OpenSim/Region/Framework/Scenes/UuidGatherer.cs4
13 files changed, 315 insertions, 72 deletions
diff --git a/OpenSim/Region/Framework/Interfaces/IFriendsModule.cs b/OpenSim/Region/Framework/Interfaces/IFriendsModule.cs
index 7a8aba2..8386030 100644
--- a/OpenSim/Region/Framework/Interfaces/IFriendsModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IFriendsModule.cs
@@ -27,6 +27,7 @@
27 27
28using OpenMetaverse; 28using OpenMetaverse;
29using OpenSim.Framework; 29using OpenSim.Framework;
30using System.Collections.Generic;
30 31
31namespace OpenSim.Region.Framework.Interfaces 32namespace OpenSim.Region.Framework.Interfaces
32{ 33{
@@ -45,5 +46,6 @@ namespace OpenSim.Region.Framework.Interfaces
45 /// </param> 46 /// </param>
46 /// <param name="offerMessage"></param> 47 /// <param name="offerMessage"></param>
47 void OfferFriendship(UUID fromUserId, IClientAPI toUserClient, string offerMessage); 48 void OfferFriendship(UUID fromUserId, IClientAPI toUserClient, string offerMessage);
49 List<FriendListItem> GetUserFriends(UUID agentID);
48 } 50 }
49} 51}
diff --git a/OpenSim/Region/Framework/Interfaces/ILandObject.cs b/OpenSim/Region/Framework/Interfaces/ILandObject.cs
index c2b1292..084184f 100644
--- a/OpenSim/Region/Framework/Interfaces/ILandObject.cs
+++ b/OpenSim/Region/Framework/Interfaces/ILandObject.cs
@@ -54,6 +54,7 @@ namespace OpenSim.Region.Framework.Interfaces
54 bool IsBannedFromLand(UUID avatar); 54 bool IsBannedFromLand(UUID avatar);
55 bool IsRestrictedFromLand(UUID avatar); 55 bool IsRestrictedFromLand(UUID avatar);
56 void SendLandUpdateToClient(IClientAPI remote_client); 56 void SendLandUpdateToClient(IClientAPI remote_client);
57 void SendLandUpdateToClient(bool snap_selection, IClientAPI remote_client);
57 List<UUID> CreateAccessListArrayByFlag(AccessList flag); 58 List<UUID> CreateAccessListArrayByFlag(AccessList flag);
58 void SendAccessList(UUID agentID, UUID sessionID, uint flags, int sequenceID, IClientAPI remote_client); 59 void SendAccessList(UUID agentID, UUID sessionID, uint flags, int sequenceID, IClientAPI remote_client);
59 void UpdateAccessList(uint flags, List<ParcelManager.ParcelAccessEntry> entries, IClientAPI remote_client); 60 void UpdateAccessList(uint flags, List<ParcelManager.ParcelAccessEntry> entries, IClientAPI remote_client);
diff --git a/OpenSim/Region/Framework/Interfaces/IScriptModuleComms.cs b/OpenSim/Region/Framework/Interfaces/IScriptModuleComms.cs
new file mode 100644
index 0000000..5cdf191
--- /dev/null
+++ b/OpenSim/Region/Framework/Interfaces/IScriptModuleComms.cs
@@ -0,0 +1,44 @@
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 OpenMetaverse;
30
31namespace OpenSim.Region.Framework.Interfaces
32{
33 public delegate void ScriptCommand(UUID script, string id, string module, string command, string k);
34
35 public interface IScriptModuleComms
36 {
37 event ScriptCommand OnScriptCommand;
38
39 void DispatchReply(UUID script, int code, string text, string k);
40
41 // For use ONLY by the script API
42 void RaiseEvent(UUID script, string id, string module, string command, string k);
43 }
44}
diff --git a/OpenSim/Region/Framework/Scenes/EntityBase.cs b/OpenSim/Region/Framework/Scenes/EntityBase.cs
index c2ec6a5..1c76c54 100644
--- a/OpenSim/Region/Framework/Scenes/EntityBase.cs
+++ b/OpenSim/Region/Framework/Scenes/EntityBase.cs
@@ -94,14 +94,6 @@ namespace OpenSim.Region.Framework.Scenes
94 set { m_velocity = value; } 94 set { m_velocity = value; }
95 } 95 }
96 96
97 protected Quaternion m_rotation = new Quaternion(0f, 0f, 1f, 0f);
98
99 public virtual Quaternion Rotation
100 {
101 get { return m_rotation; }
102 set { m_rotation = value; }
103 }
104
105 protected uint m_localId; 97 protected uint m_localId;
106 98
107 public virtual uint LocalId 99 public virtual uint LocalId
@@ -115,13 +107,7 @@ namespace OpenSim.Region.Framework.Scenes
115 /// </summary> 107 /// </summary>
116 public EntityBase() 108 public EntityBase()
117 { 109 {
118 m_uuid = UUID.Zero;
119
120 m_pos = Vector3.Zero;
121 m_velocity = Vector3.Zero;
122 Rotation = Quaternion.Identity;
123 m_name = "(basic entity)"; 110 m_name = "(basic entity)";
124 m_rotationalvelocity = Vector3.Zero;
125 } 111 }
126 112
127 /// <summary> 113 /// <summary>
diff --git a/OpenSim/Region/Framework/Scenes/Hypergrid/HGAssetMapper.cs b/OpenSim/Region/Framework/Scenes/Hypergrid/HGAssetMapper.cs
index 244ac3b..ec50598 100644
--- a/OpenSim/Region/Framework/Scenes/Hypergrid/HGAssetMapper.cs
+++ b/OpenSim/Region/Framework/Scenes/Hypergrid/HGAssetMapper.cs
@@ -77,13 +77,13 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid
77 77
78 #region Internal functions 78 #region Internal functions
79 79
80 private string UserAssetURL(UUID userID) 80// private string UserAssetURL(UUID userID)
81 { 81// {
82 CachedUserInfo uinfo = m_scene.CommsManager.UserProfileCacheService.GetUserDetails(userID); 82// CachedUserInfo uinfo = m_scene.CommsManager.UserProfileCacheService.GetUserDetails(userID);
83 if (uinfo != null) 83// if (uinfo != null)
84 return (uinfo.UserProfile.UserAssetURI == "") ? null : uinfo.UserProfile.UserAssetURI; 84// return (uinfo.UserProfile.UserAssetURI == "") ? null : uinfo.UserProfile.UserAssetURI;
85 return null; 85// return null;
86 } 86// }
87 87
88// private string UserInventoryURL(UUID userID) 88// private string UserInventoryURL(UUID userID)
89// { 89// {
@@ -118,7 +118,7 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid
118 // HGAssetService dispatches it to the remote grid. 118 // HGAssetService dispatches it to the remote grid.
119 // It's not pretty, but the best that can be done while 119 // It's not pretty, but the best that can be done while
120 // not having a global naming infrastructure 120 // not having a global naming infrastructure
121 AssetBase asset1 = new AssetBase(); 121 AssetBase asset1 = new AssetBase(asset.FullID, asset.Name, asset.Type);
122 Copy(asset, asset1); 122 Copy(asset, asset1);
123 try 123 try
124 { 124 {
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index 4d76b4ef..66fb918 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -93,7 +93,6 @@ namespace OpenSim.Region.Framework.Scenes
93 93
94 public void AddInventoryItem(UUID AgentID, InventoryItemBase item) 94 public void AddInventoryItem(UUID AgentID, InventoryItemBase item)
95 { 95 {
96
97 if (InventoryService.AddItem(item)) 96 if (InventoryService.AddItem(item))
98 { 97 {
99 int userlevel = 0; 98 int userlevel = 0;
@@ -627,11 +626,8 @@ namespace OpenSim.Region.Framework.Scenes
627 /// <returns></returns> 626 /// <returns></returns>
628 private AssetBase CreateAsset(string name, string description, sbyte assetType, byte[] data) 627 private AssetBase CreateAsset(string name, string description, sbyte assetType, byte[] data)
629 { 628 {
630 AssetBase asset = new AssetBase(); 629 AssetBase asset = new AssetBase(UUID.Random(), name, assetType);
631 asset.Name = name;
632 asset.Description = description; 630 asset.Description = description;
633 asset.Type = assetType;
634 asset.FullID = UUID.Random();
635 asset.Data = (data == null) ? new byte[1] : data; 631 asset.Data = (data == null) ? new byte[1] : data;
636 632
637 return asset; 633 return asset;
@@ -807,20 +803,6 @@ namespace OpenSim.Region.Framework.Scenes
807 InventoryService.DeleteFolders(remoteClient.AgentId, folderIDs); 803 InventoryService.DeleteFolders(remoteClient.AgentId, folderIDs);
808 } 804 }
809 805
810 private SceneObjectGroup GetGroupByPrim(uint localID)
811 {
812 List<EntityBase> EntityList = GetEntities();
813
814 foreach (EntityBase ent in EntityList)
815 {
816 if (ent is SceneObjectGroup)
817 {
818 if (((SceneObjectGroup) ent).HasChildPrim(localID))
819 return (SceneObjectGroup) ent;
820 }
821 }
822 return null;
823 }
824 806
825 /// <summary> 807 /// <summary>
826 /// Send the details of a prim's inventory to the client. 808 /// Send the details of a prim's inventory to the client.
@@ -1175,7 +1157,13 @@ namespace OpenSim.Region.Framework.Scenes
1175 { 1157 {
1176 m_log.DebugFormat("[AGENT INVENTORY]: Send Inventory Folder {0} Update to {1} {2}", folder.Name, client.FirstName, client.LastName); 1158 m_log.DebugFormat("[AGENT INVENTORY]: Send Inventory Folder {0} Update to {1} {2}", folder.Name, client.FirstName, client.LastName);
1177 InventoryCollection contents = InventoryService.GetFolderContent(client.AgentId, folder.ID); 1159 InventoryCollection contents = InventoryService.GetFolderContent(client.AgentId, folder.ID);
1178 client.SendInventoryFolderDetails(client.AgentId, folder.ID, contents.Items, contents.Folders, fetchFolders, fetchItems); 1160 InventoryFolderBase containingFolder = new InventoryFolderBase();
1161 containingFolder.ID = folder.ID;
1162 containingFolder.Owner = client.AgentId;
1163 containingFolder = InventoryService.GetFolder(containingFolder);
1164 int version = containingFolder.Version;
1165
1166 client.SendInventoryFolderDetails(client.AgentId, folder.ID, contents.Items, contents.Folders, version, fetchFolders, fetchItems);
1179 } 1167 }
1180 1168
1181 /// <summary> 1169 /// <summary>
diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
index 1a91f0c..47fbeb4 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
@@ -462,7 +462,7 @@ namespace OpenSim.Region.Framework.Scenes
462 { 462 {
463 remoteClient.SendInventoryFolderDetails( 463 remoteClient.SendInventoryFolderDetails(
464 fold.Owner, folderID, fold.RequestListOfItems(), 464 fold.Owner, folderID, fold.RequestListOfItems(),
465 fold.RequestListOfFolders(), fetchFolders, fetchItems); 465 fold.RequestListOfFolders(), fold.Version, fetchFolders, fetchItems);
466 return; 466 return;
467 } 467 }
468 468
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index a6ee40a..aeca7df 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -36,6 +36,7 @@ using System.Timers;
36using System.Xml; 36using System.Xml;
37using Nini.Config; 37using Nini.Config;
38using OpenMetaverse; 38using OpenMetaverse;
39using OpenMetaverse.Packets;
39using OpenMetaverse.Imaging; 40using OpenMetaverse.Imaging;
40using OpenSim.Framework; 41using OpenSim.Framework;
41using OpenSim.Services.Interfaces; 42using OpenSim.Services.Interfaces;
@@ -87,8 +88,18 @@ namespace OpenSim.Region.Framework.Scenes
87 protected List<RegionInfo> m_regionRestartNotifyList = new List<RegionInfo>(); 88 protected List<RegionInfo> m_regionRestartNotifyList = new List<RegionInfo>();
88 protected List<RegionInfo> m_neighbours = new List<RegionInfo>(); 89 protected List<RegionInfo> m_neighbours = new List<RegionInfo>();
89 90
90 public volatile bool BordersLocked = false; 91 private volatile int m_bordersLocked = 0;
91 92 public bool BordersLocked
93 {
94 get { return m_bordersLocked == 1; }
95 set
96 {
97 if (value == true)
98 m_bordersLocked = 1;
99 else
100 m_bordersLocked = 0;
101 }
102 }
92 public List<Border> NorthBorders = new List<Border>(); 103 public List<Border> NorthBorders = new List<Border>();
93 public List<Border> EastBorders = new List<Border>(); 104 public List<Border> EastBorders = new List<Border>();
94 public List<Border> SouthBorders = new List<Border>(); 105 public List<Border> SouthBorders = new List<Border>();
@@ -397,6 +408,73 @@ namespace OpenSim.Region.Framework.Scenes
397 408
398 #endregion 409 #endregion
399 410
411 #region BinaryStats
412
413 public class StatLogger
414 {
415 public DateTime StartTime;
416 public string Path;
417 public System.IO.BinaryWriter Log;
418 }
419 static StatLogger m_statLog = null;
420 static TimeSpan m_statLogPeriod = TimeSpan.FromSeconds(300);
421 static string m_statsDir = String.Empty;
422 static Object m_statLockObject = new Object();
423 private void LogSimStats(SimStats stats)
424 {
425 SimStatsPacket pack = new SimStatsPacket();
426 pack.Region = new SimStatsPacket.RegionBlock();
427 pack.Region.RegionX = stats.RegionX;
428 pack.Region.RegionY = stats.RegionY;
429 pack.Region.RegionFlags = stats.RegionFlags;
430 pack.Region.ObjectCapacity = stats.ObjectCapacity;
431 //pack.Region = //stats.RegionBlock;
432 pack.Stat = stats.StatsBlock;
433 pack.Header.Reliable = false;
434
435 // note that we are inside the reporter lock when called
436 DateTime now = DateTime.Now;
437
438 // hide some time information into the packet
439 pack.Header.Sequence = (uint)now.Ticks;
440
441 lock (m_statLockObject) // m_statLog is shared so make sure there is only executer here
442 {
443 try
444 {
445 if (m_statLog == null || now > m_statLog.StartTime + m_statLogPeriod)
446 {
447 // First log file or time has expired, start writing to a new log file
448 if (m_statLog != null && m_statLog.Log != null)
449 {
450 m_statLog.Log.Close();
451 }
452 m_statLog = new StatLogger();
453 m_statLog.StartTime = now;
454 m_statLog.Path = (m_statsDir.Length > 0 ? m_statsDir + System.IO.Path.DirectorySeparatorChar.ToString() : "")
455 + String.Format("stats-{0}.log", now.ToString("yyyyMMddHHmmss"));
456 m_statLog.Log = new BinaryWriter(File.Open(m_statLog.Path, FileMode.Append, FileAccess.Write));
457 }
458
459 // Write the serialized data to disk
460 if (m_statLog != null && m_statLog.Log != null)
461 m_statLog.Log.Write(pack.ToBytes());
462 }
463 catch (Exception ex)
464 {
465 m_log.Error("statistics gathering failed: " + ex.Message, ex);
466 if (m_statLog != null && m_statLog.Log != null)
467 {
468 m_statLog.Log.Close();
469 }
470 m_statLog = null;
471 }
472 }
473 return;
474 }
475
476 #endregion
477
400 #region Constructors 478 #region Constructors
401 479
402 public Scene(RegionInfo regInfo, AgentCircuitManager authen, 480 public Scene(RegionInfo regInfo, AgentCircuitManager authen,
@@ -582,6 +660,38 @@ namespace OpenSim.Region.Framework.Scenes
582 } 660 }
583 661
584 m_log.Info("[SCENE]: Using the " + m_update_prioritization_scheme + " prioritization scheme"); 662 m_log.Info("[SCENE]: Using the " + m_update_prioritization_scheme + " prioritization scheme");
663
664 #region BinaryStats
665
666 try
667 {
668 IConfig statConfig = m_config.Configs["Statistics.Binary"];
669 if (statConfig.Contains("enabled") && statConfig.GetBoolean("enabled"))
670 {
671 if (statConfig.Contains("collect_region_stats"))
672 {
673 if (statConfig.GetBoolean("collect_region_stats"))
674 {
675 // if enabled, add us to the event. If not enabled, I won't get called
676 StatsReporter.OnSendStatsResult += LogSimStats;
677 }
678 }
679 if (statConfig.Contains("region_stats_period_seconds"))
680 {
681 m_statLogPeriod = TimeSpan.FromSeconds(statConfig.GetInt("region_stats_period_seconds"));
682 }
683 if (statConfig.Contains("stats_dir"))
684 {
685 m_statsDir = statConfig.GetString("stats_dir");
686 }
687 }
688 }
689 catch
690 {
691 // if it doesn't work, we don't collect anything
692 }
693
694 #endregion BinaryStats
585 } 695 }
586 catch 696 catch
587 { 697 {
@@ -1043,7 +1153,7 @@ namespace OpenSim.Region.Framework.Scenes
1043 TimeSpan SinceLastFrame = DateTime.UtcNow - m_lastupdate; 1153 TimeSpan SinceLastFrame = DateTime.UtcNow - m_lastupdate;
1044 physicsFPS = 0f; 1154 physicsFPS = 0f;
1045 1155
1046 maintc = maintc = otherMS = Environment.TickCount; 1156 maintc = otherMS = Environment.TickCount;
1047 int tmpFrameMS = maintc; 1157 int tmpFrameMS = maintc;
1048 1158
1049 // Increment the frame counter 1159 // Increment the frame counter
@@ -4273,6 +4383,16 @@ namespace OpenSim.Region.Framework.Scenes
4273 return m_sceneGraph.GetSceneObjectPart(fullID); 4383 return m_sceneGraph.GetSceneObjectPart(fullID);
4274 } 4384 }
4275 4385
4386 /// <summary>
4387 /// Get a scene object group that contains the prim with the given local id
4388 /// </summary>
4389 /// <param name="localID"></param>
4390 /// <returns>null if no scene object group containing that prim is found</returns>
4391 public SceneObjectGroup GetGroupByPrim(uint localID)
4392 {
4393 return m_sceneGraph.GetGroupByPrim(localID);
4394 }
4395
4276 public bool TryGetAvatar(UUID avatarId, out ScenePresence avatar) 4396 public bool TryGetAvatar(UUID avatarId, out ScenePresence avatar)
4277 { 4397 {
4278 return m_sceneGraph.TryGetAvatar(avatarId, out avatar); 4398 return m_sceneGraph.TryGetAvatar(avatarId, out avatar);
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 0b752c9..bcc9b37 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -204,6 +204,14 @@ namespace OpenSim.Region.Framework.Scenes
204 get { return m_parts.Count; } 204 get { return m_parts.Count; }
205 } 205 }
206 206
207 protected Quaternion m_rotation = Quaternion.Identity;
208
209 public virtual Quaternion Rotation
210 {
211 get { return m_rotation; }
212 set { m_rotation = value; }
213 }
214
207 public Quaternion GroupRotation 215 public Quaternion GroupRotation
208 { 216 {
209 get { return m_rootPart.RotationOffset; } 217 get { return m_rootPart.RotationOffset; }
@@ -1959,12 +1967,12 @@ namespace OpenSim.Region.Framework.Scenes
1959 /// Note: this may not be cused by opensim (it probably should) but it's used by 1967 /// Note: this may not be cused by opensim (it probably should) but it's used by
1960 /// external modules. 1968 /// external modules.
1961 /// </summary> 1969 /// </summary>
1962 public void SendGroupRootUpdate() 1970 public void SendGroupRootTerseUpdate()
1963 { 1971 {
1964 if (IsDeleted) 1972 if (IsDeleted)
1965 return; 1973 return;
1966 1974
1967 RootPart.SendFullUpdateToAllClients(); 1975 RootPart.SendTerseUpdateToAllClients();
1968 } 1976 }
1969 1977
1970 public void QueueForUpdateCheck() 1978 public void QueueForUpdateCheck()
@@ -2946,12 +2954,13 @@ namespace OpenSim.Region.Framework.Scenes
2946 /// <param name="rot"></param> 2954 /// <param name="rot"></param>
2947 public void UpdateGroupRotationR(Quaternion rot) 2955 public void UpdateGroupRotationR(Quaternion rot)
2948 { 2956 {
2949
2950 m_rootPart.UpdateRotation(rot); 2957 m_rootPart.UpdateRotation(rot);
2951 if (m_rootPart.PhysActor != null) 2958
2959 PhysicsActor actor = m_rootPart.PhysActor;
2960 if (actor != null)
2952 { 2961 {
2953 m_rootPart.PhysActor.Orientation = m_rootPart.RotationOffset; 2962 actor.Orientation = m_rootPart.RotationOffset;
2954 m_scene.PhysicsScene.AddPhysicsActorTaint(m_rootPart.PhysActor); 2963 m_scene.PhysicsScene.AddPhysicsActorTaint(actor);
2955 } 2964 }
2956 2965
2957 HasGroupChanged = true; 2966 HasGroupChanged = true;
@@ -2966,11 +2975,14 @@ namespace OpenSim.Region.Framework.Scenes
2966 public void UpdateGroupRotationPR(Vector3 pos, Quaternion rot) 2975 public void UpdateGroupRotationPR(Vector3 pos, Quaternion rot)
2967 { 2976 {
2968 m_rootPart.UpdateRotation(rot); 2977 m_rootPart.UpdateRotation(rot);
2969 if (m_rootPart.PhysActor != null) 2978
2979 PhysicsActor actor = m_rootPart.PhysActor;
2980 if (actor != null)
2970 { 2981 {
2971 m_rootPart.PhysActor.Orientation = m_rootPart.RotationOffset; 2982 actor.Orientation = m_rootPart.RotationOffset;
2972 m_scene.PhysicsScene.AddPhysicsActorTaint(m_rootPart.PhysActor); 2983 m_scene.PhysicsScene.AddPhysicsActorTaint(actor);
2973 } 2984 }
2985
2974 AbsolutePosition = pos; 2986 AbsolutePosition = pos;
2975 2987
2976 HasGroupChanged = true; 2988 HasGroupChanged = true;
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 2bc7f66..73d0984 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -243,7 +243,7 @@ namespace OpenSim.Region.Framework.Scenes
243 protected SceneObjectGroup m_parentGroup; 243 protected SceneObjectGroup m_parentGroup;
244 protected byte[] m_particleSystem = Utils.EmptyBytes; 244 protected byte[] m_particleSystem = Utils.EmptyBytes;
245 protected ulong m_regionHandle; 245 protected ulong m_regionHandle;
246 protected Quaternion m_rotationOffset; 246 protected Quaternion m_rotationOffset = Quaternion.Identity;
247 protected PrimitiveBaseShape m_shape; 247 protected PrimitiveBaseShape m_shape;
248 protected UUID m_uuid; 248 protected UUID m_uuid;
249 protected Vector3 m_velocity; 249 protected Vector3 m_velocity;
@@ -3758,14 +3758,12 @@ namespace OpenSim.Region.Framework.Scenes
3758 3758
3759 Vector3 lPos = OffsetPosition; 3759 Vector3 lPos = OffsetPosition;
3760 3760
3761 byte state = Shape.State;
3762 if (IsAttachment) 3761 if (IsAttachment)
3763 { 3762 {
3764 if (ParentGroup.RootPart != this) 3763 if (ParentGroup.RootPart != this)
3765 return; 3764 return;
3766 3765
3767 lPos = ParentGroup.RootPart.AttachedPos; 3766 lPos = ParentGroup.RootPart.AttachedPos;
3768 state = (byte)AttachmentPoint;
3769 } 3767 }
3770 else 3768 else
3771 { 3769 {
@@ -3778,7 +3776,7 @@ namespace OpenSim.Region.Framework.Scenes
3778 remoteClient.SendPrimTerseUpdate(new SendPrimitiveTerseData(m_regionHandle, 3776 remoteClient.SendPrimTerseUpdate(new SendPrimitiveTerseData(m_regionHandle,
3779 m_parentGroup.GetTimeDilation(), LocalId, lPos, 3777 m_parentGroup.GetTimeDilation(), LocalId, lPos,
3780 RotationOffset, Velocity, Acceleration, 3778 RotationOffset, Velocity, Acceleration,
3781 AngularVelocity, state, FromItemID, 3779 AngularVelocity, FromItemID,
3782 OwnerID, (int)AttachmentPoint, null, ParentGroup.GetUpdatePriority(remoteClient))); 3780 OwnerID, (int)AttachmentPoint, null, ParentGroup.GetUpdatePriority(remoteClient)));
3783 } 3781 }
3784 3782
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 6c0d9f2..08c144a 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -76,7 +76,7 @@ namespace OpenSim.Region.Framework.Scenes
76 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 76 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
77 77
78 private static readonly byte[] BAKE_INDICES = new byte[] { 8, 9, 10, 11, 19, 20 }; 78 private static readonly byte[] BAKE_INDICES = new byte[] { 8, 9, 10, 11, 19, 20 };
79 private static readonly byte[] DEFAULT_TEXTURE = AvatarAppearance.GetDefaultTexture().GetBytes(); 79// private static readonly byte[] DEFAULT_TEXTURE = AvatarAppearance.GetDefaultTexture().GetBytes();
80 private static readonly Array DIR_CONTROL_FLAGS = Enum.GetValues(typeof(Dir_ControlFlags)); 80 private static readonly Array DIR_CONTROL_FLAGS = Enum.GetValues(typeof(Dir_ControlFlags));
81 private static readonly Vector3 HEAD_ADJUSTMENT = new Vector3(0f, 0f, 0.3f); 81 private static readonly Vector3 HEAD_ADJUSTMENT = new Vector3(0f, 0f, 0.3f);
82 /// <summary> 82 /// <summary>
@@ -181,7 +181,7 @@ namespace OpenSim.Region.Framework.Scenes
181 private byte m_state; 181 private byte m_state;
182 182
183 //Reuse the Vector3 instead of creating a new one on the UpdateMovement method 183 //Reuse the Vector3 instead of creating a new one on the UpdateMovement method
184 private Vector3 movementvector; 184// private Vector3 movementvector;
185 185
186 private bool m_autopilotMoving; 186 private bool m_autopilotMoving;
187 private Vector3 m_autoPilotTarget; 187 private Vector3 m_autoPilotTarget;
@@ -481,6 +481,12 @@ namespace OpenSim.Region.Framework.Scenes
481 } 481 }
482 } 482 }
483 483
484 public Quaternion Rotation
485 {
486 get { return m_bodyRot; }
487 set { m_bodyRot = value; }
488 }
489
484 /// <summary> 490 /// <summary>
485 /// If this is true, agent doesn't have a representation in this scene. 491 /// If this is true, agent doesn't have a representation in this scene.
486 /// this is an agent 'looking into' this scene from a nearby scene(region) 492 /// this is an agent 'looking into' this scene from a nearby scene(region)
@@ -1912,14 +1918,10 @@ namespace OpenSim.Region.Framework.Scenes
1912 } 1918 }
1913 1919
1914 1920
1915 AssetBase Animasset = new AssetBase(); 1921 AssetBase Animasset = new AssetBase(UUID.Random(), "Random Animation", (sbyte)AssetType.Animation);
1916 Animasset.Data = anim.ToBytes(); 1922 Animasset.Data = anim.ToBytes();
1917 Animasset.Temporary = true; 1923 Animasset.Temporary = true;
1918 Animasset.Local = true; 1924 Animasset.Local = true;
1919 Animasset.FullID = UUID.Random();
1920 Animasset.ID = Animasset.FullID.ToString();
1921 Animasset.Name = "Random Animation";
1922 Animasset.Type = (sbyte)AssetType.Animation;
1923 Animasset.Description = "dance"; 1925 Animasset.Description = "dance";
1924 //BinBVHAnimation bbvhanim = new BinBVHAnimation(Animasset.Data); 1926 //BinBVHAnimation bbvhanim = new BinBVHAnimation(Animasset.Data);
1925 1927
@@ -2068,7 +2070,7 @@ namespace OpenSim.Region.Framework.Scenes
2068 if (heldDown) { move.Z -= 1; } 2070 if (heldDown) { move.Z -= 1; }
2069 2071
2070 // Is the avatar trying to move? 2072 // Is the avatar trying to move?
2071 bool moving = (move != Vector3.Zero); 2073// bool moving = (move != Vector3.Zero);
2072 bool jumping = m_animTickJump != 0; 2074 bool jumping = m_animTickJump != 0;
2073 2075
2074 #endregion Inputs 2076 #endregion Inputs
@@ -2256,7 +2258,7 @@ namespace OpenSim.Region.Framework.Scenes
2256 2258
2257 m_perfMonMS = Environment.TickCount; 2259 m_perfMonMS = Environment.TickCount;
2258 2260
2259 m_rotation = rotation; 2261 Rotation = rotation;
2260 Vector3 direc = vec * rotation; 2262 Vector3 direc = vec * rotation;
2261 direc.Normalize(); 2263 direc.Normalize();
2262 2264
@@ -2320,7 +2322,7 @@ namespace OpenSim.Region.Framework.Scenes
2320 2322
2321 if (m_isChildAgent == false) 2323 if (m_isChildAgent == false)
2322 { 2324 {
2323 PhysicsActor actor = m_physicsActor; 2325// PhysicsActor actor = m_physicsActor;
2324 2326
2325 // NOTE: Velocity is not the same as m_velocity. Velocity will attempt to 2327 // NOTE: Velocity is not the same as m_velocity. Velocity will attempt to
2326 // grab the latest PhysicsActor velocity, whereas m_velocity is often 2328 // grab the latest PhysicsActor velocity, whereas m_velocity is often
@@ -3256,7 +3258,7 @@ namespace OpenSim.Region.Framework.Scenes
3256 Vector3 force = m_forceToApply.Value; 3258 Vector3 force = m_forceToApply.Value;
3257 3259
3258 m_updateflag = true; 3260 m_updateflag = true;
3259 movementvector = force; 3261// movementvector = force;
3260 Velocity = force; 3262 Velocity = force;
3261 3263
3262 m_forceToApply = null; 3264 m_forceToApply = null;
@@ -3905,7 +3907,7 @@ namespace OpenSim.Region.Framework.Scenes
3905 } 3907 }
3906 else 3908 else
3907 { 3909 {
3908 group = Scene.SceneGraph.GetGroupByPrim(data.localID); 3910 group = Scene.GetGroupByPrim(data.localID);
3909 if (group != null) 3911 if (group != null)
3910 return GetSOGUpdatePriority(group); 3912 return GetSOGUpdatePriority(group);
3911 } 3913 }
diff --git a/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs b/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs
new file mode 100644
index 0000000..b68a044
--- /dev/null
+++ b/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs
@@ -0,0 +1,88 @@
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.Collections.Generic;
29using System.Text;
30using NUnit.Framework;
31using NUnit.Framework.SyntaxHelpers;
32using OpenMetaverse;
33using OpenSim.Framework;
34using OpenSim.Region.Framework.Scenes;
35using OpenSim.Services.Interfaces;
36using OpenSim.Tests.Common;
37using OpenSim.Tests.Common.Setup;
38using OpenSim.Tests.Common.Mock;
39
40namespace OpenSim.Region.Framework.Scenes.Tests
41{
42 [TestFixture]
43 public class UuidGathererTests
44 {
45 protected IAssetService m_assetService;
46 protected UuidGatherer m_uuidGatherer;
47
48 [SetUp]
49 public void Init()
50 {
51 m_assetService = new MockAssetService();
52 m_uuidGatherer = new UuidGatherer(m_assetService);
53 }
54
55 [Test]
56 public void TestCorruptAsset()
57 {
58 TestHelper.InMethod();
59
60 UUID corruptAssetUuid = UUID.Parse("00000000-0000-0000-0000-000000000666");
61 AssetBase corruptAsset = AssetHelpers.CreateAsset(corruptAssetUuid, "CORRUPT ASSET");
62 m_assetService.Store(corruptAsset);
63
64 IDictionary<UUID, int> foundAssetUuids = new Dictionary<UUID, int>();
65 m_uuidGatherer.GatherAssetUuids(corruptAssetUuid, AssetType.Object, foundAssetUuids);
66
67 // We count the uuid as gathered even if the asset itself is corrupt.
68 Assert.That(foundAssetUuids.Count, Is.EqualTo(1));
69 }
70
71 /// <summary>
72 /// Test requests made for non-existent assets while we're gathering
73 /// </summary>
74 [Test]
75 public void TestMissingAsset()
76 {
77 TestHelper.InMethod();
78
79 UUID missingAssetUuid = UUID.Parse("00000000-0000-0000-0000-000000000666");
80 IDictionary<UUID, int> foundAssetUuids = new Dictionary<UUID, int>();
81
82 m_uuidGatherer.GatherAssetUuids(missingAssetUuid, AssetType.Object, foundAssetUuids);
83
84 // We count the uuid as gathered even if the asset itself is missing.
85 Assert.That(foundAssetUuids.Count, Is.EqualTo(1));
86 }
87 }
88}
diff --git a/OpenSim/Region/Framework/Scenes/UuidGatherer.cs b/OpenSim/Region/Framework/Scenes/UuidGatherer.cs
index 525a93a..930af81 100644
--- a/OpenSim/Region/Framework/Scenes/UuidGatherer.cs
+++ b/OpenSim/Region/Framework/Scenes/UuidGatherer.cs
@@ -273,7 +273,9 @@ namespace OpenSim.Region.Framework.Scenes
273 { 273 {
274 string xml = Utils.BytesToString(objectAsset.Data); 274 string xml = Utils.BytesToString(objectAsset.Data);
275 SceneObjectGroup sog = SceneObjectSerializer.FromOriginalXmlFormat(xml); 275 SceneObjectGroup sog = SceneObjectSerializer.FromOriginalXmlFormat(xml);
276 GatherAssetUuids(sog, assetUuids); 276
277 if (null != sog)
278 GatherAssetUuids(sog, assetUuids);
277 } 279 }
278 } 280 }
279 } 281 }