diff options
Diffstat (limited to 'OpenSim')
18 files changed, 484 insertions, 311 deletions
diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index bed9a49..3f7a773 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs | |||
@@ -331,7 +331,7 @@ namespace OpenSim | |||
331 | /// <param name="regionInfo"></param> | 331 | /// <param name="regionInfo"></param> |
332 | /// <param name="portadd_flag"></param> | 332 | /// <param name="portadd_flag"></param> |
333 | /// <returns></returns> | 333 | /// <returns></returns> |
334 | public IClientNetworkServer CreateRegion(RegionInfo regionInfo, bool portadd_flag, out IScene scene) | 334 | public List<IClientNetworkServer> CreateRegion(RegionInfo regionInfo, bool portadd_flag, out IScene scene) |
335 | { | 335 | { |
336 | return CreateRegion(regionInfo, portadd_flag, false, out scene); | 336 | return CreateRegion(regionInfo, portadd_flag, false, out scene); |
337 | } | 337 | } |
@@ -341,7 +341,7 @@ namespace OpenSim | |||
341 | /// </summary> | 341 | /// </summary> |
342 | /// <param name="regionInfo"></param> | 342 | /// <param name="regionInfo"></param> |
343 | /// <returns></returns> | 343 | /// <returns></returns> |
344 | public IClientNetworkServer CreateRegion(RegionInfo regionInfo, out IScene scene) | 344 | public List<IClientNetworkServer> CreateRegion(RegionInfo regionInfo, out IScene scene) |
345 | { | 345 | { |
346 | return CreateRegion(regionInfo, false, true, out scene); | 346 | return CreateRegion(regionInfo, false, true, out scene); |
347 | } | 347 | } |
@@ -353,7 +353,7 @@ namespace OpenSim | |||
353 | /// <param name="portadd_flag"></param> | 353 | /// <param name="portadd_flag"></param> |
354 | /// <param name="do_post_init"></param> | 354 | /// <param name="do_post_init"></param> |
355 | /// <returns></returns> | 355 | /// <returns></returns> |
356 | public IClientNetworkServer CreateRegion(RegionInfo regionInfo, bool portadd_flag, bool do_post_init, out IScene mscene) | 356 | public List<IClientNetworkServer> CreateRegion(RegionInfo regionInfo, bool portadd_flag, bool do_post_init, out IScene mscene) |
357 | { | 357 | { |
358 | int port = regionInfo.InternalEndPoint.Port; | 358 | int port = regionInfo.InternalEndPoint.Port; |
359 | 359 | ||
@@ -378,8 +378,8 @@ namespace OpenSim | |||
378 | Util.XmlRpcCommand(proxyUrl, "AddPort", port, port + proxyOffset, regionInfo.ExternalHostName); | 378 | Util.XmlRpcCommand(proxyUrl, "AddPort", port, port + proxyOffset, regionInfo.ExternalHostName); |
379 | } | 379 | } |
380 | 380 | ||
381 | IClientNetworkServer clientServer; | 381 | List<IClientNetworkServer> clientServers; |
382 | Scene scene = SetupScene(regionInfo, proxyOffset, Config, out clientServer); | 382 | Scene scene = SetupScene(regionInfo, proxyOffset, Config, out clientServers); |
383 | 383 | ||
384 | m_log.Info("[MODULES]: Loading Region's modules (old style)"); | 384 | m_log.Info("[MODULES]: Loading Region's modules (old style)"); |
385 | 385 | ||
@@ -483,8 +483,11 @@ namespace OpenSim | |||
483 | 483 | ||
484 | if (m_autoCreateClientStack) | 484 | if (m_autoCreateClientStack) |
485 | { | 485 | { |
486 | m_clientServers.Add(clientServer); | 486 | foreach (IClientNetworkServer clientserver in clientServers) |
487 | clientServer.Start(); | 487 | { |
488 | m_clientServers.Add(clientserver); | ||
489 | clientserver.Start(); | ||
490 | } | ||
488 | } | 491 | } |
489 | 492 | ||
490 | if (scene.SnmpService != null) | 493 | if (scene.SnmpService != null) |
@@ -504,7 +507,7 @@ namespace OpenSim | |||
504 | scene.Start(); | 507 | scene.Start(); |
505 | scene.StartScripts(); | 508 | scene.StartScripts(); |
506 | 509 | ||
507 | return clientServer; | 510 | return clientServers; |
508 | } | 511 | } |
509 | 512 | ||
510 | /// <summary> | 513 | /// <summary> |
@@ -725,7 +728,7 @@ namespace OpenSim | |||
725 | /// <param name="regionInfo"></param> | 728 | /// <param name="regionInfo"></param> |
726 | /// <param name="clientServer"> </param> | 729 | /// <param name="clientServer"> </param> |
727 | /// <returns></returns> | 730 | /// <returns></returns> |
728 | protected Scene SetupScene(RegionInfo regionInfo, out IClientNetworkServer clientServer) | 731 | protected Scene SetupScene(RegionInfo regionInfo, out List<IClientNetworkServer> clientServer) |
729 | { | 732 | { |
730 | return SetupScene(regionInfo, 0, null, out clientServer); | 733 | return SetupScene(regionInfo, 0, null, out clientServer); |
731 | } | 734 | } |
@@ -739,19 +742,20 @@ namespace OpenSim | |||
739 | /// <param name="clientServer"> </param> | 742 | /// <param name="clientServer"> </param> |
740 | /// <returns></returns> | 743 | /// <returns></returns> |
741 | protected Scene SetupScene( | 744 | protected Scene SetupScene( |
742 | RegionInfo regionInfo, int proxyOffset, IConfigSource configSource, out IClientNetworkServer clientServer) | 745 | RegionInfo regionInfo, int proxyOffset, IConfigSource configSource, out List<IClientNetworkServer> clientServer) |
743 | { | 746 | { |
747 | List<IClientNetworkServer> clientNetworkServers = null; | ||
748 | |||
744 | AgentCircuitManager circuitManager = new AgentCircuitManager(); | 749 | AgentCircuitManager circuitManager = new AgentCircuitManager(); |
745 | IPAddress listenIP = regionInfo.InternalEndPoint.Address; | 750 | IPAddress listenIP = regionInfo.InternalEndPoint.Address; |
746 | //if (!IPAddress.TryParse(regionInfo.InternalEndPoint, out listenIP)) | 751 | //if (!IPAddress.TryParse(regionInfo.InternalEndPoint, out listenIP)) |
747 | // listenIP = IPAddress.Parse("0.0.0.0"); | 752 | // listenIP = IPAddress.Parse("0.0.0.0"); |
748 | 753 | ||
749 | uint port = (uint) regionInfo.InternalEndPoint.Port; | 754 | uint port = (uint) regionInfo.InternalEndPoint.Port; |
750 | 755 | IClientNetworkServer clientNetworkServer; | |
751 | if (m_autoCreateClientStack) | 756 | if (m_autoCreateClientStack) |
752 | { | 757 | { |
753 | clientServer | 758 | clientNetworkServers = m_clientStackManager.CreateServers( |
754 | = m_clientStackManager.CreateServer( | ||
755 | listenIP, ref port, proxyOffset, regionInfo.m_allow_alternate_ports, configSource, | 759 | listenIP, ref port, proxyOffset, regionInfo.m_allow_alternate_ports, configSource, |
756 | circuitManager); | 760 | circuitManager); |
757 | } | 761 | } |
@@ -766,9 +770,12 @@ namespace OpenSim | |||
766 | 770 | ||
767 | if (m_autoCreateClientStack) | 771 | if (m_autoCreateClientStack) |
768 | { | 772 | { |
769 | clientServer.AddScene(scene); | 773 | foreach (IClientNetworkServer clientnetserver in clientNetworkServers) |
774 | { | ||
775 | clientnetserver.AddScene(scene); | ||
776 | } | ||
770 | } | 777 | } |
771 | 778 | clientServer = clientNetworkServers; | |
772 | scene.LoadWorldMap(); | 779 | scene.LoadWorldMap(); |
773 | 780 | ||
774 | scene.PhysicsScene = GetPhysicsScene(scene.RegionInfo.RegionName); | 781 | scene.PhysicsScene = GetPhysicsScene(scene.RegionInfo.RegionName); |
diff --git a/OpenSim/Region/ClientStack/ClientStackManager.cs b/OpenSim/Region/ClientStack/ClientStackManager.cs index 84ea0b3..299aabd 100644 --- a/OpenSim/Region/ClientStack/ClientStackManager.cs +++ b/OpenSim/Region/ClientStack/ClientStackManager.cs | |||
@@ -26,6 +26,7 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | ||
29 | using System.Net; | 30 | using System.Net; |
30 | using System.Reflection; | 31 | using System.Reflection; |
31 | using log4net; | 32 | using log4net; |
@@ -38,39 +39,53 @@ namespace OpenSim.Region.ClientStack | |||
38 | { | 39 | { |
39 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 40 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
40 | 41 | ||
41 | private Type plugin; | 42 | private List<Type> plugin = new List<Type>(); |
42 | private Assembly pluginAssembly; | 43 | private List<Assembly> pluginAssembly = new List<Assembly>(); |
43 | 44 | ||
44 | public ClientStackManager(string dllName) | 45 | public ClientStackManager(string pDllName) |
45 | { | 46 | { |
46 | m_log.Info("[CLIENTSTACK]: Attempting to load " + dllName); | 47 | List<string> clientstacks = new List<string>(); |
47 | 48 | if (pDllName.Contains(",")) | |
48 | try | 49 | { |
50 | clientstacks = new List<string>(pDllName.Split(',')); | ||
51 | } | ||
52 | else | ||
49 | { | 53 | { |
50 | plugin = null; | 54 | clientstacks.Add(pDllName); |
51 | pluginAssembly = Assembly.LoadFrom(dllName); | 55 | } |
56 | foreach (string dllName in clientstacks) | ||
57 | { | ||
58 | m_log.Info("[CLIENTSTACK]: Attempting to load " + dllName); | ||
52 | 59 | ||
53 | foreach (Type pluginType in pluginAssembly.GetTypes()) | 60 | try |
54 | { | 61 | { |
55 | if (pluginType.IsPublic) | 62 | //plugin = null; |
56 | { | 63 | Assembly itemAssembly = Assembly.LoadFrom(dllName); |
57 | Type typeInterface = pluginType.GetInterface("IClientNetworkServer", true); | 64 | pluginAssembly.Add(itemAssembly); |
58 | 65 | ||
59 | if (typeInterface != null) | 66 | foreach (Type pluginType in itemAssembly.GetTypes()) |
67 | { | ||
68 | if (pluginType.IsPublic) | ||
60 | { | 69 | { |
61 | m_log.Info("[CLIENTSTACK]: Added IClientNetworkServer Interface"); | 70 | Type typeInterface = pluginType.GetInterface("IClientNetworkServer", true); |
62 | plugin = pluginType; | 71 | |
63 | return; | 72 | if (typeInterface != null) |
73 | { | ||
74 | m_log.Info("[CLIENTSTACK]: Added IClientNetworkServer Interface"); | ||
75 | plugin.Add(pluginType); | ||
76 | break; | ||
77 | } | ||
64 | } | 78 | } |
65 | } | 79 | } |
66 | } | 80 | } |
67 | } catch (ReflectionTypeLoadException e) | 81 | catch (ReflectionTypeLoadException e) |
68 | { | ||
69 | foreach (Exception e2 in e.LoaderExceptions) | ||
70 | { | 82 | { |
71 | m_log.Error(e2.ToString()); | 83 | foreach (Exception e2 in e.LoaderExceptions) |
84 | { | ||
85 | m_log.Error(e2.ToString()); | ||
86 | } | ||
87 | throw e; | ||
72 | } | 88 | } |
73 | throw e; | ||
74 | } | 89 | } |
75 | } | 90 | } |
76 | 91 | ||
@@ -84,11 +99,11 @@ namespace OpenSim.Region.ClientStack | |||
84 | /// <param name="assetCache"></param> | 99 | /// <param name="assetCache"></param> |
85 | /// <param name="authenticateClass"></param> | 100 | /// <param name="authenticateClass"></param> |
86 | /// <returns></returns> | 101 | /// <returns></returns> |
87 | public IClientNetworkServer CreateServer( | 102 | public List<IClientNetworkServer> CreateServers( |
88 | IPAddress _listenIP, ref uint port, int proxyPortOffset, bool allow_alternate_port, | 103 | IPAddress _listenIP, ref uint port, int proxyPortOffset, bool allow_alternate_port, |
89 | AgentCircuitManager authenticateClass) | 104 | AgentCircuitManager authenticateClass) |
90 | { | 105 | { |
91 | return CreateServer( | 106 | return CreateServers( |
92 | _listenIP, ref port, proxyPortOffset, allow_alternate_port, null, authenticateClass); | 107 | _listenIP, ref port, proxyPortOffset, allow_alternate_port, null, authenticateClass); |
93 | } | 108 | } |
94 | 109 | ||
@@ -105,20 +120,24 @@ namespace OpenSim.Region.ClientStack | |||
105 | /// <param name="assetCache"></param> | 120 | /// <param name="assetCache"></param> |
106 | /// <param name="authenticateClass"></param> | 121 | /// <param name="authenticateClass"></param> |
107 | /// <returns></returns> | 122 | /// <returns></returns> |
108 | public IClientNetworkServer CreateServer( | 123 | public List<IClientNetworkServer> CreateServers( |
109 | IPAddress _listenIP, ref uint port, int proxyPortOffset, bool allow_alternate_port, IConfigSource configSource, | 124 | IPAddress _listenIP, ref uint port, int proxyPortOffset, bool allow_alternate_port, IConfigSource configSource, |
110 | AgentCircuitManager authenticateClass) | 125 | AgentCircuitManager authenticateClass) |
111 | { | 126 | { |
127 | List<IClientNetworkServer> servers = new List<IClientNetworkServer>(); | ||
112 | if (plugin != null) | 128 | if (plugin != null) |
113 | { | 129 | { |
114 | IClientNetworkServer server = | 130 | for (int i = 0; i < plugin.Count; i++) |
115 | (IClientNetworkServer)Activator.CreateInstance(pluginAssembly.GetType(plugin.ToString())); | 131 | { |
116 | 132 | IClientNetworkServer server = | |
117 | server.Initialise( | 133 | (IClientNetworkServer) Activator.CreateInstance(pluginAssembly[i].GetType(plugin[i].ToString())); |
118 | _listenIP, ref port, proxyPortOffset, allow_alternate_port, | 134 | |
119 | configSource, authenticateClass); | 135 | server.Initialise( |
120 | 136 | _listenIP, ref port, proxyPortOffset, allow_alternate_port, | |
121 | return server; | 137 | configSource, authenticateClass); |
138 | servers.Add(server); | ||
139 | } | ||
140 | return servers; | ||
122 | } | 141 | } |
123 | 142 | ||
124 | m_log.Error("[CLIENTSTACK]: Couldn't initialize a new server"); | 143 | m_log.Error("[CLIENTSTACK]: Couldn't initialize a new server"); |
diff --git a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs index a0f1e8c..730643d 100644 --- a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs +++ b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs | |||
@@ -790,32 +790,43 @@ namespace OpenSim.Region.CoreModules.Asset | |||
790 | { | 790 | { |
791 | UuidGatherer gatherer = new UuidGatherer(m_AssetService); | 791 | UuidGatherer gatherer = new UuidGatherer(m_AssetService); |
792 | 792 | ||
793 | HashSet<UUID> uniqueUuids = new HashSet<UUID>(); | ||
793 | Dictionary<UUID, AssetType> assets = new Dictionary<UUID, AssetType>(); | 794 | Dictionary<UUID, AssetType> assets = new Dictionary<UUID, AssetType>(); |
795 | |||
794 | foreach (Scene s in m_Scenes) | 796 | foreach (Scene s in m_Scenes) |
795 | { | 797 | { |
796 | StampRegionStatusFile(s.RegionInfo.RegionID); | 798 | StampRegionStatusFile(s.RegionInfo.RegionID); |
797 | 799 | ||
798 | s.ForEachSOG(delegate(SceneObjectGroup e) | 800 | s.ForEachSOG(delegate(SceneObjectGroup e) |
799 | { | 801 | { |
800 | gatherer.GatherAssetUuids(e, assets); | 802 | gatherer.GatherAssetUuids(e, assets); |
801 | }); | ||
802 | } | ||
803 | 803 | ||
804 | foreach (UUID assetID in assets.Keys) | 804 | foreach (UUID assetID in assets.Keys) |
805 | { | 805 | { |
806 | string filename = GetFileName(assetID.ToString()); | 806 | uniqueUuids.Add(assetID); |
807 | 807 | ||
808 | if (File.Exists(filename)) | 808 | string filename = GetFileName(assetID.ToString()); |
809 | { | 809 | |
810 | File.SetLastAccessTime(filename, DateTime.Now); | 810 | if (File.Exists(filename)) |
811 | } | 811 | { |
812 | else if (storeUncached) | 812 | File.SetLastAccessTime(filename, DateTime.Now); |
813 | { | 813 | } |
814 | m_AssetService.Get(assetID.ToString()); | 814 | else if (storeUncached) |
815 | } | 815 | { |
816 | AssetBase cachedAsset = m_AssetService.Get(assetID.ToString()); | ||
817 | if (cachedAsset == null && assets[assetID] != AssetType.Unknown) | ||
818 | m_log.DebugFormat( | ||
819 | "[FLOTSAM ASSET CACHE]: Could not find asset {0}, type {1} referenced by object {2} at {3} in scene {4} when pre-caching all scene assets", | ||
820 | assetID, assets[assetID], e.Name, e.AbsolutePosition, s.Name); | ||
821 | } | ||
822 | } | ||
823 | |||
824 | assets.Clear(); | ||
825 | }); | ||
816 | } | 826 | } |
817 | 827 | ||
818 | return assets.Keys.Count; | 828 | |
829 | return uniqueUuids.Count; | ||
819 | } | 830 | } |
820 | 831 | ||
821 | /// <summary> | 832 | /// <summary> |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/MapImage/MapImageServiceModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/MapImage/MapImageServiceModule.cs index 5836eb9..b61062f 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/MapImage/MapImageServiceModule.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/MapImage/MapImageServiceModule.cs | |||
@@ -75,7 +75,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.MapImage | |||
75 | public void Close() { } | 75 | public void Close() { } |
76 | public void PostInitialise() { } | 76 | public void PostInitialise() { } |
77 | 77 | ||
78 | |||
79 | ///<summary> | 78 | ///<summary> |
80 | /// | 79 | /// |
81 | ///</summary> | 80 | ///</summary> |
@@ -136,7 +135,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.MapImage | |||
136 | ///</summary> | 135 | ///</summary> |
137 | public void AddRegion(Scene scene) | 136 | public void AddRegion(Scene scene) |
138 | { | 137 | { |
139 | if (! m_enabled) | 138 | if (!m_enabled) |
140 | return; | 139 | return; |
141 | 140 | ||
142 | // Every shared region module has to maintain an indepedent list of | 141 | // Every shared region module has to maintain an indepedent list of |
@@ -209,6 +208,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.MapImage | |||
209 | 208 | ||
210 | using (Image mapTile = tileGenerator.CreateMapTile()) | 209 | using (Image mapTile = tileGenerator.CreateMapTile()) |
211 | { | 210 | { |
211 | // XXX: The MapImageModule will return a null if the user has chosen not to create map tiles and there | ||
212 | // is no static map tile. | ||
213 | if (mapTile == null) | ||
214 | return; | ||
215 | |||
212 | using (MemoryStream stream = new MemoryStream()) | 216 | using (MemoryStream stream = new MemoryStream()) |
213 | { | 217 | { |
214 | mapTile.Save(stream, ImageFormat.Jpeg); | 218 | mapTile.Save(stream, ImageFormat.Jpeg); |
diff --git a/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs b/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs index d412efc..e7065dc 100644 --- a/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs +++ b/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs | |||
@@ -113,7 +113,6 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap | |||
113 | //t = System.Environment.TickCount - t; | 113 | //t = System.Environment.TickCount - t; |
114 | //m_log.InfoFormat("[MAPTILE] generation of 10 maptiles needed {0} ms", t); | 114 | //m_log.InfoFormat("[MAPTILE] generation of 10 maptiles needed {0} ms", t); |
115 | 115 | ||
116 | |||
117 | if (drawPrimVolume) | 116 | if (drawPrimVolume) |
118 | { | 117 | { |
119 | DrawObjectVolume(m_scene, mapbmp); | 118 | DrawObjectVolume(m_scene, mapbmp); |
@@ -121,7 +120,7 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap | |||
121 | } | 120 | } |
122 | else | 121 | else |
123 | { | 122 | { |
124 | mapbmp = fetchTexture(m_scene.RegionInfo.RegionSettings.TerrainImageID); | 123 | mapbmp = FetchTexture(m_scene.RegionInfo.RegionSettings.TerrainImageID); |
125 | } | 124 | } |
126 | return mapbmp; | 125 | return mapbmp; |
127 | } | 126 | } |
@@ -232,11 +231,19 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap | |||
232 | // } | 231 | // } |
233 | // } | 232 | // } |
234 | 233 | ||
235 | private Bitmap fetchTexture(UUID id) | 234 | private Bitmap FetchTexture(UUID id) |
236 | { | 235 | { |
237 | AssetBase asset = m_scene.AssetService.Get(id.ToString()); | 236 | AssetBase asset = m_scene.AssetService.Get(id.ToString()); |
238 | m_log.DebugFormat("[MAPTILE]: Fetched static texture {0}, found: {1}", id, asset != null); | 237 | |
239 | if (asset == null) return null; | 238 | if (asset != null) |
239 | { | ||
240 | m_log.DebugFormat("[MAPTILE]: Static map image texture {0} found for {1}", id, m_scene.Name); | ||
241 | } | ||
242 | else | ||
243 | { | ||
244 | m_log.WarnFormat("[MAPTILE]: Static map image texture {0} not found for {1}", id, m_scene.Name); | ||
245 | return null; | ||
246 | } | ||
240 | 247 | ||
241 | ManagedImage managedImage; | 248 | ManagedImage managedImage; |
242 | Image image; | 249 | Image image; |
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 6005f07..c352465 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -2517,7 +2517,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2517 | 2517 | ||
2518 | ParentPart = m_scene.GetSceneObjectPart(m_requestedSitTargetID); | 2518 | ParentPart = m_scene.GetSceneObjectPart(m_requestedSitTargetID); |
2519 | ParentID = m_requestedSitTargetID; | 2519 | ParentID = m_requestedSitTargetID; |
2520 | 2520 | m_AngularVelocity = Vector3.Zero; | |
2521 | Velocity = Vector3.Zero; | 2521 | Velocity = Vector3.Zero; |
2522 | RemoveFromPhysicalScene(); | 2522 | RemoveFromPhysicalScene(); |
2523 | 2523 | ||
@@ -2533,7 +2533,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2533 | 2533 | ||
2534 | public void HandleAgentSitOnGround() | 2534 | public void HandleAgentSitOnGround() |
2535 | { | 2535 | { |
2536 | // m_updateCount = 0; // Kill animation update burst so that the SIT_G.. will stick. | 2536 | // m_updateCount = 0; // Kill animation update burst so that the SIT_G.. will stick.. |
2537 | m_AngularVelocity = Vector3.Zero; | ||
2537 | Animator.TrySetMovementAnimation("SIT_GROUND_CONSTRAINED"); | 2538 | Animator.TrySetMovementAnimation("SIT_GROUND_CONSTRAINED"); |
2538 | SitGround = true; | 2539 | SitGround = true; |
2539 | RemoveFromPhysicalScene(); | 2540 | RemoveFromPhysicalScene(); |
diff --git a/OpenSim/Region/Framework/Scenes/UuidGatherer.cs b/OpenSim/Region/Framework/Scenes/UuidGatherer.cs index 2279e62..b09ae39 100644 --- a/OpenSim/Region/Framework/Scenes/UuidGatherer.cs +++ b/OpenSim/Region/Framework/Scenes/UuidGatherer.cs | |||
@@ -127,7 +127,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
127 | /// within this object). | 127 | /// within this object). |
128 | /// </remarks> | 128 | /// </remarks> |
129 | /// <param name="sceneObject">The scene object for which to gather assets</param> | 129 | /// <param name="sceneObject">The scene object for which to gather assets</param> |
130 | /// <param name="assetUuids">The assets gathered</param> | 130 | /// <param name="assetUuids"> |
131 | /// A dictionary which is populated with the asset UUIDs gathered and the type of that asset. | ||
132 | /// For assets where the type is not clear (e.g. UUIDs extracted from LSL and notecards), the type is Unknown. | ||
133 | /// </param> | ||
131 | public void GatherAssetUuids(SceneObjectGroup sceneObject, IDictionary<UUID, AssetType> assetUuids) | 134 | public void GatherAssetUuids(SceneObjectGroup sceneObject, IDictionary<UUID, AssetType> assetUuids) |
132 | { | 135 | { |
133 | // m_log.DebugFormat( | 136 | // m_log.DebugFormat( |
@@ -257,8 +260,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
257 | UUID uuid = new UUID(uuidMatch.Value); | 260 | UUID uuid = new UUID(uuidMatch.Value); |
258 | // m_log.DebugFormat("[ARCHIVER]: Recording {0} in text", uuid); | 261 | // m_log.DebugFormat("[ARCHIVER]: Recording {0} in text", uuid); |
259 | 262 | ||
260 | // Assume AssetIDs embedded are textures. | 263 | // Embedded asset references (if not false positives) could be for many types of asset, so we will |
261 | assetUuids[uuid] = AssetType.Texture; | 264 | // label these as unknown. |
265 | assetUuids[uuid] = AssetType.Unknown; | ||
262 | } | 266 | } |
263 | } | 267 | } |
264 | } | 268 | } |
diff --git a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStore.cs b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStore.cs index 34894ba..0b7b31b 100644 --- a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStore.cs +++ b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStore.cs | |||
@@ -68,12 +68,46 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore | |||
68 | protected List<TakeValueCallbackClass> m_TakeStore; | 68 | protected List<TakeValueCallbackClass> m_TakeStore; |
69 | protected List<TakeValueCallbackClass> m_ReadStore; | 69 | protected List<TakeValueCallbackClass> m_ReadStore; |
70 | 70 | ||
71 | // add separators for quoted paths | ||
72 | protected static Regex m_ParsePassOne = new Regex("{[^}]+}"); | ||
73 | |||
74 | // add separators for array references | ||
75 | protected static Regex m_ParsePassTwo = new Regex("(\\[[0-9]+\\]|\\[\\+\\])"); | ||
76 | |||
77 | // add quotes to bare identifiers which are limited to alphabetic characters | ||
78 | protected static Regex m_ParsePassThree = new Regex("\\.([a-zA-Z]+)"); | ||
79 | |||
80 | // remove extra separator characters | ||
81 | protected static Regex m_ParsePassFour = new Regex("\\.+"); | ||
82 | |||
83 | // expression used to validate the full path, this is canonical representation | ||
84 | protected static Regex m_ValidatePath = new Regex("^\\.(({[^}]+}|\\[[0-9]+\\]|\\[\\+\\])\\.)+$"); | ||
85 | |||
86 | // expression used to match path components | ||
87 | protected static Regex m_PathComponent = new Regex("\\.({[^}]+}|\\[[0-9]+\\]|\\[\\+\\]+)"); | ||
88 | |||
89 | // extract the internals of an array reference | ||
90 | protected static Regex m_SimpleArrayPattern = new Regex("\\[([0-9]+)\\]"); | ||
91 | protected static Regex m_ArrayPattern = new Regex("\\[([0-9]+|\\+)\\]"); | ||
92 | |||
93 | // extract the internals of a has reference | ||
94 | protected static Regex m_HashPattern = new Regex("{([^}]+)}"); | ||
71 | 95 | ||
72 | // ----------------------------------------------------------------- | 96 | // ----------------------------------------------------------------- |
73 | /// <summary> | 97 | /// <summary> |
74 | /// | 98 | /// |
75 | /// </summary> | 99 | /// </summary> |
76 | // ----------------------------------------------------------------- | 100 | // ----------------------------------------------------------------- |
101 | public static string CanonicalPathExpression(string path) | ||
102 | { | ||
103 | return PathExpressionToKey(ParsePathExpression(path)); | ||
104 | } | ||
105 | |||
106 | // ----------------------------------------------------------------- | ||
107 | /// <summary> | ||
108 | /// | ||
109 | /// </summary> | ||
110 | // ----------------------------------------------------------------- | ||
77 | public JsonStore() : this("") {} | 111 | public JsonStore() : this("") {} |
78 | 112 | ||
79 | public JsonStore(string value) | 113 | public JsonStore(string value) |
@@ -224,9 +258,8 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore | |||
224 | if (result == null) | 258 | if (result == null) |
225 | return false; | 259 | return false; |
226 | 260 | ||
227 | Regex aPattern = new Regex("\\[([0-9]+|\\+)\\]"); | 261 | // Check for and extract array references |
228 | MatchCollection amatches = aPattern.Matches(pkey,0); | 262 | MatchCollection amatches = m_ArrayPattern.Matches(pkey,0); |
229 | |||
230 | if (amatches.Count > 0) | 263 | if (amatches.Count > 0) |
231 | { | 264 | { |
232 | if (result.Type != OSDType.Array) | 265 | if (result.Type != OSDType.Array) |
@@ -263,9 +296,8 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore | |||
263 | return false; | 296 | return false; |
264 | } | 297 | } |
265 | 298 | ||
266 | Regex hPattern = new Regex("{([^}]+)}"); | 299 | // Check for and extract hash references |
267 | MatchCollection hmatches = hPattern.Matches(pkey,0); | 300 | MatchCollection hmatches = m_HashPattern.Matches(pkey,0); |
268 | |||
269 | if (hmatches.Count > 0) | 301 | if (hmatches.Count > 0) |
270 | { | 302 | { |
271 | Match match = hmatches[0]; | 303 | Match match = hmatches[0]; |
@@ -340,26 +372,21 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore | |||
340 | path = "." + path + "."; | 372 | path = "." + path + "."; |
341 | 373 | ||
342 | // add separators for quoted paths | 374 | // add separators for quoted paths |
343 | Regex pass1 = new Regex("{[^}]+}"); | 375 | path = m_ParsePassOne.Replace(path,".$0.",-1,0); |
344 | path = pass1.Replace(path,".$0.",-1,0); | ||
345 | 376 | ||
346 | // add separators for array references | 377 | // add separators for array references |
347 | Regex pass2 = new Regex("(\\[[0-9]+\\]|\\[\\+\\])"); | 378 | path = m_ParsePassTwo.Replace(path,".$0.",-1,0); |
348 | path = pass2.Replace(path,".$0.",-1,0); | ||
349 | 379 | ||
350 | // add quotes to bare identifier | 380 | // add quotes to bare identifier |
351 | Regex pass3 = new Regex("\\.([a-zA-Z]+)"); | 381 | path = m_ParsePassThree.Replace(path,".{$1}",-1,0); |
352 | path = pass3.Replace(path,".{$1}",-1,0); | ||
353 | 382 | ||
354 | // remove extra separators | 383 | // remove extra separators |
355 | Regex pass4 = new Regex("\\.+"); | 384 | path = m_ParsePassFour.Replace(path,".",-1,0); |
356 | path = pass4.Replace(path,".",-1,0); | ||
357 | 385 | ||
358 | Regex validate = new Regex("^\\.(({[^}]+}|\\[[0-9]+\\]|\\[\\+\\])\\.)+$"); | 386 | // validate the results (catches extra quote characters for example) |
359 | if (validate.IsMatch(path)) | 387 | if (m_ValidatePath.IsMatch(path)) |
360 | { | 388 | { |
361 | Regex parser = new Regex("\\.({[^}]+}|\\[[0-9]+\\]|\\[\\+\\]+)"); | 389 | MatchCollection matches = m_PathComponent.Matches(path,0); |
362 | MatchCollection matches = parser.Matches(path,0); | ||
363 | foreach (Match match in matches) | 390 | foreach (Match match in matches) |
364 | m_path.Push(match.Groups[1].Value); | 391 | m_path.Push(match.Groups[1].Value); |
365 | } | 392 | } |
@@ -385,9 +412,8 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore | |||
385 | return null; | 412 | return null; |
386 | 413 | ||
387 | // ---------- Check for an array index ---------- | 414 | // ---------- Check for an array index ---------- |
388 | Regex aPattern = new Regex("\\[([0-9]+)\\]"); | 415 | MatchCollection amatches = m_SimpleArrayPattern.Matches(pkey,0); |
389 | MatchCollection amatches = aPattern.Matches(pkey,0); | 416 | |
390 | |||
391 | if (amatches.Count > 0) | 417 | if (amatches.Count > 0) |
392 | { | 418 | { |
393 | if (rmap.Type != OSDType.Array) | 419 | if (rmap.Type != OSDType.Array) |
@@ -410,9 +436,8 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore | |||
410 | } | 436 | } |
411 | 437 | ||
412 | // ---------- Check for a hash index ---------- | 438 | // ---------- Check for a hash index ---------- |
413 | Regex hPattern = new Regex("{([^}]+)}"); | 439 | MatchCollection hmatches = m_HashPattern.Matches(pkey,0); |
414 | MatchCollection hmatches = hPattern.Matches(pkey,0); | 440 | |
415 | |||
416 | if (hmatches.Count > 0) | 441 | if (hmatches.Count > 0) |
417 | { | 442 | { |
418 | if (rmap.Type != OSDType.Map) | 443 | if (rmap.Type != OSDType.Map) |
diff --git a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreScriptModule.cs b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreScriptModule.cs index 29955af..5b7a79d 100644 --- a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreScriptModule.cs +++ b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreScriptModule.cs | |||
@@ -165,29 +165,32 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore | |||
165 | 165 | ||
166 | try | 166 | try |
167 | { | 167 | { |
168 | m_comms.RegisterScriptInvocation(this, "JsonCreateStore"); | 168 | m_comms.RegisterScriptInvocations(this); |
169 | m_comms.RegisterScriptInvocation(this, "JsonDestroyStore"); | ||
170 | m_comms.RegisterScriptInvocation(this, "JsonTestStore"); | ||
171 | 169 | ||
172 | m_comms.RegisterScriptInvocation(this, "JsonReadNotecard"); | 170 | // m_comms.RegisterScriptInvocation(this, "JsonCreateStore"); |
173 | m_comms.RegisterScriptInvocation(this, "JsonWriteNotecard"); | 171 | // m_comms.RegisterScriptInvocation(this, "JsonDestroyStore"); |
172 | // m_comms.RegisterScriptInvocation(this, "JsonTestStore"); | ||
174 | 173 | ||
175 | m_comms.RegisterScriptInvocation(this, "JsonTestPath"); | 174 | // m_comms.RegisterScriptInvocation(this, "JsonReadNotecard"); |
176 | m_comms.RegisterScriptInvocation(this, "JsonTestPathJson"); | 175 | // m_comms.RegisterScriptInvocation(this, "JsonWriteNotecard"); |
177 | 176 | ||
178 | m_comms.RegisterScriptInvocation(this, "JsonGetValue"); | 177 | // m_comms.RegisterScriptInvocation(this, "JsonTestPathList"); |
179 | m_comms.RegisterScriptInvocation(this, "JsonGetValueJson"); | 178 | // m_comms.RegisterScriptInvocation(this, "JsonTestPath"); |
179 | // m_comms.RegisterScriptInvocation(this, "JsonTestPathJson"); | ||
180 | 180 | ||
181 | m_comms.RegisterScriptInvocation(this, "JsonTakeValue"); | 181 | // m_comms.RegisterScriptInvocation(this, "JsonGetValue"); |
182 | m_comms.RegisterScriptInvocation(this, "JsonTakeValueJson"); | 182 | // m_comms.RegisterScriptInvocation(this, "JsonGetValueJson"); |
183 | 183 | ||
184 | m_comms.RegisterScriptInvocation(this, "JsonReadValue"); | 184 | // m_comms.RegisterScriptInvocation(this, "JsonTakeValue"); |
185 | m_comms.RegisterScriptInvocation(this, "JsonReadValueJson"); | 185 | // m_comms.RegisterScriptInvocation(this, "JsonTakeValueJson"); |
186 | 186 | ||
187 | m_comms.RegisterScriptInvocation(this, "JsonSetValue"); | 187 | // m_comms.RegisterScriptInvocation(this, "JsonReadValue"); |
188 | m_comms.RegisterScriptInvocation(this, "JsonSetValueJson"); | 188 | // m_comms.RegisterScriptInvocation(this, "JsonReadValueJson"); |
189 | 189 | ||
190 | m_comms.RegisterScriptInvocation(this, "JsonRemoveValue"); | 190 | // m_comms.RegisterScriptInvocation(this, "JsonSetValue"); |
191 | // m_comms.RegisterScriptInvocation(this, "JsonSetValueJson"); | ||
192 | |||
193 | // m_comms.RegisterScriptInvocation(this, "JsonRemoveValue"); | ||
191 | } | 194 | } |
192 | catch (Exception e) | 195 | catch (Exception e) |
193 | { | 196 | { |
@@ -215,17 +218,8 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore | |||
215 | /// | 218 | /// |
216 | /// </summary> | 219 | /// </summary> |
217 | // ----------------------------------------------------------------- | 220 | // ----------------------------------------------------------------- |
218 | protected void GenerateRuntimeError(string msg) | 221 | [ScriptInvocation] |
219 | { | 222 | public UUID JsonCreateStore(UUID hostID, UUID scriptID, string value) |
220 | throw new Exception("JsonStore Runtime Error: " + msg); | ||
221 | } | ||
222 | |||
223 | // ----------------------------------------------------------------- | ||
224 | /// <summary> | ||
225 | /// | ||
226 | /// </summary> | ||
227 | // ----------------------------------------------------------------- | ||
228 | protected UUID JsonCreateStore(UUID hostID, UUID scriptID, string value) | ||
229 | { | 223 | { |
230 | UUID uuid = UUID.Zero; | 224 | UUID uuid = UUID.Zero; |
231 | if (! m_store.CreateStore(value, ref uuid)) | 225 | if (! m_store.CreateStore(value, ref uuid)) |
@@ -239,7 +233,8 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore | |||
239 | /// | 233 | /// |
240 | /// </summary> | 234 | /// </summary> |
241 | // ----------------------------------------------------------------- | 235 | // ----------------------------------------------------------------- |
242 | protected int JsonDestroyStore(UUID hostID, UUID scriptID, UUID storeID) | 236 | [ScriptInvocation] |
237 | public int JsonDestroyStore(UUID hostID, UUID scriptID, UUID storeID) | ||
243 | { | 238 | { |
244 | return m_store.DestroyStore(storeID) ? 1 : 0; | 239 | return m_store.DestroyStore(storeID) ? 1 : 0; |
245 | } | 240 | } |
@@ -249,7 +244,8 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore | |||
249 | /// | 244 | /// |
250 | /// </summary> | 245 | /// </summary> |
251 | // ----------------------------------------------------------------- | 246 | // ----------------------------------------------------------------- |
252 | protected int JsonTestStore(UUID hostID, UUID scriptID, UUID storeID) | 247 | [ScriptInvocation] |
248 | public int JsonTestStore(UUID hostID, UUID scriptID, UUID storeID) | ||
253 | { | 249 | { |
254 | return m_store.TestStore(storeID) ? 1 : 0; | 250 | return m_store.TestStore(storeID) ? 1 : 0; |
255 | } | 251 | } |
@@ -259,7 +255,8 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore | |||
259 | /// | 255 | /// |
260 | /// </summary> | 256 | /// </summary> |
261 | // ----------------------------------------------------------------- | 257 | // ----------------------------------------------------------------- |
262 | protected UUID JsonReadNotecard(UUID hostID, UUID scriptID, UUID storeID, string path, UUID assetID) | 258 | [ScriptInvocation] |
259 | public UUID JsonReadNotecard(UUID hostID, UUID scriptID, UUID storeID, string path, UUID assetID) | ||
263 | { | 260 | { |
264 | UUID reqID = UUID.Random(); | 261 | UUID reqID = UUID.Random(); |
265 | Util.FireAndForget(delegate(object o) { DoJsonReadNotecard(reqID,hostID,scriptID,storeID,path,assetID); }); | 262 | Util.FireAndForget(delegate(object o) { DoJsonReadNotecard(reqID,hostID,scriptID,storeID,path,assetID); }); |
@@ -271,7 +268,8 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore | |||
271 | /// | 268 | /// |
272 | /// </summary> | 269 | /// </summary> |
273 | // ----------------------------------------------------------------- | 270 | // ----------------------------------------------------------------- |
274 | protected UUID JsonWriteNotecard(UUID hostID, UUID scriptID, UUID storeID, string path, string name) | 271 | [ScriptInvocation] |
272 | public UUID JsonWriteNotecard(UUID hostID, UUID scriptID, UUID storeID, string path, string name) | ||
275 | { | 273 | { |
276 | UUID reqID = UUID.Random(); | 274 | UUID reqID = UUID.Random(); |
277 | Util.FireAndForget(delegate(object o) { DoJsonWriteNotecard(reqID,hostID,scriptID,storeID,path,name); }); | 275 | Util.FireAndForget(delegate(object o) { DoJsonWriteNotecard(reqID,hostID,scriptID,storeID,path,name); }); |
@@ -283,12 +281,25 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore | |||
283 | /// | 281 | /// |
284 | /// </summary> | 282 | /// </summary> |
285 | // ----------------------------------------------------------------- | 283 | // ----------------------------------------------------------------- |
286 | protected int JsonTestPath(UUID hostID, UUID scriptID, UUID storeID, string path) | 284 | [ScriptInvocation] |
285 | public string JsonList2Path(UUID hostID, UUID scriptID, object[] pathlist) | ||
286 | { | ||
287 | return JsonStore.CanonicalPathExpression(ConvertList2Path(pathlist)); | ||
288 | } | ||
289 | |||
290 | // ----------------------------------------------------------------- | ||
291 | /// <summary> | ||
292 | /// | ||
293 | /// </summary> | ||
294 | // ----------------------------------------------------------------- | ||
295 | [ScriptInvocation] | ||
296 | public int JsonTestPath(UUID hostID, UUID scriptID, UUID storeID, string path) | ||
287 | { | 297 | { |
288 | return m_store.TestPath(storeID,path,false) ? 1 : 0; | 298 | return m_store.TestPath(storeID,path,false) ? 1 : 0; |
289 | } | 299 | } |
290 | 300 | ||
291 | protected int JsonTestPathJson(UUID hostID, UUID scriptID, UUID storeID, string path) | 301 | [ScriptInvocation] |
302 | public int JsonTestPathJson(UUID hostID, UUID scriptID, UUID storeID, string path) | ||
292 | { | 303 | { |
293 | return m_store.TestPath(storeID,path,true) ? 1 : 0; | 304 | return m_store.TestPath(storeID,path,true) ? 1 : 0; |
294 | } | 305 | } |
@@ -298,12 +309,14 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore | |||
298 | /// | 309 | /// |
299 | /// </summary> | 310 | /// </summary> |
300 | // ----------------------------------------------------------------- | 311 | // ----------------------------------------------------------------- |
301 | protected int JsonSetValue(UUID hostID, UUID scriptID, UUID storeID, string path, string value) | 312 | [ScriptInvocation] |
313 | public int JsonSetValue(UUID hostID, UUID scriptID, UUID storeID, string path, string value) | ||
302 | { | 314 | { |
303 | return m_store.SetValue(storeID,path,value,false) ? 1 : 0; | 315 | return m_store.SetValue(storeID,path,value,false) ? 1 : 0; |
304 | } | 316 | } |
305 | 317 | ||
306 | protected int JsonSetValueJson(UUID hostID, UUID scriptID, UUID storeID, string path, string value) | 318 | [ScriptInvocation] |
319 | public int JsonSetValueJson(UUID hostID, UUID scriptID, UUID storeID, string path, string value) | ||
307 | { | 320 | { |
308 | return m_store.SetValue(storeID,path,value,true) ? 1 : 0; | 321 | return m_store.SetValue(storeID,path,value,true) ? 1 : 0; |
309 | } | 322 | } |
@@ -313,7 +326,8 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore | |||
313 | /// | 326 | /// |
314 | /// </summary> | 327 | /// </summary> |
315 | // ----------------------------------------------------------------- | 328 | // ----------------------------------------------------------------- |
316 | protected int JsonRemoveValue(UUID hostID, UUID scriptID, UUID storeID, string path) | 329 | [ScriptInvocation] |
330 | public int JsonRemoveValue(UUID hostID, UUID scriptID, UUID storeID, string path) | ||
317 | { | 331 | { |
318 | return m_store.RemoveValue(storeID,path) ? 1 : 0; | 332 | return m_store.RemoveValue(storeID,path) ? 1 : 0; |
319 | } | 333 | } |
@@ -323,14 +337,16 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore | |||
323 | /// | 337 | /// |
324 | /// </summary> | 338 | /// </summary> |
325 | // ----------------------------------------------------------------- | 339 | // ----------------------------------------------------------------- |
326 | protected string JsonGetValue(UUID hostID, UUID scriptID, UUID storeID, string path) | 340 | [ScriptInvocation] |
341 | public string JsonGetValue(UUID hostID, UUID scriptID, UUID storeID, string path) | ||
327 | { | 342 | { |
328 | string value = String.Empty; | 343 | string value = String.Empty; |
329 | m_store.GetValue(storeID,path,false,out value); | 344 | m_store.GetValue(storeID,path,false,out value); |
330 | return value; | 345 | return value; |
331 | } | 346 | } |
332 | 347 | ||
333 | protected string JsonGetValueJson(UUID hostID, UUID scriptID, UUID storeID, string path) | 348 | [ScriptInvocation] |
349 | public string JsonGetValueJson(UUID hostID, UUID scriptID, UUID storeID, string path) | ||
334 | { | 350 | { |
335 | string value = String.Empty; | 351 | string value = String.Empty; |
336 | m_store.GetValue(storeID,path,true, out value); | 352 | m_store.GetValue(storeID,path,true, out value); |
@@ -342,60 +358,75 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore | |||
342 | /// | 358 | /// |
343 | /// </summary> | 359 | /// </summary> |
344 | // ----------------------------------------------------------------- | 360 | // ----------------------------------------------------------------- |
345 | protected UUID JsonTakeValue(UUID hostID, UUID scriptID, UUID storeID, string path) | 361 | [ScriptInvocation] |
362 | public UUID JsonTakeValue(UUID hostID, UUID scriptID, UUID storeID, string path) | ||
346 | { | 363 | { |
347 | UUID reqID = UUID.Random(); | 364 | UUID reqID = UUID.Random(); |
348 | Util.FireAndForget(delegate(object o) { DoJsonTakeValue(scriptID,reqID,storeID,path,false); }); | 365 | Util.FireAndForget(delegate(object o) { DoJsonTakeValue(scriptID,reqID,storeID,path,false); }); |
349 | return reqID; | 366 | return reqID; |
350 | } | 367 | } |
351 | 368 | ||
352 | protected UUID JsonTakeValueJson(UUID hostID, UUID scriptID, UUID storeID, string path) | 369 | [ScriptInvocation] |
370 | public UUID JsonTakeValueJson(UUID hostID, UUID scriptID, UUID storeID, string path) | ||
353 | { | 371 | { |
354 | UUID reqID = UUID.Random(); | 372 | UUID reqID = UUID.Random(); |
355 | Util.FireAndForget(delegate(object o) { DoJsonTakeValue(scriptID,reqID,storeID,path,true); }); | 373 | Util.FireAndForget(delegate(object o) { DoJsonTakeValue(scriptID,reqID,storeID,path,true); }); |
356 | return reqID; | 374 | return reqID; |
357 | } | 375 | } |
358 | 376 | ||
359 | private void DoJsonTakeValue(UUID scriptID, UUID reqID, UUID storeID, string path, bool useJson) | ||
360 | { | ||
361 | try | ||
362 | { | ||
363 | m_store.TakeValue(storeID,path,useJson,delegate(string value) { DispatchValue(scriptID,reqID,value); }); | ||
364 | return; | ||
365 | } | ||
366 | catch (Exception e) | ||
367 | { | ||
368 | m_log.InfoFormat("[JsonStoreScripts]: unable to retrieve value; {0}",e.ToString()); | ||
369 | } | ||
370 | |||
371 | DispatchValue(scriptID,reqID,String.Empty); | ||
372 | } | ||
373 | |||
374 | |||
375 | // ----------------------------------------------------------------- | 377 | // ----------------------------------------------------------------- |
376 | /// <summary> | 378 | /// <summary> |
377 | /// | 379 | /// |
378 | /// </summary> | 380 | /// </summary> |
379 | // ----------------------------------------------------------------- | 381 | // ----------------------------------------------------------------- |
380 | protected UUID JsonReadValue(UUID hostID, UUID scriptID, UUID storeID, string path) | 382 | [ScriptInvocation] |
383 | public UUID JsonReadValue(UUID hostID, UUID scriptID, UUID storeID, string path) | ||
381 | { | 384 | { |
382 | UUID reqID = UUID.Random(); | 385 | UUID reqID = UUID.Random(); |
383 | Util.FireAndForget(delegate(object o) { DoJsonReadValue(scriptID,reqID,storeID,path,false); }); | 386 | Util.FireAndForget(delegate(object o) { DoJsonReadValue(scriptID,reqID,storeID,path,false); }); |
384 | return reqID; | 387 | return reqID; |
385 | } | 388 | } |
386 | 389 | ||
387 | protected UUID JsonReadValueJson(UUID hostID, UUID scriptID, UUID storeID, string path) | 390 | [ScriptInvocation] |
391 | public UUID JsonReadValueJson(UUID hostID, UUID scriptID, UUID storeID, string path) | ||
388 | { | 392 | { |
389 | UUID reqID = UUID.Random(); | 393 | UUID reqID = UUID.Random(); |
390 | Util.FireAndForget(delegate(object o) { DoJsonReadValue(scriptID,reqID,storeID,path,true); }); | 394 | Util.FireAndForget(delegate(object o) { DoJsonReadValue(scriptID,reqID,storeID,path,true); }); |
391 | return reqID; | 395 | return reqID; |
392 | } | 396 | } |
393 | 397 | ||
394 | private void DoJsonReadValue(UUID scriptID, UUID reqID, UUID storeID, string path, bool useJson) | 398 | #endregion |
399 | |||
400 | // ----------------------------------------------------------------- | ||
401 | /// <summary> | ||
402 | /// | ||
403 | /// </summary> | ||
404 | // ----------------------------------------------------------------- | ||
405 | protected void GenerateRuntimeError(string msg) | ||
406 | { | ||
407 | throw new Exception("JsonStore Runtime Error: " + msg); | ||
408 | } | ||
409 | |||
410 | // ----------------------------------------------------------------- | ||
411 | /// <summary> | ||
412 | /// | ||
413 | /// </summary> | ||
414 | // ----------------------------------------------------------------- | ||
415 | protected void DispatchValue(UUID scriptID, UUID reqID, string value) | ||
416 | { | ||
417 | m_comms.DispatchReply(scriptID,1,value,reqID.ToString()); | ||
418 | } | ||
419 | |||
420 | // ----------------------------------------------------------------- | ||
421 | /// <summary> | ||
422 | /// | ||
423 | /// </summary> | ||
424 | // ----------------------------------------------------------------- | ||
425 | private void DoJsonTakeValue(UUID scriptID, UUID reqID, UUID storeID, string path, bool useJson) | ||
395 | { | 426 | { |
396 | try | 427 | try |
397 | { | 428 | { |
398 | m_store.ReadValue(storeID,path,useJson,delegate(string value) { DispatchValue(scriptID,reqID,value); }); | 429 | m_store.TakeValue(storeID,path,useJson,delegate(string value) { DispatchValue(scriptID,reqID,value); }); |
399 | return; | 430 | return; |
400 | } | 431 | } |
401 | catch (Exception e) | 432 | catch (Exception e) |
@@ -406,16 +437,25 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore | |||
406 | DispatchValue(scriptID,reqID,String.Empty); | 437 | DispatchValue(scriptID,reqID,String.Empty); |
407 | } | 438 | } |
408 | 439 | ||
409 | #endregion | ||
410 | 440 | ||
411 | // ----------------------------------------------------------------- | 441 | // ----------------------------------------------------------------- |
412 | /// <summary> | 442 | /// <summary> |
413 | /// | 443 | /// |
414 | /// </summary> | 444 | /// </summary> |
415 | // ----------------------------------------------------------------- | 445 | // ----------------------------------------------------------------- |
416 | protected void DispatchValue(UUID scriptID, UUID reqID, string value) | 446 | private void DoJsonReadValue(UUID scriptID, UUID reqID, UUID storeID, string path, bool useJson) |
417 | { | 447 | { |
418 | m_comms.DispatchReply(scriptID,1,value,reqID.ToString()); | 448 | try |
449 | { | ||
450 | m_store.ReadValue(storeID,path,useJson,delegate(string value) { DispatchValue(scriptID,reqID,value); }); | ||
451 | return; | ||
452 | } | ||
453 | catch (Exception e) | ||
454 | { | ||
455 | m_log.InfoFormat("[JsonStoreScripts]: unable to retrieve value; {0}",e.ToString()); | ||
456 | } | ||
457 | |||
458 | DispatchValue(scriptID,reqID,String.Empty); | ||
419 | } | 459 | } |
420 | 460 | ||
421 | // ----------------------------------------------------------------- | 461 | // ----------------------------------------------------------------- |
@@ -505,5 +545,43 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore | |||
505 | 545 | ||
506 | m_comms.DispatchReply(scriptID,1,assetID.ToString(),reqID.ToString()); | 546 | m_comms.DispatchReply(scriptID,1,assetID.ToString(),reqID.ToString()); |
507 | } | 547 | } |
548 | |||
549 | // ----------------------------------------------------------------- | ||
550 | /// <summary> | ||
551 | /// Convert a list of values that are path components to a single string path | ||
552 | /// </summary> | ||
553 | // ----------------------------------------------------------------- | ||
554 | protected static Regex m_ArrayPattern = new Regex("^([0-9]+|\\+)$"); | ||
555 | private string ConvertList2Path(object[] pathlist) | ||
556 | { | ||
557 | string path = ""; | ||
558 | for (int i = 0; i < pathlist.Length; i++) | ||
559 | { | ||
560 | string token = ""; | ||
561 | |||
562 | if (pathlist[i] is string) | ||
563 | { | ||
564 | token = pathlist[i].ToString(); | ||
565 | |||
566 | // Check to see if this is a bare number which would not be a valid | ||
567 | // identifier otherwise | ||
568 | if (m_ArrayPattern.IsMatch(token)) | ||
569 | token = '[' + token + ']'; | ||
570 | } | ||
571 | else if (pathlist[i] is int) | ||
572 | { | ||
573 | token = "[" + pathlist[i].ToString() + "]"; | ||
574 | } | ||
575 | else | ||
576 | { | ||
577 | token = "." + pathlist[i].ToString() + "."; | ||
578 | } | ||
579 | |||
580 | path += token + "."; | ||
581 | } | ||
582 | |||
583 | return path; | ||
584 | } | ||
585 | |||
508 | } | 586 | } |
509 | } \ No newline at end of file | 587 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs index 3884a5d..192bcb5 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs | |||
@@ -126,9 +126,9 @@ public sealed class BSCharacter : BSPhysObject | |||
126 | DetailLog("{0},BSCharacter.Destroy", LocalID); | 126 | DetailLog("{0},BSCharacter.Destroy", LocalID); |
127 | PhysicsScene.TaintedObject("BSCharacter.destroy", delegate() | 127 | PhysicsScene.TaintedObject("BSCharacter.destroy", delegate() |
128 | { | 128 | { |
129 | PhysicsScene.Shapes.DereferenceBody(PhysBody, true /* inTaintTime */, null /* bodyCallback */); | 129 | PhysicsScene.Shapes.DereferenceBody(PhysBody, null /* bodyCallback */); |
130 | PhysBody.Clear(); | 130 | PhysBody.Clear(); |
131 | PhysicsScene.Shapes.DereferenceShape(PhysShape, true /* inTaintTime */, null /* bodyCallback */); | 131 | PhysicsScene.Shapes.DereferenceShape(PhysShape, null /* bodyCallback */); |
132 | PhysShape.Clear(); | 132 | PhysShape.Clear(); |
133 | }); | 133 | }); |
134 | } | 134 | } |
@@ -557,11 +557,12 @@ public sealed class BSCharacter : BSPhysObject | |||
557 | { | 557 | { |
558 | get | 558 | get |
559 | { | 559 | { |
560 | return _velocityMotor.TargetValue; | 560 | return m_targetVelocity; |
561 | } | 561 | } |
562 | set | 562 | set |
563 | { | 563 | { |
564 | DetailLog("{0},BSCharacter.setTargetVelocity,call,vel={1}", LocalID, value); | 564 | DetailLog("{0},BSCharacter.setTargetVelocity,call,vel={1}", LocalID, value); |
565 | m_targetVelocity = value; | ||
565 | OMV.Vector3 targetVel = value; | 566 | OMV.Vector3 targetVel = value; |
566 | if (_setAlwaysRun) | 567 | if (_setAlwaysRun) |
567 | targetVel *= BSParam.AvatarAlwaysRunFactor; | 568 | targetVel *= BSParam.AvatarAlwaysRunFactor; |
@@ -591,7 +592,6 @@ public sealed class BSCharacter : BSPhysObject | |||
591 | _velocityMotor.Reset(); | 592 | _velocityMotor.Reset(); |
592 | _velocityMotor.SetCurrent(_velocity); | 593 | _velocityMotor.SetCurrent(_velocity); |
593 | _velocityMotor.SetTarget(_velocity); | 594 | _velocityMotor.SetTarget(_velocity); |
594 | // Even though the motor is initialized, it's not used and the velocity goes straight into the avatar. | ||
595 | _velocityMotor.Enabled = false; | 595 | _velocityMotor.Enabled = false; |
596 | 596 | ||
597 | DetailLog("{0},BSCharacter.setVelocity,taint,vel={1}", LocalID, _velocity); | 597 | DetailLog("{0},BSCharacter.setVelocity,taint,vel={1}", LocalID, _velocity); |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs index 05ab180..8ecf2ff 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs | |||
@@ -581,9 +581,18 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
581 | } | 581 | } |
582 | #endregion // Vehicle parameter setting | 582 | #endregion // Vehicle parameter setting |
583 | 583 | ||
584 | public void Refresh() | ||
585 | { | ||
586 | // If asking for a refresh, reset the physical parameters before the next simulation step. | ||
587 | PhysicsScene.PostTaintObject("BSDynamics.Refresh", Prim.LocalID, delegate() | ||
588 | { | ||
589 | SetPhysicalParameters(); | ||
590 | }); | ||
591 | } | ||
592 | |||
584 | // Some of the properties of this prim may have changed. | 593 | // Some of the properties of this prim may have changed. |
585 | // Do any updating needed for a vehicle | 594 | // Do any updating needed for a vehicle |
586 | public void Refresh() | 595 | private void SetPhysicalParameters() |
587 | { | 596 | { |
588 | if (IsActive) | 597 | if (IsActive) |
589 | { | 598 | { |
@@ -614,7 +623,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
614 | // The actual vehicle gravity is set to zero in Bullet so we can do all the application of same. | 623 | // The actual vehicle gravity is set to zero in Bullet so we can do all the application of same. |
615 | PhysicsScene.PE.SetGravity(Prim.PhysBody, Vector3.Zero); | 624 | PhysicsScene.PE.SetGravity(Prim.PhysBody, Vector3.Zero); |
616 | 625 | ||
617 | VDetailLog("{0},BSDynamics.Refresh,mass={1},inert={2},grav={3},aDamp={4},frict={5},rest={6},lFact={7},aFact={8}", | 626 | VDetailLog("{0},BSDynamics.SetPhysicalParameters,mass={1},inert={2},vehGrav={3},aDamp={4},frict={5},rest={6},lFact={7},aFact={8}", |
618 | Prim.LocalID, m_vehicleMass, Prim.Inertia, m_VehicleGravity, | 627 | Prim.LocalID, m_vehicleMass, Prim.Inertia, m_VehicleGravity, |
619 | BSParam.VehicleAngularDamping, BSParam.VehicleFriction, BSParam.VehicleRestitution, | 628 | BSParam.VehicleAngularDamping, BSParam.VehicleFriction, BSParam.VehicleRestitution, |
620 | BSParam.VehicleLinearFactor, BSParam.VehicleAngularFactor | 629 | BSParam.VehicleLinearFactor, BSParam.VehicleAngularFactor |
@@ -622,26 +631,15 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
622 | } | 631 | } |
623 | else | 632 | else |
624 | { | 633 | { |
625 | PhysicsScene.PE.RemoveFromCollisionFlags(Prim.PhysBody, CollisionFlags.BS_VEHICLE_COLLISIONS); | 634 | if (Prim.PhysBody.HasPhysicalBody) |
635 | PhysicsScene.PE.RemoveFromCollisionFlags(Prim.PhysBody, CollisionFlags.BS_VEHICLE_COLLISIONS); | ||
626 | } | 636 | } |
627 | } | 637 | } |
628 | 638 | ||
629 | public bool RemoveBodyDependencies(BSPhysObject prim) | 639 | public bool RemoveBodyDependencies(BSPhysObject prim) |
630 | { | 640 | { |
631 | // If active, we need to add our properties back when the body is rebuilt. | ||
632 | return IsActive; | ||
633 | } | ||
634 | |||
635 | public void RestoreBodyDependencies(BSPhysObject prim) | ||
636 | { | ||
637 | if (Prim.LocalID != prim.LocalID) | ||
638 | { | ||
639 | // The call should be on us by our prim. Error if not. | ||
640 | PhysicsScene.Logger.ErrorFormat("{0} RestoreBodyDependencies: called by not my prim. passedLocalID={1}, vehiclePrimLocalID={2}", | ||
641 | LogHeader, prim.LocalID, Prim.LocalID); | ||
642 | return; | ||
643 | } | ||
644 | Refresh(); | 641 | Refresh(); |
642 | return IsActive; | ||
645 | } | 643 | } |
646 | 644 | ||
647 | #region Known vehicle value functions | 645 | #region Known vehicle value functions |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs index 54dc458..0c4db40 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs | |||
@@ -219,43 +219,65 @@ public sealed class BSLinksetCompound : BSLinkset | |||
219 | { | 219 | { |
220 | // Gather the child info. It might not be there if the linkset is in transition. | 220 | // Gather the child info. It might not be there if the linkset is in transition. |
221 | BSLinksetCompoundInfo lsi = updated.LinksetInfo as BSLinksetCompoundInfo; | 221 | BSLinksetCompoundInfo lsi = updated.LinksetInfo as BSLinksetCompoundInfo; |
222 | if (LinksetRoot.PhysShape.HasPhysicalShape && lsi != null) | 222 | if (lsi != null) |
223 | { | 223 | { |
224 | if (PhysicsScene.PE.IsCompound(LinksetRoot.PhysShape)) | 224 | // Since the child moved or rotationed, it needs a new relative position within the linkset |
225 | BSLinksetCompoundInfo newLsi = new BSLinksetCompoundInfo(lsi.Index, LinksetRoot, updated, LinksetRoot.PositionDisplacement); | ||
226 | updated.LinksetInfo = newLsi; | ||
227 | |||
228 | // Find the physical instance of the child | ||
229 | if (LinksetRoot.PhysShape.HasPhysicalShape && PhysicsScene.PE.IsCompound(LinksetRoot.PhysShape)) | ||
225 | { | 230 | { |
226 | BulletShape linksetChildShape = PhysicsScene.PE.GetChildShapeFromCompoundShapeIndex(LinksetRoot.PhysShape, lsi.Index); | 231 | // It is possible that the linkset is still under construction and the child is not yet |
227 | if (linksetChildShape.HasPhysicalShape) | 232 | // inserted into the compound shape. A rebuild of the linkset in a pre-step action will |
233 | // build the whole thing with the new position or rotation. | ||
234 | // The index must be checked because Bullet references the child array but does no validity | ||
235 | // checking of the child index passed. | ||
236 | int numLinksetChildren = PhysicsScene.PE.GetNumberOfCompoundChildren(LinksetRoot.PhysShape); | ||
237 | if (lsi.Index < numLinksetChildren) | ||
228 | { | 238 | { |
229 | // Compute the offset from the center-of-gravity | 239 | BulletShape linksetChildShape = PhysicsScene.PE.GetChildShapeFromCompoundShapeIndex(LinksetRoot.PhysShape, lsi.Index); |
230 | BSLinksetCompoundInfo newLsi = new BSLinksetCompoundInfo(lsi.Index, LinksetRoot, updated, LinksetRoot.PositionDisplacement); | 240 | if (linksetChildShape.HasPhysicalShape) |
231 | PhysicsScene.PE.UpdateChildTransform(LinksetRoot.PhysShape, lsi.Index, | 241 | { |
232 | newLsi.OffsetFromCenterOfMass, | 242 | // Found the child shape within the compound shape |
233 | newLsi.OffsetRot, | 243 | PhysicsScene.PE.UpdateChildTransform(LinksetRoot.PhysShape, lsi.Index, |
234 | true /* shouldRecalculateLocalAabb */); | 244 | newLsi.OffsetFromCenterOfMass, |
235 | DetailLog("{0},BSLinksetCompound.UpdateProperties,changeChildPosRot,whichUpdated={1},newLsi={2}", | 245 | newLsi.OffsetRot, |
236 | updated.LocalID, whichUpdated, newLsi); | 246 | true /* shouldRecalculateLocalAabb */); |
237 | updated.LinksetInfo = newLsi; | 247 | updatedChild = true; |
238 | updatedChild = true; | 248 | DetailLog("{0},BSLinksetCompound.UpdateProperties,changeChildPosRot,whichUpdated={1},newLsi={2}", |
249 | updated.LocalID, whichUpdated, newLsi); | ||
250 | } | ||
251 | else // DEBUG DEBUG | ||
252 | { // DEBUG DEBUG | ||
253 | DetailLog("{0},BSLinksetCompound.UpdateProperties,couldNotUpdateChild,noChildShape,shape={1}", | ||
254 | updated.LocalID, linksetChildShape); | ||
255 | } // DEBUG DEBUG | ||
239 | } | 256 | } |
240 | else // DEBUG DEBUG | 257 | else // DEBUG DEBUG |
241 | { // DEBUG DEBUG | 258 | { // DEBUG DEBUG |
242 | DetailLog("{0},BSLinksetCompound.UpdateProperties,couldNotUpdateChild,noChildShape,shape={1}", | 259 | // the child is not yet in the compound shape. This is non-fatal. |
243 | updated.LocalID, linksetChildShape); | 260 | DetailLog("{0},BSLinksetCompound.UpdateProperties,couldNotUpdateChild,childNotInCompoundShape,numChildren={1},index={2}", |
261 | updated.LocalID, numLinksetChildren, lsi.Index); | ||
244 | } // DEBUG DEBUG | 262 | } // DEBUG DEBUG |
245 | } | 263 | } |
246 | else // DEBUG DEBUG | 264 | else // DEBUG DEBUG |
247 | { // DEBUG DEBUG | 265 | { // DEBUG DEBUG |
248 | DetailLog("{0},BSLinksetCompound.UpdateProperties,couldNotUpdateChild,notCompound", updated.LocalID); | 266 | DetailLog("{0},BSLinksetCompound.UpdateProperties,couldNotUpdateChild,noBodyOrNotCompound", updated.LocalID); |
249 | } // DEBUG DEBUG | 267 | } // DEBUG DEBUG |
250 | } | 268 | } |
251 | else // DEBUG DEBUG | 269 | else // DEBUG DEBUG |
252 | { // DEBUG DEBUG | 270 | { // DEBUG DEBUG |
253 | DetailLog("{0},BSLinksetCompound.UpdateProperties,couldNotUpdateChild,rootPhysShape={1},lsi={2}", | 271 | DetailLog("{0},BSLinksetCompound.UpdateProperties,couldNotUpdateChild,noLinkSetInfo,rootPhysShape={1}", |
254 | updated.LocalID, LinksetRoot.PhysShape, lsi == null ? "NULL" : lsi.ToString()); | 272 | updated.LocalID, LinksetRoot.PhysShape); |
255 | } // DEBUG DEBUG | 273 | } // DEBUG DEBUG |
274 | |||
256 | if (!updatedChild) | 275 | if (!updatedChild) |
257 | { | 276 | { |
258 | // If couldn't do the individual child, the linkset needs a rebuild to incorporate the new child info. | 277 | // If couldn't do the individual child, the linkset needs a rebuild to incorporate the new child info. |
278 | // Note: there are several ways through this code that will not update the child if | ||
279 | // the linkset is being rebuilt. In this case, scheduling a rebuild is a NOOP since | ||
280 | // there will already be a rebuild scheduled. | ||
259 | DetailLog("{0},BSLinksetCompound.UpdateProperties,couldNotUpdateChild.schedulingRebuild,whichUpdated={1}", | 281 | DetailLog("{0},BSLinksetCompound.UpdateProperties,couldNotUpdateChild.schedulingRebuild,whichUpdated={1}", |
260 | updated.LocalID, whichUpdated); | 282 | updated.LocalID, whichUpdated); |
261 | updated.LinksetInfo = null; // setting to 'null' causes relative position to be recomputed. | 283 | updated.LinksetInfo = null; // setting to 'null' causes relative position to be recomputed. |
@@ -274,13 +296,14 @@ public sealed class BSLinksetCompound : BSLinkset | |||
274 | bool ret = false; | 296 | bool ret = false; |
275 | 297 | ||
276 | DetailLog("{0},BSLinksetCompound.RemoveBodyDependencies,refreshIfChild,rID={1},rBody={2},isRoot={3}", | 298 | DetailLog("{0},BSLinksetCompound.RemoveBodyDependencies,refreshIfChild,rID={1},rBody={2},isRoot={3}", |
277 | child.LocalID, LinksetRoot.LocalID, LinksetRoot.PhysBody.AddrString, IsRoot(child)); | 299 | child.LocalID, LinksetRoot.LocalID, LinksetRoot.PhysBody, IsRoot(child)); |
278 | 300 | ||
279 | if (!IsRoot(child)) | 301 | if (!IsRoot(child)) |
280 | { | 302 | { |
281 | // Because it is a convenient time, recompute child world position and rotation based on | 303 | // Because it is a convenient time, recompute child world position and rotation based on |
282 | // its position in the linkset. | 304 | // its position in the linkset. |
283 | RecomputeChildWorldPosition(child, true); | 305 | RecomputeChildWorldPosition(child, true /* inTaintTime */); |
306 | child.LinksetInfo = null; | ||
284 | } | 307 | } |
285 | 308 | ||
286 | // Cannot schedule a refresh/rebuild here because this routine is called when | 309 | // Cannot schedule a refresh/rebuild here because this routine is called when |
@@ -295,6 +318,14 @@ public sealed class BSLinksetCompound : BSLinkset | |||
295 | // prim. The child prim's location must be recomputed based on the location of the root shape. | 318 | // prim. The child prim's location must be recomputed based on the location of the root shape. |
296 | private void RecomputeChildWorldPosition(BSPhysObject child, bool inTaintTime) | 319 | private void RecomputeChildWorldPosition(BSPhysObject child, bool inTaintTime) |
297 | { | 320 | { |
321 | // For the moment (20130201), disable this computation (converting the child physical addr back to | ||
322 | // a region address) until we have a good handle on center-of-mass offsets and what the physics | ||
323 | // engine moving a child actually means. | ||
324 | // The simulator keeps track of where children should be as the linkset moves. Setting | ||
325 | // the pos/rot here does not effect that knowledge as there is no good way for the | ||
326 | // physics engine to send the simulator an update for a child. | ||
327 | |||
328 | /* | ||
298 | BSLinksetCompoundInfo lci = child.LinksetInfo as BSLinksetCompoundInfo; | 329 | BSLinksetCompoundInfo lci = child.LinksetInfo as BSLinksetCompoundInfo; |
299 | if (lci != null) | 330 | if (lci != null) |
300 | { | 331 | { |
@@ -323,6 +354,7 @@ public sealed class BSLinksetCompound : BSLinkset | |||
323 | // LogHeader, child.LocalID); | 354 | // LogHeader, child.LocalID); |
324 | DetailLog("{0},BSLinksetCompound.recomputeChildWorldPosition,noRelativePositonInfo", child.LocalID); | 355 | DetailLog("{0},BSLinksetCompound.recomputeChildWorldPosition,noRelativePositonInfo", child.LocalID); |
325 | } | 356 | } |
357 | */ | ||
326 | } | 358 | } |
327 | 359 | ||
328 | // ================================================================ | 360 | // ================================================================ |
@@ -356,6 +388,7 @@ public sealed class BSLinksetCompound : BSLinkset | |||
356 | 388 | ||
357 | // Cause the child's body to be rebuilt and thus restored to normal operation | 389 | // Cause the child's body to be rebuilt and thus restored to normal operation |
358 | RecomputeChildWorldPosition(child, false); | 390 | RecomputeChildWorldPosition(child, false); |
391 | child.LinksetInfo = null; | ||
359 | child.ForceBodyShapeRebuild(false); | 392 | child.ForceBodyShapeRebuild(false); |
360 | 393 | ||
361 | if (!HasAnyChildren) | 394 | if (!HasAnyChildren) |
@@ -377,16 +410,16 @@ public sealed class BSLinksetCompound : BSLinkset | |||
377 | // Constraint linksets are rebuilt every time. | 410 | // Constraint linksets are rebuilt every time. |
378 | // Note that this works for rebuilding just the root after a linkset is taken apart. | 411 | // Note that this works for rebuilding just the root after a linkset is taken apart. |
379 | // Called at taint time!! | 412 | // Called at taint time!! |
380 | private bool disableCOM = true; // disable until we get this debugged | 413 | private bool disableCOM = true; // DEBUG DEBUG: disable until we get this debugged |
381 | private void RecomputeLinksetCompound() | 414 | private void RecomputeLinksetCompound() |
382 | { | 415 | { |
383 | try | 416 | try |
384 | { | 417 | { |
385 | // Suppress rebuilding while rebuilding | 418 | // Suppress rebuilding while rebuilding. (We know rebuilding is on only one thread.) |
386 | Rebuilding = true; | 419 | Rebuilding = true; |
387 | 420 | ||
388 | // Cause the root shape to be rebuilt as a compound object with just the root in it | 421 | // Cause the root shape to be rebuilt as a compound object with just the root in it |
389 | LinksetRoot.ForceBodyShapeRebuild(true); | 422 | LinksetRoot.ForceBodyShapeRebuild(true /* inTaintTime */); |
390 | 423 | ||
391 | // The center of mass for the linkset is the geometric center of the group. | 424 | // The center of mass for the linkset is the geometric center of the group. |
392 | // Compute a displacement for each component so it is relative to the center-of-mass. | 425 | // Compute a displacement for each component so it is relative to the center-of-mass. |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs index a113530..823402b 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs | |||
@@ -190,18 +190,6 @@ public abstract class BSPhysObject : PhysicsActor | |||
190 | public abstract OMV.Quaternion RawOrientation { get; set; } | 190 | public abstract OMV.Quaternion RawOrientation { get; set; } |
191 | public abstract OMV.Quaternion ForceOrientation { get; set; } | 191 | public abstract OMV.Quaternion ForceOrientation { get; set; } |
192 | 192 | ||
193 | // The system is telling us the velocity it wants to move at. | ||
194 | // Velocity in world coordinates. | ||
195 | // protected OMV.Vector3 m_targetVelocity; // use the definition in PhysicsActor | ||
196 | public override OMV.Vector3 TargetVelocity | ||
197 | { | ||
198 | get { return m_targetVelocity; } | ||
199 | set | ||
200 | { | ||
201 | m_targetVelocity = value; | ||
202 | Velocity = value; | ||
203 | } | ||
204 | } | ||
205 | public virtual float TargetSpeed | 193 | public virtual float TargetSpeed |
206 | { | 194 | { |
207 | get | 195 | get |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs index b5dd131..54bf063 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs | |||
@@ -146,9 +146,9 @@ public sealed class BSPrim : BSPhysObject | |||
146 | { | 146 | { |
147 | DetailLog("{0},BSPrim.Destroy,taint,", LocalID); | 147 | DetailLog("{0},BSPrim.Destroy,taint,", LocalID); |
148 | // If there are physical body and shape, release my use of same. | 148 | // If there are physical body and shape, release my use of same. |
149 | PhysicsScene.Shapes.DereferenceBody(PhysBody, true, null); | 149 | PhysicsScene.Shapes.DereferenceBody(PhysBody, null); |
150 | PhysBody.Clear(); | 150 | PhysBody.Clear(); |
151 | PhysicsScene.Shapes.DereferenceShape(PhysShape, true, null); | 151 | PhysicsScene.Shapes.DereferenceShape(PhysShape, null); |
152 | PhysShape.Clear(); | 152 | PhysShape.Clear(); |
153 | }); | 153 | }); |
154 | } | 154 | } |
@@ -181,11 +181,19 @@ public sealed class BSPrim : BSPhysObject | |||
181 | 181 | ||
182 | public override bool ForceBodyShapeRebuild(bool inTaintTime) | 182 | public override bool ForceBodyShapeRebuild(bool inTaintTime) |
183 | { | 183 | { |
184 | PhysicsScene.TaintedObject(inTaintTime, "BSPrim.ForceBodyShapeRebuild", delegate() | 184 | if (inTaintTime) |
185 | { | 185 | { |
186 | _mass = CalculateMass(); // changing the shape changes the mass | 186 | _mass = CalculateMass(); // changing the shape changes the mass |
187 | CreateGeomAndObject(true); | 187 | CreateGeomAndObject(true); |
188 | }); | 188 | } |
189 | else | ||
190 | { | ||
191 | PhysicsScene.TaintedObject("BSPrim.ForceBodyShapeRebuild", delegate() | ||
192 | { | ||
193 | _mass = CalculateMass(); // changing the shape changes the mass | ||
194 | CreateGeomAndObject(true); | ||
195 | }); | ||
196 | } | ||
189 | return true; | 197 | return true; |
190 | } | 198 | } |
191 | public override bool Grabbed { | 199 | public override bool Grabbed { |
@@ -1597,9 +1605,9 @@ public sealed class BSPrim : BSPhysObject | |||
1597 | public void CreateGeomAndObject(bool forceRebuild) | 1605 | public void CreateGeomAndObject(bool forceRebuild) |
1598 | { | 1606 | { |
1599 | // Create the correct physical representation for this type of object. | 1607 | // Create the correct physical representation for this type of object. |
1600 | // Updates PhysBody and PhysShape with the new information. | 1608 | // Updates base.PhysBody and base.PhysShape with the new information. |
1601 | // Ignore 'forceRebuild'. This routine makes the right choices and changes of necessary. | 1609 | // Ignore 'forceRebuild'. This routine makes the right choices and changes of necessary. |
1602 | PhysicsScene.Shapes.GetBodyAndShape(false, PhysicsScene.World, this, null, delegate(BulletBody dBody) | 1610 | PhysicsScene.Shapes.GetBodyAndShape(false /*forceRebuild */, PhysicsScene.World, this, null, delegate(BulletBody dBody) |
1603 | { | 1611 | { |
1604 | // Called if the current prim body is about to be destroyed. | 1612 | // Called if the current prim body is about to be destroyed. |
1605 | // Remove all the physical dependencies on the old body. | 1613 | // Remove all the physical dependencies on the old body. |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs b/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs index 473ef10..37bccbc 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs | |||
@@ -116,8 +116,7 @@ public sealed class BSShapeCollection : IDisposable | |||
116 | // rebuild the body around it. | 116 | // rebuild the body around it. |
117 | // Updates prim.BSBody with information/pointers to requested body | 117 | // Updates prim.BSBody with information/pointers to requested body |
118 | // Returns 'true' if BSBody was changed. | 118 | // Returns 'true' if BSBody was changed. |
119 | bool newBody = CreateBody((newGeom || forceRebuild), prim, PhysicsScene.World, | 119 | bool newBody = CreateBody((newGeom || forceRebuild), prim, PhysicsScene.World, bodyCallback); |
120 | prim.PhysShape, bodyCallback); | ||
121 | ret = newGeom || newBody; | 120 | ret = newGeom || newBody; |
122 | } | 121 | } |
123 | DetailLog("{0},BSShapeCollection.GetBodyAndShape,taintExit,force={1},ret={2},body={3},shape={4}", | 122 | DetailLog("{0},BSShapeCollection.GetBodyAndShape,taintExit,force={1},ret={2},body={3},shape={4}", |
@@ -134,48 +133,44 @@ public sealed class BSShapeCollection : IDisposable | |||
134 | // Track another user of a body. | 133 | // Track another user of a body. |
135 | // We presume the caller has allocated the body. | 134 | // We presume the caller has allocated the body. |
136 | // Bodies only have one user so the body is just put into the world if not already there. | 135 | // Bodies only have one user so the body is just put into the world if not already there. |
137 | public void ReferenceBody(BulletBody body, bool inTaintTime) | 136 | private void ReferenceBody(BulletBody body) |
138 | { | 137 | { |
139 | lock (m_collectionActivityLock) | 138 | lock (m_collectionActivityLock) |
140 | { | 139 | { |
141 | if (DDetail) DetailLog("{0},BSShapeCollection.ReferenceBody,newBody,body={1}", body.ID, body); | 140 | if (DDetail) DetailLog("{0},BSShapeCollection.ReferenceBody,newBody,body={1}", body.ID, body); |
142 | PhysicsScene.TaintedObject(inTaintTime, "BSShapeCollection.ReferenceBody", delegate() | 141 | if (!PhysicsScene.PE.IsInWorld(PhysicsScene.World, body)) |
143 | { | 142 | { |
144 | if (!PhysicsScene.PE.IsInWorld(PhysicsScene.World, body)) | 143 | PhysicsScene.PE.AddObjectToWorld(PhysicsScene.World, body); |
145 | { | 144 | if (DDetail) DetailLog("{0},BSShapeCollection.ReferenceBody,addedToWorld,ref={1}", body.ID, body); |
146 | PhysicsScene.PE.AddObjectToWorld(PhysicsScene.World, body); | 145 | } |
147 | if (DDetail) DetailLog("{0},BSShapeCollection.ReferenceBody,addedToWorld,ref={1}", body.ID, body); | ||
148 | } | ||
149 | }); | ||
150 | } | 146 | } |
151 | } | 147 | } |
152 | 148 | ||
153 | // Release the usage of a body. | 149 | // Release the usage of a body. |
154 | // Called when releasing use of a BSBody. BSShape is handled separately. | 150 | // Called when releasing use of a BSBody. BSShape is handled separately. |
155 | public void DereferenceBody(BulletBody body, bool inTaintTime, BodyDestructionCallback bodyCallback ) | 151 | // Called in taint time. |
152 | public void DereferenceBody(BulletBody body, BodyDestructionCallback bodyCallback ) | ||
156 | { | 153 | { |
157 | if (!body.HasPhysicalBody) | 154 | if (!body.HasPhysicalBody) |
158 | return; | 155 | return; |
159 | 156 | ||
157 | PhysicsScene.AssertInTaintTime("BSShapeCollection.DereferenceBody"); | ||
158 | |||
160 | lock (m_collectionActivityLock) | 159 | lock (m_collectionActivityLock) |
161 | { | 160 | { |
162 | PhysicsScene.TaintedObject(inTaintTime, "BSShapeCollection.DereferenceBody", delegate() | 161 | if (DDetail) DetailLog("{0},BSShapeCollection.DereferenceBody,DestroyingBody,body={1}", body.ID, body); |
163 | { | 162 | // If the caller needs to know the old body is going away, pass the event up. |
164 | if (DDetail) DetailLog("{0},BSShapeCollection.DereferenceBody,DestroyingBody,body={1},inTaintTime={2}", | 163 | if (bodyCallback != null) bodyCallback(body); |
165 | body.ID, body, inTaintTime); | ||
166 | // If the caller needs to know the old body is going away, pass the event up. | ||
167 | if (bodyCallback != null) bodyCallback(body); | ||
168 | 164 | ||
169 | if (PhysicsScene.PE.IsInWorld(PhysicsScene.World, body)) | 165 | if (PhysicsScene.PE.IsInWorld(PhysicsScene.World, body)) |
170 | { | 166 | { |
171 | PhysicsScene.PE.RemoveObjectFromWorld(PhysicsScene.World, body); | 167 | PhysicsScene.PE.RemoveObjectFromWorld(PhysicsScene.World, body); |
172 | if (DDetail) DetailLog("{0},BSShapeCollection.DereferenceBody,removingFromWorld. Body={1}", body.ID, body); | 168 | if (DDetail) DetailLog("{0},BSShapeCollection.DereferenceBody,removingFromWorld. Body={1}", body.ID, body); |
173 | } | 169 | } |
174 | 170 | ||
175 | // Zero any reference to the shape so it is not freed when the body is deleted. | 171 | // Zero any reference to the shape so it is not freed when the body is deleted. |
176 | PhysicsScene.PE.SetCollisionShape(PhysicsScene.World, body, null); | 172 | PhysicsScene.PE.SetCollisionShape(PhysicsScene.World, body, null); |
177 | PhysicsScene.PE.DestroyObject(PhysicsScene.World, body); | 173 | PhysicsScene.PE.DestroyObject(PhysicsScene.World, body); |
178 | }); | ||
179 | } | 174 | } |
180 | } | 175 | } |
181 | 176 | ||
@@ -246,44 +241,43 @@ public sealed class BSShapeCollection : IDisposable | |||
246 | } | 241 | } |
247 | 242 | ||
248 | // Release the usage of a shape. | 243 | // Release the usage of a shape. |
249 | public void DereferenceShape(BulletShape shape, bool inTaintTime, ShapeDestructionCallback shapeCallback) | 244 | public void DereferenceShape(BulletShape shape, ShapeDestructionCallback shapeCallback) |
250 | { | 245 | { |
251 | if (!shape.HasPhysicalShape) | 246 | if (!shape.HasPhysicalShape) |
252 | return; | 247 | return; |
253 | 248 | ||
254 | PhysicsScene.TaintedObject(inTaintTime, "BSShapeCollection.DereferenceShape", delegate() | 249 | PhysicsScene.AssertInTaintTime("BSShapeCollection.DereferenceShape"); |
250 | |||
251 | if (shape.HasPhysicalShape) | ||
255 | { | 252 | { |
256 | if (shape.HasPhysicalShape) | 253 | if (shape.isNativeShape) |
257 | { | 254 | { |
258 | if (shape.isNativeShape) | 255 | // Native shapes are not tracked and are released immediately |
259 | { | 256 | if (DDetail) DetailLog("{0},BSShapeCollection.DereferenceShape,deleteNativeShape,ptr={1}", |
260 | // Native shapes are not tracked and are released immediately | 257 | BSScene.DetailLogZero, shape.AddrString); |
261 | if (DDetail) DetailLog("{0},BSShapeCollection.DereferenceShape,deleteNativeShape,ptr={1},taintTime={2}", | 258 | if (shapeCallback != null) shapeCallback(shape); |
262 | BSScene.DetailLogZero, shape.AddrString, inTaintTime); | 259 | PhysicsScene.PE.DeleteCollisionShape(PhysicsScene.World, shape); |
263 | if (shapeCallback != null) shapeCallback(shape); | 260 | } |
264 | PhysicsScene.PE.DeleteCollisionShape(PhysicsScene.World, shape); | 261 | else |
265 | } | 262 | { |
266 | else | 263 | switch (shape.type) |
267 | { | 264 | { |
268 | switch (shape.type) | 265 | case BSPhysicsShapeType.SHAPE_HULL: |
269 | { | 266 | DereferenceHull(shape, shapeCallback); |
270 | case BSPhysicsShapeType.SHAPE_HULL: | 267 | break; |
271 | DereferenceHull(shape, shapeCallback); | 268 | case BSPhysicsShapeType.SHAPE_MESH: |
272 | break; | 269 | DereferenceMesh(shape, shapeCallback); |
273 | case BSPhysicsShapeType.SHAPE_MESH: | 270 | break; |
274 | DereferenceMesh(shape, shapeCallback); | 271 | case BSPhysicsShapeType.SHAPE_COMPOUND: |
275 | break; | 272 | DereferenceCompound(shape, shapeCallback); |
276 | case BSPhysicsShapeType.SHAPE_COMPOUND: | 273 | break; |
277 | DereferenceCompound(shape, shapeCallback); | 274 | case BSPhysicsShapeType.SHAPE_UNKNOWN: |
278 | break; | 275 | break; |
279 | case BSPhysicsShapeType.SHAPE_UNKNOWN: | 276 | default: |
280 | break; | 277 | break; |
281 | default: | ||
282 | break; | ||
283 | } | ||
284 | } | 278 | } |
285 | } | 279 | } |
286 | }); | 280 | } |
287 | } | 281 | } |
288 | 282 | ||
289 | // Count down the reference count for a mesh shape | 283 | // Count down the reference count for a mesh shape |
@@ -394,7 +388,7 @@ public sealed class BSShapeCollection : IDisposable | |||
394 | 388 | ||
395 | if (shapeInfo.type != BSPhysicsShapeType.SHAPE_UNKNOWN) | 389 | if (shapeInfo.type != BSPhysicsShapeType.SHAPE_UNKNOWN) |
396 | { | 390 | { |
397 | DereferenceShape(shapeInfo, true, null); | 391 | DereferenceShape(shapeInfo, null); |
398 | } | 392 | } |
399 | else | 393 | else |
400 | { | 394 | { |
@@ -544,7 +538,7 @@ public sealed class BSShapeCollection : IDisposable | |||
544 | ShapeDestructionCallback shapeCallback) | 538 | ShapeDestructionCallback shapeCallback) |
545 | { | 539 | { |
546 | // release any previous shape | 540 | // release any previous shape |
547 | DereferenceShape(prim.PhysShape, true, shapeCallback); | 541 | DereferenceShape(prim.PhysShape, shapeCallback); |
548 | 542 | ||
549 | BulletShape newShape = BuildPhysicalNativeShape(prim, shapeType, shapeKey); | 543 | BulletShape newShape = BuildPhysicalNativeShape(prim, shapeType, shapeKey); |
550 | 544 | ||
@@ -612,7 +606,7 @@ public sealed class BSShapeCollection : IDisposable | |||
612 | prim.LocalID, prim.PhysShape.shapeKey.ToString("X"), newMeshKey.ToString("X")); | 606 | prim.LocalID, prim.PhysShape.shapeKey.ToString("X"), newMeshKey.ToString("X")); |
613 | 607 | ||
614 | // Since we're recreating new, get rid of the reference to the previous shape | 608 | // Since we're recreating new, get rid of the reference to the previous shape |
615 | DereferenceShape(prim.PhysShape, true, shapeCallback); | 609 | DereferenceShape(prim.PhysShape, shapeCallback); |
616 | 610 | ||
617 | newShape = CreatePhysicalMesh(prim.PhysObjectName, newMeshKey, prim.BaseShape, prim.Size, lod); | 611 | newShape = CreatePhysicalMesh(prim.PhysObjectName, newMeshKey, prim.BaseShape, prim.Size, lod); |
618 | // Take evasive action if the mesh was not constructed. | 612 | // Take evasive action if the mesh was not constructed. |
@@ -683,7 +677,7 @@ public sealed class BSShapeCollection : IDisposable | |||
683 | prim.LocalID, prim.PhysShape.shapeKey.ToString("X"), newHullKey.ToString("X")); | 677 | prim.LocalID, prim.PhysShape.shapeKey.ToString("X"), newHullKey.ToString("X")); |
684 | 678 | ||
685 | // Remove usage of the previous shape. | 679 | // Remove usage of the previous shape. |
686 | DereferenceShape(prim.PhysShape, true, shapeCallback); | 680 | DereferenceShape(prim.PhysShape, shapeCallback); |
687 | 681 | ||
688 | newShape = CreatePhysicalHull(prim.PhysObjectName, newHullKey, prim.BaseShape, prim.Size, lod); | 682 | newShape = CreatePhysicalHull(prim.PhysObjectName, newHullKey, prim.BaseShape, prim.Size, lod); |
689 | newShape = VerifyMeshCreated(newShape, prim); | 683 | newShape = VerifyMeshCreated(newShape, prim); |
@@ -818,7 +812,6 @@ public sealed class BSShapeCollection : IDisposable | |||
818 | // Don't need to do this as the shape is freed when the new root shape is created below. | 812 | // Don't need to do this as the shape is freed when the new root shape is created below. |
819 | // DereferenceShape(prim.PhysShape, true, shapeCallback); | 813 | // DereferenceShape(prim.PhysShape, true, shapeCallback); |
820 | 814 | ||
821 | |||
822 | BulletShape cShape = PhysicsScene.PE.CreateCompoundShape(PhysicsScene.World, false); | 815 | BulletShape cShape = PhysicsScene.PE.CreateCompoundShape(PhysicsScene.World, false); |
823 | 816 | ||
824 | // Create the shape for the root prim and add it to the compound shape. Cannot be a native shape. | 817 | // Create the shape for the root prim and add it to the compound shape. Cannot be a native shape. |
@@ -933,8 +926,7 @@ public sealed class BSShapeCollection : IDisposable | |||
933 | // Updates prim.BSBody with the information about the new body if one is created. | 926 | // Updates prim.BSBody with the information about the new body if one is created. |
934 | // Returns 'true' if an object was actually created. | 927 | // Returns 'true' if an object was actually created. |
935 | // Called at taint-time. | 928 | // Called at taint-time. |
936 | private bool CreateBody(bool forceRebuild, BSPhysObject prim, BulletWorld sim, BulletShape shape, | 929 | private bool CreateBody(bool forceRebuild, BSPhysObject prim, BulletWorld sim, BodyDestructionCallback bodyCallback) |
937 | BodyDestructionCallback bodyCallback) | ||
938 | { | 930 | { |
939 | bool ret = false; | 931 | bool ret = false; |
940 | 932 | ||
@@ -951,27 +943,28 @@ public sealed class BSShapeCollection : IDisposable | |||
951 | { | 943 | { |
952 | // If the collisionObject is not the correct type for solidness, rebuild what's there | 944 | // If the collisionObject is not the correct type for solidness, rebuild what's there |
953 | mustRebuild = true; | 945 | mustRebuild = true; |
946 | if (DDetail) DetailLog("{0},BSShapeCollection.CreateBody,forceRebuildBecauseChangingBodyType,bodyType={1}", prim.LocalID, bodyType); | ||
954 | } | 947 | } |
955 | } | 948 | } |
956 | 949 | ||
957 | if (mustRebuild || forceRebuild) | 950 | if (mustRebuild || forceRebuild) |
958 | { | 951 | { |
959 | // Free any old body | 952 | // Free any old body |
960 | DereferenceBody(prim.PhysBody, true, bodyCallback); | 953 | DereferenceBody(prim.PhysBody, bodyCallback); |
961 | 954 | ||
962 | BulletBody aBody; | 955 | BulletBody aBody; |
963 | if (prim.IsSolid) | 956 | if (prim.IsSolid) |
964 | { | 957 | { |
965 | aBody = PhysicsScene.PE.CreateBodyFromShape(sim, shape, prim.LocalID, prim.RawPosition, prim.RawOrientation); | 958 | aBody = PhysicsScene.PE.CreateBodyFromShape(sim, prim.PhysShape, prim.LocalID, prim.RawPosition, prim.RawOrientation); |
966 | if (DDetail) DetailLog("{0},BSShapeCollection.CreateBody,mesh,body={1}", prim.LocalID, aBody); | 959 | if (DDetail) DetailLog("{0},BSShapeCollection.CreateBody,mesh,body={1}", prim.LocalID, aBody); |
967 | } | 960 | } |
968 | else | 961 | else |
969 | { | 962 | { |
970 | aBody = PhysicsScene.PE.CreateGhostFromShape(sim, shape, prim.LocalID, prim.RawPosition, prim.RawOrientation); | 963 | aBody = PhysicsScene.PE.CreateGhostFromShape(sim, prim.PhysShape, prim.LocalID, prim.RawPosition, prim.RawOrientation); |
971 | if (DDetail) DetailLog("{0},BSShapeCollection.CreateBody,ghost,body={1}", prim.LocalID, aBody); | 964 | if (DDetail) DetailLog("{0},BSShapeCollection.CreateBody,ghost,body={1}", prim.LocalID, aBody); |
972 | } | 965 | } |
973 | 966 | ||
974 | ReferenceBody(aBody, true); | 967 | ReferenceBody(aBody); |
975 | 968 | ||
976 | prim.PhysBody = aBody; | 969 | prim.PhysBody = aBody; |
977 | 970 | ||
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt b/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt index a95e169..a3b3556 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt +++ b/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt | |||
@@ -6,6 +6,7 @@ One sided meshes? Should terrain be built into a closed shape? | |||
6 | Ref: http://bulletphysics.org/Bullet/phpBB3/viewtopic.php?t=4869 | 6 | Ref: http://bulletphysics.org/Bullet/phpBB3/viewtopic.php?t=4869 |
7 | Deleting a linkset while standing on the root will leave the physical shape of the root behind. | 7 | Deleting a linkset while standing on the root will leave the physical shape of the root behind. |
8 | Not sure if it is because standing on it. Done with large prim linksets. | 8 | Not sure if it is because standing on it. Done with large prim linksets. |
9 | Terrain detail: double terrain mesh detail | ||
9 | Vehicle angular vertical attraction | 10 | Vehicle angular vertical attraction |
10 | vehicle angular banking | 11 | vehicle angular banking |
11 | Center-of-gravity | 12 | Center-of-gravity |
@@ -34,34 +35,20 @@ Vehicle script tuning/debugging | |||
34 | Weapon shooter script | 35 | Weapon shooter script |
35 | Add material densities to the material types | 36 | Add material densities to the material types |
36 | 37 | ||
37 | CRASHES | ||
38 | ================================================= | ||
39 | Crazyness during 20130115 office hours was PositionAdjustUnderground for both char and prim | ||
40 | m1:logs/20130115.0934/physics-BulletSim-20130115083613.log | ||
41 | Creation of Neb's terrain made the terrain "disappear". Everything started to fall | ||
42 | and then get restored to be above terrain. | ||
43 | 20121129.1411: editting/moving phys object across region boundries causes crash | ||
44 | getPos-> btRigidBody::upcast -> getBodyType -> BOOM | ||
45 | 20121128.1600: mesh object not rezzing (no physics mesh). | ||
46 | Causes many errors. Doesn't stop after first error with box shape. | ||
47 | Eventually crashes when deleting the object. | ||
48 | 20121206.1434: rez Sam-pan into OSGrid BulletSim11 region | ||
49 | Immediate simulator crash. Mono does not output any stacktrace and | ||
50 | log just stops after reporting taint-time linking of the linkset. | ||
51 | |||
52 | VEHICLES TODO LIST: | 38 | VEHICLES TODO LIST: |
53 | ================================================= | 39 | ================================================= |
54 | Border crossing with linked vehicle causes crash | 40 | Border crossing with linked vehicle causes crash |
41 | 20121129.1411: editting/moving phys object across region boundries causes crash | ||
42 | getPos-> btRigidBody::upcast -> getBodyType -> BOOM | ||
55 | Vehicles (Move smoothly) | 43 | Vehicles (Move smoothly) |
56 | Some vehicles should not be able to turn if no speed or off ground. | 44 | Some vehicles should not be able to turn if no speed or off ground. |
45 | What to do if vehicle and prim buoyancy differ? | ||
57 | Cannot edit/move a vehicle being ridden: it jumps back to the origional position. | 46 | Cannot edit/move a vehicle being ridden: it jumps back to the origional position. |
58 | Neb car jiggling left and right | 47 | Neb car jiggling left and right |
59 | Happens on terrain and any other mesh object. Flat cubes are much smoother. | 48 | Happens on terrain and any other mesh object. Flat cubes are much smoother. |
60 | This has been reduced but not eliminated. | 49 | This has been reduced but not eliminated. |
61 | Implement referenceFrame for all the motion routines. | 50 | Implement referenceFrame for all the motion routines. |
62 | For limitMotorUp, use raycast down to find if vehicle is in the air. | 51 | For limitMotorUp, use raycast down to find if vehicle is in the air. |
63 | Angular motion around Z moves the vehicle in world Z and not vehicle Z in ODE. | ||
64 | Verify that angular motion specified around Z moves in the vehicle coordinates. | ||
65 | Verify llGetVel() is returning a smooth and good value for vehicle movement. | 52 | Verify llGetVel() is returning a smooth and good value for vehicle movement. |
66 | llGetVel() should return the root's velocity if requested in a child prim. | 53 | llGetVel() should return the root's velocity if requested in a child prim. |
67 | Implement function efficiency for lineaar and angular motion. | 54 | Implement function efficiency for lineaar and angular motion. |
@@ -73,10 +60,15 @@ Remove vehicle angular velocity zeroing in BSPrim.UpdateProperties(). | |||
73 | Incorporate inter-relationship of angular corrections. For instance, angularDeflection | 60 | Incorporate inter-relationship of angular corrections. For instance, angularDeflection |
74 | and angularMotorUp will compute same X or Y correction. When added together | 61 | and angularMotorUp will compute same X or Y correction. When added together |
75 | creates over-correction and over-shoot and wabbling. | 62 | creates over-correction and over-shoot and wabbling. |
63 | Vehicle attributes are not restored when a vehicle is rezzed on region creation | ||
64 | Create vehicle, setup vehicle properties, restart region, vehicle is not reinitialized. | ||
76 | 65 | ||
77 | GENERAL TODO LIST: | 66 | GENERAL TODO LIST: |
78 | ================================================= | 67 | ================================================= |
79 | Avatar standing on a moving object should start to move with the object. | 68 | Collisions are inconsistant: arrows are supposed to hit and report collision. Often don't. |
69 | If arrow show at prim, collision reported about 1/3 of time. If collision reported, | ||
70 | both arrow and prim report it. The arrow bounces off the prim 9 out of 10 times. | ||
71 | Shooting 5m sphere "arrows" at 60m/s. | ||
80 | llMoveToTarget objects are not effected by gravity until target is removed. | 72 | llMoveToTarget objects are not effected by gravity until target is removed. |
81 | Compute CCD parameters based on body size | 73 | Compute CCD parameters based on body size |
82 | Can solver iterations be changed per body/shape? Can be for constraints but what | 74 | Can solver iterations be changed per body/shape? Can be for constraints but what |
@@ -135,6 +127,7 @@ Physical and phantom will drop through the terrain | |||
135 | 127 | ||
136 | LINKSETS | 128 | LINKSETS |
137 | ====================================================== | 129 | ====================================================== |
130 | Child prims do not report collisions | ||
138 | Editing a child of a linkset causes the child to go phantom | 131 | Editing a child of a linkset causes the child to go phantom |
139 | Move a child prim once when it is physical and can never move it again without it going phantom | 132 | Move a child prim once when it is physical and can never move it again without it going phantom |
140 | Offset the center of the linkset to be the geometric center of all the prims | 133 | Offset the center of the linkset to be the geometric center of all the prims |
@@ -330,4 +323,8 @@ Boats float low in the water (DONE) | |||
330 | Boats floating at proper level (DONE) | 323 | Boats floating at proper level (DONE) |
331 | When is force introduced by SetForce removed? The prestep action could go forever. (DONE) | 324 | When is force introduced by SetForce removed? The prestep action could go forever. (DONE) |
332 | (Resolution: setForce registers a prestep action which keeps applying the force) | 325 | (Resolution: setForce registers a prestep action which keeps applying the force) |
333 | Child movement in linkset (don't rebuild linkset) (DONE 20130122)) \ No newline at end of file | 326 | Child movement in linkset (don't rebuild linkset) (DONE 20130122)) |
327 | Avatar standing on a moving object should start to move with the object. (DONE 20130125) | ||
328 | Angular motion around Z moves the vehicle in world Z and not vehicle Z in ODE. | ||
329 | Verify that angular motion specified around Z moves in the vehicle coordinates. | ||
330 | DONE 20130120: BulletSim properly applies force in vehicle relative coordinates. \ No newline at end of file | ||
diff --git a/OpenSim/Region/Physics/Manager/PhysicsScene.cs b/OpenSim/Region/Physics/Manager/PhysicsScene.cs index fe418d3..20a70b4 100644 --- a/OpenSim/Region/Physics/Manager/PhysicsScene.cs +++ b/OpenSim/Region/Physics/Manager/PhysicsScene.cs | |||
@@ -47,7 +47,7 @@ namespace OpenSim.Region.Physics.Manager | |||
47 | public delegate void JointDeactivated(PhysicsJoint joint); | 47 | public delegate void JointDeactivated(PhysicsJoint joint); |
48 | public delegate void JointErrorMessage(PhysicsJoint joint, string message); // this refers to an "error message due to a problem", not "amount of joint constraint violation" | 48 | public delegate void JointErrorMessage(PhysicsJoint joint, string message); // this refers to an "error message due to a problem", not "amount of joint constraint violation" |
49 | 49 | ||
50 | public enum RayFilterFlags:ushort | 50 | public enum RayFilterFlags : ushort |
51 | { | 51 | { |
52 | // the flags | 52 | // the flags |
53 | water = 0x01, | 53 | water = 0x01, |
@@ -64,7 +64,7 @@ namespace OpenSim.Region.Physics.Manager | |||
64 | ClosestHit = 0x8000, | 64 | ClosestHit = 0x8000, |
65 | 65 | ||
66 | // some combinations | 66 | // some combinations |
67 | LSLPhanton = phantom | volumedtc, | 67 | LSLPhantom = phantom | volumedtc, |
68 | PrimsNonPhantom = nonphysical | physical, | 68 | PrimsNonPhantom = nonphysical | physical, |
69 | PrimsNonPhantomAgents = nonphysical | physical | agent, | 69 | PrimsNonPhantomAgents = nonphysical | physical | agent, |
70 | 70 | ||
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 38a9cb0..f4a812c 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -12342,7 +12342,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
12342 | if (checkNonPhysical) | 12342 | if (checkNonPhysical) |
12343 | rayfilter |= RayFilterFlags.nonphysical; | 12343 | rayfilter |= RayFilterFlags.nonphysical; |
12344 | if (detectPhantom) | 12344 | if (detectPhantom) |
12345 | rayfilter |= RayFilterFlags.LSLPhanton; | 12345 | rayfilter |= RayFilterFlags.LSLPhantom; |
12346 | 12346 | ||
12347 | Vector3 direction = dir * ( 1/dist); | 12347 | Vector3 direction = dir * ( 1/dist); |
12348 | 12348 | ||