aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/ApplicationPlugins/LoadRegions/Properties/AssemblyInfo.cs4
-rw-r--r--OpenSim/ApplicationPlugins/RegionModulesController/Properties/AssemblyInfo.cs2
-rw-r--r--OpenSim/ApplicationPlugins/RemoteController/Properties/AssemblyInfo.cs2
-rw-r--r--OpenSim/Capabilities/Handlers/Properties/AssemblyInfo.cs2
-rw-r--r--OpenSim/Capabilities/Properties/AssemblyInfo.cs2
-rw-r--r--OpenSim/ConsoleClient/Properties/AssemblyInfo.cs2
-rw-r--r--OpenSim/Data/MSSQL/Properties/AssemblyInfo.cs2
-rw-r--r--OpenSim/Data/MySQL/Properties/AssemblyInfo.cs2
-rw-r--r--OpenSim/Data/Null/Properties/AssemblyInfo.cs2
-rw-r--r--OpenSim/Data/Properties/AssemblyInfo.cs2
-rw-r--r--OpenSim/Data/SQLite/Properties/AssemblyInfo.cs2
-rw-r--r--OpenSim/Framework/AssemblyInfo.cs2
-rw-r--r--OpenSim/Framework/AssetLoader/Filesystem/Properties/AssemblyInfo.cs2
-rw-r--r--OpenSim/Framework/Communications/Properties/AssemblyInfo.cs2
-rw-r--r--OpenSim/Framework/Configuration/HTTP/Properties/AssemblyInfo.cs2
-rw-r--r--OpenSim/Framework/Configuration/XML/Properties/AssemblyInfo.cs2
-rw-r--r--OpenSim/Framework/Console/AssemblyInfo.cs2
-rw-r--r--OpenSim/Framework/Monitoring/Properties/AssemblyInfo.cs2
-rw-r--r--OpenSim/Framework/RegionInfo.cs27
-rw-r--r--OpenSim/Framework/RegionLoader/Filesystem/Properties/AssemblyInfo.cs2
-rw-r--r--OpenSim/Framework/RegionLoader/Web/Properties/AssemblyInfo.cs2
-rw-r--r--OpenSim/Framework/Serialization/Properties/AssemblyInfo.cs2
-rw-r--r--OpenSim/Framework/Servers/HttpServer/Properties/AssemblyInfo.cs2
-rw-r--r--OpenSim/Framework/Servers/Properties/AssemblyInfo.cs2
-rw-r--r--OpenSim/Framework/Servers/VersionInfo.cs2
-rw-r--r--OpenSim/Region/Application/OpenSimBase.cs37
-rw-r--r--OpenSim/Region/ClientStack/ClientStackManager.cs83
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/Properties/AssemblyInfo.cs2
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs2
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/Properties/AssemblyInfo.cs2
-rw-r--r--OpenSim/Region/ClientStack/Properties/AssemblyInfo.cs2
-rw-r--r--OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetTransactionModule.cs18
-rw-r--r--OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs3
-rw-r--r--OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs41
-rw-r--r--OpenSim/Region/CoreModules/Framework/InterfaceCommander/Command.cs4
-rw-r--r--OpenSim/Region/CoreModules/Properties/AssemblyInfo.cs2
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/MapImage/MapImageServiceModule.cs8
-rw-r--r--OpenSim/Region/CoreModules/World/Estate/EstateManagementCommands.cs2
-rw-r--r--OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs88
-rw-r--r--OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs10
-rw-r--r--OpenSim/Region/DataSnapshot/Properties/AssemblyInfo.cs2
-rw-r--r--OpenSim/Region/Framework/Interfaces/IJsonStoreModule.cs1
-rw-r--r--OpenSim/Region/Framework/Properties/AssemblyInfo.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/EventManager.cs56
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs11
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs7
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs126
-rw-r--r--OpenSim/Region/Framework/Scenes/UuidGatherer.cs10
-rw-r--r--OpenSim/Region/OptionalModules/Properties/AssemblyInfo.cs2
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStore.cs73
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreModule.cs13
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreScriptModule.cs209
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs119
-rw-r--r--OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs2
-rw-r--r--OpenSim/Region/Physics/BasicPhysicsPlugin/AssemblyInfo.cs2
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSAPIXNA.cs202
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSApiTemplate.cs28
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs21
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs100
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs81
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSParam.cs41
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs120
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs68
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSScene.cs23
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs125
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt44
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/Properties/AssemblyInfo.cs2
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/Tests/BasicVehicles.cs150
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/Tests/BulletSimTests.cs56
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/Tests/BulletSimTestsUtil.cs95
-rw-r--r--OpenSim/Region/Physics/ConvexDecompositionDotNet/Properties/AssemblyInfo.cs2
-rw-r--r--OpenSim/Region/Physics/Manager/AssemblyInfo.cs2
-rw-r--r--OpenSim/Region/Physics/Manager/PhysicsScene.cs4
-rw-r--r--OpenSim/Region/Physics/Meshing/Properties/AssemblyInfo.cs2
-rw-r--r--OpenSim/Region/Physics/OdePlugin/AssemblyInfo.cs2
-rw-r--r--OpenSim/Region/Physics/OdePlugin/OdeScene.cs4
-rw-r--r--OpenSim/Region/Physics/POSPlugin/AssemblyInfo.cs2
-rw-r--r--OpenSim/Region/RegionCombinerModule/Properties/AssemblyInfo.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs15
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Properties/AssemblyInfo.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/Properties/AssemblyInfo.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/Properties/AssemblyInfo.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs30
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/CodeTools/Properties/AssemblyInfo.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Instance/Properties/AssemblyInfo.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Instance/Tests/CoopTerminationTests.cs165
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Properties/AssemblyInfo.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/EventManager.cs6
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/Properties/AssemblyInfo.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/XEngine.cs2
-rw-r--r--OpenSim/Region/UserStatistics/Properties/AssemblyInfo.cs2
-rw-r--r--OpenSim/Server/Base/Properties/AssemblyInfo.cs2
-rw-r--r--OpenSim/Server/Handlers/Properties/AssemblyInfo.cs2
-rw-r--r--OpenSim/Server/Properties/AssemblyInfo.cs2
-rw-r--r--OpenSim/Services/AssetService/Properties/AssemblyInfo.cs2
-rw-r--r--OpenSim/Services/AuthenticationService/Properties/AssemblyInfo.cs2
-rw-r--r--OpenSim/Services/AuthorizationService/Properties/AssemblyInfo.cs2
-rw-r--r--OpenSim/Services/AvatarService/Properties/AssemblyInfo.cs2
-rw-r--r--OpenSim/Services/Base/Properties/AssemblyInfo.cs2
-rw-r--r--OpenSim/Services/Connectors/Properties/AssemblyInfo.cs2
-rw-r--r--OpenSim/Services/FreeswitchService/Properties/AssemblyInfo.cs2
-rw-r--r--OpenSim/Services/Friends/Properties/AssemblyInfo.cs2
-rw-r--r--OpenSim/Services/GridService/Properties/AssemblyInfo.cs2
-rw-r--r--OpenSim/Services/HypergridService/Properties/AssemblyInfo.cs2
-rw-r--r--OpenSim/Services/Interfaces/Properties/AssemblyInfo.cs2
-rw-r--r--OpenSim/Services/InventoryService/Properties/AssemblyInfo.cs2
-rw-r--r--OpenSim/Services/LLLoginService/Properties/AssemblyInfo.cs2
-rw-r--r--OpenSim/Services/MapImageService/Properties/AssemblyInfo.cs2
-rw-r--r--OpenSim/Services/PresenceService/Properties/AssemblyInfo.cs2
-rw-r--r--OpenSim/Services/UserAccountService/Properties/AssemblyInfo.cs2
-rw-r--r--OpenSim/Tools/Compiler/Properties/AssemblyInfo.cs2
-rw-r--r--OpenSim/Tools/Configger/Properties/AssemblyInfo.cs2
-rw-r--r--OpenSim/Tools/pCampBot/Properties/AssemblyInfo.cs2
-rw-r--r--ThirdParty/SmartThreadPool/AssemblyInfo.cs2
-rw-r--r--bin/OpenSim.ini.example7
-rw-r--r--bin/OpenSimDefaults.ini1
-rw-r--r--bin/Regions/Regions.ini.example1
-rwxr-xr-xbin/lib32/BulletSim.dllbin551424 -> 545280 bytes
-rwxr-xr-xbin/lib32/libBulletSim.sobin1720231 -> 1690012 bytes
-rwxr-xr-xbin/lib64/BulletSim.dllbin700416 -> 693248 bytes
-rwxr-xr-xbin/lib64/libBulletSim.sobin1858716 -> 1834927 bytes
-rw-r--r--prebuild.xml34
122 files changed, 1854 insertions, 661 deletions
diff --git a/OpenSim/ApplicationPlugins/LoadRegions/Properties/AssemblyInfo.cs b/OpenSim/ApplicationPlugins/LoadRegions/Properties/AssemblyInfo.cs
index 57615ea..b81c1e5 100644
--- a/OpenSim/ApplicationPlugins/LoadRegions/Properties/AssemblyInfo.cs
+++ b/OpenSim/ApplicationPlugins/LoadRegions/Properties/AssemblyInfo.cs
@@ -60,7 +60,7 @@ using System.Runtime.InteropServices;
60// 60//
61// You can specify all the values or you can default the Build and Revision Numbers 61// You can specify all the values or you can default the Build and Revision Numbers
62// by using the '*' as shown below: 62// by using the '*' as shown below:
63// [assembly: AssemblyVersion("0.7.5.*")] 63// [assembly: AssemblyVersion("0.7.6.*")]
64 64
65[assembly : AssemblyVersion("0.7.5.*")] 65[assembly : AssemblyVersion("0.7.6.*")]
66[assembly : AssemblyFileVersion("0.6.5.0")] \ No newline at end of file 66[assembly : AssemblyFileVersion("0.6.5.0")] \ No newline at end of file
diff --git a/OpenSim/ApplicationPlugins/RegionModulesController/Properties/AssemblyInfo.cs b/OpenSim/ApplicationPlugins/RegionModulesController/Properties/AssemblyInfo.cs
index 14527d9..be6054d 100644
--- a/OpenSim/ApplicationPlugins/RegionModulesController/Properties/AssemblyInfo.cs
+++ b/OpenSim/ApplicationPlugins/RegionModulesController/Properties/AssemblyInfo.cs
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
29// Build Number 29// Build Number
30// Revision 30// Revision
31// 31//
32[assembly: AssemblyVersion("0.7.5.*")] 32[assembly: AssemblyVersion("0.7.6.*")]
33[assembly: AssemblyFileVersion("1.0.0.0")] 33[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/OpenSim/ApplicationPlugins/RemoteController/Properties/AssemblyInfo.cs b/OpenSim/ApplicationPlugins/RemoteController/Properties/AssemblyInfo.cs
index 8ad948c..3ec7a13 100644
--- a/OpenSim/ApplicationPlugins/RemoteController/Properties/AssemblyInfo.cs
+++ b/OpenSim/ApplicationPlugins/RemoteController/Properties/AssemblyInfo.cs
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
29// Build Number 29// Build Number
30// Revision 30// Revision
31// 31//
32[assembly: AssemblyVersion("0.7.5.*")] 32[assembly: AssemblyVersion("0.7.6.*")]
33[assembly: AssemblyFileVersion("1.0.0.0")] 33[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/OpenSim/Capabilities/Handlers/Properties/AssemblyInfo.cs b/OpenSim/Capabilities/Handlers/Properties/AssemblyInfo.cs
index a681fb6..4ff5fe1 100644
--- a/OpenSim/Capabilities/Handlers/Properties/AssemblyInfo.cs
+++ b/OpenSim/Capabilities/Handlers/Properties/AssemblyInfo.cs
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
29// Build Number 29// Build Number
30// Revision 30// Revision
31// 31//
32[assembly: AssemblyVersion("0.7.5.*")] 32[assembly: AssemblyVersion("0.7.6.*")]
33[assembly: AssemblyFileVersion("1.0.0.0")] 33[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/OpenSim/Capabilities/Properties/AssemblyInfo.cs b/OpenSim/Capabilities/Properties/AssemblyInfo.cs
index 26254f2..f8a9dae 100644
--- a/OpenSim/Capabilities/Properties/AssemblyInfo.cs
+++ b/OpenSim/Capabilities/Properties/AssemblyInfo.cs
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
29// Build Number 29// Build Number
30// Revision 30// Revision
31// 31//
32[assembly: AssemblyVersion("0.7.5.*")] 32[assembly: AssemblyVersion("0.7.6.*")]
33[assembly: AssemblyFileVersion("1.0.0.0")] 33[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/OpenSim/ConsoleClient/Properties/AssemblyInfo.cs b/OpenSim/ConsoleClient/Properties/AssemblyInfo.cs
index c240f90..9c0c784 100644
--- a/OpenSim/ConsoleClient/Properties/AssemblyInfo.cs
+++ b/OpenSim/ConsoleClient/Properties/AssemblyInfo.cs
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
29// Build Number 29// Build Number
30// Revision 30// Revision
31// 31//
32[assembly: AssemblyVersion("0.7.5.*")] 32[assembly: AssemblyVersion("0.7.6.*")]
33[assembly: AssemblyFileVersion("1.0.0.0")] 33[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/OpenSim/Data/MSSQL/Properties/AssemblyInfo.cs b/OpenSim/Data/MSSQL/Properties/AssemblyInfo.cs
index 1a67e70..4e96be8 100644
--- a/OpenSim/Data/MSSQL/Properties/AssemblyInfo.cs
+++ b/OpenSim/Data/MSSQL/Properties/AssemblyInfo.cs
@@ -61,5 +61,5 @@ using System.Runtime.InteropServices;
61// You can specify all the values or you can default the Revision and Build Numbers 61// You can specify all the values or you can default the Revision and Build Numbers
62// by using the '*' as shown below: 62// by using the '*' as shown below:
63 63
64[assembly : AssemblyVersion("0.7.5.*")] 64[assembly : AssemblyVersion("0.7.6.*")]
65[assembly : AssemblyFileVersion("0.6.5.0")] 65[assembly : AssemblyFileVersion("0.6.5.0")]
diff --git a/OpenSim/Data/MySQL/Properties/AssemblyInfo.cs b/OpenSim/Data/MySQL/Properties/AssemblyInfo.cs
index ab3fe36..7bfa28d 100644
--- a/OpenSim/Data/MySQL/Properties/AssemblyInfo.cs
+++ b/OpenSim/Data/MySQL/Properties/AssemblyInfo.cs
@@ -61,5 +61,5 @@ using System.Runtime.InteropServices;
61// You can specify all the values or you can default the Revision and Build Numbers 61// You can specify all the values or you can default the Revision and Build Numbers
62// by using the '*' as shown below: 62// by using the '*' as shown below:
63 63
64[assembly : AssemblyVersion("0.7.5.*")] 64[assembly : AssemblyVersion("0.7.6.*")]
65[assembly : AssemblyFileVersion("0.6.5.0")] 65[assembly : AssemblyFileVersion("0.6.5.0")]
diff --git a/OpenSim/Data/Null/Properties/AssemblyInfo.cs b/OpenSim/Data/Null/Properties/AssemblyInfo.cs
index 43b0bb3..3931b3d 100644
--- a/OpenSim/Data/Null/Properties/AssemblyInfo.cs
+++ b/OpenSim/Data/Null/Properties/AssemblyInfo.cs
@@ -61,5 +61,5 @@ using System.Runtime.InteropServices;
61// You can specify all the values or you can default the Revision and Build Numbers 61// You can specify all the values or you can default the Revision and Build Numbers
62// by using the '*' as shown below: 62// by using the '*' as shown below:
63 63
64[assembly : AssemblyVersion("0.7.5.*")] 64[assembly : AssemblyVersion("0.7.6.*")]
65[assembly : AssemblyFileVersion("0.6.5.0")] 65[assembly : AssemblyFileVersion("0.6.5.0")]
diff --git a/OpenSim/Data/Properties/AssemblyInfo.cs b/OpenSim/Data/Properties/AssemblyInfo.cs
index 0da1a6b..9f342ad 100644
--- a/OpenSim/Data/Properties/AssemblyInfo.cs
+++ b/OpenSim/Data/Properties/AssemblyInfo.cs
@@ -61,5 +61,5 @@ using System.Runtime.InteropServices;
61// You can specify all the values or you can default the Revision and Build Numbers 61// You can specify all the values or you can default the Revision and Build Numbers
62// by using the '*' as shown below: 62// by using the '*' as shown below:
63 63
64[assembly : AssemblyVersion("0.7.5.*")] 64[assembly : AssemblyVersion("0.7.6.*")]
65[assembly : AssemblyFileVersion("0.6.5.0")] 65[assembly : AssemblyFileVersion("0.6.5.0")]
diff --git a/OpenSim/Data/SQLite/Properties/AssemblyInfo.cs b/OpenSim/Data/SQLite/Properties/AssemblyInfo.cs
index c9a8553..ba52f82 100644
--- a/OpenSim/Data/SQLite/Properties/AssemblyInfo.cs
+++ b/OpenSim/Data/SQLite/Properties/AssemblyInfo.cs
@@ -61,5 +61,5 @@ using System.Runtime.InteropServices;
61// You can specify all the values or you can default the Revision and Build Numbers 61// You can specify all the values or you can default the Revision and Build Numbers
62// by using the '*' as shown below: 62// by using the '*' as shown below:
63 63
64[assembly : AssemblyVersion("0.7.5.*")] 64[assembly : AssemblyVersion("0.7.6.*")]
65[assembly : AssemblyFileVersion("0.6.5.0")] 65[assembly : AssemblyFileVersion("0.6.5.0")]
diff --git a/OpenSim/Framework/AssemblyInfo.cs b/OpenSim/Framework/AssemblyInfo.cs
index 02986d5..b3db56c 100644
--- a/OpenSim/Framework/AssemblyInfo.cs
+++ b/OpenSim/Framework/AssemblyInfo.cs
@@ -59,5 +59,5 @@ using System.Runtime.InteropServices;
59// Revision 59// Revision
60// 60//
61 61
62[assembly : AssemblyVersion("0.7.5.*")] 62[assembly : AssemblyVersion("0.7.6.*")]
63[assembly : AssemblyFileVersion("0.6.5.0")] \ No newline at end of file 63[assembly : AssemblyFileVersion("0.6.5.0")] \ No newline at end of file
diff --git a/OpenSim/Framework/AssetLoader/Filesystem/Properties/AssemblyInfo.cs b/OpenSim/Framework/AssetLoader/Filesystem/Properties/AssemblyInfo.cs
index 0498ed4..077244d 100644
--- a/OpenSim/Framework/AssetLoader/Filesystem/Properties/AssemblyInfo.cs
+++ b/OpenSim/Framework/AssetLoader/Filesystem/Properties/AssemblyInfo.cs
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
29// Build Number 29// Build Number
30// Revision 30// Revision
31// 31//
32[assembly: AssemblyVersion("0.7.5.*")] 32[assembly: AssemblyVersion("0.7.6.*")]
33[assembly: AssemblyFileVersion("1.0.0.0")] 33[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/OpenSim/Framework/Communications/Properties/AssemblyInfo.cs b/OpenSim/Framework/Communications/Properties/AssemblyInfo.cs
index 6d1c03a..cf575ac 100644
--- a/OpenSim/Framework/Communications/Properties/AssemblyInfo.cs
+++ b/OpenSim/Framework/Communications/Properties/AssemblyInfo.cs
@@ -61,5 +61,5 @@ using System.Runtime.InteropServices;
61// You can specify all the values or you can default the Revision and Build Numbers 61// You can specify all the values or you can default the Revision and Build Numbers
62// by using the '*' as shown below: 62// by using the '*' as shown below:
63 63
64[assembly : AssemblyVersion("0.7.5.*")] 64[assembly : AssemblyVersion("0.7.6.*")]
65[assembly : AssemblyFileVersion("0.6.5.0")] 65[assembly : AssemblyFileVersion("0.6.5.0")]
diff --git a/OpenSim/Framework/Configuration/HTTP/Properties/AssemblyInfo.cs b/OpenSim/Framework/Configuration/HTTP/Properties/AssemblyInfo.cs
index 0674656..c3b6227 100644
--- a/OpenSim/Framework/Configuration/HTTP/Properties/AssemblyInfo.cs
+++ b/OpenSim/Framework/Configuration/HTTP/Properties/AssemblyInfo.cs
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
29// Build Number 29// Build Number
30// Revision 30// Revision
31// 31//
32[assembly: AssemblyVersion("0.7.5.*")] 32[assembly: AssemblyVersion("0.7.6.*")]
33[assembly: AssemblyFileVersion("1.0.0.0")] 33[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/OpenSim/Framework/Configuration/XML/Properties/AssemblyInfo.cs b/OpenSim/Framework/Configuration/XML/Properties/AssemblyInfo.cs
index 1095b23..b0d2d67 100644
--- a/OpenSim/Framework/Configuration/XML/Properties/AssemblyInfo.cs
+++ b/OpenSim/Framework/Configuration/XML/Properties/AssemblyInfo.cs
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
29// Build Number 29// Build Number
30// Revision 30// Revision
31// 31//
32[assembly: AssemblyVersion("0.7.5.*")] 32[assembly: AssemblyVersion("0.7.6.*")]
33[assembly: AssemblyFileVersion("1.0.0.0")] 33[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/OpenSim/Framework/Console/AssemblyInfo.cs b/OpenSim/Framework/Console/AssemblyInfo.cs
index 37c7304..c618454 100644
--- a/OpenSim/Framework/Console/AssemblyInfo.cs
+++ b/OpenSim/Framework/Console/AssemblyInfo.cs
@@ -55,4 +55,4 @@ using System.Runtime.InteropServices;
55// You can specify all values by your own or you can build default build and revision 55// You can specify all values by your own or you can build default build and revision
56// numbers with the '*' character (the default): 56// numbers with the '*' character (the default):
57 57
58[assembly : AssemblyVersion("0.7.5.*")] 58[assembly : AssemblyVersion("0.7.6.*")]
diff --git a/OpenSim/Framework/Monitoring/Properties/AssemblyInfo.cs b/OpenSim/Framework/Monitoring/Properties/AssemblyInfo.cs
index 1f2bb40..bb83db1 100644
--- a/OpenSim/Framework/Monitoring/Properties/AssemblyInfo.cs
+++ b/OpenSim/Framework/Monitoring/Properties/AssemblyInfo.cs
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
29// Build Number 29// Build Number
30// Revision 30// Revision
31// 31//
32[assembly: AssemblyVersion("0.7.5.*")] 32[assembly: AssemblyVersion("0.7.6.*")]
33[assembly: AssemblyFileVersion("1.0.0.0")] 33[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs
index 016f2a6..24b9c89 100644
--- a/OpenSim/Framework/RegionInfo.cs
+++ b/OpenSim/Framework/RegionInfo.cs
@@ -143,6 +143,7 @@ namespace OpenSim.Framework
143 public UUID RegionID = UUID.Zero; 143 public UUID RegionID = UUID.Zero;
144 public string RemotingAddress; 144 public string RemotingAddress;
145 public UUID ScopeID = UUID.Zero; 145 public UUID ScopeID = UUID.Zero;
146 private UUID m_maptileStaticUUID = UUID.Zero;
146 147
147 private Dictionary<String, String> m_otherSettings = new Dictionary<string, string>(); 148 private Dictionary<String, String> m_otherSettings = new Dictionary<string, string>();
148 149
@@ -338,6 +339,11 @@ namespace OpenSim.Framework
338 get { return m_regionType; } 339 get { return m_regionType; }
339 } 340 }
340 341
342 public UUID MaptileStaticUUID
343 {
344 get { return m_maptileStaticUUID; }
345 }
346
341 /// <summary> 347 /// <summary>
342 /// The port by which http communication occurs with the region (most noticeably, CAPS communication) 348 /// The port by which http communication occurs with the region (most noticeably, CAPS communication)
343 /// </summary> 349 /// </summary>
@@ -641,7 +647,7 @@ namespace OpenSim.Framework
641 m_regionType = config.GetString("RegionType", String.Empty); 647 m_regionType = config.GetString("RegionType", String.Empty);
642 allKeys.Remove("RegionType"); 648 allKeys.Remove("RegionType");
643 649
644 #region Prim stuff 650 #region Prim and map stuff
645 651
646 m_nonphysPrimMin = config.GetFloat("NonPhysicalPrimMin", 0); 652 m_nonphysPrimMin = config.GetFloat("NonPhysicalPrimMin", 0);
647 allKeys.Remove("NonPhysicalPrimMin"); 653 allKeys.Remove("NonPhysicalPrimMin");
@@ -663,6 +669,13 @@ namespace OpenSim.Framework
663 669
664 m_linksetCapacity = config.GetInt("LinksetPrims", 0); 670 m_linksetCapacity = config.GetInt("LinksetPrims", 0);
665 allKeys.Remove("LinksetPrims"); 671 allKeys.Remove("LinksetPrims");
672
673 allKeys.Remove("MaptileStaticUUID");
674 string mapTileStaticUUID = config.GetString("MaptileStaticUUID", UUID.Zero.ToString());
675 if (UUID.TryParse(mapTileStaticUUID.Trim(), out m_maptileStaticUUID))
676 {
677 config.Set("MaptileStaticUUID", m_maptileStaticUUID.ToString());
678 }
666 679
667 #endregion 680 #endregion
668 681
@@ -729,6 +742,9 @@ namespace OpenSim.Framework
729 742
730 if (RegionType != String.Empty) 743 if (RegionType != String.Empty)
731 config.Set("RegionType", RegionType); 744 config.Set("RegionType", RegionType);
745
746 if (m_maptileStaticUUID != UUID.Zero)
747 config.Set("MaptileStaticUUID", m_maptileStaticUUID.ToString());
732 } 748 }
733 749
734 public bool ignoreIncomingConfiguration(string configuration_key, object configuration_result) 750 public bool ignoreIncomingConfiguration(string configuration_key, object configuration_result)
@@ -827,6 +843,9 @@ namespace OpenSim.Framework
827 843
828 configMember.addConfigurationOption("region_type", ConfigurationOption.ConfigurationTypes.TYPE_STRING, 844 configMember.addConfigurationOption("region_type", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
829 "Free form string describing the type of region", String.Empty, true); 845 "Free form string describing the type of region", String.Empty, true);
846
847 configMember.addConfigurationOption("region_static_maptile", ConfigurationOption.ConfigurationTypes.TYPE_UUID,
848 "UUID of a texture to use as the map for this region", m_maptileStaticUUID.ToString(), true);
830 } 849 }
831 850
832 public void loadConfigurationOptions() 851 public void loadConfigurationOptions()
@@ -880,6 +899,9 @@ namespace OpenSim.Framework
880 899
881 configMember.addConfigurationOption("region_type", ConfigurationOption.ConfigurationTypes.TYPE_STRING, 900 configMember.addConfigurationOption("region_type", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
882 "Region Type", String.Empty, true); 901 "Region Type", String.Empty, true);
902
903 configMember.addConfigurationOption("region_static_maptile", ConfigurationOption.ConfigurationTypes.TYPE_UUID,
904 "UUID of a texture to use as the map for this region", String.Empty, true);
883 } 905 }
884 906
885 public bool handleIncomingConfiguration(string configuration_key, object configuration_result) 907 public bool handleIncomingConfiguration(string configuration_key, object configuration_result)
@@ -949,6 +971,9 @@ namespace OpenSim.Framework
949 case "region_type": 971 case "region_type":
950 m_regionType = (string)configuration_result; 972 m_regionType = (string)configuration_result;
951 break; 973 break;
974 case "region_static_maptile":
975 m_maptileStaticUUID = (UUID)configuration_result;
976 break;
952 } 977 }
953 978
954 return true; 979 return true;
diff --git a/OpenSim/Framework/RegionLoader/Filesystem/Properties/AssemblyInfo.cs b/OpenSim/Framework/RegionLoader/Filesystem/Properties/AssemblyInfo.cs
index d670f2f..f836350 100644
--- a/OpenSim/Framework/RegionLoader/Filesystem/Properties/AssemblyInfo.cs
+++ b/OpenSim/Framework/RegionLoader/Filesystem/Properties/AssemblyInfo.cs
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
29// Build Number 29// Build Number
30// Revision 30// Revision
31// 31//
32[assembly: AssemblyVersion("0.7.5.*")] 32[assembly: AssemblyVersion("0.7.6.*")]
33[assembly: AssemblyFileVersion("1.0.0.0")] 33[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/OpenSim/Framework/RegionLoader/Web/Properties/AssemblyInfo.cs b/OpenSim/Framework/RegionLoader/Web/Properties/AssemblyInfo.cs
index 7309a12..72fa679 100644
--- a/OpenSim/Framework/RegionLoader/Web/Properties/AssemblyInfo.cs
+++ b/OpenSim/Framework/RegionLoader/Web/Properties/AssemblyInfo.cs
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
29// Build Number 29// Build Number
30// Revision 30// Revision
31// 31//
32[assembly: AssemblyVersion("0.7.5.*")] 32[assembly: AssemblyVersion("0.7.6.*")]
33[assembly: AssemblyFileVersion("1.0.0.0")] 33[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/OpenSim/Framework/Serialization/Properties/AssemblyInfo.cs b/OpenSim/Framework/Serialization/Properties/AssemblyInfo.cs
index 11efa4b..7a122da 100644
--- a/OpenSim/Framework/Serialization/Properties/AssemblyInfo.cs
+++ b/OpenSim/Framework/Serialization/Properties/AssemblyInfo.cs
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
29// Build Number 29// Build Number
30// Revision 30// Revision
31// 31//
32[assembly: AssemblyVersion("0.7.5.*")] 32[assembly: AssemblyVersion("0.7.6.*")]
33[assembly: AssemblyFileVersion("1.0.0.0")] 33[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/OpenSim/Framework/Servers/HttpServer/Properties/AssemblyInfo.cs b/OpenSim/Framework/Servers/HttpServer/Properties/AssemblyInfo.cs
index 02ecc25..386be2d 100644
--- a/OpenSim/Framework/Servers/HttpServer/Properties/AssemblyInfo.cs
+++ b/OpenSim/Framework/Servers/HttpServer/Properties/AssemblyInfo.cs
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
29// Build Number 29// Build Number
30// Revision 30// Revision
31// 31//
32[assembly: AssemblyVersion("0.7.5.*")] 32[assembly: AssemblyVersion("0.7.6.*")]
33[assembly: AssemblyFileVersion("1.0.0.0")] 33[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/OpenSim/Framework/Servers/Properties/AssemblyInfo.cs b/OpenSim/Framework/Servers/Properties/AssemblyInfo.cs
index 021f63c..792c62e 100644
--- a/OpenSim/Framework/Servers/Properties/AssemblyInfo.cs
+++ b/OpenSim/Framework/Servers/Properties/AssemblyInfo.cs
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
29// Build Number 29// Build Number
30// Revision 30// Revision
31// 31//
32[assembly: AssemblyVersion("0.7.5.*")] 32[assembly: AssemblyVersion("0.7.6.*")]
33[assembly: AssemblyFileVersion("1.0.0.0")] 33[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/OpenSim/Framework/Servers/VersionInfo.cs b/OpenSim/Framework/Servers/VersionInfo.cs
index c9d9770..80568e0 100644
--- a/OpenSim/Framework/Servers/VersionInfo.cs
+++ b/OpenSim/Framework/Servers/VersionInfo.cs
@@ -29,7 +29,7 @@ namespace OpenSim
29{ 29{
30 public class VersionInfo 30 public class VersionInfo
31 { 31 {
32 private const string VERSION_NUMBER = "0.7.5"; 32 private const string VERSION_NUMBER = "0.7.6";
33 private const Flavour VERSION_FLAVOUR = Flavour.Dev; 33 private const Flavour VERSION_FLAVOUR = Flavour.Dev;
34 34
35 public enum Flavour 35 public enum Flavour
diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs
index c3c87e7..f5c06df 100644
--- a/OpenSim/Region/Application/OpenSimBase.cs
+++ b/OpenSim/Region/Application/OpenSimBase.cs
@@ -316,7 +316,7 @@ namespace OpenSim
316 /// <param name="regionInfo"></param> 316 /// <param name="regionInfo"></param>
317 /// <param name="portadd_flag"></param> 317 /// <param name="portadd_flag"></param>
318 /// <returns></returns> 318 /// <returns></returns>
319 public IClientNetworkServer CreateRegion(RegionInfo regionInfo, bool portadd_flag, out IScene scene) 319 public List<IClientNetworkServer> CreateRegion(RegionInfo regionInfo, bool portadd_flag, out IScene scene)
320 { 320 {
321 return CreateRegion(regionInfo, portadd_flag, false, out scene); 321 return CreateRegion(regionInfo, portadd_flag, false, out scene);
322 } 322 }
@@ -326,7 +326,7 @@ namespace OpenSim
326 /// </summary> 326 /// </summary>
327 /// <param name="regionInfo"></param> 327 /// <param name="regionInfo"></param>
328 /// <returns></returns> 328 /// <returns></returns>
329 public IClientNetworkServer CreateRegion(RegionInfo regionInfo, out IScene scene) 329 public List<IClientNetworkServer> CreateRegion(RegionInfo regionInfo, out IScene scene)
330 { 330 {
331 return CreateRegion(regionInfo, false, true, out scene); 331 return CreateRegion(regionInfo, false, true, out scene);
332 } 332 }
@@ -338,7 +338,7 @@ namespace OpenSim
338 /// <param name="portadd_flag"></param> 338 /// <param name="portadd_flag"></param>
339 /// <param name="do_post_init"></param> 339 /// <param name="do_post_init"></param>
340 /// <returns></returns> 340 /// <returns></returns>
341 public IClientNetworkServer CreateRegion(RegionInfo regionInfo, bool portadd_flag, bool do_post_init, out IScene mscene) 341 public List<IClientNetworkServer> CreateRegion(RegionInfo regionInfo, bool portadd_flag, bool do_post_init, out IScene mscene)
342 { 342 {
343 int port = regionInfo.InternalEndPoint.Port; 343 int port = regionInfo.InternalEndPoint.Port;
344 344
@@ -363,8 +363,8 @@ namespace OpenSim
363 Util.XmlRpcCommand(proxyUrl, "AddPort", port, port + proxyOffset, regionInfo.ExternalHostName); 363 Util.XmlRpcCommand(proxyUrl, "AddPort", port, port + proxyOffset, regionInfo.ExternalHostName);
364 } 364 }
365 365
366 IClientNetworkServer clientServer; 366 List<IClientNetworkServer> clientServers;
367 Scene scene = SetupScene(regionInfo, proxyOffset, Config, out clientServer); 367 Scene scene = SetupScene(regionInfo, proxyOffset, Config, out clientServers);
368 368
369 m_log.Info("[MODULES]: Loading Region's modules (old style)"); 369 m_log.Info("[MODULES]: Loading Region's modules (old style)");
370 370
@@ -414,8 +414,11 @@ namespace OpenSim
414 414
415 if (m_autoCreateClientStack) 415 if (m_autoCreateClientStack)
416 { 416 {
417 m_clientServers.Add(clientServer); 417 foreach (IClientNetworkServer clientserver in clientServers)
418 clientServer.Start(); 418 {
419 m_clientServers.Add(clientserver);
420 clientserver.Start();
421 }
419 } 422 }
420 423
421 scene.EventManager.OnShutdown += delegate() { ShutdownRegion(scene); }; 424 scene.EventManager.OnShutdown += delegate() { ShutdownRegion(scene); };
@@ -425,7 +428,7 @@ namespace OpenSim
425 scene.Start(); 428 scene.Start();
426 scene.StartScripts(); 429 scene.StartScripts();
427 430
428 return clientServer; 431 return clientServers;
429 } 432 }
430 433
431 /// <summary> 434 /// <summary>
@@ -641,7 +644,7 @@ namespace OpenSim
641 /// <param name="regionInfo"></param> 644 /// <param name="regionInfo"></param>
642 /// <param name="clientServer"> </param> 645 /// <param name="clientServer"> </param>
643 /// <returns></returns> 646 /// <returns></returns>
644 protected Scene SetupScene(RegionInfo regionInfo, out IClientNetworkServer clientServer) 647 protected Scene SetupScene(RegionInfo regionInfo, out List<IClientNetworkServer> clientServer)
645 { 648 {
646 return SetupScene(regionInfo, 0, null, out clientServer); 649 return SetupScene(regionInfo, 0, null, out clientServer);
647 } 650 }
@@ -655,19 +658,20 @@ namespace OpenSim
655 /// <param name="clientServer"> </param> 658 /// <param name="clientServer"> </param>
656 /// <returns></returns> 659 /// <returns></returns>
657 protected Scene SetupScene( 660 protected Scene SetupScene(
658 RegionInfo regionInfo, int proxyOffset, IConfigSource configSource, out IClientNetworkServer clientServer) 661 RegionInfo regionInfo, int proxyOffset, IConfigSource configSource, out List<IClientNetworkServer> clientServer)
659 { 662 {
663 List<IClientNetworkServer> clientNetworkServers = null;
664
660 AgentCircuitManager circuitManager = new AgentCircuitManager(); 665 AgentCircuitManager circuitManager = new AgentCircuitManager();
661 IPAddress listenIP = regionInfo.InternalEndPoint.Address; 666 IPAddress listenIP = regionInfo.InternalEndPoint.Address;
662 //if (!IPAddress.TryParse(regionInfo.InternalEndPoint, out listenIP)) 667 //if (!IPAddress.TryParse(regionInfo.InternalEndPoint, out listenIP))
663 // listenIP = IPAddress.Parse("0.0.0.0"); 668 // listenIP = IPAddress.Parse("0.0.0.0");
664 669
665 uint port = (uint) regionInfo.InternalEndPoint.Port; 670 uint port = (uint) regionInfo.InternalEndPoint.Port;
666 671 IClientNetworkServer clientNetworkServer;
667 if (m_autoCreateClientStack) 672 if (m_autoCreateClientStack)
668 { 673 {
669 clientServer 674 clientNetworkServers = m_clientStackManager.CreateServers(
670 = m_clientStackManager.CreateServer(
671 listenIP, ref port, proxyOffset, regionInfo.m_allow_alternate_ports, configSource, 675 listenIP, ref port, proxyOffset, regionInfo.m_allow_alternate_ports, configSource,
672 circuitManager); 676 circuitManager);
673 } 677 }
@@ -682,9 +686,12 @@ namespace OpenSim
682 686
683 if (m_autoCreateClientStack) 687 if (m_autoCreateClientStack)
684 { 688 {
685 clientServer.AddScene(scene); 689 foreach (IClientNetworkServer clientnetserver in clientNetworkServers)
690 {
691 clientnetserver.AddScene(scene);
692 }
686 } 693 }
687 694 clientServer = clientNetworkServers;
688 scene.LoadWorldMap(); 695 scene.LoadWorldMap();
689 696
690 scene.PhysicsScene = GetPhysicsScene(scene.RegionInfo.RegionName); 697 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
28using System; 28using System;
29using System.Collections.Generic;
29using System.Net; 30using System.Net;
30using System.Reflection; 31using System.Reflection;
31using log4net; 32using 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/ClientStack/Linden/Caps/Properties/AssemblyInfo.cs b/OpenSim/Region/ClientStack/Linden/Caps/Properties/AssemblyInfo.cs
index 060a61c..d29a001 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/Properties/AssemblyInfo.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/Properties/AssemblyInfo.cs
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
29// Build Number 29// Build Number
30// Revision 30// Revision
31// 31//
32[assembly: AssemblyVersion("0.7.5.*")] 32[assembly: AssemblyVersion("0.7.6.*")]
33[assembly: AssemblyFileVersion("1.0.0.0")] 33[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
index 0ccd69a..88b64f5 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
@@ -4893,7 +4893,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4893 // may improve movement smoothness. 4893 // may improve movement smoothness.
4894// acceleration = new Vector3(1, 0, 0); 4894// acceleration = new Vector3(1, 0, 0);
4895 4895
4896 angularVelocity = Vector3.Zero; 4896 angularVelocity = presence.AngularVelocity;
4897 rotation = presence.Rotation; 4897 rotation = presence.Rotation;
4898 4898
4899 if (sendTexture) 4899 if (sendTexture)
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/Properties/AssemblyInfo.cs b/OpenSim/Region/ClientStack/Linden/UDP/Properties/AssemblyInfo.cs
index af2f6f8..8f9dad3 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/Properties/AssemblyInfo.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/Properties/AssemblyInfo.cs
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
29// Build Number 29// Build Number
30// Revision 30// Revision
31// 31//
32[assembly: AssemblyVersion("0.7.5.*")] 32[assembly: AssemblyVersion("0.7.6.*")]
33[assembly: AssemblyFileVersion("1.0.0.0")] 33[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/OpenSim/Region/ClientStack/Properties/AssemblyInfo.cs b/OpenSim/Region/ClientStack/Properties/AssemblyInfo.cs
index e72bd86..0b6ee2f 100644
--- a/OpenSim/Region/ClientStack/Properties/AssemblyInfo.cs
+++ b/OpenSim/Region/ClientStack/Properties/AssemblyInfo.cs
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
29// Build Number 29// Build Number
30// Revision 30// Revision
31// 31//
32[assembly: AssemblyVersion("0.7.5.*")] 32[assembly: AssemblyVersion("0.7.6.*")]
33[assembly: AssemblyFileVersion("1.0.0.0")] 33[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetTransactionModule.cs b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetTransactionModule.cs
index e973652..d1ad74f 100644
--- a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetTransactionModule.cs
+++ b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetTransactionModule.cs
@@ -214,9 +214,9 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
214 public void HandleTaskItemUpdateFromTransaction( 214 public void HandleTaskItemUpdateFromTransaction(
215 IClientAPI remoteClient, SceneObjectPart part, UUID transactionID, TaskInventoryItem item) 215 IClientAPI remoteClient, SceneObjectPart part, UUID transactionID, TaskInventoryItem item)
216 { 216 {
217 m_log.DebugFormat( 217// m_log.DebugFormat(
218 "[ASSET TRANSACTION MODULE] Called HandleTaskItemUpdateFromTransaction with item {0} in {1} for {2} in {3}", 218// "[ASSET TRANSACTION MODULE]: Called HandleTaskItemUpdateFromTransaction with item {0} in {1} for {2} in {3}",
219 item.Name, part.Name, remoteClient.Name, m_Scene.RegionInfo.RegionName); 219// item.Name, part.Name, remoteClient.Name, m_Scene.RegionInfo.RegionName);
220 220
221 AgentAssetTransactions transactions = 221 AgentAssetTransactions transactions =
222 GetUserTransactions(remoteClient.AgentId); 222 GetUserTransactions(remoteClient.AgentId);
@@ -230,15 +230,17 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
230 /// </summary> 230 /// </summary>
231 /// <param name="remoteClient"></param> 231 /// <param name="remoteClient"></param>
232 /// <param name="assetID"></param> 232 /// <param name="assetID"></param>
233 /// <param name="transaction"></param> 233 /// <param name="transactionID"></param>
234 /// <param name="type"></param> 234 /// <param name="type"></param>
235 /// <param name="data"></param></param> 235 /// <param name="data"></param></param>
236 /// <param name="tempFile"></param> 236 /// <param name="tempFile"></param>
237 public void HandleUDPUploadRequest(IClientAPI remoteClient, 237 public void HandleUDPUploadRequest(IClientAPI remoteClient,
238 UUID assetID, UUID transaction, sbyte type, byte[] data, 238 UUID assetID, UUID transactionID, sbyte type, byte[] data,
239 bool storeLocal, bool tempFile) 239 bool storeLocal, bool tempFile)
240 { 240 {
241// m_log.Debug("HandleUDPUploadRequest - assetID: " + assetID.ToString() + " transaction: " + transaction.ToString() + " type: " + type.ToString() + " storelocal: " + storeLocal + " tempFile: " + tempFile); 241// m_log.DebugFormat(
242// "[ASSET TRANSACTION MODULE]: HandleUDPUploadRequest - assetID: {0}, transaction {1}, type {2}, storeLocal {3}, tempFile {4}, data.Length {5}",
243// assetID, transactionID, type, storeLocal, tempFile, data.Length);
242 244
243 if (((AssetType)type == AssetType.Texture || 245 if (((AssetType)type == AssetType.Texture ||
244 (AssetType)type == AssetType.Sound || 246 (AssetType)type == AssetType.Sound ||
@@ -274,8 +276,8 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
274 } 276 }
275 277
276 AgentAssetTransactions transactions = GetUserTransactions(remoteClient.AgentId); 278 AgentAssetTransactions transactions = GetUserTransactions(remoteClient.AgentId);
277 AssetXferUploader uploader = transactions.RequestXferUploader(transaction); 279 AssetXferUploader uploader = transactions.RequestXferUploader(transactionID);
278 uploader.StartUpload(remoteClient, assetID, transaction, type, data, storeLocal, tempFile); 280 uploader.StartUpload(remoteClient, assetID, transactionID, type, data, storeLocal, tempFile);
279 } 281 }
280 282
281 /// <summary> 283 /// <summary>
diff --git a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs
index 8add4bb..11efe6d 100644
--- a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs
+++ b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs
@@ -321,7 +321,8 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
321 // to avoid a race condition when the appearance module retrieves the item to set the asset id in 321 // to avoid a race condition when the appearance module retrieves the item to set the asset id in
322 // the AvatarAppearance structure. 322 // the AvatarAppearance structure.
323 item.AssetID = m_asset.FullID; 323 item.AssetID = m_asset.FullID;
324 m_Scene.InventoryService.UpdateItem(item); 324 if (item.AssetID != UUID.Zero)
325 m_Scene.InventoryService.UpdateItem(item);
325 326
326 if (m_uploadState == UploadState.Complete) 327 if (m_uploadState == UploadState.Complete)
327 { 328 {
diff --git a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs
index 8e800cb..00af175 100644
--- a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs
+++ b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs
@@ -707,32 +707,43 @@ namespace OpenSim.Region.CoreModules.Asset
707 { 707 {
708 UuidGatherer gatherer = new UuidGatherer(m_AssetService); 708 UuidGatherer gatherer = new UuidGatherer(m_AssetService);
709 709
710 HashSet<UUID> uniqueUuids = new HashSet<UUID>();
710 Dictionary<UUID, AssetType> assets = new Dictionary<UUID, AssetType>(); 711 Dictionary<UUID, AssetType> assets = new Dictionary<UUID, AssetType>();
712
711 foreach (Scene s in m_Scenes) 713 foreach (Scene s in m_Scenes)
712 { 714 {
713 StampRegionStatusFile(s.RegionInfo.RegionID); 715 StampRegionStatusFile(s.RegionInfo.RegionID);
714 716
715 s.ForEachSOG(delegate(SceneObjectGroup e) 717 s.ForEachSOG(delegate(SceneObjectGroup e)
716 { 718 {
717 gatherer.GatherAssetUuids(e, assets); 719 gatherer.GatherAssetUuids(e, assets);
718 });
719 }
720 720
721 foreach (UUID assetID in assets.Keys) 721 foreach (UUID assetID in assets.Keys)
722 { 722 {
723 string filename = GetFileName(assetID.ToString()); 723 uniqueUuids.Add(assetID);
724 724
725 if (File.Exists(filename)) 725 string filename = GetFileName(assetID.ToString());
726 { 726
727 File.SetLastAccessTime(filename, DateTime.Now); 727 if (File.Exists(filename))
728 } 728 {
729 else if (storeUncached) 729 File.SetLastAccessTime(filename, DateTime.Now);
730 { 730 }
731 m_AssetService.Get(assetID.ToString()); 731 else if (storeUncached)
732 } 732 {
733 AssetBase cachedAsset = m_AssetService.Get(assetID.ToString());
734 if (cachedAsset == null && assets[assetID] != AssetType.Unknown)
735 m_log.DebugFormat(
736 "[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",
737 assetID, assets[assetID], e.Name, e.AbsolutePosition, s.Name);
738 }
739 }
740
741 assets.Clear();
742 });
733 } 743 }
734 744
735 return assets.Keys.Count; 745
746 return uniqueUuids.Count;
736 } 747 }
737 748
738 /// <summary> 749 /// <summary>
diff --git a/OpenSim/Region/CoreModules/Framework/InterfaceCommander/Command.cs b/OpenSim/Region/CoreModules/Framework/InterfaceCommander/Command.cs
index 4004135..b9786ae 100644
--- a/OpenSim/Region/CoreModules/Framework/InterfaceCommander/Command.cs
+++ b/OpenSim/Region/CoreModules/Framework/InterfaceCommander/Command.cs
@@ -28,6 +28,7 @@
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using OpenSim.Region.Framework.Interfaces; 30using OpenSim.Region.Framework.Interfaces;
31using OpenMetaverse;
31 32
32namespace OpenSim.Region.CoreModules.Framework.InterfaceCommander 33namespace OpenSim.Region.CoreModules.Framework.InterfaceCommander
33{ 34{
@@ -152,6 +153,9 @@ namespace OpenSim.Region.CoreModules.Framework.InterfaceCommander
152 case "Boolean": 153 case "Boolean":
153 m_args[i].ArgumentValue = Boolean.Parse(arg.ToString()); 154 m_args[i].ArgumentValue = Boolean.Parse(arg.ToString());
154 break; 155 break;
156 case "UUID":
157 m_args[i].ArgumentValue = UUID.Parse(arg.ToString());
158 break;
155 default: 159 default:
156 Console.WriteLine("ERROR: Unknown desired type for argument " + m_args[i].Name + " on command " + m_name); 160 Console.WriteLine("ERROR: Unknown desired type for argument " + m_args[i].Name + " on command " + m_name);
157 break; 161 break;
diff --git a/OpenSim/Region/CoreModules/Properties/AssemblyInfo.cs b/OpenSim/Region/CoreModules/Properties/AssemblyInfo.cs
index 5a8c4a2..f6353f9 100644
--- a/OpenSim/Region/CoreModules/Properties/AssemblyInfo.cs
+++ b/OpenSim/Region/CoreModules/Properties/AssemblyInfo.cs
@@ -30,7 +30,7 @@ using Mono.Addins;
30// Build Number 30// Build Number
31// Revision 31// Revision
32// 32//
33[assembly: AssemblyVersion("0.7.5.*")] 33[assembly: AssemblyVersion("0.7.6.*")]
34[assembly: AssemblyFileVersion("1.0.0.0")] 34[assembly: AssemblyFileVersion("1.0.0.0")]
35 35
36[assembly: Addin("OpenSim.Region.CoreModules", "0.1")] 36[assembly: Addin("OpenSim.Region.CoreModules", "0.1")]
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/MapImage/MapImageServiceModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/MapImage/MapImageServiceModule.cs
index a839086..26d22b8 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>
@@ -133,7 +132,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.MapImage
133 ///</summary> 132 ///</summary>
134 public void AddRegion(Scene scene) 133 public void AddRegion(Scene scene)
135 { 134 {
136 if (! m_enabled) 135 if (!m_enabled)
137 return; 136 return;
138 137
139 // Every shared region module has to maintain an indepedent list of 138 // Every shared region module has to maintain an indepedent list of
@@ -206,6 +205,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.MapImage
206 205
207 using (Image mapTile = tileGenerator.CreateMapTile()) 206 using (Image mapTile = tileGenerator.CreateMapTile())
208 { 207 {
208 // XXX: The MapImageModule will return a null if the user has chosen not to create map tiles and there
209 // is no static map tile.
210 if (mapTile == null)
211 return;
212
209 using (MemoryStream stream = new MemoryStream()) 213 using (MemoryStream stream = new MemoryStream())
210 { 214 {
211 mapTile.Save(stream, ImageFormat.Jpeg); 215 mapTile.Save(stream, ImageFormat.Jpeg);
diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementCommands.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementCommands.cs
index 3b84d57..4d49794 100644
--- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementCommands.cs
+++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementCommands.cs
@@ -117,7 +117,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
117 117
118 m_module.Scene.RegionInfo.RegionSettings.Save(); 118 m_module.Scene.RegionInfo.RegionSettings.Save();
119 m_module.TriggerRegionInfoChange(); 119 m_module.TriggerRegionInfoChange();
120 m_module.sendRegionInfoPacketToAll(); 120 m_module.sendRegionHandshakeToAll();
121 } 121 }
122 } 122 }
123 } 123 }
diff --git a/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs b/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs
index 8a422b0..e7065dc 100644
--- a/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs
+++ b/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs
@@ -77,42 +77,51 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
77 { 77 {
78 bool drawPrimVolume = true; 78 bool drawPrimVolume = true;
79 bool textureTerrain = false; 79 bool textureTerrain = false;
80 bool generateMaptiles = true;
81 Bitmap mapbmp;
80 82
81 try 83 try
82 { 84 {
83 IConfig startupConfig = m_config.Configs["Startup"]; 85 IConfig startupConfig = m_config.Configs["Startup"];
84 drawPrimVolume = startupConfig.GetBoolean("DrawPrimOnMapTile", drawPrimVolume); 86 drawPrimVolume = startupConfig.GetBoolean("DrawPrimOnMapTile", drawPrimVolume);
85 textureTerrain = startupConfig.GetBoolean("TextureOnMapTile", textureTerrain); 87 textureTerrain = startupConfig.GetBoolean("TextureOnMapTile", textureTerrain);
88 generateMaptiles = startupConfig.GetBoolean("GenerateMaptiles", generateMaptiles);
86 } 89 }
87 catch 90 catch
88 { 91 {
89 m_log.Warn("[MAPTILE]: Failed to load StartupConfig"); 92 m_log.Warn("[MAPTILE]: Failed to load StartupConfig");
90 } 93 }
91 94
92 if (textureTerrain) 95 if (generateMaptiles)
93 { 96 {
94 terrainRenderer = new TexturedMapTileRenderer(); 97 if (textureTerrain)
95 } 98 {
96 else 99 terrainRenderer = new TexturedMapTileRenderer();
97 { 100 }
98 terrainRenderer = new ShadedMapTileRenderer(); 101 else
99 } 102 {
100 terrainRenderer.Initialise(m_scene, m_config); 103 terrainRenderer = new ShadedMapTileRenderer();
104 }
101 105
102 Bitmap mapbmp = new Bitmap((int)Constants.RegionSize, (int)Constants.RegionSize, System.Drawing.Imaging.PixelFormat.Format24bppRgb); 106 terrainRenderer.Initialise(m_scene, m_config);
103 //long t = System.Environment.TickCount;
104 //for (int i = 0; i < 10; ++i) {
105 terrainRenderer.TerrainToBitmap(mapbmp);
106 //}
107 //t = System.Environment.TickCount - t;
108 //m_log.InfoFormat("[MAPTILE] generation of 10 maptiles needed {0} ms", t);
109 107
108 mapbmp = new Bitmap((int)Constants.RegionSize, (int)Constants.RegionSize, System.Drawing.Imaging.PixelFormat.Format24bppRgb);
109 //long t = System.Environment.TickCount;
110 //for (int i = 0; i < 10; ++i) {
111 terrainRenderer.TerrainToBitmap(mapbmp);
112 //}
113 //t = System.Environment.TickCount - t;
114 //m_log.InfoFormat("[MAPTILE] generation of 10 maptiles needed {0} ms", t);
110 115
111 if (drawPrimVolume) 116 if (drawPrimVolume)
117 {
118 DrawObjectVolume(m_scene, mapbmp);
119 }
120 }
121 else
112 { 122 {
113 DrawObjectVolume(m_scene, mapbmp); 123 mapbmp = FetchTexture(m_scene.RegionInfo.RegionSettings.TerrainImageID);
114 } 124 }
115
116 return mapbmp; 125 return mapbmp;
117 } 126 }
118 127
@@ -222,6 +231,49 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
222// } 231// }
223// } 232// }
224 233
234 private Bitmap FetchTexture(UUID id)
235 {
236 AssetBase asset = m_scene.AssetService.Get(id.ToString());
237
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 }
247
248 ManagedImage managedImage;
249 Image image;
250
251 try
252 {
253 if (OpenJPEG.DecodeToImage(asset.Data, out managedImage, out image))
254 return new Bitmap(image);
255 else
256 return null;
257 }
258 catch (DllNotFoundException)
259 {
260 m_log.ErrorFormat("[MAPTILE]: OpenJpeg is not installed correctly on this system. Asset Data is empty for {0}", id);
261
262 }
263 catch (IndexOutOfRangeException)
264 {
265 m_log.ErrorFormat("[MAPTILE]: OpenJpeg was unable to decode this. Asset Data is empty for {0}", id);
266
267 }
268 catch (Exception)
269 {
270 m_log.ErrorFormat("[MAPTILE]: OpenJpeg was unable to decode this. Asset Data is empty for {0}", id);
271
272 }
273 return null;
274
275 }
276
225 private Bitmap DrawObjectVolume(Scene whichScene, Bitmap mapbmp) 277 private Bitmap DrawObjectVolume(Scene whichScene, Bitmap mapbmp)
226 { 278 {
227 int tc = 0; 279 int tc = 0;
diff --git a/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs b/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs
index 7b235ae..9fc2daf 100644
--- a/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs
+++ b/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs
@@ -592,11 +592,11 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands
592 cdl.AddRow( 592 cdl.AddRow(
593 "LightColor", 593 "LightColor",
594 string.Format("<{0},{1},{2},{3}>", s.LightColorR, s.LightColorB, s.LightColorG, s.LightColorA)); 594 string.Format("<{0},{1},{2},{3}>", s.LightColorR, s.LightColorB, s.LightColorG, s.LightColorA));
595 cdl.AddRow("FlexiDrag", s.LightCutoff); 595 cdl.AddRow("LightCutoff", s.LightCutoff);
596 cdl.AddRow("FlexiDrag", s.LightEntry); 596 cdl.AddRow("LightEntry", s.LightEntry);
597 cdl.AddRow("FlexiDrag", s.LightFalloff); 597 cdl.AddRow("LightFalloff", s.LightFalloff);
598 cdl.AddRow("FlexiDrag", s.LightIntensity); 598 cdl.AddRow("LightIntensity", s.LightIntensity);
599 cdl.AddRow("FlexiDrag", s.LightRadius); 599 cdl.AddRow("LightRadius", s.LightRadius);
600 cdl.AddRow("Media", string.Format("{0} entries", s.Media != null ? s.Media.Count.ToString() : "n/a")); 600 cdl.AddRow("Media", string.Format("{0} entries", s.Media != null ? s.Media.Count.ToString() : "n/a"));
601 cdl.AddRow("PathBegin", s.PathBegin); 601 cdl.AddRow("PathBegin", s.PathBegin);
602 cdl.AddRow("PathEnd", s.PathEnd); 602 cdl.AddRow("PathEnd", s.PathEnd);
diff --git a/OpenSim/Region/DataSnapshot/Properties/AssemblyInfo.cs b/OpenSim/Region/DataSnapshot/Properties/AssemblyInfo.cs
index b926264..0f083c7 100644
--- a/OpenSim/Region/DataSnapshot/Properties/AssemblyInfo.cs
+++ b/OpenSim/Region/DataSnapshot/Properties/AssemblyInfo.cs
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
29// Build Number 29// Build Number
30// Revision 30// Revision
31// 31//
32[assembly: AssemblyVersion("0.7.5.*")] 32[assembly: AssemblyVersion("0.7.6.*")]
33[assembly: AssemblyFileVersion("1.0.0.0")] 33[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/OpenSim/Region/Framework/Interfaces/IJsonStoreModule.cs b/OpenSim/Region/Framework/Interfaces/IJsonStoreModule.cs
index da39e95..0bb4567 100644
--- a/OpenSim/Region/Framework/Interfaces/IJsonStoreModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IJsonStoreModule.cs
@@ -37,6 +37,7 @@ namespace OpenSim.Region.Framework.Interfaces
37 { 37 {
38 bool CreateStore(string value, ref UUID result); 38 bool CreateStore(string value, ref UUID result);
39 bool DestroyStore(UUID storeID); 39 bool DestroyStore(UUID storeID);
40 bool TestStore(UUID storeID);
40 bool TestPath(UUID storeID, string path, bool useJson); 41 bool TestPath(UUID storeID, string path, bool useJson);
41 bool SetValue(UUID storeID, string path, string value, bool useJson); 42 bool SetValue(UUID storeID, string path, string value, bool useJson);
42 bool RemoveValue(UUID storeID, string path); 43 bool RemoveValue(UUID storeID, string path);
diff --git a/OpenSim/Region/Framework/Properties/AssemblyInfo.cs b/OpenSim/Region/Framework/Properties/AssemblyInfo.cs
index 9b504c0..2a5828e 100644
--- a/OpenSim/Region/Framework/Properties/AssemblyInfo.cs
+++ b/OpenSim/Region/Framework/Properties/AssemblyInfo.cs
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
29// Build Number 29// Build Number
30// Revision 30// Revision
31// 31//
32[assembly: AssemblyVersion("0.7.5.*")] 32[assembly: AssemblyVersion("0.7.6.*")]
33[assembly: AssemblyFileVersion("1.0.0.0")] 33[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs
index 902ded1..9ee1520 100644
--- a/OpenSim/Region/Framework/Scenes/EventManager.cs
+++ b/OpenSim/Region/Framework/Scenes/EventManager.cs
@@ -549,6 +549,20 @@ namespace OpenSim.Region.Framework.Scenes
549 /// </remarks> 549 /// </remarks>
550 public event ScriptControlEvent OnScriptControlEvent; 550 public event ScriptControlEvent OnScriptControlEvent;
551 551
552 public delegate void ScriptMovingStartEvent(uint localID);
553
554 /// <summary>
555 /// TODO: Should be triggered when a physics object starts moving.
556 /// </summary>
557 public event ScriptMovingStartEvent OnScriptMovingStartEvent;
558
559 public delegate void ScriptMovingEndEvent(uint localID);
560
561 /// <summary>
562 /// TODO: Should be triggered when a physics object stops moving.
563 /// </summary>
564 public event ScriptMovingEndEvent OnScriptMovingEndEvent;
565
552 public delegate void ScriptAtTargetEvent(uint localID, uint handle, Vector3 targetpos, Vector3 atpos); 566 public delegate void ScriptAtTargetEvent(uint localID, uint handle, Vector3 targetpos, Vector3 atpos);
553 567
554 /// <summary> 568 /// <summary>
@@ -2212,6 +2226,48 @@ namespace OpenSim.Region.Framework.Scenes
2212 } 2226 }
2213 } 2227 }
2214 2228
2229 public void TriggerMovingStartEvent(uint localID)
2230 {
2231 ScriptMovingStartEvent handlerScriptMovingStartEvent = OnScriptMovingStartEvent;
2232 if (handlerScriptMovingStartEvent != null)
2233 {
2234 foreach (ScriptMovingStartEvent d in handlerScriptMovingStartEvent.GetInvocationList())
2235 {
2236 try
2237 {
2238 d(localID);
2239 }
2240 catch (Exception e)
2241 {
2242 m_log.ErrorFormat(
2243 "[EVENT MANAGER]: Delegate for TriggerMovingStartEvent failed - continuing. {0} {1}",
2244 e.Message, e.StackTrace);
2245 }
2246 }
2247 }
2248 }
2249
2250 public void TriggerMovingEndEvent(uint localID)
2251 {
2252 ScriptMovingEndEvent handlerScriptMovingEndEvent = OnScriptMovingEndEvent;
2253 if (handlerScriptMovingEndEvent != null)
2254 {
2255 foreach (ScriptMovingEndEvent d in handlerScriptMovingEndEvent.GetInvocationList())
2256 {
2257 try
2258 {
2259 d(localID);
2260 }
2261 catch (Exception e)
2262 {
2263 m_log.ErrorFormat(
2264 "[EVENT MANAGER]: Delegate for TriggerMovingEndEvent failed - continuing. {0} {1}",
2265 e.Message, e.StackTrace);
2266 }
2267 }
2268 }
2269 }
2270
2215 public void TriggerRequestChangeWaterHeight(float height) 2271 public void TriggerRequestChangeWaterHeight(float height)
2216 { 2272 {
2217 if (height < 0) 2273 if (height < 0)
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index 92bf85a..6808017 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -407,16 +407,16 @@ namespace OpenSim.Region.Framework.Scenes
407 if (item.Owner != remoteClient.AgentId) 407 if (item.Owner != remoteClient.AgentId)
408 return; 408 return;
409 409
410 if (UUID.Zero == transactionID) 410 item.Name = itemUpd.Name;
411 { 411 item.Description = itemUpd.Description;
412 item.Name = itemUpd.Name;
413 item.Description = itemUpd.Description;
414 412
415// m_log.DebugFormat( 413// m_log.DebugFormat(
416// "[USER INVENTORY]: itemUpd {0} {1} {2} {3}, item {4} {5} {6} {7}", 414// "[USER INVENTORY]: itemUpd {0} {1} {2} {3}, item {4} {5} {6} {7}",
417// itemUpd.NextPermissions, itemUpd.GroupPermissions, itemUpd.EveryOnePermissions, item.Flags, 415// itemUpd.NextPermissions, itemUpd.GroupPermissions, itemUpd.EveryOnePermissions, item.Flags,
418// item.NextPermissions, item.GroupPermissions, item.EveryOnePermissions, item.CurrentPermissions); 416// item.NextPermissions, item.GroupPermissions, item.EveryOnePermissions, item.CurrentPermissions);
419 417
418 if (itemUpd.NextPermissions != 0) // Use this to determine validity. Can never be 0 if valid
419 {
420 if (item.NextPermissions != (itemUpd.NextPermissions & item.BasePermissions)) 420 if (item.NextPermissions != (itemUpd.NextPermissions & item.BasePermissions))
421 item.Flags |= (uint)InventoryItemFlags.ObjectOverwriteNextOwner; 421 item.Flags |= (uint)InventoryItemFlags.ObjectOverwriteNextOwner;
422 item.NextPermissions = itemUpd.NextPermissions & item.BasePermissions; 422 item.NextPermissions = itemUpd.NextPermissions & item.BasePermissions;
@@ -451,7 +451,8 @@ namespace OpenSim.Region.Framework.Scenes
451 451
452 InventoryService.UpdateItem(item); 452 InventoryService.UpdateItem(item);
453 } 453 }
454 else 454
455 if (UUID.Zero != transactionID)
455 { 456 {
456 if (AgentTransactionsModule != null) 457 if (AgentTransactionsModule != null)
457 { 458 {
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index f2cb117..f8d84e3 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -917,10 +917,15 @@ namespace OpenSim.Region.Framework.Scenes
917 string tile = startupConfig.GetString("MaptileStaticUUID", UUID.Zero.ToString()); 917 string tile = startupConfig.GetString("MaptileStaticUUID", UUID.Zero.ToString());
918 UUID tileID; 918 UUID tileID;
919 919
920 if (UUID.TryParse(tile, out tileID)) 920 if (tile != UUID.Zero.ToString() && UUID.TryParse(tile, out tileID))
921 { 921 {
922 RegionInfo.RegionSettings.TerrainImageID = tileID; 922 RegionInfo.RegionSettings.TerrainImageID = tileID;
923 } 923 }
924 else
925 {
926 RegionInfo.RegionSettings.TerrainImageID = RegionInfo.MaptileStaticUUID;
927 m_log.InfoFormat("[SCENE]: Region {0}, maptile set to {1}", RegionInfo.RegionName, RegionInfo.MaptileStaticUUID.ToString());
928 }
924 } 929 }
925 930
926 string grant = startupConfig.GetString("AllowedClients", String.Empty); 931 string grant = startupConfig.GetString("AllowedClients", String.Empty);
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index a90872e..6e41774 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -200,6 +200,11 @@ namespace OpenSim.Region.Framework.Scenes
200 200
201 private const int LAND_VELOCITYMAG_MAX = 12; 201 private const int LAND_VELOCITYMAG_MAX = 12;
202 202
203 private const float FLY_ROLL_MAX_RADIANS = 1.1f;
204
205 private const float FLY_ROLL_RADIANS_PER_UPDATE = 0.06f;
206 private const float FLY_ROLL_RESET_RADIANS_PER_UPDATE = 0.02f;
207
203 private float m_health = 100f; 208 private float m_health = 100f;
204 209
205 protected ulong crossingFromRegion; 210 protected ulong crossingFromRegion;
@@ -568,6 +573,14 @@ namespace OpenSim.Region.Framework.Scenes
568 } 573 }
569 } 574 }
570 575
576 // Used for limited viewer 'fake' user rotations.
577 private Vector3 m_AngularVelocity = Vector3.Zero;
578
579 public Vector3 AngularVelocity
580 {
581 get { return m_AngularVelocity; }
582 }
583
571 public bool IsChildAgent { get; set; } 584 public bool IsChildAgent { get; set; }
572 585
573 /// <summary> 586 /// <summary>
@@ -690,6 +703,8 @@ namespace OpenSim.Region.Framework.Scenes
690 703
691 #endregion 704 #endregion
692 705
706
707
693 #region Constructor(s) 708 #region Constructor(s)
694 709
695 public ScenePresence( 710 public ScenePresence(
@@ -1033,6 +1048,85 @@ namespace OpenSim.Region.Framework.Scenes
1033 ControllingClient.StopFlying(this); 1048 ControllingClient.StopFlying(this);
1034 } 1049 }
1035 1050
1051 /// <summary>
1052 /// Applies a roll accumulator to the avatar's angular velocity for the avatar fly roll effect.
1053 /// </summary>
1054 /// <param name="amount">Postive or negative roll amount in radians</param>
1055 private void ApplyFlyingRoll(float amount, bool PressingUp, bool PressingDown)
1056 {
1057
1058 float rollAmount = Util.Clamp(m_AngularVelocity.Z + amount, -FLY_ROLL_MAX_RADIANS, FLY_ROLL_MAX_RADIANS);
1059 m_AngularVelocity.Z = rollAmount;
1060
1061 // APPLY EXTRA consideration for flying up and flying down during this time.
1062 // if we're turning left
1063 if (amount > 0)
1064 {
1065
1066 // If we're at the max roll and pressing up, we want to swing BACK a bit
1067 // Automatically adds noise
1068 if (PressingUp)
1069 {
1070 if (m_AngularVelocity.Z >= FLY_ROLL_MAX_RADIANS - 0.04f)
1071 m_AngularVelocity.Z -= 0.9f;
1072 }
1073 // If we're at the max roll and pressing down, we want to swing MORE a bit
1074 if (PressingDown)
1075 {
1076 if (m_AngularVelocity.Z >= FLY_ROLL_MAX_RADIANS && m_AngularVelocity.Z < FLY_ROLL_MAX_RADIANS + 0.6f)
1077 m_AngularVelocity.Z += 0.6f;
1078 }
1079 }
1080 else // we're turning right.
1081 {
1082 // If we're at the max roll and pressing up, we want to swing BACK a bit
1083 // Automatically adds noise
1084 if (PressingUp)
1085 {
1086 if (m_AngularVelocity.Z <= (-FLY_ROLL_MAX_RADIANS))
1087 m_AngularVelocity.Z += 0.6f;
1088 }
1089 // If we're at the max roll and pressing down, we want to swing MORE a bit
1090 if (PressingDown)
1091 {
1092 if (m_AngularVelocity.Z >= -FLY_ROLL_MAX_RADIANS - 0.6f)
1093 m_AngularVelocity.Z -= 0.6f;
1094 }
1095 }
1096 }
1097
1098 /// <summary>
1099 /// incrementally sets roll amount to zero
1100 /// </summary>
1101 /// <param name="amount">Positive roll amount in radians</param>
1102 /// <returns></returns>
1103 private float CalculateFlyingRollResetToZero(float amount)
1104 {
1105 const float rollMinRadians = 0f;
1106
1107 if (m_AngularVelocity.Z > 0)
1108 {
1109
1110 float leftOverToMin = m_AngularVelocity.Z - rollMinRadians;
1111 if (amount > leftOverToMin)
1112 return -leftOverToMin;
1113 else
1114 return -amount;
1115
1116 }
1117 else
1118 {
1119
1120 float leftOverToMin = -m_AngularVelocity.Z - rollMinRadians;
1121 if (amount > leftOverToMin)
1122 return leftOverToMin;
1123 else
1124 return amount;
1125 }
1126 }
1127
1128
1129
1036 // neighbouring regions we have enabled a child agent in 1130 // neighbouring regions we have enabled a child agent in
1037 // holds the seed cap for the child agent in that region 1131 // holds the seed cap for the child agent in that region
1038 private Dictionary<ulong, string> m_knownChildRegions = new Dictionary<ulong, string>(); 1132 private Dictionary<ulong, string> m_knownChildRegions = new Dictionary<ulong, string>();
@@ -1513,6 +1607,33 @@ namespace OpenSim.Region.Framework.Scenes
1513 bool controlland = (((flags & AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0) || 1607 bool controlland = (((flags & AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0) ||
1514 ((flags & AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_UP_NEG) != 0)); 1608 ((flags & AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_UP_NEG) != 0));
1515 1609
1610
1611 //m_log.Debug("[CONTROL]: " +flags);
1612 // Applies a satisfying roll effect to the avatar when flying.
1613 if (((flags & AgentManager.ControlFlags.AGENT_CONTROL_TURN_LEFT) != 0) && ((flags & AgentManager.ControlFlags.AGENT_CONTROL_YAW_POS) != 0))
1614 {
1615
1616 ApplyFlyingRoll(FLY_ROLL_RADIANS_PER_UPDATE, ((flags & AgentManager.ControlFlags.AGENT_CONTROL_UP_POS) != 0), ((flags & AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0));
1617
1618
1619 }
1620 else if (((flags & AgentManager.ControlFlags.AGENT_CONTROL_TURN_RIGHT) != 0) &&
1621 ((flags & AgentManager.ControlFlags.AGENT_CONTROL_YAW_NEG) != 0))
1622 {
1623 ApplyFlyingRoll(-FLY_ROLL_RADIANS_PER_UPDATE, ((flags & AgentManager.ControlFlags.AGENT_CONTROL_UP_POS) != 0), ((flags & AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0));
1624
1625
1626 }
1627 else
1628 {
1629 if (m_AngularVelocity.Z != 0)
1630 m_AngularVelocity.Z += CalculateFlyingRollResetToZero(FLY_ROLL_RESET_RADIANS_PER_UPDATE);
1631
1632 }
1633
1634
1635
1636
1516 if (Flying && IsColliding && controlland) 1637 if (Flying && IsColliding && controlland)
1517 { 1638 {
1518 // nesting this check because LengthSquared() is expensive and we don't 1639 // nesting this check because LengthSquared() is expensive and we don't
@@ -2221,7 +2342,7 @@ namespace OpenSim.Region.Framework.Scenes
2221 2342
2222 ParentPart = m_scene.GetSceneObjectPart(m_requestedSitTargetID); 2343 ParentPart = m_scene.GetSceneObjectPart(m_requestedSitTargetID);
2223 ParentID = m_requestedSitTargetID; 2344 ParentID = m_requestedSitTargetID;
2224 2345 m_AngularVelocity = Vector3.Zero;
2225 Velocity = Vector3.Zero; 2346 Velocity = Vector3.Zero;
2226 RemoveFromPhysicalScene(); 2347 RemoveFromPhysicalScene();
2227 2348
@@ -2237,7 +2358,8 @@ namespace OpenSim.Region.Framework.Scenes
2237 2358
2238 public void HandleAgentSitOnGround() 2359 public void HandleAgentSitOnGround()
2239 { 2360 {
2240// m_updateCount = 0; // Kill animation update burst so that the SIT_G.. will stick. 2361// m_updateCount = 0; // Kill animation update burst so that the SIT_G.. will stick..
2362 m_AngularVelocity = Vector3.Zero;
2241 Animator.TrySetMovementAnimation("SIT_GROUND_CONSTRAINED"); 2363 Animator.TrySetMovementAnimation("SIT_GROUND_CONSTRAINED");
2242 SitGround = true; 2364 SitGround = true;
2243 RemoveFromPhysicalScene(); 2365 RemoveFromPhysicalScene();
diff --git a/OpenSim/Region/Framework/Scenes/UuidGatherer.cs b/OpenSim/Region/Framework/Scenes/UuidGatherer.cs
index e238d01..ad33607 100644
--- a/OpenSim/Region/Framework/Scenes/UuidGatherer.cs
+++ b/OpenSim/Region/Framework/Scenes/UuidGatherer.cs
@@ -131,7 +131,10 @@ namespace OpenSim.Region.Framework.Scenes
131 /// within this object). 131 /// within this object).
132 /// </remarks> 132 /// </remarks>
133 /// <param name="sceneObject">The scene object for which to gather assets</param> 133 /// <param name="sceneObject">The scene object for which to gather assets</param>
134 /// <param name="assetUuids">The assets gathered</param> 134 /// <param name="assetUuids">
135 /// A dictionary which is populated with the asset UUIDs gathered and the type of that asset.
136 /// For assets where the type is not clear (e.g. UUIDs extracted from LSL and notecards), the type is Unknown.
137 /// </param>
135 public void GatherAssetUuids(SceneObjectGroup sceneObject, IDictionary<UUID, AssetType> assetUuids) 138 public void GatherAssetUuids(SceneObjectGroup sceneObject, IDictionary<UUID, AssetType> assetUuids)
136 { 139 {
137// m_log.DebugFormat( 140// m_log.DebugFormat(
@@ -261,8 +264,9 @@ namespace OpenSim.Region.Framework.Scenes
261 UUID uuid = new UUID(uuidMatch.Value); 264 UUID uuid = new UUID(uuidMatch.Value);
262// m_log.DebugFormat("[ARCHIVER]: Recording {0} in text", uuid); 265// m_log.DebugFormat("[ARCHIVER]: Recording {0} in text", uuid);
263 266
264 // Assume AssetIDs embedded are textures. 267 // Embedded asset references (if not false positives) could be for many types of asset, so we will
265 assetUuids[uuid] = AssetType.Texture; 268 // label these as unknown.
269 assetUuids[uuid] = AssetType.Unknown;
266 } 270 }
267 } 271 }
268 } 272 }
diff --git a/OpenSim/Region/OptionalModules/Properties/AssemblyInfo.cs b/OpenSim/Region/OptionalModules/Properties/AssemblyInfo.cs
index 217b2d5..0065531 100644
--- a/OpenSim/Region/OptionalModules/Properties/AssemblyInfo.cs
+++ b/OpenSim/Region/OptionalModules/Properties/AssemblyInfo.cs
@@ -30,7 +30,7 @@ using Mono.Addins;
30// Build Number 30// Build Number
31// Revision 31// Revision
32// 32//
33[assembly: AssemblyVersion("0.7.5.*")] 33[assembly: AssemblyVersion("0.7.6.*")]
34[assembly: AssemblyFileVersion("1.0.0.0")] 34[assembly: AssemblyFileVersion("1.0.0.0")]
35 35
36[assembly: Addin("OpenSim.Region.OptionalModules", "0.1")] 36[assembly: Addin("OpenSim.Region.OptionalModules", "0.1")]
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/JsonStoreModule.cs b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreModule.cs
index e68764a..b9b3ebc 100644
--- a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreModule.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreModule.cs
@@ -221,6 +221,19 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
221 /// 221 ///
222 /// </summary> 222 /// </summary>
223 // ----------------------------------------------------------------- 223 // -----------------------------------------------------------------
224 public bool TestStore(UUID storeID)
225 {
226 if (! m_enabled) return false;
227
228 lock (m_JsonValueStore)
229 return m_JsonValueStore.ContainsKey(storeID);
230 }
231
232 // -----------------------------------------------------------------
233 /// <summary>
234 ///
235 /// </summary>
236 // -----------------------------------------------------------------
224 public bool TestPath(UUID storeID, string path, bool useJson) 237 public bool TestPath(UUID storeID, string path, bool useJson)
225 { 238 {
226 if (! m_enabled) return false; 239 if (! m_enabled) return false;
diff --git a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreScriptModule.cs b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreScriptModule.cs
index b9dcfea..5b7a79d 100644
--- a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreScriptModule.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreScriptModule.cs
@@ -165,28 +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 169
171 m_comms.RegisterScriptInvocation(this, "JsonReadNotecard"); 170 // m_comms.RegisterScriptInvocation(this, "JsonCreateStore");
172 m_comms.RegisterScriptInvocation(this, "JsonWriteNotecard"); 171 // m_comms.RegisterScriptInvocation(this, "JsonDestroyStore");
172 // m_comms.RegisterScriptInvocation(this, "JsonTestStore");
173 173
174 m_comms.RegisterScriptInvocation(this, "JsonTestPath"); 174 // m_comms.RegisterScriptInvocation(this, "JsonReadNotecard");
175 m_comms.RegisterScriptInvocation(this, "JsonTestPathJson"); 175 // m_comms.RegisterScriptInvocation(this, "JsonWriteNotecard");
176 176
177 m_comms.RegisterScriptInvocation(this, "JsonGetValue"); 177 // m_comms.RegisterScriptInvocation(this, "JsonTestPathList");
178 m_comms.RegisterScriptInvocation(this, "JsonGetValueJson"); 178 // m_comms.RegisterScriptInvocation(this, "JsonTestPath");
179 // m_comms.RegisterScriptInvocation(this, "JsonTestPathJson");
179 180
180 m_comms.RegisterScriptInvocation(this, "JsonTakeValue"); 181 // m_comms.RegisterScriptInvocation(this, "JsonGetValue");
181 m_comms.RegisterScriptInvocation(this, "JsonTakeValueJson"); 182 // m_comms.RegisterScriptInvocation(this, "JsonGetValueJson");
182 183
183 m_comms.RegisterScriptInvocation(this, "JsonReadValue"); 184 // m_comms.RegisterScriptInvocation(this, "JsonTakeValue");
184 m_comms.RegisterScriptInvocation(this, "JsonReadValueJson"); 185 // m_comms.RegisterScriptInvocation(this, "JsonTakeValueJson");
185 186
186 m_comms.RegisterScriptInvocation(this, "JsonSetValue"); 187 // m_comms.RegisterScriptInvocation(this, "JsonReadValue");
187 m_comms.RegisterScriptInvocation(this, "JsonSetValueJson"); 188 // m_comms.RegisterScriptInvocation(this, "JsonReadValueJson");
188 189
189 m_comms.RegisterScriptInvocation(this, "JsonRemoveValue"); 190 // m_comms.RegisterScriptInvocation(this, "JsonSetValue");
191 // m_comms.RegisterScriptInvocation(this, "JsonSetValueJson");
192
193 // m_comms.RegisterScriptInvocation(this, "JsonRemoveValue");
190 } 194 }
191 catch (Exception e) 195 catch (Exception e)
192 { 196 {
@@ -214,23 +218,25 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
214 /// 218 ///
215 /// </summary> 219 /// </summary>
216 // ----------------------------------------------------------------- 220 // -----------------------------------------------------------------
217 protected void GenerateRuntimeError(string msg) 221 [ScriptInvocation]
222 public UUID JsonCreateStore(UUID hostID, UUID scriptID, string value)
218 { 223 {
219 throw new Exception("JsonStore Runtime Error: " + msg); 224 UUID uuid = UUID.Zero;
225 if (! m_store.CreateStore(value, ref uuid))
226 GenerateRuntimeError("Failed to create Json store");
227
228 return uuid;
220 } 229 }
221 230
222 // ----------------------------------------------------------------- 231 // -----------------------------------------------------------------
223 /// <summary> 232 /// <summary>
224 /// 233 ///
225 /// </summary> 234 /// </summary>
226 // ----------------------------------------------------------------- 235 // -----------------------------------------------------------------
227 protected UUID JsonCreateStore(UUID hostID, UUID scriptID, string value) 236 [ScriptInvocation]
237 public int JsonDestroyStore(UUID hostID, UUID scriptID, UUID storeID)
228 { 238 {
229 UUID uuid = UUID.Zero; 239 return m_store.DestroyStore(storeID) ? 1 : 0;
230 if (! m_store.CreateStore(value, ref uuid))
231 GenerateRuntimeError("Failed to create Json store");
232
233 return uuid;
234 } 240 }
235 241
236 // ----------------------------------------------------------------- 242 // -----------------------------------------------------------------
@@ -238,9 +244,10 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
238 /// 244 ///
239 /// </summary> 245 /// </summary>
240 // ----------------------------------------------------------------- 246 // -----------------------------------------------------------------
241 protected int JsonDestroyStore(UUID hostID, UUID scriptID, UUID storeID) 247 [ScriptInvocation]
248 public int JsonTestStore(UUID hostID, UUID scriptID, UUID storeID)
242 { 249 {
243 return m_store.DestroyStore(storeID) ? 1 : 0; 250 return m_store.TestStore(storeID) ? 1 : 0;
244 } 251 }
245 252
246 // ----------------------------------------------------------------- 253 // -----------------------------------------------------------------
@@ -248,7 +255,8 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
248 /// 255 ///
249 /// </summary> 256 /// </summary>
250 // ----------------------------------------------------------------- 257 // -----------------------------------------------------------------
251 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)
252 { 260 {
253 UUID reqID = UUID.Random(); 261 UUID reqID = UUID.Random();
254 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); });
@@ -260,7 +268,8 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
260 /// 268 ///
261 /// </summary> 269 /// </summary>
262 // ----------------------------------------------------------------- 270 // -----------------------------------------------------------------
263 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)
264 { 273 {
265 UUID reqID = UUID.Random(); 274 UUID reqID = UUID.Random();
266 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); });
@@ -272,12 +281,25 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
272 /// 281 ///
273 /// </summary> 282 /// </summary>
274 // ----------------------------------------------------------------- 283 // -----------------------------------------------------------------
275 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)
276 { 297 {
277 return m_store.TestPath(storeID,path,false) ? 1 : 0; 298 return m_store.TestPath(storeID,path,false) ? 1 : 0;
278 } 299 }
279 300
280 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)
281 { 303 {
282 return m_store.TestPath(storeID,path,true) ? 1 : 0; 304 return m_store.TestPath(storeID,path,true) ? 1 : 0;
283 } 305 }
@@ -287,12 +309,14 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
287 /// 309 ///
288 /// </summary> 310 /// </summary>
289 // ----------------------------------------------------------------- 311 // -----------------------------------------------------------------
290 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)
291 { 314 {
292 return m_store.SetValue(storeID,path,value,false) ? 1 : 0; 315 return m_store.SetValue(storeID,path,value,false) ? 1 : 0;
293 } 316 }
294 317
295 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)
296 { 320 {
297 return m_store.SetValue(storeID,path,value,true) ? 1 : 0; 321 return m_store.SetValue(storeID,path,value,true) ? 1 : 0;
298 } 322 }
@@ -302,7 +326,8 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
302 /// 326 ///
303 /// </summary> 327 /// </summary>
304 // ----------------------------------------------------------------- 328 // -----------------------------------------------------------------
305 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)
306 { 331 {
307 return m_store.RemoveValue(storeID,path) ? 1 : 0; 332 return m_store.RemoveValue(storeID,path) ? 1 : 0;
308 } 333 }
@@ -312,14 +337,16 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
312 /// 337 ///
313 /// </summary> 338 /// </summary>
314 // ----------------------------------------------------------------- 339 // -----------------------------------------------------------------
315 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)
316 { 342 {
317 string value = String.Empty; 343 string value = String.Empty;
318 m_store.GetValue(storeID,path,false,out value); 344 m_store.GetValue(storeID,path,false,out value);
319 return value; 345 return value;
320 } 346 }
321 347
322 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)
323 { 350 {
324 string value = String.Empty; 351 string value = String.Empty;
325 m_store.GetValue(storeID,path,true, out value); 352 m_store.GetValue(storeID,path,true, out value);
@@ -331,60 +358,75 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
331 /// 358 ///
332 /// </summary> 359 /// </summary>
333 // ----------------------------------------------------------------- 360 // -----------------------------------------------------------------
334 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)
335 { 363 {
336 UUID reqID = UUID.Random(); 364 UUID reqID = UUID.Random();
337 Util.FireAndForget(delegate(object o) { DoJsonTakeValue(scriptID,reqID,storeID,path,false); }); 365 Util.FireAndForget(delegate(object o) { DoJsonTakeValue(scriptID,reqID,storeID,path,false); });
338 return reqID; 366 return reqID;
339 } 367 }
340 368
341 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)
342 { 371 {
343 UUID reqID = UUID.Random(); 372 UUID reqID = UUID.Random();
344 Util.FireAndForget(delegate(object o) { DoJsonTakeValue(scriptID,reqID,storeID,path,true); }); 373 Util.FireAndForget(delegate(object o) { DoJsonTakeValue(scriptID,reqID,storeID,path,true); });
345 return reqID; 374 return reqID;
346 } 375 }
347 376
348 private void DoJsonTakeValue(UUID scriptID, UUID reqID, UUID storeID, string path, bool useJson)
349 {
350 try
351 {
352 m_store.TakeValue(storeID,path,useJson,delegate(string value) { DispatchValue(scriptID,reqID,value); });
353 return;
354 }
355 catch (Exception e)
356 {
357 m_log.InfoFormat("[JsonStoreScripts]: unable to retrieve value; {0}",e.ToString());
358 }
359
360 DispatchValue(scriptID,reqID,String.Empty);
361 }
362
363
364 // ----------------------------------------------------------------- 377 // -----------------------------------------------------------------
365 /// <summary> 378 /// <summary>
366 /// 379 ///
367 /// </summary> 380 /// </summary>
368 // ----------------------------------------------------------------- 381 // -----------------------------------------------------------------
369 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)
370 { 384 {
371 UUID reqID = UUID.Random(); 385 UUID reqID = UUID.Random();
372 Util.FireAndForget(delegate(object o) { DoJsonReadValue(scriptID,reqID,storeID,path,false); }); 386 Util.FireAndForget(delegate(object o) { DoJsonReadValue(scriptID,reqID,storeID,path,false); });
373 return reqID; 387 return reqID;
374 } 388 }
375 389
376 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)
377 { 392 {
378 UUID reqID = UUID.Random(); 393 UUID reqID = UUID.Random();
379 Util.FireAndForget(delegate(object o) { DoJsonReadValue(scriptID,reqID,storeID,path,true); }); 394 Util.FireAndForget(delegate(object o) { DoJsonReadValue(scriptID,reqID,storeID,path,true); });
380 return reqID; 395 return reqID;
381 } 396 }
382 397
383 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)
384 { 426 {
385 try 427 try
386 { 428 {
387 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); });
388 return; 430 return;
389 } 431 }
390 catch (Exception e) 432 catch (Exception e)
@@ -395,16 +437,25 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
395 DispatchValue(scriptID,reqID,String.Empty); 437 DispatchValue(scriptID,reqID,String.Empty);
396 } 438 }
397 439
398#endregion
399 440
400 // ----------------------------------------------------------------- 441 // -----------------------------------------------------------------
401 /// <summary> 442 /// <summary>
402 /// 443 ///
403 /// </summary> 444 /// </summary>
404 // ----------------------------------------------------------------- 445 // -----------------------------------------------------------------
405 protected void DispatchValue(UUID scriptID, UUID reqID, string value) 446 private void DoJsonReadValue(UUID scriptID, UUID reqID, UUID storeID, string path, bool useJson)
406 { 447 {
407 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);
408 } 459 }
409 460
410 // ----------------------------------------------------------------- 461 // -----------------------------------------------------------------
@@ -494,5 +545,43 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
494 545
495 m_comms.DispatchReply(scriptID,1,assetID.ToString(),reqID.ToString()); 546 m_comms.DispatchReply(scriptID,1,assetID.ToString(),reqID.ToString());
496 } 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
497 } 586 }
498} \ No newline at end of file 587} \ No newline at end of file
diff --git a/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs b/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs
index 397dd93..8042a93 100644
--- a/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs
@@ -48,7 +48,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
48 /// Tests for inventory functions in LSL 48 /// Tests for inventory functions in LSL
49 /// </summary> 49 /// </summary>
50 [TestFixture] 50 [TestFixture]
51 public class LSL_ApiInventoryTests : OpenSimTestCase 51 public class JsonStoreScriptModuleTests : OpenSimTestCase
52 { 52 {
53 private Scene m_scene; 53 private Scene m_scene;
54 private MockScriptEngine m_engine; 54 private MockScriptEngine m_engine;
@@ -59,8 +59,6 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
59 { 59 {
60 base.SetUp(); 60 base.SetUp();
61 61
62 TestHelpers.EnableLogging();
63
64 IConfigSource configSource = new IniConfigSource(); 62 IConfigSource configSource = new IniConfigSource();
65 IConfig jsonStoreConfig = configSource.AddConfig("JsonStore"); 63 IConfig jsonStoreConfig = configSource.AddConfig("JsonStore");
66 jsonStoreConfig.Set("Enabled", "true"); 64 jsonStoreConfig.Set("Enabled", "true");
@@ -72,74 +70,129 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
72 70
73 m_scene = new SceneHelpers().SetupScene(); 71 m_scene = new SceneHelpers().SetupScene();
74 SceneHelpers.SetupSceneModules(m_scene, configSource, m_engine, m_smcm, jsm, jssm); 72 SceneHelpers.SetupSceneModules(m_scene, configSource, m_engine, m_smcm, jsm, jssm);
73
74 try
75 {
76 m_smcm.RegisterScriptInvocation(this, "DummyTestMethod");
77 }
78 catch (ArgumentException)
79 {
80 Assert.Ignore("Ignoring test since running on .NET 3.5 or earlier.");
81 }
82
83 // XXX: Unfortunately, ICommsModule currently has no way of deregistering methods.
75 } 84 }
76 85
77// [Test] 86 private object InvokeOp(string name, params object[] args)
87 {
88 return m_smcm.InvokeOperation(UUID.Zero, UUID.Zero, name, args);
89 }
90
91 [Test]
78 public void TestJsonCreateStore() 92 public void TestJsonCreateStore()
79 { 93 {
80 TestHelpers.InMethod(); 94 TestHelpers.InMethod();
81// TestHelpers.EnableLogging(); 95// TestHelpers.EnableLogging();
82 96
83 UUID storeId = (UUID)m_smcm.InvokeOperation(UUID.Zero, UUID.Zero, "JsonCreateStore", new object[] { "{}" }); 97 UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{}");
84
85 Assert.That(storeId, Is.Not.EqualTo(UUID.Zero)); 98 Assert.That(storeId, Is.Not.EqualTo(UUID.Zero));
86 } 99 }
87 100
88// [Test] 101 [Test]
89 public void TestJsonGetValue() 102 public void TestJsonDestroyStore()
90 { 103 {
91 TestHelpers.InMethod(); 104 TestHelpers.InMethod();
92// TestHelpers.EnableLogging(); 105// TestHelpers.EnableLogging();
93 106
94 UUID storeId 107 UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ 'Hello' : 'World' }");
95 = (UUID)m_smcm.InvokeOperation( 108 int dsrv = (int)InvokeOp("JsonDestroyStore", storeId);
96 UUID.Zero, UUID.Zero, "JsonCreateStore", new object[] { "{ 'Hello' : 'World' }" }); 109
110 Assert.That(dsrv, Is.EqualTo(1));
111
112 int tprv = (int)InvokeOp("JsonTestPath", storeId, "Hello");
113 Assert.That(tprv, Is.EqualTo(0));
114 }
115
116 [Test]
117 public void TestJsonGetValue()
118 {
119 TestHelpers.InMethod();
120// TestHelpers.EnableLogging();
97 121
98 string value 122 UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ 'Hello' : 'World' }");
99 = (string)m_smcm.InvokeOperation(
100 UUID.Zero, UUID.Zero, "JsonGetValue", new object[] { storeId, "Hello" });
101 123
124 string value = (string)InvokeOp("JsonGetValue", storeId, "Hello");
102 Assert.That(value, Is.EqualTo("World")); 125 Assert.That(value, Is.EqualTo("World"));
103 } 126 }
104 127
105// [Test] 128// [Test]
106 public void TestJsonTestPath() 129// public void TestJsonTakeValue()
130// {
131// TestHelpers.InMethod();
132//// TestHelpers.EnableLogging();
133//
134// UUID storeId
135// = (UUID)m_smcm.InvokeOperation(
136// UUID.Zero, UUID.Zero, "JsonCreateStore", new object[] { "{ 'Hello' : 'World' }" });
137//
138// string value
139// = (string)m_smcm.InvokeOperation(
140// UUID.Zero, UUID.Zero, "JsonTakeValue", new object[] { storeId, "Hello" });
141//
142// Assert.That(value, Is.EqualTo("World"));
143//
144// string value2
145// = (string)m_smcm.InvokeOperation(
146// UUID.Zero, UUID.Zero, "JsonGetValue", new object[] { storeId, "Hello" });
147//
148// Assert.That(value, Is.Null);
149// }
150
151 [Test]
152 public void TestJsonRemoveValue()
107 { 153 {
108 TestHelpers.InMethod(); 154 TestHelpers.InMethod();
109// TestHelpers.EnableLogging(); 155// TestHelpers.EnableLogging();
110 156
111 UUID storeId 157 UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ 'Hello' : 'World' }");
112 = (UUID)m_smcm.InvokeOperation( 158
113 UUID.Zero, UUID.Zero, "JsonCreateStore", new object[] { "{ 'Hello' : 'World' }" }); 159 int returnValue = (int)InvokeOp( "JsonRemoveValue", storeId, "Hello");
160 Assert.That(returnValue, Is.EqualTo(1));
161
162 int result = (int)InvokeOp("JsonTestPath", storeId, "Hello");
163 Assert.That(result, Is.EqualTo(0));
164
165 string returnValue2 = (string)InvokeOp("JsonGetValue", storeId, "Hello");
166 Assert.That(returnValue2, Is.EqualTo(""));
167 }
168
169 [Test]
170 public void TestJsonTestPath()
171 {
172 TestHelpers.InMethod();
173// TestHelpers.EnableLogging();
114 174
115 int result 175 UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ 'Hello' : 'World' }");
116 = (int)m_smcm.InvokeOperation(
117 UUID.Zero, UUID.Zero, "JsonTestPath", new object[] { storeId, "Hello" });
118 176
177 int result = (int)InvokeOp("JsonTestPath", storeId, "Hello");
119 Assert.That(result, Is.EqualTo(1)); 178 Assert.That(result, Is.EqualTo(1));
120 } 179 }
121 180
122// [Test] 181 [Test]
123 public void TestJsonSetValue() 182 public void TestJsonSetValue()
124 { 183 {
125 TestHelpers.InMethod(); 184 TestHelpers.InMethod();
126// TestHelpers.EnableLogging(); 185// TestHelpers.EnableLogging();
127 186
128 UUID storeId 187 UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{}");
129 = (UUID)m_smcm.InvokeOperation(
130 UUID.Zero, UUID.Zero, "JsonCreateStore", new object[] { "{ }" });
131
132 int result
133 = (int)m_smcm.InvokeOperation(
134 UUID.Zero, UUID.Zero, "JsonSetValue", new object[] { storeId, "Hello", "World" });
135 188
189 int result = (int)InvokeOp("JsonSetValue", storeId, "Hello", "World");
136 Assert.That(result, Is.EqualTo(1)); 190 Assert.That(result, Is.EqualTo(1));
137 191
138 string value 192 string value = (string)InvokeOp("JsonGetValue", storeId, "Hello");
139 = (string)m_smcm.InvokeOperation(
140 UUID.Zero, UUID.Zero, "JsonGetValue", new object[] { storeId, "Hello" });
141
142 Assert.That(value, Is.EqualTo("World")); 193 Assert.That(value, Is.EqualTo("World"));
143 } 194 }
195
196 public object DummyTestMethod(object o1, object o2, object o3, object o4, object o5) { return null; }
144 } 197 }
145} \ No newline at end of file 198} \ No newline at end of file
diff --git a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs
index a522277..bf23040 100644
--- a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs
+++ b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs
@@ -74,6 +74,8 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests
74 [SetUp] 74 [SetUp]
75 public void Init() 75 public void Init()
76 { 76 {
77 base.SetUp();
78
77 IConfigSource config = new IniConfigSource(); 79 IConfigSource config = new IniConfigSource();
78 config.AddConfig("NPC"); 80 config.AddConfig("NPC");
79 config.Configs["NPC"].Set("Enabled", "true"); 81 config.Configs["NPC"].Set("Enabled", "true");
diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/AssemblyInfo.cs b/OpenSim/Region/Physics/BasicPhysicsPlugin/AssemblyInfo.cs
index fb9cb66..6fd6f7e 100644
--- a/OpenSim/Region/Physics/BasicPhysicsPlugin/AssemblyInfo.cs
+++ b/OpenSim/Region/Physics/BasicPhysicsPlugin/AssemblyInfo.cs
@@ -55,4 +55,4 @@ using System.Runtime.InteropServices;
55// You can specify all values by your own or you can build default build and revision 55// You can specify all values by your own or you can build default build and revision
56// numbers with the '*' character (the default): 56// numbers with the '*' character (the default):
57 57
58[assembly : AssemblyVersion("0.7.5.*")] 58[assembly : AssemblyVersion("0.7.6.*")]
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSAPIXNA.cs b/OpenSim/Region/Physics/BulletSPlugin/BSAPIXNA.cs
index f63d83c..04e77b8 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSAPIXNA.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSAPIXNA.cs
@@ -137,6 +137,7 @@ private sealed class BulletConstraintXNA : BulletConstraint
137 internal int LastEntityProperty = 0; 137 internal int LastEntityProperty = 0;
138 138
139 internal EntityProperties[] UpdatedObjects; 139 internal EntityProperties[] UpdatedObjects;
140 internal Dictionary<uint, GhostObject> specialCollisionObjects;
140 141
141 private static int m_collisionsThisFrame; 142 private static int m_collisionsThisFrame;
142 private BSScene PhysicsScene { get; set; } 143 private BSScene PhysicsScene { get; set; }
@@ -158,7 +159,13 @@ private sealed class BulletConstraintXNA : BulletConstraint
158 { 159 {
159 DiscreteDynamicsWorld world = (pWorld as BulletWorldXNA).world; 160 DiscreteDynamicsWorld world = (pWorld as BulletWorldXNA).world;
160 RigidBody body = ((BulletBodyXNA)pBody).rigidBody; 161 RigidBody body = ((BulletBodyXNA)pBody).rigidBody;
161 world.RemoveRigidBody(body); 162 CollisionObject collisionObject = ((BulletBodyXNA)pBody).body;
163 if (body != null)
164 world.RemoveRigidBody(body);
165 else if (collisionObject != null)
166 world.RemoveCollisionObject(collisionObject);
167 else
168 return false;
162 return true; 169 return true;
163 } 170 }
164 171
@@ -182,7 +189,7 @@ private sealed class BulletConstraintXNA : BulletConstraint
182 189
183 public override void SetRestitution(BulletBody pCollisionObject, float pRestitution) 190 public override void SetRestitution(BulletBody pCollisionObject, float pRestitution)
184 { 191 {
185 CollisionObject collisionObject = (pCollisionObject as BulletBodyXNA).rigidBody; 192 CollisionObject collisionObject = (pCollisionObject as BulletBodyXNA).body;
186 collisionObject.SetRestitution(pRestitution); 193 collisionObject.SetRestitution(pRestitution);
187 } 194 }
188 195
@@ -219,13 +226,13 @@ private sealed class BulletConstraintXNA : BulletConstraint
219 226
220 public override void SetCcdMotionThreshold(BulletBody pCollisionObject, float pccdMotionThreashold) 227 public override void SetCcdMotionThreshold(BulletBody pCollisionObject, float pccdMotionThreashold)
221 { 228 {
222 CollisionObject collisionObject = (pCollisionObject as BulletBodyXNA).rigidBody; 229 CollisionObject collisionObject = (pCollisionObject as BulletBodyXNA).body;
223 collisionObject.SetCcdMotionThreshold(pccdMotionThreashold); 230 collisionObject.SetCcdMotionThreshold(pccdMotionThreashold);
224 } 231 }
225 232
226 public override void SetCcdSweptSphereRadius(BulletBody pCollisionObject, float pCcdSweptSphereRadius) 233 public override void SetCcdSweptSphereRadius(BulletBody pCollisionObject, float pCcdSweptSphereRadius)
227 { 234 {
228 CollisionObject collisionObject = (pCollisionObject as BulletBodyXNA).rigidBody; 235 CollisionObject collisionObject = (pCollisionObject as BulletBodyXNA).body;
229 collisionObject.SetCcdSweptSphereRadius(pCcdSweptSphereRadius); 236 collisionObject.SetCcdSweptSphereRadius(pCcdSweptSphereRadius);
230 } 237 }
231 238
@@ -262,7 +269,7 @@ private sealed class BulletConstraintXNA : BulletConstraint
262 } 269 }
263 else 270 else
264 { 271 {
265 world.AddCollisionObject(rbody); 272 world.AddCollisionObject(cbody);
266 } 273 }
267 cbody.SetWorldTransform(origPos); 274 cbody.SetWorldTransform(origPos);
268 275
@@ -303,7 +310,7 @@ private sealed class BulletConstraintXNA : BulletConstraint
303 310
304 public override bool SetCollisionGroupMask(BulletBody pCollisionObject, uint pGroup, uint pMask) 311 public override bool SetCollisionGroupMask(BulletBody pCollisionObject, uint pGroup, uint pMask)
305 { 312 {
306 CollisionObject collisionObject = (pCollisionObject as BulletBodyXNA).rigidBody; 313 CollisionObject collisionObject = (pCollisionObject as BulletBodyXNA).body;
307 collisionObject.GetBroadphaseHandle().m_collisionFilterGroup = (BulletXNA.BulletCollision.CollisionFilterGroups) pGroup; 314 collisionObject.GetBroadphaseHandle().m_collisionFilterGroup = (BulletXNA.BulletCollision.CollisionFilterGroups) pGroup;
308 collisionObject.GetBroadphaseHandle().m_collisionFilterGroup = (BulletXNA.BulletCollision.CollisionFilterGroups) pGroup; 315 collisionObject.GetBroadphaseHandle().m_collisionFilterGroup = (BulletXNA.BulletCollision.CollisionFilterGroups) pGroup;
309 if ((uint) collisionObject.GetBroadphaseHandle().m_collisionFilterGroup == 0) 316 if ((uint) collisionObject.GetBroadphaseHandle().m_collisionFilterGroup == 0)
@@ -390,7 +397,7 @@ private sealed class BulletConstraintXNA : BulletConstraint
390 397
391 public override void SetTranslation(BulletBody pCollisionObject, Vector3 _position, Quaternion _orientation) 398 public override void SetTranslation(BulletBody pCollisionObject, Vector3 _position, Quaternion _orientation)
392 { 399 {
393 CollisionObject collisionObject = (pCollisionObject as BulletBodyXNA).rigidBody; 400 CollisionObject collisionObject = (pCollisionObject as BulletBodyXNA).body;
394 IndexedVector3 vposition = new IndexedVector3(_position.X, _position.Y, _position.Z); 401 IndexedVector3 vposition = new IndexedVector3(_position.X, _position.Y, _position.Z);
395 IndexedQuaternion vquaternion = new IndexedQuaternion(_orientation.X, _orientation.Y, _orientation.Z, 402 IndexedQuaternion vquaternion = new IndexedQuaternion(_orientation.X, _orientation.Y, _orientation.Z,
396 _orientation.W); 403 _orientation.W);
@@ -418,8 +425,11 @@ private sealed class BulletConstraintXNA : BulletConstraint
418 public override void SetMassProps(BulletBody pBody, float pphysMass, Vector3 plocalInertia) 425 public override void SetMassProps(BulletBody pBody, float pphysMass, Vector3 plocalInertia)
419 { 426 {
420 RigidBody body = (pBody as BulletBodyXNA).rigidBody; 427 RigidBody body = (pBody as BulletBodyXNA).rigidBody;
421 IndexedVector3 inertia = new IndexedVector3(plocalInertia.X, plocalInertia.Y, plocalInertia.Z); 428 if (body != null) // Can't set mass props on collision object.
422 body.SetMassProps(pphysMass, inertia); 429 {
430 IndexedVector3 inertia = new IndexedVector3(plocalInertia.X, plocalInertia.Y, plocalInertia.Z);
431 body.SetMassProps(pphysMass, inertia);
432 }
423 } 433 }
424 434
425 435
@@ -432,7 +442,7 @@ private sealed class BulletConstraintXNA : BulletConstraint
432 442
433 public override void SetFriction(BulletBody pCollisionObject, float _currentFriction) 443 public override void SetFriction(BulletBody pCollisionObject, float _currentFriction)
434 { 444 {
435 CollisionObject collisionObject = (pCollisionObject as BulletBodyXNA).rigidBody; 445 CollisionObject collisionObject = (pCollisionObject as BulletBodyXNA).body;
436 collisionObject.SetFriction(_currentFriction); 446 collisionObject.SetFriction(_currentFriction);
437 } 447 }
438 448
@@ -459,7 +469,7 @@ private sealed class BulletConstraintXNA : BulletConstraint
459 469
460 public override CollisionFlags RemoveFromCollisionFlags(BulletBody pCollisionObject, CollisionFlags pcollisionFlags) 470 public override CollisionFlags RemoveFromCollisionFlags(BulletBody pCollisionObject, CollisionFlags pcollisionFlags)
461 { 471 {
462 CollisionObject collisionObject = (pCollisionObject as BulletBodyXNA).rigidBody; 472 CollisionObject collisionObject = (pCollisionObject as BulletBodyXNA).body;
463 CollisionFlags existingcollisionFlags = (CollisionFlags)(uint)collisionObject.GetCollisionFlags(); 473 CollisionFlags existingcollisionFlags = (CollisionFlags)(uint)collisionObject.GetCollisionFlags();
464 existingcollisionFlags &= ~pcollisionFlags; 474 existingcollisionFlags &= ~pcollisionFlags;
465 collisionObject.SetCollisionFlags((BulletXNA.BulletCollision.CollisionFlags)(uint)existingcollisionFlags); 475 collisionObject.SetCollisionFlags((BulletXNA.BulletCollision.CollisionFlags)(uint)existingcollisionFlags);
@@ -494,8 +504,11 @@ private sealed class BulletConstraintXNA : BulletConstraint
494 public override void SetGravity(BulletBody pBody, Vector3 pGravity) 504 public override void SetGravity(BulletBody pBody, Vector3 pGravity)
495 { 505 {
496 RigidBody body = (pBody as BulletBodyXNA).rigidBody; 506 RigidBody body = (pBody as BulletBodyXNA).rigidBody;
497 IndexedVector3 gravity = new IndexedVector3(pGravity.X, pGravity.Y, pGravity.Z); 507 if (body != null) // Can't set collisionobject.set gravity
498 body.SetGravity(gravity); 508 {
509 IndexedVector3 gravity = new IndexedVector3(pGravity.X, pGravity.Y, pGravity.Z);
510 body.SetGravity(gravity);
511 }
499 } 512 }
500 513
501 public override bool DestroyConstraint(BulletWorld pWorld, BulletConstraint pConstraint) 514 public override bool DestroyConstraint(BulletWorld pWorld, BulletConstraint pConstraint)
@@ -733,7 +746,8 @@ private sealed class BulletConstraintXNA : BulletConstraint
733 public override void UpdateInertiaTensor(BulletBody pBody) 746 public override void UpdateInertiaTensor(BulletBody pBody)
734 { 747 {
735 RigidBody body = (pBody as BulletBodyXNA).rigidBody; 748 RigidBody body = (pBody as BulletBodyXNA).rigidBody;
736 body.UpdateInertiaTensor(); 749 if (body != null) // can't update inertia tensor on CollisionObject
750 body.UpdateInertiaTensor();
737 } 751 }
738 752
739 public override void RecalculateCompoundShapeLocalAabb(BulletShape pCompoundShape) 753 public override void RecalculateCompoundShapeLocalAabb(BulletShape pCompoundShape)
@@ -770,7 +784,7 @@ private sealed class BulletConstraintXNA : BulletConstraint
770 784
771 public override CollisionObjectTypes GetBodyType(BulletBody pCollisionObject) 785 public override CollisionObjectTypes GetBodyType(BulletBody pCollisionObject)
772 { 786 {
773 CollisionObject collisionObject = (pCollisionObject as BulletBodyXNA).rigidBody; 787 CollisionObject collisionObject = (pCollisionObject as BulletBodyXNA).body;
774 return (CollisionObjectTypes)(int) collisionObject.GetInternalType(); 788 return (CollisionObjectTypes)(int) collisionObject.GetInternalType();
775 } 789 }
776 790
@@ -889,7 +903,18 @@ private sealed class BulletConstraintXNA : BulletConstraint
889 world.RemoveRigidBody(bo); 903 world.RemoveRigidBody(bo);
890 } 904 }
891 } 905 }
892 906 if (co != null)
907 {
908 if (co.GetUserPointer() != null)
909 {
910 uint localId = (uint) co.GetUserPointer();
911 if (specialCollisionObjects.ContainsKey(localId))
912 {
913 specialCollisionObjects.Remove(localId);
914 }
915 }
916 }
917
893 } 918 }
894 919
895 public override void Shutdown(BulletWorld pWorld) 920 public override void Shutdown(BulletWorld pWorld)
@@ -1050,7 +1075,7 @@ private sealed class BulletConstraintXNA : BulletConstraint
1050 Vector3 worldExtent = new Vector3(Constants.RegionSize, Constants.RegionSize, Constants.RegionHeight); 1075 Vector3 worldExtent = new Vector3(Constants.RegionSize, Constants.RegionSize, Constants.RegionHeight);
1051 m_maxCollisions = maxCollisions; 1076 m_maxCollisions = maxCollisions;
1052 m_maxUpdatesPerFrame = maxUpdates; 1077 m_maxUpdatesPerFrame = maxUpdates;
1053 1078 specialCollisionObjects = new Dictionary<uint, GhostObject>();
1054 1079
1055 return new BulletWorldXNA(1, PhysicsScene, BSAPIXNA.Initialize2(worldExtent, configparms, maxCollisions, ref collisionArray, maxUpdates, ref updateArray, null)); 1080 return new BulletWorldXNA(1, PhysicsScene, BSAPIXNA.Initialize2(worldExtent, configparms, maxCollisions, ref collisionArray, maxUpdates, ref updateArray, null));
1056 } 1081 }
@@ -1310,6 +1335,12 @@ private sealed class BulletConstraintXNA : BulletConstraint
1310 CollisionShape shape = (pShape as BulletShapeXNA).shape; 1335 CollisionShape shape = (pShape as BulletShapeXNA).shape;
1311 gObj.SetCollisionShape(shape); 1336 gObj.SetCollisionShape(shape);
1312 gObj.SetUserPointer(pLocalID); 1337 gObj.SetUserPointer(pLocalID);
1338
1339 if (specialCollisionObjects.ContainsKey(pLocalID))
1340 specialCollisionObjects[pLocalID] = gObj;
1341 else
1342 specialCollisionObjects.Add(pLocalID, gObj);
1343
1313 // TODO: Add to Special CollisionObjects! 1344 // TODO: Add to Special CollisionObjects!
1314 return new BulletBodyXNA(pLocalID, gObj); 1345 return new BulletBodyXNA(pLocalID, gObj);
1315 } 1346 }
@@ -1399,7 +1430,7 @@ private sealed class BulletConstraintXNA : BulletConstraint
1399 } 1430 }
1400 1431
1401 public override BulletShape GetChildShapeFromCompoundShapeIndex(BulletShape cShape, int indx) { 1432 public override BulletShape GetChildShapeFromCompoundShapeIndex(BulletShape cShape, int indx) {
1402 /* TODO */ 1433
1403 if (cShape == null) 1434 if (cShape == null)
1404 return null; 1435 return null;
1405 CompoundShape compoundShape = (cShape as BulletShapeXNA).shape as CompoundShape; 1436 CompoundShape compoundShape = (cShape as BulletShapeXNA).shape as CompoundShape;
@@ -1407,7 +1438,7 @@ private sealed class BulletConstraintXNA : BulletConstraint
1407 BulletShape retShape = new BulletShapeXNA(shape, BSShapeTypeFromBroadPhaseNativeType(shape.GetShapeType())); 1438 BulletShape retShape = new BulletShapeXNA(shape, BSShapeTypeFromBroadPhaseNativeType(shape.GetShapeType()));
1408 1439
1409 1440
1410 return null; 1441 return retShape;
1411 } 1442 }
1412 1443
1413 public BSPhysicsShapeType BSShapeTypeFromBroadPhaseNativeType(BroadphaseNativeTypes pin) 1444 public BSPhysicsShapeType BSShapeTypeFromBroadPhaseNativeType(BroadphaseNativeTypes pin)
@@ -1802,26 +1833,29 @@ private sealed class BulletConstraintXNA : BulletConstraint
1802 numSimSteps = world.StepSimulation(timeStep, m_maxSubSteps, m_fixedTimeStep); 1833 numSimSteps = world.StepSimulation(timeStep, m_maxSubSteps, m_fixedTimeStep);
1803 int updates = 0; 1834 int updates = 0;
1804 1835
1805 1836 PersistentManifold contactManifold;
1806 1837 CollisionObject objA;
1838 CollisionObject objB;
1839 ManifoldPoint manifoldPoint;
1840 PairCachingGhostObject pairCachingGhostObject;
1807 1841
1808 m_collisionsThisFrame = 0; 1842 m_collisionsThisFrame = 0;
1809 int numManifolds = world.GetDispatcher().GetNumManifolds(); 1843 int numManifolds = world.GetDispatcher().GetNumManifolds();
1810 for (int j = 0; j < numManifolds; j++) 1844 for (int j = 0; j < numManifolds; j++)
1811 { 1845 {
1812 PersistentManifold contactManifold = world.GetDispatcher().GetManifoldByIndexInternal(j); 1846 contactManifold = world.GetDispatcher().GetManifoldByIndexInternal(j);
1813 int numContacts = contactManifold.GetNumContacts(); 1847 int numContacts = contactManifold.GetNumContacts();
1814 if (numContacts == 0) 1848 if (numContacts == 0)
1815 continue; 1849 continue;
1816 1850
1817 CollisionObject objA = contactManifold.GetBody0() as CollisionObject; 1851 objA = contactManifold.GetBody0() as CollisionObject;
1818 CollisionObject objB = contactManifold.GetBody1() as CollisionObject; 1852 objB = contactManifold.GetBody1() as CollisionObject;
1819 1853
1820 ManifoldPoint manifoldPoint = contactManifold.GetContactPoint(0); 1854 manifoldPoint = contactManifold.GetContactPoint(0);
1821 IndexedVector3 contactPoint = manifoldPoint.GetPositionWorldOnB(); 1855 //IndexedVector3 contactPoint = manifoldPoint.GetPositionWorldOnB();
1822 IndexedVector3 contactNormal = -manifoldPoint.m_normalWorldOnB; // make relative to A 1856 // IndexedVector3 contactNormal = -manifoldPoint.m_normalWorldOnB; // make relative to A
1823 1857
1824 RecordCollision(this, objA, objB, contactPoint, contactNormal,manifoldPoint.GetDistance()); 1858 RecordCollision(this, objA, objB, manifoldPoint.GetPositionWorldOnB(), -manifoldPoint.m_normalWorldOnB, manifoldPoint.GetDistance());
1825 m_collisionsThisFrame ++; 1859 m_collisionsThisFrame ++;
1826 if (m_collisionsThisFrame >= 9999999) 1860 if (m_collisionsThisFrame >= 9999999)
1827 break; 1861 break;
@@ -1829,12 +1863,19 @@ private sealed class BulletConstraintXNA : BulletConstraint
1829 1863
1830 } 1864 }
1831 1865
1832 updatedEntityCount = LastEntityProperty; 1866 foreach (GhostObject ghostObject in specialCollisionObjects.Values)
1833 updatedEntities = UpdatedObjects; 1867 {
1834 1868 pairCachingGhostObject = ghostObject as PairCachingGhostObject;
1869 if (pairCachingGhostObject != null)
1870 {
1871 RecordGhostCollisions(pairCachingGhostObject);
1872 }
1835 1873
1874 }
1836 1875
1837 1876
1877 updatedEntityCount = LastEntityProperty;
1878 updatedEntities = UpdatedObjects;
1838 1879
1839 collidersCount = LastCollisionDesc; 1880 collidersCount = LastCollisionDesc;
1840 colliders = UpdatedCollisions; 1881 colliders = UpdatedCollisions;
@@ -1860,60 +1901,49 @@ private sealed class BulletConstraintXNA : BulletConstraint
1860 } 1901 }
1861 public void RecordGhostCollisions(PairCachingGhostObject obj) 1902 public void RecordGhostCollisions(PairCachingGhostObject obj)
1862 { 1903 {
1863 /* 1904 IOverlappingPairCache cache = obj.GetOverlappingPairCache();
1864 *void BulletSim::RecordGhostCollisions(btPairCachingGhostObject* obj) 1905 ObjectArray<BroadphasePair> pairs = cache.GetOverlappingPairArray();
1865{ 1906
1866 btManifoldArray manifoldArray; 1907 DiscreteDynamicsWorld world = (PhysicsScene.World as BulletWorldXNA).world;
1867 btBroadphasePairArray& pairArray = obj->getOverlappingPairCache()->getOverlappingPairArray(); 1908 PersistentManifoldArray manifoldArray = new PersistentManifoldArray();
1868 int numPairs = pairArray.size(); 1909 BroadphasePair collisionPair;
1869 1910 PersistentManifold contactManifold;
1870 // For all the pairs of sets of contact points 1911
1871 for (int i=0; i < numPairs; i++) 1912 CollisionObject objA;
1872 { 1913 CollisionObject objB;
1873 if (m_collisionsThisFrame >= m_maxCollisionsPerFrame) 1914
1874 break; 1915 ManifoldPoint pt;
1875 1916
1876 manifoldArray.clear(); 1917 int numPairs = pairs.Count;
1877 const btBroadphasePair& pair = pairArray[i]; 1918
1878 1919 for (int i = 0; i < numPairs; i++)
1879 // The real representation is over in the world pair cache 1920 {
1880 btBroadphasePair* collisionPair = m_worldData.dynamicsWorld->getPairCache()->findPair(pair.m_pProxy0,pair.m_pProxy1); 1921 manifoldArray.Clear();
1881 if (!collisionPair) 1922 if (LastCollisionDesc < UpdatedCollisions.Length)
1882 continue; 1923 break;
1883 1924 collisionPair = world.GetPairCache().FindPair(pairs[i].m_pProxy0, pairs[i].m_pProxy1);
1884 if (collisionPair->m_algorithm) 1925 if (collisionPair == null)
1885 collisionPair->m_algorithm->getAllContactManifolds(manifoldArray); 1926 continue;
1886 1927
1887 // The collision pair has sets of collision points (manifolds) 1928 collisionPair.m_algorithm.GetAllContactManifolds(manifoldArray);
1888 for (int j=0; j < manifoldArray.size(); j++) 1929 for (int j = 0; j < manifoldArray.Count; j++)
1889 { 1930 {
1890 btPersistentManifold* contactManifold = manifoldArray[j]; 1931 contactManifold = manifoldArray[j];
1891 int numContacts = contactManifold->getNumContacts(); 1932 int numContacts = contactManifold.GetNumContacts();
1892 1933 objA = contactManifold.GetBody0() as CollisionObject;
1893 const btCollisionObject* objA = static_cast<const btCollisionObject*>(contactManifold->getBody0()); 1934 objB = contactManifold.GetBody1() as CollisionObject;
1894 const btCollisionObject* objB = static_cast<const btCollisionObject*>(contactManifold->getBody1()); 1935 for (int p = 0; p < numContacts; p++)
1895 1936 {
1896 // TODO: this is a more thurough check than the regular collision code -- 1937 pt = contactManifold.GetContactPoint(p);
1897 // here we find the penetrating contact in the manifold but for regular 1938 if (pt.GetDistance() < 0.0f)
1898 // collisions we assume the first point in the manifold is good enough. 1939 {
1899 // Decide of this extra checking is required or if first point is good enough. 1940 RecordCollision(this, objA, objB, pt.GetPositionWorldOnA(), -pt.m_normalWorldOnB,pt.GetDistance());
1900 for (int p=0; p < numContacts; p++) 1941 break;
1901 { 1942 }
1902 const btManifoldPoint& pt = contactManifold->getContactPoint(p); 1943 }
1903 // If a penetrating contact, this is a hit 1944 }
1904 if (pt.getDistance()<0.f) 1945 }
1905 { 1946
1906 const btVector3& contactPoint = pt.getPositionWorldOnA();
1907 const btVector3& normalOnA = -pt.m_normalWorldOnB;
1908 RecordCollision(objA, objB, contactPoint, normalOnA, pt.getDistance());
1909 // Only one contact point for each set of colliding objects
1910 break;
1911 }
1912 }
1913 }
1914 }
1915}
1916 */
1917 } 1947 }
1918 private static void RecordCollision(BSAPIXNA world, CollisionObject objA, CollisionObject objB, IndexedVector3 contact, IndexedVector3 norm, float penetration) 1948 private static void RecordCollision(BSAPIXNA world, CollisionObject objA, CollisionObject objB, IndexedVector3 contact, IndexedVector3 norm, float penetration)
1919 { 1949 {
@@ -1934,7 +1964,7 @@ private sealed class BulletConstraintXNA : BulletConstraint
1934 contactNormal = -contactNormal; 1964 contactNormal = -contactNormal;
1935 } 1965 }
1936 1966
1937 ulong collisionID = ((ulong) idA << 32) | idB; 1967 //ulong collisionID = ((ulong) idA << 32) | idB;
1938 1968
1939 CollisionDesc cDesc = new CollisionDesc() 1969 CollisionDesc cDesc = new CollisionDesc()
1940 { 1970 {
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSApiTemplate.cs b/OpenSim/Region/Physics/BulletSPlugin/BSApiTemplate.cs
index f25b447..abbd22c 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSApiTemplate.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSApiTemplate.cs
@@ -87,7 +87,7 @@ public enum FixedShapeKey : ulong
87[StructLayout(LayoutKind.Sequential)] 87[StructLayout(LayoutKind.Sequential)]
88public struct ShapeData 88public struct ShapeData
89{ 89{
90 public uint ID; 90 public UInt32 ID;
91 public BSPhysicsShapeType Type; 91 public BSPhysicsShapeType Type;
92 public Vector3 Position; 92 public Vector3 Position;
93 public Quaternion Rotation; 93 public Quaternion Rotation;
@@ -111,7 +111,7 @@ public struct ShapeData
111[StructLayout(LayoutKind.Sequential)] 111[StructLayout(LayoutKind.Sequential)]
112public struct SweepHit 112public struct SweepHit
113{ 113{
114 public uint ID; 114 public UInt32 ID;
115 public float Fraction; 115 public float Fraction;
116 public Vector3 Normal; 116 public Vector3 Normal;
117 public Vector3 Point; 117 public Vector3 Point;
@@ -119,15 +119,15 @@ public struct SweepHit
119[StructLayout(LayoutKind.Sequential)] 119[StructLayout(LayoutKind.Sequential)]
120public struct RaycastHit 120public struct RaycastHit
121{ 121{
122 public uint ID; 122 public UInt32 ID;
123 public float Fraction; 123 public float Fraction;
124 public Vector3 Normal; 124 public Vector3 Normal;
125} 125}
126[StructLayout(LayoutKind.Sequential)] 126[StructLayout(LayoutKind.Sequential)]
127public struct CollisionDesc 127public struct CollisionDesc
128{ 128{
129 public uint aID; 129 public UInt32 aID;
130 public uint bID; 130 public UInt32 bID;
131 public Vector3 point; 131 public Vector3 point;
132 public Vector3 normal; 132 public Vector3 normal;
133 public float penetration; 133 public float penetration;
@@ -135,7 +135,7 @@ public struct CollisionDesc
135[StructLayout(LayoutKind.Sequential)] 135[StructLayout(LayoutKind.Sequential)]
136public struct EntityProperties 136public struct EntityProperties
137{ 137{
138 public uint ID; 138 public UInt32 ID;
139 public Vector3 Position; 139 public Vector3 Position;
140 public Quaternion Rotation; 140 public Quaternion Rotation;
141 public Vector3 Velocity; 141 public Vector3 Velocity;
@@ -325,7 +325,7 @@ public abstract BulletWorld Initialize(Vector3 maxPosition, ConfigurationParamet
325public abstract int PhysicsStep(BulletWorld world, float timeStep, int maxSubSteps, float fixedTimeStep, 325public abstract int PhysicsStep(BulletWorld world, float timeStep, int maxSubSteps, float fixedTimeStep,
326 out int updatedEntityCount, out int collidersCount); 326 out int updatedEntityCount, out int collidersCount);
327 327
328public abstract bool UpdateParameter(BulletWorld world, uint localID, String parm, float value); 328public abstract bool UpdateParameter(BulletWorld world, UInt32 localID, String parm, float value);
329 329
330public abstract void Shutdown(BulletWorld sim); 330public abstract void Shutdown(BulletWorld sim);
331 331
@@ -366,24 +366,24 @@ public abstract void UpdateChildTransform(BulletShape pShape, int childIndex, Ve
366 366
367public abstract void RecalculateCompoundShapeLocalAabb(BulletShape cShape); 367public abstract void RecalculateCompoundShapeLocalAabb(BulletShape cShape);
368 368
369public abstract BulletShape DuplicateCollisionShape(BulletWorld sim, BulletShape srcShape, uint id); 369public abstract BulletShape DuplicateCollisionShape(BulletWorld sim, BulletShape srcShape, UInt32 id);
370 370
371public abstract bool DeleteCollisionShape(BulletWorld world, BulletShape shape); 371public abstract bool DeleteCollisionShape(BulletWorld world, BulletShape shape);
372 372
373public abstract CollisionObjectTypes GetBodyType(BulletBody obj); 373public abstract CollisionObjectTypes GetBodyType(BulletBody obj);
374 374
375public abstract BulletBody CreateBodyFromShape(BulletWorld sim, BulletShape shape, uint id, Vector3 pos, Quaternion rot); 375public abstract BulletBody CreateBodyFromShape(BulletWorld sim, BulletShape shape, UInt32 id, Vector3 pos, Quaternion rot);
376 376
377public abstract BulletBody CreateBodyWithDefaultMotionState(BulletShape shape, uint id, Vector3 pos, Quaternion rot); 377public abstract BulletBody CreateBodyWithDefaultMotionState(BulletShape shape, UInt32 id, Vector3 pos, Quaternion rot);
378 378
379public abstract BulletBody CreateGhostFromShape(BulletWorld sim, BulletShape shape, uint id, Vector3 pos, Quaternion rot); 379public abstract BulletBody CreateGhostFromShape(BulletWorld sim, BulletShape shape, UInt32 id, Vector3 pos, Quaternion rot);
380 380
381public abstract void DestroyObject(BulletWorld sim, BulletBody obj); 381public abstract void DestroyObject(BulletWorld sim, BulletBody obj);
382 382
383// ===================================================================================== 383// =====================================================================================
384public abstract BulletShape CreateGroundPlaneShape(uint id, float height, float collisionMargin); 384public abstract BulletShape CreateGroundPlaneShape(UInt32 id, float height, float collisionMargin);
385 385
386public abstract BulletShape CreateTerrainShape(uint id, Vector3 size, float minHeight, float maxHeight, float[] heightMap, 386public abstract BulletShape CreateTerrainShape(UInt32 id, Vector3 size, float minHeight, float maxHeight, float[] heightMap,
387 float scaleFactor, float collisionMargin); 387 float scaleFactor, float collisionMargin);
388 388
389// ===================================================================================== 389// =====================================================================================
@@ -629,7 +629,7 @@ public abstract BulletConstraint GetConstraintRef(BulletBody obj, int index);
629 629
630public abstract int GetNumConstraintRefs(BulletBody obj); 630public abstract int GetNumConstraintRefs(BulletBody obj);
631 631
632public abstract bool SetCollisionGroupMask(BulletBody body, uint filter, uint mask); 632public abstract bool SetCollisionGroupMask(BulletBody body, UInt32 filter, UInt32 mask);
633 633
634// ===================================================================================== 634// =====================================================================================
635// btCollisionShape entries 635// btCollisionShape entries
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
index 7603254..192bcb5 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
@@ -56,7 +56,6 @@ public sealed class BSCharacter : BSPhysObject
56 private int _physicsActorType; 56 private int _physicsActorType;
57 private bool _isPhysical; 57 private bool _isPhysical;
58 private bool _flying; 58 private bool _flying;
59 private bool _wasWalking; // 'true' if the avatar was walking/moving last frame
60 private bool _setAlwaysRun; 59 private bool _setAlwaysRun;
61 private bool _throttleUpdates; 60 private bool _throttleUpdates;
62 private bool _floatOnWater; 61 private bool _floatOnWater;
@@ -84,7 +83,6 @@ public sealed class BSCharacter : BSPhysObject
84 _position = pos; 83 _position = pos;
85 84
86 _flying = isFlying; 85 _flying = isFlying;
87 _wasWalking = true; // causes first step to initialize standing
88 _orientation = OMV.Quaternion.Identity; 86 _orientation = OMV.Quaternion.Identity;
89 _velocity = OMV.Vector3.Zero; 87 _velocity = OMV.Vector3.Zero;
90 _buoyancy = ComputeBuoyancyFromFlying(isFlying); 88 _buoyancy = ComputeBuoyancyFromFlying(isFlying);
@@ -128,9 +126,9 @@ public sealed class BSCharacter : BSPhysObject
128 DetailLog("{0},BSCharacter.Destroy", LocalID); 126 DetailLog("{0},BSCharacter.Destroy", LocalID);
129 PhysicsScene.TaintedObject("BSCharacter.destroy", delegate() 127 PhysicsScene.TaintedObject("BSCharacter.destroy", delegate()
130 { 128 {
131 PhysicsScene.Shapes.DereferenceBody(PhysBody, true /* inTaintTime */, null /* bodyCallback */); 129 PhysicsScene.Shapes.DereferenceBody(PhysBody, null /* bodyCallback */);
132 PhysBody.Clear(); 130 PhysBody.Clear();
133 PhysicsScene.Shapes.DereferenceShape(PhysShape, true /* inTaintTime */, null /* bodyCallback */); 131 PhysicsScene.Shapes.DereferenceShape(PhysShape, null /* bodyCallback */);
134 PhysShape.Clear(); 132 PhysShape.Clear();
135 }); 133 });
136 } 134 }
@@ -220,7 +218,13 @@ public sealed class BSCharacter : BSPhysObject
220 { 218 {
221 // The avatar shouldn't be moving 219 // The avatar shouldn't be moving
222 _velocityMotor.Zero(); 220 _velocityMotor.Zero();
223 ZeroMotion(true /* inTaintTime */); 221
222 // If we are colliding with a stationary object, presume we're standing and don't move around
223 if (!ColliderIsMoving)
224 {
225 DetailLog("{0},BSCharacter.MoveMotor,collidingWithStationary,zeroingMotion", LocalID);
226 ZeroMotion(true /* inTaintTime */);
227 }
224 228
225 // Standing has more friction on the ground 229 // Standing has more friction on the ground
226 if (_currentFriction != BSParam.AvatarStandingFriction) 230 if (_currentFriction != BSParam.AvatarStandingFriction)
@@ -229,8 +233,6 @@ public sealed class BSCharacter : BSPhysObject
229 PhysicsScene.PE.SetFriction(PhysBody, _currentFriction); 233 PhysicsScene.PE.SetFriction(PhysBody, _currentFriction);
230 } 234 }
231 DetailLog("{0},BSCharacter.MoveMotor,taint,stopping,target={1}", LocalID, _velocityMotor.TargetValue); 235 DetailLog("{0},BSCharacter.MoveMotor,taint,stopping,target={1}", LocalID, _velocityMotor.TargetValue);
232
233 _wasWalking = false;
234 } 236 }
235 else 237 else
236 { 238 {
@@ -260,7 +262,6 @@ public sealed class BSCharacter : BSPhysObject
260 262
261 DetailLog("{0},BSCharacter.MoveMotor,move,stepVel={1},vel={2},mass={3},moveForce={4}", LocalID, stepVelocity, _velocity, Mass, moveForce); 263 DetailLog("{0},BSCharacter.MoveMotor,move,stepVel={1},vel={2},mass={3},moveForce={4}", LocalID, stepVelocity, _velocity, Mass, moveForce);
262 PhysicsScene.PE.ApplyCentralImpulse(PhysBody, moveForce); 264 PhysicsScene.PE.ApplyCentralImpulse(PhysBody, moveForce);
263 _wasWalking = true;
264 } 265 }
265 }); 266 });
266 } 267 }
@@ -556,11 +557,12 @@ public sealed class BSCharacter : BSPhysObject
556 { 557 {
557 get 558 get
558 { 559 {
559 return _velocityMotor.TargetValue; 560 return m_targetVelocity;
560 } 561 }
561 set 562 set
562 { 563 {
563 DetailLog("{0},BSCharacter.setTargetVelocity,call,vel={1}", LocalID, value); 564 DetailLog("{0},BSCharacter.setTargetVelocity,call,vel={1}", LocalID, value);
565 m_targetVelocity = value;
564 OMV.Vector3 targetVel = value; 566 OMV.Vector3 targetVel = value;
565 if (_setAlwaysRun) 567 if (_setAlwaysRun)
566 targetVel *= BSParam.AvatarAlwaysRunFactor; 568 targetVel *= BSParam.AvatarAlwaysRunFactor;
@@ -590,7 +592,6 @@ public sealed class BSCharacter : BSPhysObject
590 _velocityMotor.Reset(); 592 _velocityMotor.Reset();
591 _velocityMotor.SetCurrent(_velocity); 593 _velocityMotor.SetCurrent(_velocity);
592 _velocityMotor.SetTarget(_velocity); 594 _velocityMotor.SetTarget(_velocity);
593 // Even though the motor is initialized, it's not used and the velocity goes straight into the avatar.
594 _velocityMotor.Enabled = false; 595 _velocityMotor.Enabled = false;
595 596
596 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 7ad7c89..8ecf2ff 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
@@ -125,9 +125,9 @@ namespace OpenSim.Region.Physics.BulletSPlugin
125 static readonly float PIOverTwo = ((float)Math.PI) / 2f; 125 static readonly float PIOverTwo = ((float)Math.PI) / 2f;
126 126
127 // For debugging, flags to turn on and off individual corrections. 127 // For debugging, flags to turn on and off individual corrections.
128 private bool enableAngularVerticalAttraction; 128 public bool enableAngularVerticalAttraction;
129 private bool enableAngularDeflection; 129 public bool enableAngularDeflection;
130 private bool enableAngularBanking; 130 public bool enableAngularBanking;
131 131
132 public BSDynamics(BSScene myScene, BSPrim myPrim) 132 public BSDynamics(BSScene myScene, BSPrim myPrim)
133 { 133 {
@@ -146,7 +146,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
146 enableAngularBanking = false; 146 enableAngularBanking = false;
147 if (BSParam.VehicleDebuggingEnabled != ConfigurationParameters.numericFalse) 147 if (BSParam.VehicleDebuggingEnabled != ConfigurationParameters.numericFalse)
148 { 148 {
149 enableAngularVerticalAttraction = false; 149 enableAngularVerticalAttraction = true;
150 enableAngularDeflection = false; 150 enableAngularDeflection = false;
151 enableAngularBanking = false; 151 enableAngularBanking = false;
152 } 152 }
@@ -165,7 +165,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
165 } 165 }
166 166
167 #region Vehicle parameter setting 167 #region Vehicle parameter setting
168 internal void ProcessFloatVehicleParam(Vehicle pParam, float pValue) 168 public void ProcessFloatVehicleParam(Vehicle pParam, float pValue)
169 { 169 {
170 VDetailLog("{0},ProcessFloatVehicleParam,param={1},val={2}", Prim.LocalID, pParam, pValue); 170 VDetailLog("{0},ProcessFloatVehicleParam,param={1},val={2}", Prim.LocalID, pParam, pValue);
171 switch (pParam) 171 switch (pParam)
@@ -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 {
@@ -591,14 +600,15 @@ namespace OpenSim.Region.Physics.BulletSPlugin
591 m_vehicleMass = Prim.Linkset.LinksetMass; 600 m_vehicleMass = Prim.Linkset.LinksetMass;
592 601
593 // Friction affects are handled by this vehicle code 602 // Friction affects are handled by this vehicle code
594 float friction = 0f; 603 PhysicsScene.PE.SetFriction(Prim.PhysBody, BSParam.VehicleFriction);
595 PhysicsScene.PE.SetFriction(Prim.PhysBody, friction); 604 PhysicsScene.PE.SetRestitution(Prim.PhysBody, BSParam.VehicleRestitution);
596 605
597 // Moderate angular movement introduced by Bullet. 606 // Moderate angular movement introduced by Bullet.
598 // TODO: possibly set AngularFactor and LinearFactor for the type of vehicle. 607 // TODO: possibly set AngularFactor and LinearFactor for the type of vehicle.
599 // Maybe compute linear and angular factor and damping from params. 608 // Maybe compute linear and angular factor and damping from params.
600 float angularDamping = BSParam.VehicleAngularDamping; 609 PhysicsScene.PE.SetAngularDamping(Prim.PhysBody, BSParam.VehicleAngularDamping);
601 PhysicsScene.PE.SetAngularDamping(Prim.PhysBody, angularDamping); 610 PhysicsScene.PE.SetLinearFactor(Prim.PhysBody, BSParam.VehicleLinearFactorV);
611 PhysicsScene.PE.SetAngularFactorV(Prim.PhysBody, BSParam.VehicleAngularFactorV);
602 612
603 // Vehicles report collision events so we know when it's on the ground 613 // Vehicles report collision events so we know when it's on the ground
604 PhysicsScene.PE.AddToCollisionFlags(Prim.PhysBody, CollisionFlags.BS_VEHICLE_COLLISIONS); 614 PhysicsScene.PE.AddToCollisionFlags(Prim.PhysBody, CollisionFlags.BS_VEHICLE_COLLISIONS);
@@ -613,31 +623,23 @@ namespace OpenSim.Region.Physics.BulletSPlugin
613 // 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.
614 PhysicsScene.PE.SetGravity(Prim.PhysBody, Vector3.Zero); 624 PhysicsScene.PE.SetGravity(Prim.PhysBody, Vector3.Zero);
615 625
616 VDetailLog("{0},BSDynamics.Refresh,mass={1},frict={2},inert={3},aDamp={4},grav={5}", 626 VDetailLog("{0},BSDynamics.SetPhysicalParameters,mass={1},inert={2},vehGrav={3},aDamp={4},frict={5},rest={6},lFact={7},aFact={8}",
617 Prim.LocalID, m_vehicleMass, friction, Prim.Inertia, angularDamping, m_VehicleGravity); 627 Prim.LocalID, m_vehicleMass, Prim.Inertia, m_VehicleGravity,
628 BSParam.VehicleAngularDamping, BSParam.VehicleFriction, BSParam.VehicleRestitution,
629 BSParam.VehicleLinearFactor, BSParam.VehicleAngularFactor
630 );
618 } 631 }
619 else 632 else
620 { 633 {
621 PhysicsScene.PE.RemoveFromCollisionFlags(Prim.PhysBody, CollisionFlags.BS_VEHICLE_COLLISIONS); 634 if (Prim.PhysBody.HasPhysicalBody)
635 PhysicsScene.PE.RemoveFromCollisionFlags(Prim.PhysBody, CollisionFlags.BS_VEHICLE_COLLISIONS);
622 } 636 }
623 } 637 }
624 638
625 public bool RemoveBodyDependencies(BSPhysObject prim) 639 public bool RemoveBodyDependencies(BSPhysObject prim)
626 { 640 {
627 // If active, we need to add our properties back when the body is rebuilt.
628 return IsActive;
629 }
630
631 public void RestoreBodyDependencies(BSPhysObject prim)
632 {
633 if (Prim.LocalID != prim.LocalID)
634 {
635 // The call should be on us by our prim. Error if not.
636 PhysicsScene.Logger.ErrorFormat("{0} RestoreBodyDependencies: called by not my prim. passedLocalID={1}, vehiclePrimLocalID={2}",
637 LogHeader, prim.LocalID, Prim.LocalID);
638 return;
639 }
640 Refresh(); 641 Refresh();
642 return IsActive;
641 } 643 }
642 644
643 #region Known vehicle value functions 645 #region Known vehicle value functions
@@ -673,13 +675,13 @@ namespace OpenSim.Region.Physics.BulletSPlugin
673 private const int m_knownChangedWaterLevel = 1 << 9; 675 private const int m_knownChangedWaterLevel = 1 << 9;
674 private const int m_knownChangedForwardVelocity = 1 <<10; 676 private const int m_knownChangedForwardVelocity = 1 <<10;
675 677
676 private void ForgetKnownVehicleProperties() 678 public void ForgetKnownVehicleProperties()
677 { 679 {
678 m_knownHas = 0; 680 m_knownHas = 0;
679 m_knownChanged = 0; 681 m_knownChanged = 0;
680 } 682 }
681 // Push all the changed values back into the physics engine 683 // Push all the changed values back into the physics engine
682 private void PushKnownChanged() 684 public void PushKnownChanged()
683 { 685 {
684 if (m_knownChanged != 0) 686 if (m_knownChanged != 0)
685 { 687 {
@@ -799,7 +801,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
799 m_knownVelocity = Prim.ForceVelocity; 801 m_knownVelocity = Prim.ForceVelocity;
800 m_knownHas |= m_knownChangedVelocity; 802 m_knownHas |= m_knownChangedVelocity;
801 } 803 }
802 return (Vector3)m_knownVelocity; 804 return m_knownVelocity;
803 } 805 }
804 set 806 set
805 { 807 {
@@ -898,9 +900,6 @@ namespace OpenSim.Region.Physics.BulletSPlugin
898 { 900 {
899 if (!IsActive) return; 901 if (!IsActive) return;
900 902
901 if (PhysicsScene.VehiclePhysicalLoggingEnabled)
902 PhysicsScene.PE.DumpRigidBody(PhysicsScene.World, Prim.PhysBody);
903
904 ForgetKnownVehicleProperties(); 903 ForgetKnownVehicleProperties();
905 904
906 MoveLinear(pTimestep); 905 MoveLinear(pTimestep);
@@ -922,6 +921,15 @@ namespace OpenSim.Region.Physics.BulletSPlugin
922 Prim.LocalID, VehiclePosition, m_knownForce, VehicleVelocity, VehicleRotationalVelocity); 921 Prim.LocalID, VehiclePosition, m_knownForce, VehicleVelocity, VehicleRotationalVelocity);
923 } 922 }
924 923
924 // Called after the simulation step
925 internal void PostStep(float pTimestep)
926 {
927 if (!IsActive) return;
928
929 if (PhysicsScene.VehiclePhysicalLoggingEnabled)
930 PhysicsScene.PE.DumpRigidBody(PhysicsScene.World, Prim.PhysBody);
931 }
932
925 // Apply the effect of the linear motor and other linear motions (like hover and float). 933 // Apply the effect of the linear motor and other linear motions (like hover and float).
926 private void MoveLinear(float pTimestep) 934 private void MoveLinear(float pTimestep)
927 { 935 {
@@ -953,10 +961,13 @@ namespace OpenSim.Region.Physics.BulletSPlugin
953 // ================================================================== 961 // ==================================================================
954 // Clamp high or low velocities 962 // Clamp high or low velocities
955 float newVelocityLengthSq = VehicleVelocity.LengthSquared(); 963 float newVelocityLengthSq = VehicleVelocity.LengthSquared();
956 if (newVelocityLengthSq > BSParam.VehicleMaxLinearVelocity) 964 if (newVelocityLengthSq > BSParam.VehicleMaxLinearVelocitySq)
957 { 965 {
966 Vector3 origVelW = VehicleVelocity; // DEBUG DEBUG
958 VehicleVelocity /= VehicleVelocity.Length(); 967 VehicleVelocity /= VehicleVelocity.Length();
959 VehicleVelocity *= BSParam.VehicleMaxLinearVelocity; 968 VehicleVelocity *= BSParam.VehicleMaxLinearVelocity;
969 VDetailLog("{0}, MoveLinear,clampMax,origVelW={1},lenSq={2},maxVelSq={3},,newVelW={4}",
970 Prim.LocalID, origVelW, newVelocityLengthSq, BSParam.VehicleMaxLinearVelocitySq, VehicleVelocity);
960 } 971 }
961 else if (newVelocityLengthSq < 0.001f) 972 else if (newVelocityLengthSq < 0.001f)
962 VehicleVelocity = Vector3.Zero; 973 VehicleVelocity = Vector3.Zero;
@@ -968,8 +979,9 @@ namespace OpenSim.Region.Physics.BulletSPlugin
968 public void ComputeLinearVelocity(float pTimestep) 979 public void ComputeLinearVelocity(float pTimestep)
969 { 980 {
970 // Step the motor from the current value. Get the correction needed this step. 981 // Step the motor from the current value. Get the correction needed this step.
971 Vector3 currentVel = VehicleVelocity * Quaternion.Inverse(VehicleOrientation); 982 Vector3 origVelW = VehicleVelocity; // DEBUG
972 Vector3 linearMotorCorrectionV = m_linearMotor.Step(pTimestep, currentVel); 983 Vector3 currentVelV = VehicleVelocity * Quaternion.Inverse(VehicleOrientation);
984 Vector3 linearMotorCorrectionV = m_linearMotor.Step(pTimestep, currentVelV);
973 985
974 // Motor is vehicle coordinates. Rotate it to world coordinates 986 // Motor is vehicle coordinates. Rotate it to world coordinates
975 Vector3 linearMotorVelocityW = linearMotorCorrectionV * VehicleOrientation; 987 Vector3 linearMotorVelocityW = linearMotorCorrectionV * VehicleOrientation;
@@ -984,8 +996,8 @@ namespace OpenSim.Region.Physics.BulletSPlugin
984 // Add this correction to the velocity to make it faster/slower. 996 // Add this correction to the velocity to make it faster/slower.
985 VehicleVelocity += linearMotorVelocityW; 997 VehicleVelocity += linearMotorVelocityW;
986 998
987 VDetailLog("{0}, MoveLinear,velocity,vehVel={1},correction={2},force={3}", 999 VDetailLog("{0}, MoveLinear,velocity,origVelW={1},velV={2},correctV={3},correctW={4},newVelW={5}",
988 Prim.LocalID, VehicleVelocity, linearMotorCorrectionV, linearMotorVelocityW); 1000 Prim.LocalID, origVelW, currentVelV, linearMotorCorrectionV, linearMotorVelocityW, VehicleVelocity);
989 } 1001 }
990 1002
991 public void ComputeLinearTerrainHeightCorrection(float pTimestep) 1003 public void ComputeLinearTerrainHeightCorrection(float pTimestep)
@@ -1185,12 +1197,12 @@ namespace OpenSim.Region.Physics.BulletSPlugin
1185 1197
1186 // Hack to reduce downward force if the vehicle is probably sitting on the ground 1198 // Hack to reduce downward force if the vehicle is probably sitting on the ground
1187 if (Prim.IsColliding && IsGroundVehicle) 1199 if (Prim.IsColliding && IsGroundVehicle)
1188 appliedGravity *= 0.2f; 1200 appliedGravity *= BSParam.VehicleGroundGravityFudge;
1189 1201
1190 VehicleAddForce(appliedGravity); 1202 VehicleAddForce(appliedGravity);
1191 1203
1192 VDetailLog("{0}, MoveLinear,applyGravity,vehGrav={1},appliedForce-{2}", 1204 VDetailLog("{0}, MoveLinear,applyGravity,vehGrav={1},collid={2},appliedForce={3}",
1193 Prim.LocalID, m_VehicleGravity, appliedGravity); 1205 Prim.LocalID, m_VehicleGravity, Prim.IsColliding, appliedGravity);
1194 } 1206 }
1195 1207
1196 // ======================================================================= 1208 // =======================================================================
@@ -1292,6 +1304,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
1292 if (enableAngularVerticalAttraction && m_verticalAttractionTimescale < m_verticalAttractionCutoff) 1304 if (enableAngularVerticalAttraction && m_verticalAttractionTimescale < m_verticalAttractionCutoff)
1293 { 1305 {
1294 Vector3 vertContributionV = Vector3.Zero; 1306 Vector3 vertContributionV = Vector3.Zero;
1307 Vector3 origRotVelW = VehicleRotationalVelocity; // DEBUG DEBUG
1295 1308
1296 // Take a vector pointing up and convert it from world to vehicle relative coords. 1309 // Take a vector pointing up and convert it from world to vehicle relative coords.
1297 Vector3 verticalError = Vector3.UnitZ * VehicleOrientation; 1310 Vector3 verticalError = Vector3.UnitZ * VehicleOrientation;
@@ -1319,13 +1332,14 @@ namespace OpenSim.Region.Physics.BulletSPlugin
1319 1332
1320 // 'vertContrbution' is now the necessary angular correction to correct tilt in one second. 1333 // 'vertContrbution' is now the necessary angular correction to correct tilt in one second.
1321 // Correction happens over a number of seconds. 1334 // Correction happens over a number of seconds.
1322 Vector3 unscaledContrib = vertContributionV; // DEBUG DEBUG 1335 Vector3 unscaledContribVerticalErrorV = vertContributionV; // DEBUG DEBUG
1323 vertContributionV /= m_verticalAttractionTimescale; 1336 vertContributionV /= m_verticalAttractionTimescale;
1324 1337
1325 VehicleRotationalVelocity += vertContributionV * VehicleOrientation; 1338 VehicleRotationalVelocity += vertContributionV * VehicleOrientation;
1326 1339
1327 VDetailLog("{0}, MoveAngular,verticalAttraction,,verticalError={1},unscaled={2},eff={3},ts={4},vertAttr={5}", 1340 VDetailLog("{0}, MoveAngular,verticalAttraction,,origRotVW={1},vertError={2},unscaledV={3},eff={4},ts={5},vertContribV={6}",
1328 Prim.LocalID, verticalError, unscaledContrib, m_verticalAttractionEfficiency, m_verticalAttractionTimescale, vertContributionV); 1341 Prim.LocalID, origRotVelW, verticalError, unscaledContribVerticalErrorV,
1342 m_verticalAttractionEfficiency, m_verticalAttractionTimescale, vertContributionV);
1329 } 1343 }
1330 } 1344 }
1331 1345
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs
index 2c8dd23..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 = false; // 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/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs
index 06186b0..8c098b2 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs
@@ -82,9 +82,19 @@ public static class BSParam
82 public static float AvatarStepApproachFactor { get; private set; } 82 public static float AvatarStepApproachFactor { get; private set; }
83 public static float AvatarStepForceFactor { get; private set; } 83 public static float AvatarStepForceFactor { get; private set; }
84 84
85 // Vehicle parameters
85 public static float VehicleMaxLinearVelocity { get; private set; } 86 public static float VehicleMaxLinearVelocity { get; private set; }
87 public static float VehicleMaxLinearVelocitySq { get; private set; }
86 public static float VehicleMaxAngularVelocity { get; private set; } 88 public static float VehicleMaxAngularVelocity { get; private set; }
89 public static float VehicleMaxAngularVelocitySq { get; private set; }
87 public static float VehicleAngularDamping { get; private set; } 90 public static float VehicleAngularDamping { get; private set; }
91 public static float VehicleFriction { get; private set; }
92 public static float VehicleRestitution { get; private set; }
93 public static float VehicleLinearFactor { get; private set; }
94 public static Vector3 VehicleLinearFactorV { get; private set; }
95 public static float VehicleAngularFactor { get; private set; }
96 public static Vector3 VehicleAngularFactorV { get; private set; }
97 public static float VehicleGroundGravityFudge { get; private set; }
88 public static float VehicleDebuggingEnabled { get; private set; } 98 public static float VehicleDebuggingEnabled { get; private set; }
89 99
90 public static float LinksetImplementation { get; private set; } 100 public static float LinksetImplementation { get; private set; }
@@ -373,7 +383,7 @@ public static class BSParam
373 (s) => { return TerrainRestitution; }, 383 (s) => { return TerrainRestitution; },
374 (s,p,l,v) => { TerrainRestitution = v; /* TODO: set on real terrain */ } ), 384 (s,p,l,v) => { TerrainRestitution = v; /* TODO: set on real terrain */ } ),
375 new ParameterDefn("TerrainCollisionMargin", "Margin where collision checking starts" , 385 new ParameterDefn("TerrainCollisionMargin", "Margin where collision checking starts" ,
376 0.04f, 386 0.08f,
377 (s,cf,p,v) => { TerrainCollisionMargin = cf.GetFloat(p, v); }, 387 (s,cf,p,v) => { TerrainCollisionMargin = cf.GetFloat(p, v); },
378 (s) => { return TerrainCollisionMargin; }, 388 (s) => { return TerrainCollisionMargin; },
379 (s,p,l,v) => { TerrainCollisionMargin = v; /* TODO: set on real terrain */ } ), 389 (s,p,l,v) => { TerrainCollisionMargin = v; /* TODO: set on real terrain */ } ),
@@ -443,17 +453,42 @@ public static class BSParam
443 1000.0f, 453 1000.0f,
444 (s,cf,p,v) => { VehicleMaxLinearVelocity = cf.GetFloat(p, v); }, 454 (s,cf,p,v) => { VehicleMaxLinearVelocity = cf.GetFloat(p, v); },
445 (s) => { return (float)VehicleMaxLinearVelocity; }, 455 (s) => { return (float)VehicleMaxLinearVelocity; },
446 (s,p,l,v) => { VehicleMaxLinearVelocity = v; } ), 456 (s,p,l,v) => { VehicleMaxLinearVelocity = v; VehicleMaxLinearVelocitySq = v * v; } ),
447 new ParameterDefn("VehicleMaxAngularVelocity", "Maximum rotational velocity magnitude that can be assigned to a vehicle", 457 new ParameterDefn("VehicleMaxAngularVelocity", "Maximum rotational velocity magnitude that can be assigned to a vehicle",
448 12.0f, 458 12.0f,
449 (s,cf,p,v) => { VehicleMaxAngularVelocity = cf.GetFloat(p, v); }, 459 (s,cf,p,v) => { VehicleMaxAngularVelocity = cf.GetFloat(p, v); },
450 (s) => { return (float)VehicleMaxAngularVelocity; }, 460 (s) => { return (float)VehicleMaxAngularVelocity; },
451 (s,p,l,v) => { VehicleMaxAngularVelocity = v; } ), 461 (s,p,l,v) => { VehicleMaxAngularVelocity = v; VehicleMaxAngularVelocitySq = v * v; } ),
452 new ParameterDefn("VehicleAngularDamping", "Factor to damp vehicle angular movement per second (0.0 - 1.0)", 462 new ParameterDefn("VehicleAngularDamping", "Factor to damp vehicle angular movement per second (0.0 - 1.0)",
453 0.0f, 463 0.0f,
454 (s,cf,p,v) => { VehicleAngularDamping = cf.GetFloat(p, v); }, 464 (s,cf,p,v) => { VehicleAngularDamping = cf.GetFloat(p, v); },
455 (s) => { return VehicleAngularDamping; }, 465 (s) => { return VehicleAngularDamping; },
456 (s,p,l,v) => { VehicleAngularDamping = v; } ), 466 (s,p,l,v) => { VehicleAngularDamping = v; } ),
467 new ParameterDefn("VehicleLinearFactor", "Fraction of physical linear changes applied to vehicle (0.0 - 1.0)",
468 1.0f,
469 (s,cf,p,v) => { VehicleLinearFactor = cf.GetFloat(p, v); },
470 (s) => { return VehicleLinearFactor; },
471 (s,p,l,v) => { VehicleLinearFactor = v; VehicleLinearFactorV = new Vector3(v, v, v); } ),
472 new ParameterDefn("VehicleAngularFactor", "Fraction of physical angular changes applied to vehicle (0.0 - 1.0)",
473 1.0f,
474 (s,cf,p,v) => { VehicleAngularFactor = cf.GetFloat(p, v); },
475 (s) => { return VehicleAngularFactor; },
476 (s,p,l,v) => { VehicleAngularFactor = v; VehicleAngularFactorV = new Vector3(v, v, v); } ),
477 new ParameterDefn("VehicleFriction", "Friction of vehicle on the ground (0.0 - 1.0)",
478 0.0f,
479 (s,cf,p,v) => { VehicleFriction = cf.GetFloat(p, v); },
480 (s) => { return VehicleFriction; },
481 (s,p,l,v) => { VehicleFriction = v; } ),
482 new ParameterDefn("VehicleRestitution", "Bouncyness factor for vehicles (0.0 - 1.0)",
483 0.0f,
484 (s,cf,p,v) => { VehicleRestitution = cf.GetFloat(p, v); },
485 (s) => { return VehicleRestitution; },
486 (s,p,l,v) => { VehicleRestitution = v; } ),
487 new ParameterDefn("VehicleGroundGravityFudge", "Factor to multiple gravity if a ground vehicle is probably on the ground (0.0 - 1.0)",
488 0.2f,
489 (s,cf,p,v) => { VehicleGroundGravityFudge = cf.GetFloat(p, v); },
490 (s) => { return VehicleGroundGravityFudge; },
491 (s,p,l,v) => { VehicleGroundGravityFudge = v; } ),
457 new ParameterDefn("VehicleDebuggingEnable", "Turn on/off vehicle debugging", 492 new ParameterDefn("VehicleDebuggingEnable", "Turn on/off vehicle debugging",
458 ConfigurationParameters.numericFalse, 493 ConfigurationParameters.numericFalse,
459 (s,cf,p,v) => { VehicleDebuggingEnabled = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); }, 494 (s,cf,p,v) => { VehicleDebuggingEnabled = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); },
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs
index 027c786..823402b 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs
@@ -95,12 +95,16 @@ public abstract class BSPhysObject : PhysicsActor
95 SubscribedEventsMs = 0; 95 SubscribedEventsMs = 0;
96 CollidingStep = 0; 96 CollidingStep = 0;
97 CollidingGroundStep = 0; 97 CollidingGroundStep = 0;
98 CollisionAccumulation = 0;
99 ColliderIsMoving = false;
100 CollisionScore = 0;
98 } 101 }
99 102
100 // Tell the object to clean up. 103 // Tell the object to clean up.
101 public virtual void Destroy() 104 public virtual void Destroy()
102 { 105 {
103 UnRegisterAllPreStepActions(); 106 UnRegisterAllPreStepActions();
107 UnRegisterAllPostStepActions();
104 } 108 }
105 109
106 public BSScene PhysicsScene { get; protected set; } 110 public BSScene PhysicsScene { get; protected set; }
@@ -174,29 +178,18 @@ public abstract class BSPhysObject : PhysicsActor
174 public abstract OMV.Vector3 RawPosition { get; set; } 178 public abstract OMV.Vector3 RawPosition { get; set; }
175 public abstract OMV.Vector3 ForcePosition { get; set; } 179 public abstract OMV.Vector3 ForcePosition { get; set; }
176 180
177 // Position is what the simulator thinks the positions of the prim is. 181 // 'Position' and 'Orientation' is what the simulator thinks the positions of the prim is.
178 // Because Bullet needs the zero coordinate to be the center of mass of the linkset, 182 // Because Bullet needs the zero coordinate to be the center of mass of the linkset,
179 // sometimes it is necessary to displace the position the physics engine thinks 183 // sometimes it is necessary to displace the position the physics engine thinks
180 // the position is. PositionDisplacement must be added and removed from the 184 // the position is. PositionDisplacement must be added and removed from the
181 // position as the simulator position is stored and fetched from the physics 185 // position as the simulator position is stored and fetched from the physics
182 // engine. 186 // engine. Similar to OrientationDisplacement.
183 public virtual OMV.Vector3 PositionDisplacement { get; set; } 187 public virtual OMV.Vector3 PositionDisplacement { get; set; }
188 public virtual OMV.Quaternion OrientationDisplacement { get; set; }
184 189
185 public abstract OMV.Quaternion RawOrientation { get; set; } 190 public abstract OMV.Quaternion RawOrientation { get; set; }
186 public abstract OMV.Quaternion ForceOrientation { get; set; } 191 public abstract OMV.Quaternion ForceOrientation { get; set; }
187 192
188 // The system is telling us the velocity it wants to move at.
189 // Velocity in world coordinates.
190 // protected OMV.Vector3 m_targetVelocity; // use the definition in PhysicsActor
191 public override OMV.Vector3 TargetVelocity
192 {
193 get { return m_targetVelocity; }
194 set
195 {
196 m_targetVelocity = value;
197 Velocity = value;
198 }
199 }
200 public virtual float TargetSpeed 193 public virtual float TargetSpeed
201 { 194 {
202 get 195 get
@@ -237,6 +230,12 @@ public abstract class BSPhysObject : PhysicsActor
237 protected long CollidingObjectStep { get; set; } 230 protected long CollidingObjectStep { get; set; }
238 // The collision flags we think are set in Bullet 231 // The collision flags we think are set in Bullet
239 protected CollisionFlags CurrentCollisionFlags { get; set; } 232 protected CollisionFlags CurrentCollisionFlags { get; set; }
233 // On a collision, check the collider and remember if the last collider was moving
234 // Used to modify the standing of avatars (avatars on stationary things stand still)
235 protected bool ColliderIsMoving;
236
237 // Count of collisions for this object
238 protected long CollisionAccumulation { get; set; }
240 239
241 public override bool IsColliding { 240 public override bool IsColliding {
242 get { return (CollidingStep == PhysicsScene.SimulationStep); } 241 get { return (CollidingStep == PhysicsScene.SimulationStep); }
@@ -299,7 +298,12 @@ public abstract class BSPhysObject : PhysicsActor
299 return ret; 298 return ret;
300 } 299 }
301 300
302 // if someone has subscribed for collision events.... 301 CollisionAccumulation++;
302
303 // For movement tests, remember if we are colliding with an object that is moving.
304 ColliderIsMoving = collidee != null ? collidee.RawVelocity != OMV.Vector3.Zero : false;
305
306 // If someone has subscribed for collision events log the collision so it will be reported up
303 if (SubscribedEvents()) { 307 if (SubscribedEvents()) {
304 CollisionCollection.AddCollider(collidingWith, new ContactPoint(contactPoint, contactNormal, pentrationDepth)); 308 CollisionCollection.AddCollider(collidingWith, new ContactPoint(contactPoint, contactNormal, pentrationDepth));
305 DetailLog("{0},{1}.Collison.AddCollider,call,with={2},point={3},normal={4},depth={5}", 309 DetailLog("{0},{1}.Collison.AddCollider,call,with={2},point={3},normal={4},depth={5}",
@@ -385,6 +389,17 @@ public abstract class BSPhysObject : PhysicsActor
385 public override bool SubscribedEvents() { 389 public override bool SubscribedEvents() {
386 return (SubscribedEventsMs > 0); 390 return (SubscribedEventsMs > 0);
387 } 391 }
392 // Because 'CollisionScore' is called many times while sorting, it should not be recomputed
393 // each time called. So this is built to be light weight for each collision and to do
394 // all the processing when the user asks for the info.
395 public void ComputeCollisionScore()
396 {
397 // Scale the collision count by the time since the last collision.
398 // The "+1" prevents dividing by zero.
399 long timeAgo = PhysicsScene.SimulationStep - CollidingStep + 1;
400 CollisionScore = CollisionAccumulation / timeAgo;
401 }
402 public override float CollisionScore { get; set; }
388 403
389 #endregion // Collisions 404 #endregion // Collisions
390 405
@@ -393,52 +408,103 @@ public abstract class BSPhysObject : PhysicsActor
393 // These actions are optional so, rather than scanning all the physical objects and asking them 408 // These actions are optional so, rather than scanning all the physical objects and asking them
394 // if they have anything to do, a physical object registers for an event call before the step is performed. 409 // if they have anything to do, a physical object registers for an event call before the step is performed.
395 // This bookkeeping makes it easy to add, remove and clean up after all these registrations. 410 // This bookkeeping makes it easy to add, remove and clean up after all these registrations.
396 private Dictionary<string, BSScene.PreStepAction> RegisteredActions = new Dictionary<string, BSScene.PreStepAction>(); 411 private Dictionary<string, BSScene.PreStepAction> RegisteredPrestepActions = new Dictionary<string, BSScene.PreStepAction>();
412 private Dictionary<string, BSScene.PostStepAction> RegisteredPoststepActions = new Dictionary<string, BSScene.PostStepAction>();
397 protected void RegisterPreStepAction(string op, uint id, BSScene.PreStepAction actn) 413 protected void RegisterPreStepAction(string op, uint id, BSScene.PreStepAction actn)
398 { 414 {
399 string identifier = op + "-" + id.ToString(); 415 string identifier = op + "-" + id.ToString();
400 416
401 lock (RegisteredActions) 417 lock (RegisteredPrestepActions)
402 { 418 {
403 // Clean out any existing action 419 // Clean out any existing action
404 UnRegisterPreStepAction(op, id); 420 UnRegisterPreStepAction(op, id);
405 421
406 RegisteredActions[identifier] = actn; 422 RegisteredPrestepActions[identifier] = actn;
423
424 PhysicsScene.BeforeStep += actn;
407 } 425 }
408 PhysicsScene.BeforeStep += actn;
409 DetailLog("{0},BSPhysObject.RegisterPreStepAction,id={1}", LocalID, identifier); 426 DetailLog("{0},BSPhysObject.RegisterPreStepAction,id={1}", LocalID, identifier);
410 } 427 }
411 428
412 // Unregister a pre step action. Safe to call if the action has not been registered. 429 // Unregister a pre step action. Safe to call if the action has not been registered.
413 protected void UnRegisterPreStepAction(string op, uint id) 430 // Returns 'true' if an action was actually removed
431 protected bool UnRegisterPreStepAction(string op, uint id)
414 { 432 {
415 string identifier = op + "-" + id.ToString(); 433 string identifier = op + "-" + id.ToString();
416 bool removed = false; 434 bool removed = false;
417 lock (RegisteredActions) 435 lock (RegisteredPrestepActions)
418 { 436 {
419 if (RegisteredActions.ContainsKey(identifier)) 437 if (RegisteredPrestepActions.ContainsKey(identifier))
420 { 438 {
421 PhysicsScene.BeforeStep -= RegisteredActions[identifier]; 439 PhysicsScene.BeforeStep -= RegisteredPrestepActions[identifier];
422 RegisteredActions.Remove(identifier); 440 RegisteredPrestepActions.Remove(identifier);
423 removed = true; 441 removed = true;
424 } 442 }
425 } 443 }
426 DetailLog("{0},BSPhysObject.UnRegisterPreStepAction,id={1},removed={2}", LocalID, identifier, removed); 444 DetailLog("{0},BSPhysObject.UnRegisterPreStepAction,id={1},removed={2}", LocalID, identifier, removed);
445 return removed;
427 } 446 }
428 447
429 protected void UnRegisterAllPreStepActions() 448 protected void UnRegisterAllPreStepActions()
430 { 449 {
431 lock (RegisteredActions) 450 lock (RegisteredPrestepActions)
432 { 451 {
433 foreach (KeyValuePair<string, BSScene.PreStepAction> kvp in RegisteredActions) 452 foreach (KeyValuePair<string, BSScene.PreStepAction> kvp in RegisteredPrestepActions)
434 { 453 {
435 PhysicsScene.BeforeStep -= kvp.Value; 454 PhysicsScene.BeforeStep -= kvp.Value;
436 } 455 }
437 RegisteredActions.Clear(); 456 RegisteredPrestepActions.Clear();
438 } 457 }
439 DetailLog("{0},BSPhysObject.UnRegisterAllPreStepActions,", LocalID); 458 DetailLog("{0},BSPhysObject.UnRegisterAllPreStepActions,", LocalID);
440 } 459 }
460
461 protected void RegisterPostStepAction(string op, uint id, BSScene.PostStepAction actn)
462 {
463 string identifier = op + "-" + id.ToString();
464
465 lock (RegisteredPoststepActions)
466 {
467 // Clean out any existing action
468 UnRegisterPostStepAction(op, id);
469
470 RegisteredPoststepActions[identifier] = actn;
471
472 PhysicsScene.AfterStep += actn;
473 }
474 DetailLog("{0},BSPhysObject.RegisterPostStepAction,id={1}", LocalID, identifier);
475 }
441 476
477 // Unregister a pre step action. Safe to call if the action has not been registered.
478 // Returns 'true' if an action was actually removed.
479 protected bool UnRegisterPostStepAction(string op, uint id)
480 {
481 string identifier = op + "-" + id.ToString();
482 bool removed = false;
483 lock (RegisteredPoststepActions)
484 {
485 if (RegisteredPoststepActions.ContainsKey(identifier))
486 {
487 PhysicsScene.AfterStep -= RegisteredPoststepActions[identifier];
488 RegisteredPoststepActions.Remove(identifier);
489 removed = true;
490 }
491 }
492 DetailLog("{0},BSPhysObject.UnRegisterPostStepAction,id={1},removed={2}", LocalID, identifier, removed);
493 return removed;
494 }
495
496 protected void UnRegisterAllPostStepActions()
497 {
498 lock (RegisteredPoststepActions)
499 {
500 foreach (KeyValuePair<string, BSScene.PostStepAction> kvp in RegisteredPoststepActions)
501 {
502 PhysicsScene.AfterStep -= kvp.Value;
503 }
504 RegisteredPoststepActions.Clear();
505 }
506 DetailLog("{0},BSPhysObject.UnRegisterAllPostStepActions,", LocalID);
507 }
442 508
443 #endregion // Per Simulation Step actions 509 #endregion // Per Simulation Step actions
444 510
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
index 8b00a33..54bf063 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
@@ -59,7 +59,6 @@ public sealed class BSPrim : BSPhysObject
59 private OMV.Vector3 _force; 59 private OMV.Vector3 _force;
60 private OMV.Vector3 _velocity; 60 private OMV.Vector3 _velocity;
61 private OMV.Vector3 _torque; 61 private OMV.Vector3 _torque;
62 private float _collisionScore;
63 private OMV.Vector3 _acceleration; 62 private OMV.Vector3 _acceleration;
64 private OMV.Quaternion _orientation; 63 private OMV.Quaternion _orientation;
65 private int _physicsActorType; 64 private int _physicsActorType;
@@ -74,7 +73,7 @@ public sealed class BSPrim : BSPhysObject
74 private bool _kinematic; 73 private bool _kinematic;
75 private float _buoyancy; 74 private float _buoyancy;
76 75
77 private BSDynamics _vehicle; 76 public BSDynamics VehicleController { get; private set; }
78 77
79 private BSVMotor _targetMotor; 78 private BSVMotor _targetMotor;
80 private OMV.Vector3 _PIDTarget; 79 private OMV.Vector3 _PIDTarget;
@@ -108,7 +107,7 @@ public sealed class BSPrim : BSPhysObject
108 _friction = PhysicsScene.Params.defaultFriction; 107 _friction = PhysicsScene.Params.defaultFriction;
109 _restitution = PhysicsScene.Params.defaultRestitution; 108 _restitution = PhysicsScene.Params.defaultRestitution;
110 109
111 _vehicle = new BSDynamics(PhysicsScene, this); // add vehicleness 110 VehicleController = new BSDynamics(PhysicsScene, this); // add vehicleness
112 111
113 _mass = CalculateMass(); 112 _mass = CalculateMass();
114 113
@@ -147,9 +146,9 @@ public sealed class BSPrim : BSPhysObject
147 { 146 {
148 DetailLog("{0},BSPrim.Destroy,taint,", LocalID); 147 DetailLog("{0},BSPrim.Destroy,taint,", LocalID);
149 // 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.
150 PhysicsScene.Shapes.DereferenceBody(PhysBody, true, null); 149 PhysicsScene.Shapes.DereferenceBody(PhysBody, null);
151 PhysBody.Clear(); 150 PhysBody.Clear();
152 PhysicsScene.Shapes.DereferenceShape(PhysShape, true, null); 151 PhysicsScene.Shapes.DereferenceShape(PhysShape, null);
153 PhysShape.Clear(); 152 PhysShape.Clear();
154 }); 153 });
155 } 154 }
@@ -182,11 +181,19 @@ public sealed class BSPrim : BSPhysObject
182 181
183 public override bool ForceBodyShapeRebuild(bool inTaintTime) 182 public override bool ForceBodyShapeRebuild(bool inTaintTime)
184 { 183 {
185 PhysicsScene.TaintedObject(inTaintTime, "BSPrim.ForceBodyShapeRebuild", delegate() 184 if (inTaintTime)
186 { 185 {
187 _mass = CalculateMass(); // changing the shape changes the mass 186 _mass = CalculateMass(); // changing the shape changes the mass
188 CreateGeomAndObject(true); 187 CreateGeomAndObject(true);
189 }); 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 }
190 return true; 197 return true;
191 } 198 }
192 public override bool Grabbed { 199 public override bool Grabbed {
@@ -345,6 +352,10 @@ public sealed class BSPrim : BSPhysObject
345 { 352 {
346 bool ret = false; 353 bool ret = false;
347 354
355 // We don't care where non-physical items are placed
356 if (!IsPhysicallyActive)
357 return ret;
358
348 if (!PhysicsScene.TerrainManager.IsWithinKnownTerrain(RawPosition)) 359 if (!PhysicsScene.TerrainManager.IsWithinKnownTerrain(RawPosition))
349 { 360 {
350 // The physical object is out of the known/simulated area. 361 // The physical object is out of the known/simulated area.
@@ -513,7 +524,7 @@ public sealed class BSPrim : BSPhysObject
513 524
514 public override int VehicleType { 525 public override int VehicleType {
515 get { 526 get {
516 return (int)_vehicle.Type; // if we are a vehicle, return that type 527 return (int)VehicleController.Type; // if we are a vehicle, return that type
517 } 528 }
518 set { 529 set {
519 Vehicle type = (Vehicle)value; 530 Vehicle type = (Vehicle)value;
@@ -522,14 +533,20 @@ public sealed class BSPrim : BSPhysObject
522 { 533 {
523 // Done at taint time so we're sure the physics engine is not using the variables 534 // Done at taint time so we're sure the physics engine is not using the variables
524 // Vehicle code changes the parameters for this vehicle type. 535 // Vehicle code changes the parameters for this vehicle type.
525 _vehicle.ProcessTypeChange(type); 536 VehicleController.ProcessTypeChange(type);
526 ActivateIfPhysical(false); 537 ActivateIfPhysical(false);
527 538
528 // If an active vehicle, register the vehicle code to be called before each step 539 // If an active vehicle, register the vehicle code to be called before each step
529 if (_vehicle.Type == Vehicle.TYPE_NONE) 540 if (VehicleController.Type == Vehicle.TYPE_NONE)
541 {
530 UnRegisterPreStepAction("BSPrim.Vehicle", LocalID); 542 UnRegisterPreStepAction("BSPrim.Vehicle", LocalID);
543 PhysicsScene.AfterStep -= VehicleController.PostStep;
544 }
531 else 545 else
532 RegisterPreStepAction("BSPrim.Vehicle", LocalID, _vehicle.Step); 546 {
547 RegisterPreStepAction("BSPrim.Vehicle", LocalID, VehicleController.Step);
548 PhysicsScene.AfterStep += VehicleController.PostStep;
549 }
533 }); 550 });
534 } 551 }
535 } 552 }
@@ -537,7 +554,7 @@ public sealed class BSPrim : BSPhysObject
537 { 554 {
538 PhysicsScene.TaintedObject("BSPrim.VehicleFloatParam", delegate() 555 PhysicsScene.TaintedObject("BSPrim.VehicleFloatParam", delegate()
539 { 556 {
540 _vehicle.ProcessFloatVehicleParam((Vehicle)param, value); 557 VehicleController.ProcessFloatVehicleParam((Vehicle)param, value);
541 ActivateIfPhysical(false); 558 ActivateIfPhysical(false);
542 }); 559 });
543 } 560 }
@@ -545,7 +562,7 @@ public sealed class BSPrim : BSPhysObject
545 { 562 {
546 PhysicsScene.TaintedObject("BSPrim.VehicleVectorParam", delegate() 563 PhysicsScene.TaintedObject("BSPrim.VehicleVectorParam", delegate()
547 { 564 {
548 _vehicle.ProcessVectorVehicleParam((Vehicle)param, value); 565 VehicleController.ProcessVectorVehicleParam((Vehicle)param, value);
549 ActivateIfPhysical(false); 566 ActivateIfPhysical(false);
550 }); 567 });
551 } 568 }
@@ -553,7 +570,7 @@ public sealed class BSPrim : BSPhysObject
553 { 570 {
554 PhysicsScene.TaintedObject("BSPrim.VehicleRotationParam", delegate() 571 PhysicsScene.TaintedObject("BSPrim.VehicleRotationParam", delegate()
555 { 572 {
556 _vehicle.ProcessRotationVehicleParam((Vehicle)param, rotation); 573 VehicleController.ProcessRotationVehicleParam((Vehicle)param, rotation);
557 ActivateIfPhysical(false); 574 ActivateIfPhysical(false);
558 }); 575 });
559 } 576 }
@@ -561,7 +578,7 @@ public sealed class BSPrim : BSPhysObject
561 { 578 {
562 PhysicsScene.TaintedObject("BSPrim.VehicleFlags", delegate() 579 PhysicsScene.TaintedObject("BSPrim.VehicleFlags", delegate()
563 { 580 {
564 _vehicle.ProcessVehicleFlags(param, remove); 581 VehicleController.ProcessVehicleFlags(param, remove);
565 }); 582 });
566 } 583 }
567 584
@@ -638,11 +655,6 @@ public sealed class BSPrim : BSPhysObject
638 // DetailLog("{0},BSPrim.SetTorque,call,torque={1}", LocalID, _torque); 655 // DetailLog("{0},BSPrim.SetTorque,call,torque={1}", LocalID, _torque);
639 } 656 }
640 } 657 }
641 public override float CollisionScore {
642 get { return _collisionScore; }
643 set { _collisionScore = value;
644 }
645 }
646 public override OMV.Vector3 Acceleration { 658 public override OMV.Vector3 Acceleration {
647 get { return _acceleration; } 659 get { return _acceleration; }
648 set { _acceleration = value; } 660 set { _acceleration = value; }
@@ -747,7 +759,7 @@ public sealed class BSPrim : BSPhysObject
747 // isSolid: other objects bounce off of this object 759 // isSolid: other objects bounce off of this object
748 // isVolumeDetect: other objects pass through but can generate collisions 760 // isVolumeDetect: other objects pass through but can generate collisions
749 // collisionEvents: whether this object returns collision events 761 // collisionEvents: whether this object returns collision events
750 private void UpdatePhysicalParameters() 762 public void UpdatePhysicalParameters()
751 { 763 {
752 // DetailLog("{0},BSPrim.UpdatePhysicalParameters,entry,body={1},shape={2}", LocalID, BSBody, BSShape); 764 // DetailLog("{0},BSPrim.UpdatePhysicalParameters,entry,body={1},shape={2}", LocalID, BSBody, BSShape);
753 765
@@ -759,7 +771,7 @@ public sealed class BSPrim : BSPhysObject
759 MakeDynamic(IsStatic); 771 MakeDynamic(IsStatic);
760 772
761 // Update vehicle specific parameters (after MakeDynamic() so can change physical parameters) 773 // Update vehicle specific parameters (after MakeDynamic() so can change physical parameters)
762 _vehicle.Refresh(); 774 VehicleController.Refresh();
763 775
764 // Arrange for collision events if the simulator wants them 776 // Arrange for collision events if the simulator wants them
765 EnableCollisions(SubscribedEvents()); 777 EnableCollisions(SubscribedEvents());
@@ -1593,15 +1605,15 @@ public sealed class BSPrim : BSPhysObject
1593 public void CreateGeomAndObject(bool forceRebuild) 1605 public void CreateGeomAndObject(bool forceRebuild)
1594 { 1606 {
1595 // Create the correct physical representation for this type of object. 1607 // Create the correct physical representation for this type of object.
1596 // Updates PhysBody and PhysShape with the new information. 1608 // Updates base.PhysBody and base.PhysShape with the new information.
1597 // 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.
1598 PhysicsScene.Shapes.GetBodyAndShape(false, PhysicsScene.World, this, null, delegate(BulletBody dBody) 1610 PhysicsScene.Shapes.GetBodyAndShape(false /*forceRebuild */, PhysicsScene.World, this, null, delegate(BulletBody dBody)
1599 { 1611 {
1600 // Called if the current prim body is about to be destroyed. 1612 // Called if the current prim body is about to be destroyed.
1601 // Remove all the physical dependencies on the old body. 1613 // Remove all the physical dependencies on the old body.
1602 // (Maybe someday make the changing of BSShape an event to be subscribed to by BSLinkset, ...) 1614 // (Maybe someday make the changing of BSShape an event to be subscribed to by BSLinkset, ...)
1603 Linkset.RemoveBodyDependencies(this); 1615 Linkset.RemoveBodyDependencies(this);
1604 _vehicle.RemoveBodyDependencies(this); 1616 VehicleController.RemoveBodyDependencies(this);
1605 }); 1617 });
1606 1618
1607 // Make sure the properties are set on the new object 1619 // Make sure the properties are set on the new object
@@ -1618,9 +1630,9 @@ public sealed class BSPrim : BSPhysObject
1618 { 1630 {
1619 // A temporary kludge to suppress the rotational effects introduced on vehicles by Bullet 1631 // A temporary kludge to suppress the rotational effects introduced on vehicles by Bullet
1620 // TODO: handle physics introduced by Bullet with computed vehicle physics. 1632 // TODO: handle physics introduced by Bullet with computed vehicle physics.
1621 if (_vehicle.IsActive) 1633 if (VehicleController.IsActive)
1622 { 1634 {
1623 // entprop.RotationalVelocity = OMV.Vector3.Zero; 1635 entprop.RotationalVelocity = OMV.Vector3.Zero;
1624 } 1636 }
1625 1637
1626 // DetailLog("{0},BSPrim.UpdateProperties,entry,entprop={1}", LocalID, entprop); // DEBUG DEBUG 1638 // DetailLog("{0},BSPrim.UpdateProperties,entry,entprop={1}", LocalID, entprop); // DEBUG DEBUG
@@ -1643,7 +1655,7 @@ public sealed class BSPrim : BSPhysObject
1643 // DetailLog("{0},BSPrim.UpdateProperties,afterAssign,entprop={1}", LocalID, entprop); // DEBUG DEBUG 1655 // DetailLog("{0},BSPrim.UpdateProperties,afterAssign,entprop={1}", LocalID, entprop); // DEBUG DEBUG
1644 1656
1645 // The sanity check can change the velocity and/or position. 1657 // The sanity check can change the velocity and/or position.
1646 if (IsPhysical && PositionSanityCheck(true /* inTaintTime */ )) 1658 if (PositionSanityCheck(true /* inTaintTime */ ))
1647 { 1659 {
1648 entprop.Position = _position; 1660 entprop.Position = _position;
1649 entprop.Velocity = _velocity; 1661 entprop.Velocity = _velocity;
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
index cb304b6..a4690ba 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
@@ -26,6 +26,7 @@
26 */ 26 */
27using System; 27using System;
28using System.Collections.Generic; 28using System.Collections.Generic;
29using System.Linq;
29using System.Reflection; 30using System.Reflection;
30using System.Runtime.InteropServices; 31using System.Runtime.InteropServices;
31using System.Text; 32using System.Text;
@@ -87,7 +88,7 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
87 public delegate void PreStepAction(float timeStep); 88 public delegate void PreStepAction(float timeStep);
88 public delegate void PostStepAction(float timeStep); 89 public delegate void PostStepAction(float timeStep);
89 public event PreStepAction BeforeStep; 90 public event PreStepAction BeforeStep;
90 public event PreStepAction AfterStep; 91 public event PostStepAction AfterStep;
91 92
92 // A value of the time now so all the collision and update routines do not have to get their own 93 // A value of the time now so all the collision and update routines do not have to get their own
93 // Set to 'now' just before all the prims and actors are called for collisions and updates 94 // Set to 'now' just before all the prims and actors are called for collisions and updates
@@ -697,7 +698,21 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
697 698
698 public override Dictionary<uint, float> GetTopColliders() 699 public override Dictionary<uint, float> GetTopColliders()
699 { 700 {
700 return new Dictionary<uint, float>(); 701 Dictionary<uint, float> topColliders;
702
703 lock (PhysObjects)
704 {
705 foreach (KeyValuePair<uint, BSPhysObject> kvp in PhysObjects)
706 {
707 kvp.Value.ComputeCollisionScore();
708 }
709
710 List<BSPhysObject> orderedPrims = new List<BSPhysObject>(PhysObjects.Values);
711 orderedPrims.OrderByDescending(p => p.CollisionScore);
712 topColliders = orderedPrims.Take(25).ToDictionary(p => p.LocalID, p => p.CollisionScore);
713 }
714
715 return topColliders;
701 } 716 }
702 717
703 public override bool IsThreaded { get { return false; } } 718 public override bool IsThreaded { get { return false; } }
@@ -748,7 +763,7 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
748 763
749 private void TriggerPostStepEvent(float timeStep) 764 private void TriggerPostStepEvent(float timeStep)
750 { 765 {
751 PreStepAction actions = AfterStep; 766 PostStepAction actions = AfterStep;
752 if (actions != null) 767 if (actions != null)
753 actions(timeStep); 768 actions(timeStep);
754 769
@@ -840,7 +855,7 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
840 { 855 {
841 DetailLog("{0},BSScene.AssertInTaintTime,NOT IN TAINT TIME,Region={1},Where={2}", DetailLogZero, RegionName, whereFrom); 856 DetailLog("{0},BSScene.AssertInTaintTime,NOT IN TAINT TIME,Region={1},Where={2}", DetailLogZero, RegionName, whereFrom);
842 m_log.ErrorFormat("{0} NOT IN TAINT TIME!! Region={1}, Where={2}", LogHeader, RegionName, whereFrom); 857 m_log.ErrorFormat("{0} NOT IN TAINT TIME!! Region={1}, Where={2}", LogHeader, RegionName, whereFrom);
843 Util.PrintCallStack(DetailLog); 858 // Util.PrintCallStack(DetailLog);
844 } 859 }
845 return InTaintTime; 860 return InTaintTime;
846 } 861 }
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs b/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs
index 9fbfcdc..9febd90 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 801f690..a3b3556 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt
+++ b/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt
@@ -1,8 +1,12 @@
1CURRENT PRIORITIES 1CURRENT PRIORITIES
2================================================= 2=================================================
3One sided meshes? Should terrain be built into a closed shape?
4 When meshes get partially wedged into the terrain, they cannot push themselves out.
5 It is possible that Bullet processes collisions whether entering or leaving a mesh.
6 Ref: http://bulletphysics.org/Bullet/phpBB3/viewtopic.php?t=4869
3Deleting a linkset while standing on the root will leave the physical shape of the root behind. 7Deleting a linkset while standing on the root will leave the physical shape of the root behind.
4 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.
5Child movement in linkset (don't rebuild linkset) 9Terrain detail: double terrain mesh detail
6Vehicle angular vertical attraction 10Vehicle angular vertical attraction
7vehicle angular banking 11vehicle angular banking
8Center-of-gravity 12Center-of-gravity
@@ -12,6 +16,7 @@ when should angular and linear motor targets be zeroed? when selected?
12 Need a vehicle.clear()? Or an 'else' in prestep if not physical. 16 Need a vehicle.clear()? Or an 'else' in prestep if not physical.
13Teravus llMoveToTarget script debug 17Teravus llMoveToTarget script debug
14 Mixing of hover, buoyancy/gravity, moveToTarget, into one force 18 Mixing of hover, buoyancy/gravity, moveToTarget, into one force
19 Setting hover height to zero disables hover even if hover flags are on (from SL wiki)
15Nebadon vehicles turning funny in arena 20Nebadon vehicles turning funny in arena
16limitMotorUp calibration (more down?) 21limitMotorUp calibration (more down?)
17llRotLookAt 22llRotLookAt
@@ -30,34 +35,20 @@ Vehicle script tuning/debugging
30 Weapon shooter script 35 Weapon shooter script
31Add material densities to the material types 36Add material densities to the material types
32 37
33CRASHES
34=================================================
35Crazyness during 20130115 office hours was PositionAdjustUnderground for both char and prim
36 m1:logs/20130115.0934/physics-BulletSim-20130115083613.log
37 Creation of Neb's terrain made the terrain "disappear". Everything started to fall
38 and then get restored to be above terrain.
3920121129.1411: editting/moving phys object across region boundries causes crash
40 getPos-> btRigidBody::upcast -> getBodyType -> BOOM
4120121128.1600: mesh object not rezzing (no physics mesh).
42 Causes many errors. Doesn't stop after first error with box shape.
43 Eventually crashes when deleting the object.
4420121206.1434: rez Sam-pan into OSGrid BulletSim11 region
45 Immediate simulator crash. Mono does not output any stacktrace and
46 log just stops after reporting taint-time linking of the linkset.
47
48VEHICLES TODO LIST: 38VEHICLES TODO LIST:
49================================================= 39=================================================
50Border crossing with linked vehicle causes crash 40Border crossing with linked vehicle causes crash
41 20121129.1411: editting/moving phys object across region boundries causes crash
42 getPos-> btRigidBody::upcast -> getBodyType -> BOOM
51Vehicles (Move smoothly) 43Vehicles (Move smoothly)
52Some vehicles should not be able to turn if no speed or off ground. 44Some vehicles should not be able to turn if no speed or off ground.
45What to do if vehicle and prim buoyancy differ?
53Cannot edit/move a vehicle being ridden: it jumps back to the origional position. 46Cannot edit/move a vehicle being ridden: it jumps back to the origional position.
54Neb car jiggling left and right 47Neb car jiggling left and right
55 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.
56 This has been reduced but not eliminated. 49 This has been reduced but not eliminated.
57Implement referenceFrame for all the motion routines. 50Implement referenceFrame for all the motion routines.
58For limitMotorUp, use raycast down to find if vehicle is in the air. 51For limitMotorUp, use raycast down to find if vehicle is in the air.
59Angular motion around Z moves the vehicle in world Z and not vehicle Z in ODE.
60 Verify that angular motion specified around Z moves in the vehicle coordinates.
61Verify llGetVel() is returning a smooth and good value for vehicle movement. 52Verify llGetVel() is returning a smooth and good value for vehicle movement.
62llGetVel() should return the root's velocity if requested in a child prim. 53llGetVel() should return the root's velocity if requested in a child prim.
63Implement function efficiency for lineaar and angular motion. 54Implement function efficiency for lineaar and angular motion.
@@ -69,10 +60,19 @@ Remove vehicle angular velocity zeroing in BSPrim.UpdateProperties().
69Incorporate inter-relationship of angular corrections. For instance, angularDeflection 60Incorporate inter-relationship of angular corrections. For instance, angularDeflection
70 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
71 creates over-correction and over-shoot and wabbling. 62 creates over-correction and over-shoot and wabbling.
63Vehicle attributes are not restored when a vehicle is rezzed on region creation
64 Create vehicle, setup vehicle properties, restart region, vehicle is not reinitialized.
72 65
73GENERAL TODO LIST: 66GENERAL TODO LIST:
74================================================= 67=================================================
68Collisions 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.
75llMoveToTarget objects are not effected by gravity until target is removed. 72llMoveToTarget objects are not effected by gravity until target is removed.
73Compute CCD parameters based on body size
74Can solver iterations be changed per body/shape? Can be for constraints but what
75 about regular vehicles?
76Implement llSetPhysicalMaterial. 76Implement llSetPhysicalMaterial.
77 extend it with Center-of-mass, rolling friction, density 77 extend it with Center-of-mass, rolling friction, density
78Implement llSetForceAndTorque. 78Implement llSetForceAndTorque.
@@ -127,6 +127,7 @@ Physical and phantom will drop through the terrain
127 127
128LINKSETS 128LINKSETS
129====================================================== 129======================================================
130Child prims do not report collisions
130Editing a child of a linkset causes the child to go phantom 131Editing a child of a linkset causes the child to go phantom
131 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
132Offset the center of the linkset to be the geometric center of all the prims 133Offset the center of the linkset to be the geometric center of all the prims
@@ -321,4 +322,9 @@ Mantis 6040 script http://opensimulator.org/mantis/view.php?id=6040 (DONE)
321Boats float low in the water (DONE) 322Boats float low in the water (DONE)
322Boats floating at proper level (DONE) 323Boats floating at proper level (DONE)
323When is force introduced by SetForce removed? The prestep action could go forever. (DONE) 324When is force introduced by SetForce removed? The prestep action could go forever. (DONE)
324 (Resolution: setForce registers a prestep action which keeps applying the force) \ No newline at end of file 325 (Resolution: setForce registers a prestep action which keeps applying the force)
326Child movement in linkset (don't rebuild linkset) (DONE 20130122))
327Avatar standing on a moving object should start to move with the object. (DONE 20130125)
328Angular 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/BulletSPlugin/Properties/AssemblyInfo.cs b/OpenSim/Region/Physics/BulletSPlugin/Properties/AssemblyInfo.cs
index 0d1db3b..d240c71 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/Properties/AssemblyInfo.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/Properties/AssemblyInfo.cs
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
29// Build Number 29// Build Number
30// Revision 30// Revision
31// 31//
32[assembly: AssemblyVersion("0.7.5.*")] 32[assembly: AssemblyVersion("0.7.6.*")]
33[assembly: AssemblyFileVersion("1.0.0.0")] 33[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/OpenSim/Region/Physics/BulletSPlugin/Tests/BasicVehicles.cs b/OpenSim/Region/Physics/BulletSPlugin/Tests/BasicVehicles.cs
new file mode 100755
index 0000000..33232bd
--- /dev/null
+++ b/OpenSim/Region/Physics/BulletSPlugin/Tests/BasicVehicles.cs
@@ -0,0 +1,150 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using System.Linq;
31using System.Text;
32
33using NUnit.Framework;
34using log4net;
35
36using OpenSim.Framework;
37using OpenSim.Region.Physics.BulletSPlugin;
38using OpenSim.Region.Physics.Manager;
39using OpenSim.Tests.Common;
40
41using OpenMetaverse;
42
43namespace OpenSim.Region.Physics.BulletSPlugin.Tests
44{
45[TestFixture]
46public class BasicVehicles : OpenSimTestCase
47{
48 // Documentation on attributes: http://www.nunit.org/index.php?p=attributes&r=2.6.1
49 // Documentation on assertions: http://www.nunit.org/index.php?p=assertions&r=2.6.1
50
51 BSScene PhysicsScene { get; set; }
52 BSPrim TestVehicle { get; set; }
53 Vector3 TestVehicleInitPosition { get; set; }
54 float simulationTimeStep = 0.089f;
55
56 [TestFixtureSetUp]
57 public void Init()
58 {
59 Dictionary<string, string> engineParams = new Dictionary<string, string>();
60 PhysicsScene = BulletSimTestsUtil.CreateBasicPhysicsEngine(engineParams);
61
62 PrimitiveBaseShape pbs = PrimitiveBaseShape.CreateSphere();
63 Vector3 pos = new Vector3(100.0f, 100.0f, 0f);
64 pos.Z = PhysicsScene.TerrainManager.GetTerrainHeightAtXYZ(pos) + 2f;
65 TestVehicleInitPosition = pos;
66 Vector3 size = new Vector3(1f, 1f, 1f);
67 pbs.Scale = size;
68 Quaternion rot = Quaternion.Identity;
69 bool isPhys = false;
70 uint localID = 123;
71
72 PhysicsScene.AddPrimShape("testPrim", pbs, pos, size, rot, isPhys, localID);
73 TestVehicle = (BSPrim)PhysicsScene.PhysObjects[localID];
74 // The actual prim shape creation happens at taint time
75 PhysicsScene.ProcessTaints();
76
77 }
78
79 [TestFixtureTearDown]
80 public void TearDown()
81 {
82 if (PhysicsScene != null)
83 {
84 // The Dispose() will also free any physical objects in the scene
85 PhysicsScene.Dispose();
86 PhysicsScene = null;
87 }
88 }
89
90 [TestCase(2f, 0.2f, 0.25f, 0.25f, 0.25f)]
91 [TestCase(2f, 0.2f, -0.25f, 0.25f, 0.25f)]
92 [TestCase(2f, 0.2f, 0.25f, -0.25f, 0.25f)]
93 [TestCase(2f, 0.2f, -0.25f, -0.25f, 0.25f)]
94 // [TestCase(2f, 0.2f, 0.785f, 0.0f, 0.25f) /*, "Leaning 45 degrees to the side" */]
95 // [TestCase(2f, 0.2f, 1.650f, 0.0f, 0.25f) /*, "Leaning more than 90 degrees to the side" */]
96 // [TestCase(2f, 0.2f, 2.750f, 0.0f, 0.25f) /*, "Almost upside down, tipped right" */]
97 // [TestCase(2f, 0.2f,-2.750f, 0.0f, 0.25f) /*, "Almost upside down, tipped left" */]
98 // [TestCase(2f, 0.2f, 0.0f, 0.785f, 0.25f) /*, "Tipped back 45 degrees" */]
99 // [TestCase(2f, 0.2f, 0.0f, 1.650f, 0.25f) /*, "Tipped back more than 90 degrees" */]
100 // [TestCase(2f, 0.2f, 0.0f, 2.750f, 0.25f) /*, "Almost upside down, tipped back" */]
101 // [TestCase(2f, 0.2f, 0.0f,-2.750f, 0.25f) /*, "Almost upside down, tipped forward" */]
102 public void AngularVerticalAttraction(float timeScale, float efficiency, float initRoll, float initPitch, float initYaw)
103 {
104 // Enough simulation steps to cover the timescale the operation should take
105 int simSteps = (int)(timeScale / simulationTimeStep) + 1;
106
107 // Tip the vehicle
108 Quaternion initOrientation = Quaternion.CreateFromEulers(initRoll, initPitch, initYaw);
109 TestVehicle.Orientation = initOrientation;
110
111 TestVehicle.Position = TestVehicleInitPosition;
112
113 // The vehicle controller is not enabled directly (by setting a vehicle type).
114 // Instead the appropriate values are set and calls are made just the parts of the
115 // controller we want to exercise. Stepping the physics engine then applies
116 // the actions of that one feature.
117 TestVehicle.VehicleController.ProcessFloatVehicleParam(Vehicle.VERTICAL_ATTRACTION_EFFICIENCY, efficiency);
118 TestVehicle.VehicleController.ProcessFloatVehicleParam(Vehicle.VERTICAL_ATTRACTION_TIMESCALE, timeScale);
119 TestVehicle.VehicleController.enableAngularVerticalAttraction = true;
120
121 TestVehicle.IsPhysical = true;
122 PhysicsScene.ProcessTaints();
123
124 // Step the simulator a bunch of times and vertical attraction should orient the vehicle up
125 for (int ii = 0; ii < simSteps; ii++)
126 {
127 TestVehicle.VehicleController.ForgetKnownVehicleProperties();
128 TestVehicle.VehicleController.ComputeAngularVerticalAttraction();
129 TestVehicle.VehicleController.PushKnownChanged();
130
131 PhysicsScene.Simulate(simulationTimeStep);
132 }
133
134 TestVehicle.IsPhysical = false;
135 PhysicsScene.ProcessTaints();
136
137 // After these steps, the vehicle should be upright
138 /*
139 float finalRoll, finalPitch, finalYaw;
140 TestVehicle.Orientation.GetEulerAngles(out finalRoll, out finalPitch, out finalYaw);
141 Assert.That(finalRoll, Is.InRange(-0.01f, 0.01f));
142 Assert.That(finalPitch, Is.InRange(-0.01f, 0.01f));
143 Assert.That(finalYaw, Is.InRange(initYaw - 0.1f, initYaw + 0.1f));
144 */
145
146 Vector3 upPointer = Vector3.UnitZ * TestVehicle.Orientation;
147 Assert.That(upPointer.Z, Is.GreaterThan(0.99f));
148 }
149}
150} \ No newline at end of file
diff --git a/OpenSim/Region/Physics/BulletSPlugin/Tests/BulletSimTests.cs b/OpenSim/Region/Physics/BulletSPlugin/Tests/BulletSimTests.cs
new file mode 100755
index 0000000..35cbc1d
--- /dev/null
+++ b/OpenSim/Region/Physics/BulletSPlugin/Tests/BulletSimTests.cs
@@ -0,0 +1,56 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using System.Linq;
31using System.Text;
32
33using NUnit.Framework;
34using log4net;
35
36using OpenSim.Tests.Common;
37
38namespace OpenSim.Region.Physics.BulletSPlugin.Tests
39{
40[TestFixture]
41public class BulletSimTests : OpenSimTestCase
42{
43 // Documentation on attributes: http://www.nunit.org/index.php?p=attributes&r=2.6.1
44 // Documentation on assertions: http://www.nunit.org/index.php?p=assertions&r=2.6.1
45
46 [TestFixtureSetUp]
47 public void Init()
48 {
49 }
50
51 [TestFixtureTearDown]
52 public void TearDown()
53 {
54 }
55}
56}
diff --git a/OpenSim/Region/Physics/BulletSPlugin/Tests/BulletSimTestsUtil.cs b/OpenSim/Region/Physics/BulletSPlugin/Tests/BulletSimTestsUtil.cs
new file mode 100755
index 0000000..28207a4
--- /dev/null
+++ b/OpenSim/Region/Physics/BulletSPlugin/Tests/BulletSimTestsUtil.cs
@@ -0,0 +1,95 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.IO;
30using System.Collections.Generic;
31using System.Linq;
32using System.Text;
33
34using Nini.Config;
35
36using OpenSim.Framework;
37using OpenSim.Region.Physics.BulletSPlugin;
38using OpenSim.Region.Physics.Meshing;
39
40namespace OpenSim.Region.Physics.BulletSPlugin.Tests
41{
42// Utility functions for building up and tearing down the sample physics environments
43public static class BulletSimTestsUtil
44{
45 // 'engineName' is the Bullet engine to use. Either null (for unmanaged), "BulletUnmanaged" or "BulletXNA"
46 // 'params' is a set of keyValue pairs to set in the engine's configuration file (override defaults)
47 // May be 'null' if there are no overrides.
48 public static BSScene CreateBasicPhysicsEngine(Dictionary<string,string> paramOverrides)
49 {
50 IConfigSource openSimINI = new IniConfigSource();
51 IConfig startupConfig = openSimINI.AddConfig("Startup");
52 startupConfig.Set("physics", "BulletSim");
53 startupConfig.Set("meshing", "Meshmerizer");
54 startupConfig.Set("cacheSculptMaps", "false"); // meshmerizer shouldn't save maps
55
56 IConfig bulletSimConfig = openSimINI.AddConfig("BulletSim");
57 // If the caller cares, specify the bullet engine otherwise it will default to "BulletUnmanaged".
58 // bulletSimConfig.Set("BulletEngine", "BulletUnmanaged");
59 // bulletSimConfig.Set("BulletEngine", "BulletXNA");
60 bulletSimConfig.Set("MeshSculptedPrim", "false");
61 bulletSimConfig.Set("ForceSimplePrimMeshing", "true");
62 if (paramOverrides != null)
63 {
64 foreach (KeyValuePair<string, string> kvp in paramOverrides)
65 {
66 bulletSimConfig.Set(kvp.Key, kvp.Value);
67 }
68 }
69
70 // If a special directory exists, put detailed logging therein.
71 // This allows local testing/debugging without having to worry that the build engine will output logs.
72 if (Directory.Exists("physlogs"))
73 {
74 bulletSimConfig.Set("PhysicsLoggingDir","./physlogs");
75 bulletSimConfig.Set("PhysicsLoggingEnabled","True");
76 bulletSimConfig.Set("PhysicsLoggingDoFlush","True");
77 bulletSimConfig.Set("VehicleLoggingEnabled","True");
78 }
79
80 BSPlugin bsPlugin = new BSPlugin();
81
82 BSScene bsScene = (BSScene)bsPlugin.GetScene("BSTestRegion");
83
84 // Since the asset requestor is not initialized, any mesh or sculptie will be a cube.
85 // In the future, add a fake asset fetcher to get meshes and sculpts.
86 // bsScene.RequestAssetMethod = ???;
87
88 Meshing.Meshmerizer mesher = new Meshmerizer(openSimINI);
89 bsScene.Initialise(mesher, openSimINI);
90
91 return bsScene;
92 }
93
94}
95}
diff --git a/OpenSim/Region/Physics/ConvexDecompositionDotNet/Properties/AssemblyInfo.cs b/OpenSim/Region/Physics/ConvexDecompositionDotNet/Properties/AssemblyInfo.cs
index 5ff945d..cafd7f4 100644
--- a/OpenSim/Region/Physics/ConvexDecompositionDotNet/Properties/AssemblyInfo.cs
+++ b/OpenSim/Region/Physics/ConvexDecompositionDotNet/Properties/AssemblyInfo.cs
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
32// You can specify all the values or you can default the Build and Revision Numbers 32// You can specify all the values or you can default the Build and Revision Numbers
33// by using the '*' as shown below: 33// by using the '*' as shown below:
34// [assembly: AssemblyVersion("1.0.*")] 34// [assembly: AssemblyVersion("1.0.*")]
35[assembly: AssemblyVersion("0.7.5.*")] 35[assembly: AssemblyVersion("0.7.6.*")]
36[assembly: AssemblyFileVersion("1.0.0.0")] 36[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/OpenSim/Region/Physics/Manager/AssemblyInfo.cs b/OpenSim/Region/Physics/Manager/AssemblyInfo.cs
index 36b4235..5da3956 100644
--- a/OpenSim/Region/Physics/Manager/AssemblyInfo.cs
+++ b/OpenSim/Region/Physics/Manager/AssemblyInfo.cs
@@ -55,4 +55,4 @@ using System.Runtime.InteropServices;
55// You can specify all values by your own or you can build default build and revision 55// You can specify all values by your own or you can build default build and revision
56// numbers with the '*' character (the default): 56// numbers with the '*' character (the default):
57 57
58[assembly : AssemblyVersion("0.7.5.*")] 58[assembly : AssemblyVersion("0.7.6.*")]
diff --git a/OpenSim/Region/Physics/Manager/PhysicsScene.cs b/OpenSim/Region/Physics/Manager/PhysicsScene.cs
index 96a9ff7..c4d7ef3 100644
--- a/OpenSim/Region/Physics/Manager/PhysicsScene.cs
+++ b/OpenSim/Region/Physics/Manager/PhysicsScene.cs
@@ -43,7 +43,7 @@ namespace OpenSim.Region.Physics.Manager
43 public delegate void JointDeactivated(PhysicsJoint joint); 43 public delegate void JointDeactivated(PhysicsJoint joint);
44 public delegate void JointErrorMessage(PhysicsJoint joint, string message); // this refers to an "error message due to a problem", not "amount of joint constraint violation" 44 public delegate void JointErrorMessage(PhysicsJoint joint, string message); // this refers to an "error message due to a problem", not "amount of joint constraint violation"
45 45
46 public enum RayFilterFlags:ushort 46 public enum RayFilterFlags : ushort
47 { 47 {
48 // the flags 48 // the flags
49 water = 0x01, 49 water = 0x01,
@@ -60,7 +60,7 @@ namespace OpenSim.Region.Physics.Manager
60 ClosestHit = 0x8000, 60 ClosestHit = 0x8000,
61 61
62 // some combinations 62 // some combinations
63 LSLPhanton = phantom | volumedtc, 63 LSLPhantom = phantom | volumedtc,
64 PrimsNonPhantom = nonphysical | physical, 64 PrimsNonPhantom = nonphysical | physical,
65 PrimsNonPhantomAgents = nonphysical | physical | agent, 65 PrimsNonPhantomAgents = nonphysical | physical | agent,
66 66
diff --git a/OpenSim/Region/Physics/Meshing/Properties/AssemblyInfo.cs b/OpenSim/Region/Physics/Meshing/Properties/AssemblyInfo.cs
index 4cc1731..bd70296 100644
--- a/OpenSim/Region/Physics/Meshing/Properties/AssemblyInfo.cs
+++ b/OpenSim/Region/Physics/Meshing/Properties/AssemblyInfo.cs
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
29// Build Number 29// Build Number
30// Revision 30// Revision
31// 31//
32[assembly: AssemblyVersion("0.7.5.*")] 32[assembly: AssemblyVersion("0.7.6.*")]
33[assembly: AssemblyFileVersion("1.0.0.0")] 33[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/OpenSim/Region/Physics/OdePlugin/AssemblyInfo.cs b/OpenSim/Region/Physics/OdePlugin/AssemblyInfo.cs
index 3c4f06a..f477ed1 100644
--- a/OpenSim/Region/Physics/OdePlugin/AssemblyInfo.cs
+++ b/OpenSim/Region/Physics/OdePlugin/AssemblyInfo.cs
@@ -55,4 +55,4 @@ using System.Runtime.InteropServices;
55// You can specify all values by your own or you can build default build and revision 55// You can specify all values by your own or you can build default build and revision
56// numbers with the '*' character (the default): 56// numbers with the '*' character (the default):
57 57
58[assembly : AssemblyVersion("0.7.5.*")] 58[assembly : AssemblyVersion("0.7.6.*")]
diff --git a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs
index 02a0b15..6d7f079 100644
--- a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs
+++ b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs
@@ -4096,8 +4096,8 @@ namespace OpenSim.Region.Physics.OdePlugin
4096 lock (_prims) 4096 lock (_prims)
4097 { 4097 {
4098 List<OdePrim> orderedPrims = new List<OdePrim>(_prims); 4098 List<OdePrim> orderedPrims = new List<OdePrim>(_prims);
4099 orderedPrims.OrderByDescending(p => p.CollisionScore).Take(25); 4099 orderedPrims.OrderByDescending(p => p.CollisionScore);
4100 topColliders = orderedPrims.ToDictionary(p => p.LocalID, p => p.CollisionScore); 4100 topColliders = orderedPrims.Take(25).ToDictionary(p => p.LocalID, p => p.CollisionScore);
4101 4101
4102 foreach (OdePrim p in _prims) 4102 foreach (OdePrim p in _prims)
4103 p.CollisionScore = 0; 4103 p.CollisionScore = 0;
diff --git a/OpenSim/Region/Physics/POSPlugin/AssemblyInfo.cs b/OpenSim/Region/Physics/POSPlugin/AssemblyInfo.cs
index d07df02..4289863 100644
--- a/OpenSim/Region/Physics/POSPlugin/AssemblyInfo.cs
+++ b/OpenSim/Region/Physics/POSPlugin/AssemblyInfo.cs
@@ -55,4 +55,4 @@ using System.Runtime.InteropServices;
55// You can specify all values by your own or you can build default build and revision 55// You can specify all values by your own or you can build default build and revision
56// numbers with the '*' character (the default): 56// numbers with the '*' character (the default):
57 57
58[assembly : AssemblyVersion("0.7.5.*")] 58[assembly : AssemblyVersion("0.7.6.*")]
diff --git a/OpenSim/Region/RegionCombinerModule/Properties/AssemblyInfo.cs b/OpenSim/Region/RegionCombinerModule/Properties/AssemblyInfo.cs
index 085eb59..ca945b5 100644
--- a/OpenSim/Region/RegionCombinerModule/Properties/AssemblyInfo.cs
+++ b/OpenSim/Region/RegionCombinerModule/Properties/AssemblyInfo.cs
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
29// Build Number 29// Build Number
30// Revision 30// Revision
31// 31//
32[assembly: AssemblyVersion("0.7.5.*")] 32[assembly: AssemblyVersion("0.7.6.*")]
33[assembly: AssemblyFileVersion("1.0.0.0")] 33[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 001f4d9..0db6fe3 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -1700,10 +1700,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1700 part.Shape.FlexiForceX = (float)Force.x; 1700 part.Shape.FlexiForceX = (float)Force.x;
1701 part.Shape.FlexiForceY = (float)Force.y; 1701 part.Shape.FlexiForceY = (float)Force.y;
1702 part.Shape.FlexiForceZ = (float)Force.z; 1702 part.Shape.FlexiForceZ = (float)Force.z;
1703 part.Shape.PathCurve = 0x80; 1703 part.Shape.PathCurve = (byte)Extrusion.Flexible;
1704 part.ParentGroup.HasGroupChanged = true; 1704 }
1705 part.ScheduleFullUpdate(); 1705 else
1706 {
1707 // Other values not set, they do not seem to be sent to the viewer
1708 // Setting PathCurve appears to be what actually toggles the check box and turns Flexi on and off
1709 part.Shape.PathCurve = (byte)Extrusion.Straight;
1710 part.Shape.FlexiEntry = false;
1706 } 1711 }
1712 part.ParentGroup.HasGroupChanged = true;
1713 part.ScheduleFullUpdate();
1707 } 1714 }
1708 1715
1709 /// <summary> 1716 /// <summary>
@@ -11374,7 +11381,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
11374 if (checkNonPhysical) 11381 if (checkNonPhysical)
11375 rayfilter |= RayFilterFlags.nonphysical; 11382 rayfilter |= RayFilterFlags.nonphysical;
11376 if (detectPhantom) 11383 if (detectPhantom)
11377 rayfilter |= RayFilterFlags.LSLPhanton; 11384 rayfilter |= RayFilterFlags.LSLPhantom;
11378 11385
11379 Vector3 direction = dir * ( 1/dist); 11386 Vector3 direction = dir * ( 1/dist);
11380 11387
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Properties/AssemblyInfo.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Properties/AssemblyInfo.cs
index d173db0..3c01eec 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Properties/AssemblyInfo.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Properties/AssemblyInfo.cs
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
29// Build Number 29// Build Number
30// Revision 30// Revision
31// 31//
32[assembly: AssemblyVersion("0.7.5.*")] 32[assembly: AssemblyVersion("0.7.6.*")]
33[assembly: AssemblyFileVersion("1.0.0.0")] 33[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/Properties/AssemblyInfo.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/Properties/AssemblyInfo.cs
index 573a803..b1825ac 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/Properties/AssemblyInfo.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/Properties/AssemblyInfo.cs
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
29// Build Number 29// Build Number
30// Revision 30// Revision
31// 31//
32[assembly: AssemblyVersion("0.7.5.*")] 32[assembly: AssemblyVersion("0.7.6.*")]
33[assembly: AssemblyFileVersion("1.0.0.0")] 33[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/Properties/AssemblyInfo.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/Properties/AssemblyInfo.cs
index f6d5d41..342dbff 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/Properties/AssemblyInfo.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/Properties/AssemblyInfo.cs
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
29// Build Number 29// Build Number
30// Revision 30// Revision
31// 31//
32[assembly: AssemblyVersion("0.7.5.*")] 32[assembly: AssemblyVersion("0.7.6.*")]
33[assembly: AssemblyFileVersion("1.0.0.0")] 33[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs
index 985e598..9e32f40 100644
--- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs
@@ -31,7 +31,6 @@ using System.Collections.Generic;
31using System.Reflection; 31using System.Reflection;
32using log4net; 32using log4net;
33using Tools; 33using Tools;
34
35using OpenSim.Region.Framework.Interfaces; 34using OpenSim.Region.Framework.Interfaces;
36 35
37namespace OpenSim.Region.ScriptEngine.Shared.CodeTools 36namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
@@ -479,20 +478,27 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
479 { 478 {
480 string retstr = String.Empty; 479 string retstr = String.Empty;
481 bool printSemicolon = true; 480 bool printSemicolon = true;
482 481 bool transformToBlock = false;
483 retstr += Indent();
484 482
485 if (m_insertCoopTerminationChecks) 483 if (m_insertCoopTerminationChecks)
486 { 484 {
487 // We have to check in event functions as well because the user can manually call these. 485 // A non-braced single line do while structure cannot contain multiple statements.
488 if (previousSymbol is GlobalFunctionDefinition 486 // So to insert the termination check we change this to a braced control structure instead.
489 || previousSymbol is WhileStatement 487 if (previousSymbol is WhileStatement
490 || previousSymbol is DoWhileStatement 488 || previousSymbol is DoWhileStatement
491 || previousSymbol is ForLoop 489 || previousSymbol is ForLoop)
492 || previousSymbol is StateEvent) 490 {
493 retstr += Generate(m_coopTerminationCheck); 491 transformToBlock = true;
492
493 // FIXME: This will be wrongly indented because the previous for/while/dowhile will have already indented.
494 retstr += GenerateIndentedLine("{");
495
496 retstr += GenerateIndentedLine(m_coopTerminationCheck);
497 }
494 } 498 }
495 499
500 retstr += Indent();
501
496 if (0 < s.kids.Count) 502 if (0 < s.kids.Count)
497 { 503 {
498 // Jump label prints its own colon, we don't need a semicolon. 504 // Jump label prints its own colon, we don't need a semicolon.
@@ -508,6 +514,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
508 if (printSemicolon) 514 if (printSemicolon)
509 retstr += GenerateLine(";"); 515 retstr += GenerateLine(";");
510 516
517 if (transformToBlock)
518 {
519 // FIXME: This will be wrongly indented because the for/while/dowhile is currently handling the unindent
520 retstr += GenerateIndentedLine("}");
521 }
522
511 return retstr; 523 return retstr;
512 } 524 }
513 525
diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Properties/AssemblyInfo.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Properties/AssemblyInfo.cs
index c65caa8..fd37753 100644
--- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Properties/AssemblyInfo.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Properties/AssemblyInfo.cs
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
29// Build Number 29// Build Number
30// Revision 30// Revision
31// 31//
32[assembly: AssemblyVersion("0.7.5.*")] 32[assembly: AssemblyVersion("0.7.6.*")]
33[assembly: AssemblyFileVersion("1.0.0.0")] 33[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/Properties/AssemblyInfo.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/Properties/AssemblyInfo.cs
index 470e1a1..74747a2 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Instance/Properties/AssemblyInfo.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Instance/Properties/AssemblyInfo.cs
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
29// Build Number 29// Build Number
30// Revision 30// Revision
31// 31//
32[assembly: AssemblyVersion("0.7.5.*")] 32[assembly: AssemblyVersion("0.7.6.*")]
33[assembly: AssemblyFileVersion("1.0.0.0")] 33[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/Tests/CoopTerminationTests.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/Tests/CoopTerminationTests.cs
index 3b13386..7ea30bf1 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Instance/Tests/CoopTerminationTests.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Instance/Tests/CoopTerminationTests.cs
@@ -55,10 +55,22 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance.Tests
55 55
56 private OSChatMessage m_osChatMessageReceived; 56 private OSChatMessage m_osChatMessageReceived;
57 57
58 /// <summary>
59 /// Number of chat messages received so far. Reset before each test.
60 /// </summary>
61 private int m_chatMessagesReceived;
62
63 /// <summary>
64 /// Number of chat messages expected. m_chatEvent is not fired until this number is reached or exceeded.
65 /// </summary>
66 private int m_chatMessagesThreshold;
67
58 [SetUp] 68 [SetUp]
59 public void Init() 69 public void Init()
60 { 70 {
61 m_osChatMessageReceived = null; 71 m_osChatMessageReceived = null;
72 m_chatMessagesReceived = 0;
73 m_chatMessagesThreshold = 0;
62 m_chatEvent = new AutoResetEvent(false); 74 m_chatEvent = new AutoResetEvent(false);
63 m_stoppedEvent = new AutoResetEvent(false); 75 m_stoppedEvent = new AutoResetEvent(false);
64 76
@@ -126,6 +138,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance.Tests
126 } 138 }
127 139
128 [Test] 140 [Test]
141 public void TestNoStopOnSingleStatementForLoop()
142 {
143 TestHelpers.InMethod();
144// TestHelpers.EnableLogging();
145
146 string script =
147@"default
148{
149 state_entry()
150 {
151 integer i = 0;
152 for (i = 0; i <= 1; i++) llSay(0, ""Iter "" + (string)i);
153 }
154}";
155
156 TestSingleStatementNoStop(script);
157 }
158
159 [Test]
129 public void TestStopOnLongSingleStatementForLoop() 160 public void TestStopOnLongSingleStatementForLoop()
130 { 161 {
131 TestHelpers.InMethod(); 162 TestHelpers.InMethod();
@@ -139,8 +170,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance.Tests
139 integer i = 0; 170 integer i = 0;
140 llSay(0, ""Thin Lizzy""); 171 llSay(0, ""Thin Lizzy"");
141 172
142 for (i = 0; i < 2147483647; i++) 173 for (i = 0; i < 2147483647; i++) llSay(0, ""Iter "" + (string)i);
143 llSay(0, ""Iter "" + (string)i);
144 } 174 }
145}"; 175}";
146 176
@@ -172,6 +202,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance.Tests
172 } 202 }
173 203
174 [Test] 204 [Test]
205 public void TestNoStopOnSingleStatementWhileLoop()
206 {
207 TestHelpers.InMethod();
208// TestHelpers.EnableLogging();
209
210 string script =
211@"default
212{
213 state_entry()
214 {
215 integer i = 0;
216 while (i < 2) llSay(0, ""Iter "" + (string)i++);
217 }
218}";
219
220 TestSingleStatementNoStop(script);
221 }
222
223 [Test]
175 public void TestStopOnLongSingleStatementWhileLoop() 224 public void TestStopOnLongSingleStatementWhileLoop()
176 { 225 {
177 TestHelpers.InMethod(); 226 TestHelpers.InMethod();
@@ -218,7 +267,50 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance.Tests
218 } 267 }
219 268
220 [Test] 269 [Test]
221 public void TestStopOnLongDoWhileLoop() 270 public void TestNoStopOnSingleStatementDoWhileLoop()
271 {
272 TestHelpers.InMethod();
273// TestHelpers.EnableLogging();
274
275 string script =
276@"default
277{
278 state_entry()
279 {
280 integer i = 0;
281
282 do llSay(0, ""Iter "" + (string)i++);
283 while (i < 2);
284 }
285}";
286
287 TestSingleStatementNoStop(script);
288 }
289
290 [Test]
291 public void TestStopOnLongSingleStatementDoWhileLoop()
292 {
293 TestHelpers.InMethod();
294// TestHelpers.EnableLogging();
295
296 string script =
297@"default
298{
299 state_entry()
300 {
301 integer i = 0;
302 llSay(0, ""Thin Lizzy"");
303
304 do llSay(0, ""Iter "" + (string)i++);
305 while (1 == 1);
306 }
307}";
308
309 TestStop(script);
310 }
311
312 [Test]
313 public void TestStopOnLongCompoundStatementDoWhileLoop()
222 { 314 {
223 TestHelpers.InMethod(); 315 TestHelpers.InMethod();
224// TestHelpers.EnableLogging(); 316// TestHelpers.EnableLogging();
@@ -234,7 +326,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance.Tests
234 do 326 do
235 { 327 {
236 llSay(0, ""Iter "" + (string)i++); 328 llSay(0, ""Iter "" + (string)i++);
237} while (1 == 1); 329 } while (1 == 1);
238 } 330 }
239}"; 331}";
240 332
@@ -245,7 +337,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance.Tests
245 public void TestStopOnInfiniteJumpLoop() 337 public void TestStopOnInfiniteJumpLoop()
246 { 338 {
247 TestHelpers.InMethod(); 339 TestHelpers.InMethod();
248 TestHelpers.EnableLogging(); 340// TestHelpers.EnableLogging();
249 341
250 string script = 342 string script =
251@"default 343@"default
@@ -320,14 +412,13 @@ default
320 TestStop(script); 412 TestStop(script);
321 } 413 }
322 414
323 private void TestStop(string script) 415 private SceneObjectPart CreateScript(string script, string itemName, UUID userId)
324 { 416 {
325 UUID userId = TestHelpers.ParseTail(0x1);
326// UUID objectId = TestHelpers.ParseTail(0x100); 417// UUID objectId = TestHelpers.ParseTail(0x100);
327// UUID itemId = TestHelpers.ParseTail(0x3); 418// UUID itemId = TestHelpers.ParseTail(0x3);
328 string itemName = "TestStop() Item";
329 419
330 SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, userId, "TestStop", 0x100); 420 SceneObjectGroup so
421 = SceneHelpers.CreateSceneObject(1, userId, string.Format("Object for {0}", itemName), 0x100);
331 m_scene.AddNewSceneObject(so, true); 422 m_scene.AddNewSceneObject(so, true);
332 423
333 InventoryItemBase itemTemplate = new InventoryItemBase(); 424 InventoryItemBase itemTemplate = new InventoryItemBase();
@@ -338,14 +429,57 @@ default
338 429
339 m_scene.EventManager.OnChatFromWorld += OnChatFromWorld; 430 m_scene.EventManager.OnChatFromWorld += OnChatFromWorld;
340 431
341 SceneObjectPart partWhereRezzed = m_scene.RezNewScript(userId, itemTemplate, script); 432 return m_scene.RezNewScript(userId, itemTemplate, script);
433 }
434
435 private void TestSingleStatementNoStop(string script)
436 {
437 // In these tests we expect to see at least 2 chat messages to confirm that the loop is working properly.
438 m_chatMessagesThreshold = 2;
439
440 UUID userId = TestHelpers.ParseTail(0x1);
441// UUID objectId = TestHelpers.ParseTail(0x100);
442// UUID itemId = TestHelpers.ParseTail(0x3);
443 string itemName = "TestNoStop";
444
445 SceneObjectPart partWhereRezzed = CreateScript(script, itemName, userId);
446 TaskInventoryItem rezzedItem = partWhereRezzed.Inventory.GetInventoryItem(itemName);
447
448 // Wait for the script to start the event before we try stopping it.
449 m_chatEvent.WaitOne(60000);
450
451 if (m_osChatMessageReceived == null)
452 Assert.Fail("Script did not start");
453 else
454 Assert.That(m_chatMessagesReceived, Is.EqualTo(2));
455
456 bool running;
457 TaskInventoryItem scriptItem = partWhereRezzed.Inventory.GetInventoryItem(itemName);
458 Assert.That(
459 SceneObjectPartInventory.TryGetScriptInstanceRunning(m_scene, scriptItem, out running), Is.True);
460 Assert.That(running, Is.True);
461 }
462
463 private void TestStop(string script)
464 {
465 // In these tests we're only interested in the first message to confirm that the script has started.
466 m_chatMessagesThreshold = 1;
342 467
468 UUID userId = TestHelpers.ParseTail(0x1);
469// UUID objectId = TestHelpers.ParseTail(0x100);
470// UUID itemId = TestHelpers.ParseTail(0x3);
471 string itemName = "TestStop";
472
473 SceneObjectPart partWhereRezzed = CreateScript(script, itemName, userId);
343 TaskInventoryItem rezzedItem = partWhereRezzed.Inventory.GetInventoryItem(itemName); 474 TaskInventoryItem rezzedItem = partWhereRezzed.Inventory.GetInventoryItem(itemName);
344 475
345 // Wait for the script to start the event before we try stopping it. 476 // Wait for the script to start the event before we try stopping it.
346 m_chatEvent.WaitOne(60000); 477 m_chatEvent.WaitOne(60000);
347 478
348 Console.WriteLine("Script started with message [{0}]", m_osChatMessageReceived.Message); 479 if (m_osChatMessageReceived != null)
480 Console.WriteLine("Script started with message [{0}]", m_osChatMessageReceived.Message);
481 else
482 Assert.Fail("Script did not start");
349 483
350 // FIXME: This is a very poor way of trying to avoid a low-probability race condition where the script 484 // FIXME: This is a very poor way of trying to avoid a low-probability race condition where the script
351 // executes llSay() but has not started the next statement before we try to stop it. 485 // executes llSay() but has not started the next statement before we try to stop it.
@@ -367,11 +501,14 @@ default
367 501
368 private void OnChatFromWorld(object sender, OSChatMessage oscm) 502 private void OnChatFromWorld(object sender, OSChatMessage oscm)
369 { 503 {
370 m_scene.EventManager.OnChatFromWorld -= OnChatFromWorld;
371 Console.WriteLine("Got chat [{0}]", oscm.Message); 504 Console.WriteLine("Got chat [{0}]", oscm.Message);
372
373 m_osChatMessageReceived = oscm; 505 m_osChatMessageReceived = oscm;
374 m_chatEvent.Set(); 506
507 if (++m_chatMessagesReceived >= m_chatMessagesThreshold)
508 {
509 m_scene.EventManager.OnChatFromWorld -= OnChatFromWorld;
510 m_chatEvent.Set();
511 }
375 } 512 }
376 } 513 }
377} \ No newline at end of file 514} \ No newline at end of file
diff --git a/OpenSim/Region/ScriptEngine/Shared/Properties/AssemblyInfo.cs b/OpenSim/Region/ScriptEngine/Shared/Properties/AssemblyInfo.cs
index e6e8777..d08b0a6 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Properties/AssemblyInfo.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Properties/AssemblyInfo.cs
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
29// Build Number 29// Build Number
30// Revision 30// Revision
31// 31//
32[assembly: AssemblyVersion("0.7.5.*")] 32[assembly: AssemblyVersion("0.7.6.*")]
33[assembly: AssemblyFileVersion("1.0.0.0")] 33[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs b/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs
index afde685..0ff2da3 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs
@@ -62,6 +62,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine
62 myScriptEngine.World.EventManager.OnScriptNotAtTargetEvent += not_at_target; 62 myScriptEngine.World.EventManager.OnScriptNotAtTargetEvent += not_at_target;
63 myScriptEngine.World.EventManager.OnScriptAtRotTargetEvent += at_rot_target; 63 myScriptEngine.World.EventManager.OnScriptAtRotTargetEvent += at_rot_target;
64 myScriptEngine.World.EventManager.OnScriptNotAtRotTargetEvent += not_at_rot_target; 64 myScriptEngine.World.EventManager.OnScriptNotAtRotTargetEvent += not_at_rot_target;
65 myScriptEngine.World.EventManager.OnScriptMovingStartEvent += moving_start;
66 myScriptEngine.World.EventManager.OnScriptMovingEndEvent += moving_end;
65 myScriptEngine.World.EventManager.OnScriptControlEvent += control; 67 myScriptEngine.World.EventManager.OnScriptControlEvent += control;
66 myScriptEngine.World.EventManager.OnScriptColliderStart += collision_start; 68 myScriptEngine.World.EventManager.OnScriptColliderStart += collision_start;
67 myScriptEngine.World.EventManager.OnScriptColliding += collision; 69 myScriptEngine.World.EventManager.OnScriptColliding += collision;
@@ -419,14 +421,14 @@ namespace OpenSim.Region.ScriptEngine.XEngine
419 // dataserver: not handled here 421 // dataserver: not handled here
420 // link_message: not handled here 422 // link_message: not handled here
421 423
422 public void moving_start(uint localID, UUID itemID) 424 public void moving_start(uint localID)
423 { 425 {
424 myScriptEngine.PostObjectEvent(localID, new EventParams( 426 myScriptEngine.PostObjectEvent(localID, new EventParams(
425 "moving_start",new object[0], 427 "moving_start",new object[0],
426 new DetectParams[0])); 428 new DetectParams[0]));
427 } 429 }
428 430
429 public void moving_end(uint localID, UUID itemID) 431 public void moving_end(uint localID)
430 { 432 {
431 myScriptEngine.PostObjectEvent(localID, new EventParams( 433 myScriptEngine.PostObjectEvent(localID, new EventParams(
432 "moving_end",new object[0], 434 "moving_end",new object[0],
diff --git a/OpenSim/Region/ScriptEngine/XEngine/Properties/AssemblyInfo.cs b/OpenSim/Region/ScriptEngine/XEngine/Properties/AssemblyInfo.cs
index bd26a8b..a887171 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/Properties/AssemblyInfo.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/Properties/AssemblyInfo.cs
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
29// Build Number 29// Build Number
30// Revision 30// Revision
31// 31//
32[assembly: AssemblyVersion("0.7.5.*")] 32[assembly: AssemblyVersion("0.7.6.*")]
33[assembly: AssemblyFileVersion("1.0.0.0")] 33[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
index d483219..8931be4 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
@@ -48,7 +48,6 @@ using OpenSim.Region.Framework.Scenes;
48using OpenSim.Region.Framework.Interfaces; 48using OpenSim.Region.Framework.Interfaces;
49using OpenSim.Region.ScriptEngine.Interfaces; 49using OpenSim.Region.ScriptEngine.Interfaces;
50using OpenSim.Region.ScriptEngine.Shared; 50using OpenSim.Region.ScriptEngine.Shared;
51using OpenSim.Region.ScriptEngine.Shared.ScriptBase;
52using OpenSim.Region.ScriptEngine.Shared.CodeTools; 51using OpenSim.Region.ScriptEngine.Shared.CodeTools;
53using OpenSim.Region.ScriptEngine.Shared.Instance; 52using OpenSim.Region.ScriptEngine.Shared.Instance;
54using OpenSim.Region.ScriptEngine.Shared.Api; 53using OpenSim.Region.ScriptEngine.Shared.Api;
@@ -630,7 +629,6 @@ namespace OpenSim.Region.ScriptEngine.XEngine
630 } 629 }
631 630
632 StringBuilder sb = new StringBuilder(); 631 StringBuilder sb = new StringBuilder();
633 Queue eq = instance.EventQueue;
634 632
635 sb.AppendFormat("Script name : {0}\n", instance.ScriptName); 633 sb.AppendFormat("Script name : {0}\n", instance.ScriptName);
636 sb.AppendFormat("Status : {0}\n", status); 634 sb.AppendFormat("Status : {0}\n", status);
diff --git a/OpenSim/Region/UserStatistics/Properties/AssemblyInfo.cs b/OpenSim/Region/UserStatistics/Properties/AssemblyInfo.cs
index 100cf99..caa6d4e 100644
--- a/OpenSim/Region/UserStatistics/Properties/AssemblyInfo.cs
+++ b/OpenSim/Region/UserStatistics/Properties/AssemblyInfo.cs
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
29// Build Number 29// Build Number
30// Revision 30// Revision
31// 31//
32[assembly: AssemblyVersion("0.7.5.*")] 32[assembly: AssemblyVersion("0.7.6.*")]
33[assembly: AssemblyFileVersion("1.0.0.0")] 33[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/OpenSim/Server/Base/Properties/AssemblyInfo.cs b/OpenSim/Server/Base/Properties/AssemblyInfo.cs
index 4bbe358..8b45564 100644
--- a/OpenSim/Server/Base/Properties/AssemblyInfo.cs
+++ b/OpenSim/Server/Base/Properties/AssemblyInfo.cs
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
29// Build Number 29// Build Number
30// Revision 30// Revision
31// 31//
32[assembly: AssemblyVersion("0.7.5.*")] 32[assembly: AssemblyVersion("0.7.6.*")]
33[assembly: AssemblyFileVersion("1.0.0.0")] 33[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/OpenSim/Server/Handlers/Properties/AssemblyInfo.cs b/OpenSim/Server/Handlers/Properties/AssemblyInfo.cs
index 53e9737..d72d36a 100644
--- a/OpenSim/Server/Handlers/Properties/AssemblyInfo.cs
+++ b/OpenSim/Server/Handlers/Properties/AssemblyInfo.cs
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
29// Build Number 29// Build Number
30// Revision 30// Revision
31// 31//
32[assembly: AssemblyVersion("0.7.5.*")] 32[assembly: AssemblyVersion("0.7.6.*")]
33[assembly: AssemblyFileVersion("1.0.0.0")] 33[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/OpenSim/Server/Properties/AssemblyInfo.cs b/OpenSim/Server/Properties/AssemblyInfo.cs
index ebc10fb..ee45e10 100644
--- a/OpenSim/Server/Properties/AssemblyInfo.cs
+++ b/OpenSim/Server/Properties/AssemblyInfo.cs
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
29// Build Number 29// Build Number
30// Revision 30// Revision
31// 31//
32[assembly: AssemblyVersion("0.7.5.*")] 32[assembly: AssemblyVersion("0.7.6.*")]
33[assembly: AssemblyFileVersion("1.0.0.0")] 33[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/OpenSim/Services/AssetService/Properties/AssemblyInfo.cs b/OpenSim/Services/AssetService/Properties/AssemblyInfo.cs
index 1509400..b57052c 100644
--- a/OpenSim/Services/AssetService/Properties/AssemblyInfo.cs
+++ b/OpenSim/Services/AssetService/Properties/AssemblyInfo.cs
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
29// Build Number 29// Build Number
30// Revision 30// Revision
31// 31//
32[assembly: AssemblyVersion("0.7.5.*")] 32[assembly: AssemblyVersion("0.7.6.*")]
33[assembly: AssemblyFileVersion("1.0.0.0")] 33[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/OpenSim/Services/AuthenticationService/Properties/AssemblyInfo.cs b/OpenSim/Services/AuthenticationService/Properties/AssemblyInfo.cs
index 0eb2ba7..99c46ec 100644
--- a/OpenSim/Services/AuthenticationService/Properties/AssemblyInfo.cs
+++ b/OpenSim/Services/AuthenticationService/Properties/AssemblyInfo.cs
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
29// Build Number 29// Build Number
30// Revision 30// Revision
31// 31//
32[assembly: AssemblyVersion("0.7.5.*")] 32[assembly: AssemblyVersion("0.7.6.*")]
33[assembly: AssemblyFileVersion("1.0.0.0")] 33[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/OpenSim/Services/AuthorizationService/Properties/AssemblyInfo.cs b/OpenSim/Services/AuthorizationService/Properties/AssemblyInfo.cs
index 6d6b11e..33e48d3 100644
--- a/OpenSim/Services/AuthorizationService/Properties/AssemblyInfo.cs
+++ b/OpenSim/Services/AuthorizationService/Properties/AssemblyInfo.cs
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
29// Build Number 29// Build Number
30// Revision 30// Revision
31// 31//
32[assembly: AssemblyVersion("0.7.5.*")] 32[assembly: AssemblyVersion("0.7.6.*")]
33[assembly: AssemblyFileVersion("1.0.0.0")] 33[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/OpenSim/Services/AvatarService/Properties/AssemblyInfo.cs b/OpenSim/Services/AvatarService/Properties/AssemblyInfo.cs
index 0944149..8b0214a 100644
--- a/OpenSim/Services/AvatarService/Properties/AssemblyInfo.cs
+++ b/OpenSim/Services/AvatarService/Properties/AssemblyInfo.cs
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
29// Build Number 29// Build Number
30// Revision 30// Revision
31// 31//
32[assembly: AssemblyVersion("0.7.5.*")] 32[assembly: AssemblyVersion("0.7.6.*")]
33[assembly: AssemblyFileVersion("1.0.0.0")] 33[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/OpenSim/Services/Base/Properties/AssemblyInfo.cs b/OpenSim/Services/Base/Properties/AssemblyInfo.cs
index 306b699..2825a88 100644
--- a/OpenSim/Services/Base/Properties/AssemblyInfo.cs
+++ b/OpenSim/Services/Base/Properties/AssemblyInfo.cs
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
29// Build Number 29// Build Number
30// Revision 30// Revision
31// 31//
32[assembly: AssemblyVersion("0.7.5.*")] 32[assembly: AssemblyVersion("0.7.6.*")]
33[assembly: AssemblyFileVersion("1.0.0.0")] 33[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/OpenSim/Services/Connectors/Properties/AssemblyInfo.cs b/OpenSim/Services/Connectors/Properties/AssemblyInfo.cs
index bfb681b..73fc72c 100644
--- a/OpenSim/Services/Connectors/Properties/AssemblyInfo.cs
+++ b/OpenSim/Services/Connectors/Properties/AssemblyInfo.cs
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
29// Build Number 29// Build Number
30// Revision 30// Revision
31// 31//
32[assembly: AssemblyVersion("0.7.5.*")] 32[assembly: AssemblyVersion("0.7.6.*")]
33[assembly: AssemblyFileVersion("1.0.0.0")] 33[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/OpenSim/Services/FreeswitchService/Properties/AssemblyInfo.cs b/OpenSim/Services/FreeswitchService/Properties/AssemblyInfo.cs
index 58c7283..fdd4b69 100644
--- a/OpenSim/Services/FreeswitchService/Properties/AssemblyInfo.cs
+++ b/OpenSim/Services/FreeswitchService/Properties/AssemblyInfo.cs
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
29// Build Number 29// Build Number
30// Revision 30// Revision
31// 31//
32[assembly: AssemblyVersion("0.7.5.*")] 32[assembly: AssemblyVersion("0.7.6.*")]
33[assembly: AssemblyFileVersion("1.0.0.0")] 33[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/OpenSim/Services/Friends/Properties/AssemblyInfo.cs b/OpenSim/Services/Friends/Properties/AssemblyInfo.cs
index dddb091..cb624f0 100644
--- a/OpenSim/Services/Friends/Properties/AssemblyInfo.cs
+++ b/OpenSim/Services/Friends/Properties/AssemblyInfo.cs
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
29// Build Number 29// Build Number
30// Revision 30// Revision
31// 31//
32[assembly: AssemblyVersion("0.7.5.*")] 32[assembly: AssemblyVersion("0.7.6.*")]
33[assembly: AssemblyFileVersion("1.0.0.0")] 33[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/OpenSim/Services/GridService/Properties/AssemblyInfo.cs b/OpenSim/Services/GridService/Properties/AssemblyInfo.cs
index 5c0c8f4..09084d3 100644
--- a/OpenSim/Services/GridService/Properties/AssemblyInfo.cs
+++ b/OpenSim/Services/GridService/Properties/AssemblyInfo.cs
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
29// Build Number 29// Build Number
30// Revision 30// Revision
31// 31//
32[assembly: AssemblyVersion("0.7.5.*")] 32[assembly: AssemblyVersion("0.7.6.*")]
33[assembly: AssemblyFileVersion("1.0.0.0")] 33[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/OpenSim/Services/HypergridService/Properties/AssemblyInfo.cs b/OpenSim/Services/HypergridService/Properties/AssemblyInfo.cs
index 49f2176..fe1889d 100644
--- a/OpenSim/Services/HypergridService/Properties/AssemblyInfo.cs
+++ b/OpenSim/Services/HypergridService/Properties/AssemblyInfo.cs
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
29// Build Number 29// Build Number
30// Revision 30// Revision
31// 31//
32[assembly: AssemblyVersion("0.7.5.*")] 32[assembly: AssemblyVersion("0.7.6.*")]
33[assembly: AssemblyFileVersion("1.0.0.0")] 33[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/OpenSim/Services/Interfaces/Properties/AssemblyInfo.cs b/OpenSim/Services/Interfaces/Properties/AssemblyInfo.cs
index 4723553..669e0b8 100644
--- a/OpenSim/Services/Interfaces/Properties/AssemblyInfo.cs
+++ b/OpenSim/Services/Interfaces/Properties/AssemblyInfo.cs
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
29// Build Number 29// Build Number
30// Revision 30// Revision
31// 31//
32[assembly: AssemblyVersion("0.7.5.*")] 32[assembly: AssemblyVersion("0.7.6.*")]
33[assembly: AssemblyFileVersion("1.0.0.0")] 33[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/OpenSim/Services/InventoryService/Properties/AssemblyInfo.cs b/OpenSim/Services/InventoryService/Properties/AssemblyInfo.cs
index 41ad9f8..0870065 100644
--- a/OpenSim/Services/InventoryService/Properties/AssemblyInfo.cs
+++ b/OpenSim/Services/InventoryService/Properties/AssemblyInfo.cs
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
29// Build Number 29// Build Number
30// Revision 30// Revision
31// 31//
32[assembly: AssemblyVersion("0.7.5.*")] 32[assembly: AssemblyVersion("0.7.6.*")]
33[assembly: AssemblyFileVersion("1.0.0.0")] 33[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/OpenSim/Services/LLLoginService/Properties/AssemblyInfo.cs b/OpenSim/Services/LLLoginService/Properties/AssemblyInfo.cs
index 62c6e0f..3ac8af7 100644
--- a/OpenSim/Services/LLLoginService/Properties/AssemblyInfo.cs
+++ b/OpenSim/Services/LLLoginService/Properties/AssemblyInfo.cs
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
29// Build Number 29// Build Number
30// Revision 30// Revision
31// 31//
32[assembly: AssemblyVersion("0.7.5.*")] 32[assembly: AssemblyVersion("0.7.6.*")]
33[assembly: AssemblyFileVersion("1.0.0.0")] 33[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/OpenSim/Services/MapImageService/Properties/AssemblyInfo.cs b/OpenSim/Services/MapImageService/Properties/AssemblyInfo.cs
index 23eb664..69adf73 100644
--- a/OpenSim/Services/MapImageService/Properties/AssemblyInfo.cs
+++ b/OpenSim/Services/MapImageService/Properties/AssemblyInfo.cs
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
29// Build Number 29// Build Number
30// Revision 30// Revision
31// 31//
32[assembly: AssemblyVersion("0.7.5.*")] 32[assembly: AssemblyVersion("0.7.6.*")]
33[assembly: AssemblyFileVersion("1.0.0.0")] 33[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/OpenSim/Services/PresenceService/Properties/AssemblyInfo.cs b/OpenSim/Services/PresenceService/Properties/AssemblyInfo.cs
index 8c03dd7..040bbe0 100644
--- a/OpenSim/Services/PresenceService/Properties/AssemblyInfo.cs
+++ b/OpenSim/Services/PresenceService/Properties/AssemblyInfo.cs
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
29// Build Number 29// Build Number
30// Revision 30// Revision
31// 31//
32[assembly: AssemblyVersion("0.7.5.*")] 32[assembly: AssemblyVersion("0.7.6.*")]
33[assembly: AssemblyFileVersion("1.0.0.0")] 33[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/OpenSim/Services/UserAccountService/Properties/AssemblyInfo.cs b/OpenSim/Services/UserAccountService/Properties/AssemblyInfo.cs
index 24e1d16..576ccce 100644
--- a/OpenSim/Services/UserAccountService/Properties/AssemblyInfo.cs
+++ b/OpenSim/Services/UserAccountService/Properties/AssemblyInfo.cs
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
29// Build Number 29// Build Number
30// Revision 30// Revision
31// 31//
32[assembly: AssemblyVersion("0.7.5.*")] 32[assembly: AssemblyVersion("0.7.6.*")]
33[assembly: AssemblyFileVersion("1.0.0.0")] 33[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/OpenSim/Tools/Compiler/Properties/AssemblyInfo.cs b/OpenSim/Tools/Compiler/Properties/AssemblyInfo.cs
index e1a1fda..b98e2d2 100644
--- a/OpenSim/Tools/Compiler/Properties/AssemblyInfo.cs
+++ b/OpenSim/Tools/Compiler/Properties/AssemblyInfo.cs
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
29// Build Number 29// Build Number
30// Revision 30// Revision
31// 31//
32[assembly: AssemblyVersion("0.7.5.*")] 32[assembly: AssemblyVersion("0.7.6.*")]
33[assembly: AssemblyFileVersion("1.0.0.0")] 33[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/OpenSim/Tools/Configger/Properties/AssemblyInfo.cs b/OpenSim/Tools/Configger/Properties/AssemblyInfo.cs
index 62a2f2d..89aafa3 100644
--- a/OpenSim/Tools/Configger/Properties/AssemblyInfo.cs
+++ b/OpenSim/Tools/Configger/Properties/AssemblyInfo.cs
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
29// Build Number 29// Build Number
30// Revision 30// Revision
31// 31//
32[assembly: AssemblyVersion("0.7.5.*")] 32[assembly: AssemblyVersion("0.7.6.*")]
33[assembly: AssemblyFileVersion("1.0.0.0")] 33[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/OpenSim/Tools/pCampBot/Properties/AssemblyInfo.cs b/OpenSim/Tools/pCampBot/Properties/AssemblyInfo.cs
index 20598f1..c4d278a 100644
--- a/OpenSim/Tools/pCampBot/Properties/AssemblyInfo.cs
+++ b/OpenSim/Tools/pCampBot/Properties/AssemblyInfo.cs
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
29// Build Number 29// Build Number
30// Revision 30// Revision
31// 31//
32[assembly: AssemblyVersion("0.7.5.*")] 32[assembly: AssemblyVersion("0.7.6.*")]
33[assembly: AssemblyFileVersion("1.0.0.0")] 33[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/ThirdParty/SmartThreadPool/AssemblyInfo.cs b/ThirdParty/SmartThreadPool/AssemblyInfo.cs
index af9baff..e2465b0 100644
--- a/ThirdParty/SmartThreadPool/AssemblyInfo.cs
+++ b/ThirdParty/SmartThreadPool/AssemblyInfo.cs
@@ -29,7 +29,7 @@ using System.Runtime.InteropServices;
29// You can specify all the values or you can default the Revision and Build Numbers 29// You can specify all the values or you can default the Revision and Build Numbers
30// by using the '*' as shown below: 30// by using the '*' as shown below:
31 31
32[assembly: AssemblyVersion("0.7.5.*")] 32[assembly: AssemblyVersion("0.7.6.*")]
33 33
34// 34//
35// In order to sign your assembly you must specify a key to use. Refer to the 35// In order to sign your assembly you must specify a key to use. Refer to the
diff --git a/bin/OpenSim.ini.example b/bin/OpenSim.ini.example
index 0fe44e9..653de5c 100644
--- a/bin/OpenSim.ini.example
+++ b/bin/OpenSim.ini.example
@@ -269,9 +269,10 @@
269 ; DefaultScriptEngine = "XEngine" 269 ; DefaultScriptEngine = "XEngine"
270 270
271 ;# {GenerateMaptiles} {} {Generate map tiles?} {true false} true 271 ;# {GenerateMaptiles} {} {Generate map tiles?} {true false} true
272 ;; Map tile options. You can choose to generate no map tiles at all, 272 ;; Map tile options. You can choose to generate normal maptiles or nominate an uploaded texture to
273 ;; generate normal maptiles, or nominate an uploaded texture to 273 ;; be the map tile using the MaptileStaticUUID parameter in this section or for individual regions in
274 ;; be the map tile 274 ;; the regions config file(s). If you do not want to upload map tiles at all, then you will need
275 ;; to disable the MapImageServiceModule entirely.
275 ; GenerateMaptiles = true 276 ; GenerateMaptiles = true
276 277
277 ;# {MaptileRefresh} {GenerateMaptiles} {Maptile refresh period?} {} 0 278 ;# {MaptileRefresh} {GenerateMaptiles} {Maptile refresh period?} {} 0
diff --git a/bin/OpenSimDefaults.ini b/bin/OpenSimDefaults.ini
index c60579b..9119273 100644
--- a/bin/OpenSimDefaults.ini
+++ b/bin/OpenSimDefaults.ini
@@ -1,7 +1,6 @@
1; This file contains defaults for various settings in OpenSimulator. These can be overriden 1; This file contains defaults for various settings in OpenSimulator. These can be overriden
2; by changing the same setting in OpenSim.ini (once OpenSim.ini.example has been copied to OpenSim.ini). 2; by changing the same setting in OpenSim.ini (once OpenSim.ini.example has been copied to OpenSim.ini).
3 3
4
5[Startup] 4[Startup]
6 ; Console prompt 5 ; Console prompt
7 ; Certain special characters can be used to customize the prompt 6 ; Certain special characters can be used to customize the prompt
diff --git a/bin/Regions/Regions.ini.example b/bin/Regions/Regions.ini.example
index 54a841d..f5282a7 100644
--- a/bin/Regions/Regions.ini.example
+++ b/bin/Regions/Regions.ini.example
@@ -45,3 +45,4 @@ ExternalHostName = "SYSTEMIP"
45; * 45; *
46 46
47; RegionType = "Mainland" 47; RegionType = "Mainland"
48; MaptileStaticUUID = "00000000-0000-0000-0000-000000000000"
diff --git a/bin/lib32/BulletSim.dll b/bin/lib32/BulletSim.dll
index b46837f..24dffac 100755
--- a/bin/lib32/BulletSim.dll
+++ b/bin/lib32/BulletSim.dll
Binary files differ
diff --git a/bin/lib32/libBulletSim.so b/bin/lib32/libBulletSim.so
index a2e6f3c..7e3ed20 100755
--- a/bin/lib32/libBulletSim.so
+++ b/bin/lib32/libBulletSim.so
Binary files differ
diff --git a/bin/lib64/BulletSim.dll b/bin/lib64/BulletSim.dll
index 0a1faf3..808f433 100755
--- a/bin/lib64/BulletSim.dll
+++ b/bin/lib64/BulletSim.dll
Binary files differ
diff --git a/bin/lib64/libBulletSim.so b/bin/lib64/libBulletSim.so
index 36674f0..9382751 100755
--- a/bin/lib64/libBulletSim.so
+++ b/bin/lib64/libBulletSim.so
Binary files differ
diff --git a/prebuild.xml b/prebuild.xml
index 106ae39..74238d1 100644
--- a/prebuild.xml
+++ b/prebuild.xml
@@ -3360,6 +3360,40 @@
3360 </Files> 3360 </Files>
3361 </Project> 3361 </Project>
3362 3362
3363 <Project frameworkVersion="v3_5" name="OpenSim.Region.Physics.BulletSPlugin.Tests" path="OpenSim/Region/Physics/BulletSPlugin/Tests" type="Library">
3364 <Configuration name="Debug">
3365 <Options>
3366 <OutputPath>../../../../../bin/</OutputPath>
3367 </Options>
3368 </Configuration>
3369 <Configuration name="Release">
3370 <Options>
3371 <OutputPath>../../../../../bin/</OutputPath>
3372 </Options>
3373 </Configuration>
3374
3375 <ReferencePath>../../../../../bin/</ReferencePath>
3376 <Reference name="System"/>
3377 <Reference name="System.Core"/>
3378 <Reference name="System.Data"/>
3379 <Reference name="Nini" path="../../../../../bin/"/>
3380 <Reference name="log4net" path="../../../../../bin/"/>
3381 <Reference name="nunit.framework" path="../../../../../bin/"/>
3382 <Reference name="OpenMetaverse" path="../../../../../bin/"/>
3383 <Reference name="OpenMetaverseTypes" path="../../../../../bin/"/>
3384 <Reference name="OpenSim.Framework"/>
3385 <Reference name="OpenSim.Tests.Common"/>
3386 <Reference name="OpenSim.Region.CoreModules"/>
3387 <Reference name="OpenSim.Region.Physics.Meshing" path="../../../../../bin/Physics/"/>
3388 <Reference name="OpenSim.Region.Physics.Manager"/>
3389 <Reference name="OpenSim.Region.Physics.BulletSPlugin" path="../../../../../bin/Physics/"/>
3390
3391 <Files>
3392 <Match pattern="*.cs" recurse="false"/>
3393 </Files>
3394 </Project>
3395
3396
3363 <Project frameworkVersion="v3_5" name="OpenSim.Server.Handlers.Tests" path="OpenSim/Server/Handlers" type="Library"> 3397 <Project frameworkVersion="v3_5" name="OpenSim.Server.Handlers.Tests" path="OpenSim/Server/Handlers" type="Library">
3364 <Configuration name="Debug"> 3398 <Configuration name="Debug">
3365 <Options> 3399 <Options>