aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/Application/OpenSimBase.cs2
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs41
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/Properties/AssemblyInfo.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/ClientStack/TCPJSONStream/ClientAcceptedEventArgs.cs50
-rw-r--r--OpenSim/Region/ClientStack/TCPJSONStream/ClientNetworkContext.cs146
-rw-r--r--OpenSim/Region/ClientStack/TCPJSONStream/DisconnectedEventArgs.cs17
-rw-r--r--OpenSim/Region/ClientStack/TCPJSONStream/OpenSimWebSocketBase.cs73
-rw-r--r--OpenSim/Region/ClientStack/TCPJSONStream/TCPJsonWebSocketServer.cs163
-rw-r--r--OpenSim/Region/CoreModules/Framework/DynamicAttributes/DAExampleModule.cs107
-rw-r--r--OpenSim/Region/CoreModules/Properties/AssemblyInfo.cs2
-rw-r--r--OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs37
-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/Scene.cs16
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs109
-rw-r--r--OpenSim/Region/Framework/Scenes/Scripting/IScriptHost.cs46
-rw-r--r--OpenSim/Region/Framework/Scenes/Scripting/NullScriptHost.cs91
-rw-r--r--OpenSim/Region/Framework/Scenes/Scripting/ScriptEngineInterface.cs38
-rw-r--r--OpenSim/Region/Framework/Scenes/Scripting/ScriptEngineLoader.cs119
-rw-r--r--OpenSim/Region/Framework/Scenes/Scripting/ScriptUtils.cs107
-rw-r--r--OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs57
-rw-r--r--OpenSim/Region/OptionalModules/Properties/AssemblyInfo.cs2
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStore.cs64
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreModule.cs28
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreScriptModule.cs42
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs61
-rw-r--r--OpenSim/Region/Physics/BasicPhysicsPlugin/AssemblyInfo.cs2
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSAPIXNA.cs70
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSApiTemplate.cs38
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs2
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSParam.cs155
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs1
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSScene.cs58
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs82
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSTerrainMesh.cs13
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BulletSimData.cs4
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt5
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/Properties/AssemblyInfo.cs2
-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/IMesher.cs1
-rw-r--r--OpenSim/Region/Physics/Meshing/Mesh.cs2
-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/POSPlugin/AssemblyInfo.cs2
-rw-r--r--OpenSim/Region/RegionCombinerModule/Properties/AssemblyInfo.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs120
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs64
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Properties/AssemblyInfo.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs11
-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/Properties/AssemblyInfo.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Instance/Properties/AssemblyInfo.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Properties/AssemblyInfo.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/Properties/AssemblyInfo.cs2
-rw-r--r--OpenSim/Region/UserStatistics/Properties/AssemblyInfo.cs2
-rw-r--r--OpenSim/Region/UserStatistics/WebStatsModule.cs2
61 files changed, 988 insertions, 1101 deletions
diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs
index f5c06df..3c8e199 100644
--- a/OpenSim/Region/Application/OpenSimBase.cs
+++ b/OpenSim/Region/Application/OpenSimBase.cs
@@ -714,7 +714,7 @@ namespace OpenSim
714 714
715 return new Scene( 715 return new Scene(
716 regionInfo, circuitManager, sceneGridService, 716 regionInfo, circuitManager, sceneGridService,
717 simDataService, estateDataService, false, 717 simDataService, estateDataService,
718 Config, m_version); 718 Config, m_version);
719 } 719 }
720 720
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
index a534522..568e216 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
@@ -617,7 +617,7 @@ namespace OpenSim.Region.ClientStack.Linden
617 = new SceneObjectPart(owner_id, pbs, position, Quaternion.Identity, Vector3.Zero); 617 = new SceneObjectPart(owner_id, pbs, position, Quaternion.Identity, Vector3.Zero);
618 618
619 prim.Scale = scale; 619 prim.Scale = scale;
620 prim.OffsetPosition = position; 620 //prim.OffsetPosition = position;
621 rotations.Add(rotation); 621 rotations.Add(rotation);
622 positions.Add(position); 622 positions.Add(position);
623 prim.UUID = UUID.Random(); 623 prim.UUID = UUID.Random();
@@ -641,25 +641,40 @@ namespace OpenSim.Region.ClientStack.Linden
641 grp.AddPart(prim); 641 grp.AddPart(prim);
642 } 642 }
643 643
644 // Fix first link number 644 Vector3 rootPos = positions[0];
645
645 if (grp.Parts.Length > 1) 646 if (grp.Parts.Length > 1)
647 {
648 // Fix first link number
646 grp.RootPart.LinkNum++; 649 grp.RootPart.LinkNum++;
647 650
648 Vector3 rootPos = positions[0]; 651 Quaternion rootRotConj = Quaternion.Conjugate(rotations[0]);
649 grp.AbsolutePosition = rootPos; 652 Quaternion tmprot;
650 for (int i = 0; i < positions.Count; i++) 653 Vector3 offset;
651 { 654
652 Vector3 offset = positions[i] - rootPos; 655 // fix children rotations and positions
653 grp.Parts[i].OffsetPosition = offset; 656 for (int i = 1; i < rotations.Count; i++)
654 } 657 {
658 tmprot = rotations[i];
659 tmprot = rootRotConj * tmprot;
660
661 grp.Parts[i].RotationOffset = tmprot;
655 662
656 for (int i = 0; i < rotations.Count; i++) 663 offset = positions[i] - rootPos;
664
665 offset *= rootRotConj;
666 grp.Parts[i].OffsetPosition = offset;
667 }
668
669 grp.AbsolutePosition = rootPos;
670 grp.UpdateGroupRotationR(rotations[0]);
671 }
672 else
657 { 673 {
658 if (i != 0) 674 grp.AbsolutePosition = rootPos;
659 grp.Parts[i].RotationOffset = rotations[i]; 675 grp.UpdateGroupRotationR(rotations[0]);
660 } 676 }
661 677
662 grp.UpdateGroupRotationR(rotations[0]);
663 data = ASCIIEncoding.ASCII.GetBytes(SceneObjectSerializer.ToOriginalXmlFormat(grp)); 678 data = ASCIIEncoding.ASCII.GetBytes(SceneObjectSerializer.ToOriginalXmlFormat(grp));
664 } 679 }
665 680
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/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/ClientStack/TCPJSONStream/ClientAcceptedEventArgs.cs b/OpenSim/Region/ClientStack/TCPJSONStream/ClientAcceptedEventArgs.cs
deleted file mode 100644
index a58eab1..0000000
--- a/OpenSim/Region/ClientStack/TCPJSONStream/ClientAcceptedEventArgs.cs
+++ /dev/null
@@ -1,50 +0,0 @@
1using System;
2using System.Net.Sockets;
3
4namespace OpenSim.Region.ClientStack.TCPJSONStream
5{
6 /// <summary>
7 /// Invoked when a client have been accepted by the <see cref="HttpListener"/>
8 /// </summary>
9 /// <remarks>
10 /// Can be used to revoke incoming connections
11 /// </remarks>
12 public class ClientAcceptedEventArgs : EventArgs
13 {
14 private readonly Socket _socket;
15 private bool _revoke;
16
17 /// <summary>
18 /// Initializes a new instance of the <see cref="ClientAcceptedEventArgs"/> class.
19 /// </summary>
20 /// <param name="socket">The socket.</param>
21 public ClientAcceptedEventArgs(Socket socket)
22 {
23 _socket = socket;
24 }
25
26 /// <summary>
27 /// Accepted socket.
28 /// </summary>
29 public Socket Socket
30 {
31 get { return _socket; }
32 }
33
34 /// <summary>
35 /// Client should be revoked.
36 /// </summary>
37 public bool Revoked
38 {
39 get { return _revoke; }
40 }
41
42 /// <summary>
43 /// Client may not be handled.
44 /// </summary>
45 public void Revoke()
46 {
47 _revoke = true;
48 }
49 }
50} \ No newline at end of file
diff --git a/OpenSim/Region/ClientStack/TCPJSONStream/ClientNetworkContext.cs b/OpenSim/Region/ClientStack/TCPJSONStream/ClientNetworkContext.cs
deleted file mode 100644
index b077b6a..0000000
--- a/OpenSim/Region/ClientStack/TCPJSONStream/ClientNetworkContext.cs
+++ /dev/null
@@ -1,146 +0,0 @@
1using System;
2using System.Collections.Generic;
3using System.IO;
4using System.Net;
5using System.Net.Sockets;
6using System.Text;
7
8namespace OpenSim.Region.ClientStack.TCPJSONStream
9{
10 public class ClientNetworkContext
11 {
12 private Socket _socket;
13 private string _remoteAddress;
14 private string _remotePort;
15 private WebSocketConnectionStage _wsConnectionStatus = WebSocketConnectionStage.Accept;
16 private int _bytesLeft;
17 private NetworkStream _stream;
18 private byte[] _buffer;
19 public event EventHandler<DisconnectedEventArgs> Disconnected = delegate { };
20
21 public ClientNetworkContext(IPEndPoint endPoint, int port, Stream stream, int buffersize, Socket sock)
22 {
23 _socket = sock;
24 _remoteAddress = endPoint.Address.ToString();
25 _remotePort = port.ToString();
26 _stream = stream as NetworkStream;
27 _buffer = new byte[buffersize];
28
29
30 }
31
32 public void BeginRead()
33 {
34 _wsConnectionStatus = WebSocketConnectionStage.Http;
35 try
36 {
37 _stream.BeginRead(_buffer, 0, _buffer.Length, OnReceive, _wsConnectionStatus);
38 }
39 catch (IOException err)
40 {
41 //m_log.Debug(err.ToString());
42 }
43 }
44
45 private void OnReceive(IAsyncResult ar)
46 {
47 try
48 {
49 int bytesRead = _stream.EndRead(ar);
50 if (bytesRead == 0)
51 {
52
53 Disconnected(this, new DisconnectedEventArgs(SocketError.ConnectionReset));
54 return;
55 }
56
57 }
58 catch (Exception)
59 {
60 }
61 }
62 /// <summary>
63 /// send a whole buffer
64 /// </summary>
65 /// <param name="buffer">buffer to send</param>
66 /// <exception cref="ArgumentNullException"></exception>
67 public void Send(byte[] buffer)
68 {
69 if (buffer == null)
70 throw new ArgumentNullException("buffer");
71 Send(buffer, 0, buffer.Length);
72 }
73
74 /// <summary>
75 /// Send data using the stream
76 /// </summary>
77 /// <param name="buffer">Contains data to send</param>
78 /// <param name="offset">Start position in buffer</param>
79 /// <param name="size">number of bytes to send</param>
80 /// <exception cref="ArgumentNullException"></exception>
81 /// <exception cref="ArgumentOutOfRangeException"></exception>
82 public void Send(byte[] buffer, int offset, int size)
83 {
84
85 if (offset + size > buffer.Length)
86 throw new ArgumentOutOfRangeException("offset", offset, "offset + size is beyond end of buffer.");
87
88 if (_stream != null && _stream.CanWrite)
89 {
90 try
91 {
92 _stream.Write(buffer, offset, size);
93 }
94 catch (IOException)
95 {
96
97 }
98 }
99
100 }
101 private void Reset()
102 {
103 if (_stream == null)
104 return;
105 _stream.Dispose();
106 _stream = null;
107 if (_socket == null)
108 return;
109 if (_socket.Connected)
110 _socket.Disconnect(true);
111 _socket = null;
112 }
113 }
114
115 public enum WebSocketConnectionStage
116 {
117 Reuse,
118 Accept,
119 Http,
120 WebSocket,
121 Closed
122 }
123
124 public enum FrameOpCodesRFC6455
125 {
126 Continue = 0x0,
127 Text = 0x1,
128 Binary = 0x2,
129 Close = 0x8,
130 Ping = 0x9,
131 Pong = 0xA
132 }
133
134 public enum DataState
135 {
136 Empty = 0,
137 Waiting = 1,
138 Receiving = 2,
139 Complete = 3,
140 Closed = 4,
141 Ping = 5,
142 Pong = 6
143 }
144
145
146}
diff --git a/OpenSim/Region/ClientStack/TCPJSONStream/DisconnectedEventArgs.cs b/OpenSim/Region/ClientStack/TCPJSONStream/DisconnectedEventArgs.cs
deleted file mode 100644
index 32880cc..0000000
--- a/OpenSim/Region/ClientStack/TCPJSONStream/DisconnectedEventArgs.cs
+++ /dev/null
@@ -1,17 +0,0 @@
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Net.Sockets;
5using System.Text;
6
7namespace OpenSim.Region.ClientStack.TCPJSONStream
8{
9 public class DisconnectedEventArgs:EventArgs
10 {
11 public SocketError Error { get; private set; }
12 public DisconnectedEventArgs(SocketError err)
13 {
14 Error = err;
15 }
16 }
17}
diff --git a/OpenSim/Region/ClientStack/TCPJSONStream/OpenSimWebSocketBase.cs b/OpenSim/Region/ClientStack/TCPJSONStream/OpenSimWebSocketBase.cs
deleted file mode 100644
index 6d02543..0000000
--- a/OpenSim/Region/ClientStack/TCPJSONStream/OpenSimWebSocketBase.cs
+++ /dev/null
@@ -1,73 +0,0 @@
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.Net;
30using Nini.Config;
31using OpenSim.Framework;
32
33namespace OpenSim.Region.ClientStack.TCPJSONStream
34{
35 public sealed class TCPJsonWebSocketBase : IClientNetworkServer
36 {
37 private TCPJsonWebSocketServer m_tcpServer;
38
39 public TCPJsonWebSocketBase()
40 {
41 }
42
43 public void Initialise(IPAddress _listenIP, ref uint port, int proxyPortOffsetParm, bool allow_alternate_port, IConfigSource configSource, AgentCircuitManager authenticateClass)
44 {
45 m_tcpServer = new TCPJsonWebSocketServer(_listenIP,ref port, proxyPortOffsetParm, allow_alternate_port,configSource,authenticateClass);
46 }
47
48 public void NetworkStop()
49 {
50 // m_tcpServer.Stop();
51 }
52
53 public bool HandlesRegion(Location x)
54 {
55 return m_tcpServer.HandlesRegion(x);
56 }
57
58 public void AddScene(IScene x)
59 {
60 m_tcpServer.AddScene(x);
61 }
62
63 public void Start()
64 {
65 //m_tcpServer.Start();
66 }
67
68 public void Stop()
69 {
70 // m_tcpServer.Stop();
71 }
72 }
73} \ No newline at end of file
diff --git a/OpenSim/Region/ClientStack/TCPJSONStream/TCPJsonWebSocketServer.cs b/OpenSim/Region/ClientStack/TCPJSONStream/TCPJsonWebSocketServer.cs
deleted file mode 100644
index c0f6792..0000000
--- a/OpenSim/Region/ClientStack/TCPJSONStream/TCPJsonWebSocketServer.cs
+++ /dev/null
@@ -1,163 +0,0 @@
1using System;
2using System.Collections.Generic;
3using System.Net;
4using System.Net.Sockets;
5using System.Reflection;
6using System.Text;
7using System.Threading;
8using Nini.Config;
9using OpenSim.Framework;
10using OpenSim.Region.Framework.Scenes;
11using log4net;
12
13namespace OpenSim.Region.ClientStack.TCPJSONStream
14{
15 public delegate void ExceptionHandler(object source, Exception exception);
16
17 public class TCPJsonWebSocketServer
18 {
19 private readonly IPAddress _address;
20 private readonly int _port;
21 private readonly ManualResetEvent _shutdownEvent = new ManualResetEvent(false);
22 private TcpListener _listener;
23 private int _pendingAccepts;
24 private bool _shutdown;
25 private int _backlogAcceptQueueLength = 5;
26 private Scene m_scene;
27 private Location m_location;
28 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
29
30 public event EventHandler<ClientAcceptedEventArgs> Accepted = delegate { };
31
32
33 public TCPJsonWebSocketServer(IPAddress _listenIP, ref uint port, int proxyPortOffsetParm,
34 bool allow_alternate_port, IConfigSource configSource,
35 AgentCircuitManager authenticateClass)
36 {
37 _address = _listenIP;
38 _port = (int)port; //Why is a uint passed in?
39 }
40 public void Stop()
41 {
42 _shutdown = true;
43 _listener.Stop();
44 if (!_shutdownEvent.WaitOne())
45 m_log.Error("[WEBSOCKETSERVER]: Failed to shutdown listener properly.");
46 _listener = null;
47 }
48
49 public bool HandlesRegion(Location x)
50 {
51 return x == m_location;
52 }
53
54 public void AddScene(IScene scene)
55 {
56 if (m_scene != null)
57 {
58 m_log.Debug("[WEBSOCKETSERVER]: AddScene() called but I already have a scene.");
59 return;
60 }
61 if (!(scene is Scene))
62 {
63 m_log.Error("[WEBSOCKETSERVER]: AddScene() called with an unrecognized scene type " + scene.GetType());
64 return;
65 }
66
67 m_scene = (Scene)scene;
68 m_location = new Location(m_scene.RegionInfo.RegionHandle);
69 }
70
71 public void Start()
72 {
73 _listener = new TcpListener(_address, _port);
74 _listener.Start(_backlogAcceptQueueLength);
75 Interlocked.Increment(ref _pendingAccepts);
76 _listener.BeginAcceptSocket(OnAccept, null);
77 }
78
79 private void OnAccept(IAsyncResult ar)
80 {
81 bool beginAcceptCalled = false;
82 try
83 {
84 int count = Interlocked.Decrement(ref _pendingAccepts);
85 if (_shutdown)
86 {
87 if (count == 0)
88 _shutdownEvent.Set();
89 return;
90 }
91 Interlocked.Increment(ref _pendingAccepts);
92 _listener.BeginAcceptSocket(OnAccept, null);
93 beginAcceptCalled = true;
94 Socket socket = _listener.EndAcceptSocket(ar);
95 if (!OnAcceptingSocket(socket))
96 {
97 socket.Disconnect(true);
98 return;
99 }
100 ClientNetworkContext context = new ClientNetworkContext((IPEndPoint) socket.RemoteEndPoint, _port,
101 new NetworkStream(socket), 16384, socket);
102 //HttpRequestParser parser;
103 context.BeginRead();
104
105 }
106 catch (Exception err)
107 {
108 if (ExceptionThrown == null)
109#if DEBUG
110 throw;
111#else
112 _logWriter.Write(this, LogPrio.Fatal, err.Message);
113 // we can't really do anything but close the connection
114#endif
115 if (ExceptionThrown != null)
116 ExceptionThrown(this, err);
117
118 if (!beginAcceptCalled)
119 RetryBeginAccept();
120
121 }
122 }
123
124 private void RetryBeginAccept()
125 {
126 try
127 {
128
129 _listener.BeginAcceptSocket(OnAccept, null);
130 }
131 catch (Exception err)
132 {
133
134 if (ExceptionThrown == null)
135#if DEBUG
136 throw;
137#else
138 // we can't really do anything but close the connection
139#endif
140 if (ExceptionThrown != null)
141 ExceptionThrown(this, err);
142 }
143 }
144
145 private bool OnAcceptingSocket(Socket sock)
146 {
147 ClientAcceptedEventArgs args = new ClientAcceptedEventArgs(sock);
148 Accepted(this, args);
149 return !args.Revoked;
150 }
151 /// <summary>
152 /// Catch exceptions not handled by the listener.
153 /// </summary>
154 /// <remarks>
155 /// Exceptions will be thrown during debug mode if this event is not used,
156 /// exceptions will be printed to console and suppressed during release mode.
157 /// </remarks>
158 public event ExceptionHandler ExceptionThrown = delegate { };
159
160
161
162 }
163}
diff --git a/OpenSim/Region/CoreModules/Framework/DynamicAttributes/DAExampleModule.cs b/OpenSim/Region/CoreModules/Framework/DynamicAttributes/DAExampleModule.cs
new file mode 100644
index 0000000..d36f65a
--- /dev/null
+++ b/OpenSim/Region/CoreModules/Framework/DynamicAttributes/DAExampleModule.cs
@@ -0,0 +1,107 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using System.Reflection;
31using log4net;
32using Mono.Addins;
33using Nini.Config;
34using OpenMetaverse;
35using OpenMetaverse.Packets;
36using OpenMetaverse.StructuredData;
37using OpenSim.Framework;
38using OpenSim.Region.Framework;
39using OpenSim.Region.Framework.Interfaces;
40using OpenSim.Region.Framework.Scenes;
41
42namespace OpenSim.Region.Framework.DynamicAttributes.DAExampleModule
43{
44 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "DAExampleModule")]
45 public class DAExampleModule : INonSharedRegionModule
46 {
47 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
48
49 private static readonly bool ENABLED = false; // enable for testing
50
51 protected Scene m_scene;
52 protected IDialogModule m_dialogMod;
53
54 public string Name { get { return "DAExample Module"; } }
55 public Type ReplaceableInterface { get { return null; } }
56
57 public void Initialise(IConfigSource source) {}
58
59 public void AddRegion(Scene scene)
60 {
61 if (ENABLED)
62 {
63 m_scene = scene;
64 m_scene.EventManager.OnSceneGroupMove += OnSceneGroupMove;
65 m_dialogMod = m_scene.RequestModuleInterface<IDialogModule>();
66 }
67 }
68
69 public void RemoveRegion(Scene scene)
70 {
71 if (ENABLED)
72 {
73 m_scene.EventManager.OnSceneGroupMove -= OnSceneGroupMove;
74 }
75 }
76
77 public void RegionLoaded(Scene scene) {}
78
79 public void Close()
80 {
81 RemoveRegion(m_scene);
82 }
83
84 protected bool OnSceneGroupMove(UUID groupId, Vector3 delta)
85 {
86 OSDMap attrs = null;
87 SceneObjectPart sop = m_scene.GetSceneObjectPart(groupId);
88 if (!sop.DynAttrs.TryGetValue(Name, out attrs))
89 attrs = new OSDMap();
90
91 OSDInteger newValue;
92
93 if (!attrs.ContainsKey("moves"))
94 newValue = new OSDInteger(1);
95 else
96 newValue = new OSDInteger(((OSDInteger)attrs["moves"]).AsInteger() + 1);
97
98 attrs["moves"] = newValue;
99
100 sop.DynAttrs[Name] = attrs;
101
102 m_dialogMod.SendGeneralAlert(string.Format("{0} {1} moved {2} times", sop.Name, sop.UUID, newValue));
103
104 return true;
105 }
106 }
107} \ No newline at end of file
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/World/Serialiser/Tests/SerialiserTests.cs b/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs
index bcb8e2f..b4348c9 100644
--- a/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs
+++ b/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs
@@ -35,6 +35,7 @@ using OpenSim.Framework;
35using OpenSim.Region.Framework.Scenes; 35using OpenSim.Region.Framework.Scenes;
36using OpenSim.Region.Framework.Scenes.Serialization; 36using OpenSim.Region.Framework.Scenes.Serialization;
37using OpenSim.Tests.Common; 37using OpenSim.Tests.Common;
38using OpenMetaverse.StructuredData;
38 39
39namespace OpenSim.Region.CoreModules.World.Serialiser.Tests 40namespace OpenSim.Region.CoreModules.World.Serialiser.Tests
40{ 41{
@@ -143,6 +144,7 @@ namespace OpenSim.Region.CoreModules.World.Serialiser.Tests
143 <Flags>None</Flags> 144 <Flags>None</Flags>
144 <CollisionSound><Guid>00000000-0000-0000-0000-000000000000</Guid></CollisionSound> 145 <CollisionSound><Guid>00000000-0000-0000-0000-000000000000</Guid></CollisionSound>
145 <CollisionSoundVolume>0</CollisionSoundVolume> 146 <CollisionSoundVolume>0</CollisionSoundVolume>
147 <DynAttrs><llsd><map><key>MyStore</key><map><key>the answer</key><integer>42</integer></map></map></llsd></DynAttrs>
146 </SceneObjectPart> 148 </SceneObjectPart>
147 </RootPart> 149 </RootPart>
148 <OtherParts /> 150 <OtherParts />
@@ -331,6 +333,7 @@ namespace OpenSim.Region.CoreModules.World.Serialiser.Tests
331 <EveryoneMask>0</EveryoneMask> 333 <EveryoneMask>0</EveryoneMask>
332 <NextOwnerMask>2147483647</NextOwnerMask> 334 <NextOwnerMask>2147483647</NextOwnerMask>
333 <Flags>None</Flags> 335 <Flags>None</Flags>
336 <DynAttrs><llsd><map><key>MyStore</key><map><key>last words</key><string>Rosebud</string></map></map></llsd></DynAttrs>
334 <SitTargetAvatar><UUID>00000000-0000-0000-0000-000000000000</UUID></SitTargetAvatar> 337 <SitTargetAvatar><UUID>00000000-0000-0000-0000-000000000000</UUID></SitTargetAvatar>
335 </SceneObjectPart> 338 </SceneObjectPart>
336 <OtherParts /> 339 <OtherParts />
@@ -359,6 +362,8 @@ namespace OpenSim.Region.CoreModules.World.Serialiser.Tests
359 Assert.That(rootPart.UUID, Is.EqualTo(new UUID("e6a5a05e-e8cc-4816-8701-04165e335790"))); 362 Assert.That(rootPart.UUID, Is.EqualTo(new UUID("e6a5a05e-e8cc-4816-8701-04165e335790")));
360 Assert.That(rootPart.CreatorID, Is.EqualTo(new UUID("a6dacf01-4636-4bb9-8a97-30609438af9d"))); 363 Assert.That(rootPart.CreatorID, Is.EqualTo(new UUID("a6dacf01-4636-4bb9-8a97-30609438af9d")));
361 Assert.That(rootPart.Name, Is.EqualTo("PrimMyRide")); 364 Assert.That(rootPart.Name, Is.EqualTo("PrimMyRide"));
365 OSDMap store = rootPart.DynAttrs["MyStore"];
366 Assert.AreEqual(42, store["the answer"].AsInteger());
362 367
363 // TODO: Check other properties 368 // TODO: Check other properties
364 } 369 }
@@ -409,6 +414,14 @@ namespace OpenSim.Region.CoreModules.World.Serialiser.Tests
409 rp.CreatorID = rpCreatorId; 414 rp.CreatorID = rpCreatorId;
410 rp.Shape = shape; 415 rp.Shape = shape;
411 416
417 string daStoreName = "MyStore";
418 string daKey = "foo";
419 string daValue = "bar";
420 OSDMap myStore = new OSDMap();
421 myStore.Add(daKey, daValue);
422 rp.DynAttrs = new DAMap();
423 rp.DynAttrs[daStoreName] = myStore;
424
412 SceneObjectGroup so = new SceneObjectGroup(rp); 425 SceneObjectGroup so = new SceneObjectGroup(rp);
413 426
414 // Need to add the object to the scene so that the request to get script state succeeds 427 // Need to add the object to the scene so that the request to get script state succeeds
@@ -424,6 +437,7 @@ namespace OpenSim.Region.CoreModules.World.Serialiser.Tests
424 UUID uuid = UUID.Zero; 437 UUID uuid = UUID.Zero;
425 string name = null; 438 string name = null;
426 UUID creatorId = UUID.Zero; 439 UUID creatorId = UUID.Zero;
440 DAMap daMap = null;
427 441
428 while (xtr.Read() && xtr.Name != "SceneObjectPart") 442 while (xtr.Read() && xtr.Name != "SceneObjectPart")
429 { 443 {
@@ -449,6 +463,10 @@ namespace OpenSim.Region.CoreModules.World.Serialiser.Tests
449 creatorId = UUID.Parse(xtr.ReadElementString("UUID")); 463 creatorId = UUID.Parse(xtr.ReadElementString("UUID"));
450 xtr.ReadEndElement(); 464 xtr.ReadEndElement();
451 break; 465 break;
466 case "DynAttrs":
467 daMap = new DAMap();
468 daMap.ReadXml(xtr);
469 break;
452 } 470 }
453 } 471 }
454 472
@@ -462,6 +480,8 @@ namespace OpenSim.Region.CoreModules.World.Serialiser.Tests
462 Assert.That(uuid, Is.EqualTo(rpUuid)); 480 Assert.That(uuid, Is.EqualTo(rpUuid));
463 Assert.That(name, Is.EqualTo(rpName)); 481 Assert.That(name, Is.EqualTo(rpName));
464 Assert.That(creatorId, Is.EqualTo(rpCreatorId)); 482 Assert.That(creatorId, Is.EqualTo(rpCreatorId));
483 Assert.NotNull(daMap);
484 Assert.AreEqual(daValue, daMap[daStoreName][daKey].AsString());
465 } 485 }
466 486
467 [Test] 487 [Test]
@@ -476,6 +496,8 @@ namespace OpenSim.Region.CoreModules.World.Serialiser.Tests
476 Assert.That(rootPart.UUID, Is.EqualTo(new UUID("9be68fdd-f740-4a0f-9675-dfbbb536b946"))); 496 Assert.That(rootPart.UUID, Is.EqualTo(new UUID("9be68fdd-f740-4a0f-9675-dfbbb536b946")));
477 Assert.That(rootPart.CreatorID, Is.EqualTo(new UUID("b46ef588-411e-4a8b-a284-d7dcfe8e74ef"))); 497 Assert.That(rootPart.CreatorID, Is.EqualTo(new UUID("b46ef588-411e-4a8b-a284-d7dcfe8e74ef")));
478 Assert.That(rootPart.Name, Is.EqualTo("PrimFun")); 498 Assert.That(rootPart.Name, Is.EqualTo("PrimFun"));
499 OSDMap store = rootPart.DynAttrs["MyStore"];
500 Assert.AreEqual("Rosebud", store["last words"].AsString());
479 501
480 // TODO: Check other properties 502 // TODO: Check other properties
481 } 503 }
@@ -500,6 +522,14 @@ namespace OpenSim.Region.CoreModules.World.Serialiser.Tests
500 rp.CreatorID = rpCreatorId; 522 rp.CreatorID = rpCreatorId;
501 rp.Shape = shape; 523 rp.Shape = shape;
502 524
525 string daStoreName = "MyStore";
526 string daKey = "foo";
527 string daValue = "bar";
528 OSDMap myStore = new OSDMap();
529 myStore.Add(daKey, daValue);
530 rp.DynAttrs = new DAMap();
531 rp.DynAttrs[daStoreName] = myStore;
532
503 SceneObjectGroup so = new SceneObjectGroup(rp); 533 SceneObjectGroup so = new SceneObjectGroup(rp);
504 534
505 // Need to add the object to the scene so that the request to get script state succeeds 535 // Need to add the object to the scene so that the request to get script state succeeds
@@ -516,6 +546,7 @@ namespace OpenSim.Region.CoreModules.World.Serialiser.Tests
516 UUID uuid = UUID.Zero; 546 UUID uuid = UUID.Zero;
517 string name = null; 547 string name = null;
518 UUID creatorId = UUID.Zero; 548 UUID creatorId = UUID.Zero;
549 DAMap daMap = null;
519 550
520 while (xtr.Read() && xtr.Name != "SceneObjectPart") 551 while (xtr.Read() && xtr.Name != "SceneObjectPart")
521 { 552 {
@@ -537,6 +568,10 @@ namespace OpenSim.Region.CoreModules.World.Serialiser.Tests
537 creatorId = UUID.Parse(xtr.ReadElementString("Guid")); 568 creatorId = UUID.Parse(xtr.ReadElementString("Guid"));
538 xtr.ReadEndElement(); 569 xtr.ReadEndElement();
539 break; 570 break;
571 case "DynAttrs":
572 daMap = new DAMap();
573 daMap.ReadXml(xtr);
574 break;
540 } 575 }
541 } 576 }
542 577
@@ -549,6 +584,8 @@ namespace OpenSim.Region.CoreModules.World.Serialiser.Tests
549 Assert.That(uuid, Is.EqualTo(rpUuid)); 584 Assert.That(uuid, Is.EqualTo(rpUuid));
550 Assert.That(name, Is.EqualTo(rpName)); 585 Assert.That(name, Is.EqualTo(rpName));
551 Assert.That(creatorId, Is.EqualTo(rpCreatorId)); 586 Assert.That(creatorId, Is.EqualTo(rpCreatorId));
587 Assert.NotNull(daMap);
588 Assert.AreEqual(daValue, daMap[daStoreName][daKey].AsString());
552 } 589 }
553 } 590 }
554} \ No newline at end of file 591} \ No newline at end of file
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 0bb4567..cc7885a 100644
--- a/OpenSim/Region/Framework/Interfaces/IJsonStoreModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IJsonStoreModule.cs
@@ -35,6 +35,7 @@ namespace OpenSim.Region.Framework.Interfaces
35 35
36 public interface IJsonStoreModule 36 public interface IJsonStoreModule
37 { 37 {
38 bool AttachObjectStore(UUID objectID);
38 bool CreateStore(string value, ref UUID result); 39 bool CreateStore(string value, ref UUID result);
39 bool DestroyStore(UUID storeID); 40 bool DestroyStore(UUID storeID);
40 bool TestStore(UUID storeID); 41 bool TestStore(UUID storeID);
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/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index f8d84e3..de3978c 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -720,7 +720,6 @@ namespace OpenSim.Region.Framework.Scenes
720 public Scene(RegionInfo regInfo, AgentCircuitManager authen, 720 public Scene(RegionInfo regInfo, AgentCircuitManager authen,
721 SceneCommunicationService sceneGridService, 721 SceneCommunicationService sceneGridService,
722 ISimulationDataService simDataService, IEstateDataService estateDataService, 722 ISimulationDataService simDataService, IEstateDataService estateDataService,
723 bool dumpAssetsToFile,
724 IConfigSource config, string simulatorVersion) 723 IConfigSource config, string simulatorVersion)
725 : this(regInfo) 724 : this(regInfo)
726 { 725 {
@@ -811,8 +810,6 @@ namespace OpenSim.Region.Framework.Scenes
811 810
812 RegisterDefaultSceneEvents(); 811 RegisterDefaultSceneEvents();
813 812
814 DumpAssetsToFile = dumpAssetsToFile;
815
816 // XXX: Don't set the public property since we don't want to activate here. This needs to be handled 813 // XXX: Don't set the public property since we don't want to activate here. This needs to be handled
817 // better in the future. 814 // better in the future.
818 m_scripts_enabled = !RegionInfo.RegionSettings.DisableScripts; 815 m_scripts_enabled = !RegionInfo.RegionSettings.DisableScripts;
@@ -4482,19 +4479,6 @@ namespace OpenSim.Region.Framework.Scenes
4482 4479
4483 #region Script Engine 4480 #region Script Engine
4484 4481
4485 private List<ScriptEngineInterface> ScriptEngines = new List<ScriptEngineInterface>();
4486 public bool DumpAssetsToFile;
4487
4488 /// <summary>
4489 ///
4490 /// </summary>
4491 /// <param name="scriptEngine"></param>
4492 public void AddScriptEngine(ScriptEngineInterface scriptEngine)
4493 {
4494 ScriptEngines.Add(scriptEngine);
4495 scriptEngine.InitializeEngine(this);
4496 }
4497
4498 private bool ScriptDanger(SceneObjectPart part,Vector3 pos) 4482 private bool ScriptDanger(SceneObjectPart part,Vector3 pos)
4499 { 4483 {
4500 ILandObject parcel = LandChannel.GetLandObject(pos.X, pos.Y); 4484 ILandObject parcel = LandChannel.GetLandObject(pos.X, pos.Y);
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 6720635..b00f388 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -37,6 +37,7 @@ using System.Xml.Serialization;
37using log4net; 37using log4net;
38using OpenMetaverse; 38using OpenMetaverse;
39using OpenMetaverse.Packets; 39using OpenMetaverse.Packets;
40using OpenMetaverse.StructuredData;
40using OpenSim.Framework; 41using OpenSim.Framework;
41using OpenSim.Region.Framework.Interfaces; 42using OpenSim.Region.Framework.Interfaces;
42using OpenSim.Region.Framework.Scenes.Scripting; 43using OpenSim.Region.Framework.Scenes.Scripting;
@@ -115,7 +116,7 @@ namespace OpenSim.Region.Framework.Scenes
115 116
116 #endregion Enumerations 117 #endregion Enumerations
117 118
118 public class SceneObjectPart : IScriptHost, ISceneEntity 119 public class SceneObjectPart : ISceneEntity
119 { 120 {
120 /// <value> 121 /// <value>
121 /// Denote all sides of the prim 122 /// Denote all sides of the prim
@@ -124,6 +125,11 @@ namespace OpenSim.Region.Framework.Scenes
124 125
125 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 126 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
126 127
128 /// <summary>
129 /// Dynamic attributes can be created and deleted as required.
130 /// </summary>
131 public DAMap DynAttrs { get; set; }
132
127 /// <value> 133 /// <value>
128 /// Is this a root part? 134 /// Is this a root part?
129 /// </value> 135 /// </value>
@@ -296,6 +302,13 @@ namespace OpenSim.Region.Framework.Scenes
296 protected Vector3 m_lastAcceleration; 302 protected Vector3 m_lastAcceleration;
297 protected Vector3 m_lastAngularVelocity; 303 protected Vector3 m_lastAngularVelocity;
298 protected int m_lastTerseSent; 304 protected int m_lastTerseSent;
305
306 protected byte m_physicsShapeType = (byte)PhysShapeType.prim;
307 // TODO: Implement these
308 //protected float m_density = 1000.0f; // in kg/m^3
309 //protected float m_gravitymod = 1.0f;
310 //protected float m_friction = 0.6f; // wood
311 //protected float m_bounce = 0.5f; // wood
299 312
300 /// <summary> 313 /// <summary>
301 /// Stores media texture data 314 /// Stores media texture data
@@ -335,6 +348,7 @@ namespace OpenSim.Region.Framework.Scenes
335 m_particleSystem = Utils.EmptyBytes; 348 m_particleSystem = Utils.EmptyBytes;
336 Rezzed = DateTime.UtcNow; 349 Rezzed = DateTime.UtcNow;
337 Description = String.Empty; 350 Description = String.Empty;
351 DynAttrs = new DAMap();
338 352
339 // Prims currently only contain a single folder (Contents). From looking at the Second Life protocol, 353 // Prims currently only contain a single folder (Contents). From looking at the Second Life protocol,
340 // this appears to have the same UUID (!) as the prim. If this isn't the case, one can't drag items from 354 // this appears to have the same UUID (!) as the prim. If this isn't the case, one can't drag items from
@@ -1315,6 +1329,69 @@ namespace OpenSim.Region.Framework.Scenes
1315 set { m_collisionSoundVolume = value; } 1329 set { m_collisionSoundVolume = value; }
1316 } 1330 }
1317 1331
1332 public byte DefaultPhysicsShapeType()
1333 {
1334 byte type;
1335
1336 if (Shape != null && (Shape.SculptType == (byte)SculptType.Mesh))
1337 type = (byte)PhysShapeType.convex;
1338 else
1339 type = (byte)PhysShapeType.prim;
1340
1341 return type;
1342 }
1343
1344 public byte PhysicsShapeType
1345 {
1346 get { return m_physicsShapeType; }
1347 set
1348 {
1349 byte oldv = m_physicsShapeType;
1350
1351 if (value >= 0 && value <= (byte)PhysShapeType.convex)
1352 {
1353 if (value == (byte)PhysShapeType.none && ParentGroup != null && ParentGroup.RootPart == this)
1354 m_physicsShapeType = DefaultPhysicsShapeType();
1355 else
1356 m_physicsShapeType = value;
1357 }
1358 else
1359 m_physicsShapeType = DefaultPhysicsShapeType();
1360
1361 if (m_physicsShapeType != oldv && ParentGroup != null)
1362 {
1363 if (m_physicsShapeType == (byte)PhysShapeType.none)
1364 {
1365 if (PhysActor != null)
1366 {
1367 Velocity = new Vector3(0, 0, 0);
1368 Acceleration = new Vector3(0, 0, 0);
1369 if (ParentGroup.RootPart == this)
1370 AngularVelocity = new Vector3(0, 0, 0);
1371 ParentGroup.Scene.RemovePhysicalPrim(1);
1372 RemoveFromPhysics();
1373 }
1374 }
1375 else if (PhysActor == null)
1376 {
1377 ApplyPhysics((uint)Flags, VolumeDetectActive);
1378 }
1379 else
1380 {
1381 // TODO: Update physics actor
1382 }
1383
1384 if (ParentGroup != null)
1385 ParentGroup.HasGroupChanged = true;
1386 }
1387 }
1388 }
1389
1390 public float Density { get; set; }
1391 public float GravityModifier { get; set; }
1392 public float Friction { get; set; }
1393 public float Restitution { get; set; }
1394
1318 #endregion Public Properties with only Get 1395 #endregion Public Properties with only Get
1319 1396
1320 private uint ApplyMask(uint val, bool set, uint mask) 1397 private uint ApplyMask(uint val, bool set, uint mask)
@@ -1516,9 +1593,8 @@ namespace OpenSim.Region.Framework.Scenes
1516 if (!ParentGroup.Scene.CollidablePrims) 1593 if (!ParentGroup.Scene.CollidablePrims)
1517 return; 1594 return;
1518 1595
1519// m_log.DebugFormat( 1596 if (PhysicsShapeType == (byte)PhysShapeType.none)
1520// "[SCENE OBJECT PART]: Applying physics to {0} {1}, m_physicalPrim {2}", 1597 return;
1521// Name, LocalId, UUID, m_physicalPrim);
1522 1598
1523 bool isPhysical = (rootObjectFlags & (uint) PrimFlags.Physics) != 0; 1599 bool isPhysical = (rootObjectFlags & (uint) PrimFlags.Physics) != 0;
1524 bool isPhantom = (rootObjectFlags & (uint) PrimFlags.Phantom) != 0; 1600 bool isPhantom = (rootObjectFlags & (uint) PrimFlags.Phantom) != 0;
@@ -1618,6 +1694,8 @@ namespace OpenSim.Region.Framework.Scenes
1618 Array.Copy(Shape.ExtraParams, extraP, extraP.Length); 1694 Array.Copy(Shape.ExtraParams, extraP, extraP.Length);
1619 dupe.Shape.ExtraParams = extraP; 1695 dupe.Shape.ExtraParams = extraP;
1620 1696
1697 dupe.DynAttrs.CopyFrom(DynAttrs);
1698
1621 if (userExposed) 1699 if (userExposed)
1622 { 1700 {
1623/* 1701/*
@@ -3869,6 +3947,26 @@ namespace OpenSim.Region.Framework.Scenes
3869 } 3947 }
3870 } 3948 }
3871 3949
3950 public void UpdateExtraPhysics(ExtraPhysicsData physdata)
3951 {
3952 if (physdata.PhysShapeType == PhysShapeType.invalid || ParentGroup == null)
3953 return;
3954
3955 if (PhysicsShapeType != (byte)physdata.PhysShapeType)
3956 {
3957 PhysicsShapeType = (byte)physdata.PhysShapeType;
3958
3959 }
3960
3961 if(Density != physdata.Density)
3962 Density = physdata.Density;
3963 if(GravityModifier != physdata.GravitationModifier)
3964 GravityModifier = physdata.GravitationModifier;
3965 if(Friction != physdata.Friction)
3966 Friction = physdata.Friction;
3967 if(Restitution != physdata.Bounce)
3968 Restitution = physdata.Bounce;
3969 }
3872 /// <summary> 3970 /// <summary>
3873 /// Update the flags on this prim. This covers properties such as phantom, physics and temporary. 3971 /// Update the flags on this prim. This covers properties such as phantom, physics and temporary.
3874 /// </summary> 3972 /// </summary>
@@ -3940,6 +4038,7 @@ namespace OpenSim.Region.Framework.Scenes
3940 4038
3941 if (SetPhantom 4039 if (SetPhantom
3942 || ParentGroup.IsAttachment 4040 || ParentGroup.IsAttachment
4041 || PhysicsShapeType == (byte)PhysShapeType.none
3943 || (Shape.PathCurve == (byte)Extrusion.Flexible)) // note: this may have been changed above in the case of joints 4042 || (Shape.PathCurve == (byte)Extrusion.Flexible)) // note: this may have been changed above in the case of joints
3944 { 4043 {
3945 AddFlag(PrimFlags.Phantom); 4044 AddFlag(PrimFlags.Phantom);
@@ -4598,4 +4697,4 @@ namespace OpenSim.Region.Framework.Scenes
4598 } 4697 }
4599 } 4698 }
4600 } 4699 }
4601} \ No newline at end of file 4700}
diff --git a/OpenSim/Region/Framework/Scenes/Scripting/IScriptHost.cs b/OpenSim/Region/Framework/Scenes/Scripting/IScriptHost.cs
deleted file mode 100644
index f3be028..0000000
--- a/OpenSim/Region/Framework/Scenes/Scripting/IScriptHost.cs
+++ /dev/null
@@ -1,46 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using OpenMetaverse;
29
30namespace OpenSim.Region.Framework.Scenes.Scripting
31{
32 public interface IScriptHost
33 {
34 string Name { get; set; }
35 string Description { get; set; }
36
37 UUID UUID { get; }
38 UUID OwnerID { get; }
39 UUID CreatorID { get; }
40 Vector3 AbsolutePosition { get; }
41
42 string SitName { get; set; }
43 string TouchName { get; set; }
44 void SetText(string text, Vector3 color, double alpha);
45 }
46}
diff --git a/OpenSim/Region/Framework/Scenes/Scripting/NullScriptHost.cs b/OpenSim/Region/Framework/Scenes/Scripting/NullScriptHost.cs
deleted file mode 100644
index d7198f0..0000000
--- a/OpenSim/Region/Framework/Scenes/Scripting/NullScriptHost.cs
+++ /dev/null
@@ -1,91 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using OpenMetaverse;
30using log4net;
31using System.Reflection;
32using OpenSim.Framework;
33
34namespace OpenSim.Region.Framework.Scenes.Scripting
35{
36 public class NullScriptHost : IScriptHost
37 {
38 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
39
40 private Vector3 m_pos = new Vector3(((int)Constants.RegionSize * 0.5f), ((int)Constants.RegionSize * 0.5f), 30);
41
42 public string Name
43 {
44 get { return "Object"; }
45 set { }
46 }
47
48 public string SitName
49 {
50 get { return String.Empty; }
51 set { }
52 }
53
54 public string TouchName
55 {
56 get { return String.Empty; }
57 set { }
58 }
59
60 public string Description
61 {
62 get { return String.Empty; }
63 set { }
64 }
65
66 public UUID UUID
67 {
68 get { return UUID.Zero; }
69 }
70
71 public UUID OwnerID
72 {
73 get { return UUID.Zero; }
74 }
75
76 public UUID CreatorID
77 {
78 get { return UUID.Zero; }
79 }
80
81 public Vector3 AbsolutePosition
82 {
83 get { return m_pos; }
84 }
85
86 public void SetText(string text, Vector3 color, double alpha)
87 {
88 m_log.Warn("Tried to SetText "+text+" on NullScriptHost");
89 }
90 }
91}
diff --git a/OpenSim/Region/Framework/Scenes/Scripting/ScriptEngineInterface.cs b/OpenSim/Region/Framework/Scenes/Scripting/ScriptEngineInterface.cs
deleted file mode 100644
index 812a21c..0000000
--- a/OpenSim/Region/Framework/Scenes/Scripting/ScriptEngineInterface.cs
+++ /dev/null
@@ -1,38 +0,0 @@
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
28//TODO: WHERE TO PLACE THIS?
29
30namespace OpenSim.Region.Framework.Scenes.Scripting
31{
32 public interface ScriptEngineInterface
33 {
34 void InitializeEngine(Scene Sceneworld);
35 void Shutdown();
36// void StartScript(string ScriptID, IScriptHost ObjectID);
37 }
38}
diff --git a/OpenSim/Region/Framework/Scenes/Scripting/ScriptEngineLoader.cs b/OpenSim/Region/Framework/Scenes/Scripting/ScriptEngineLoader.cs
deleted file mode 100644
index c58ccc5..0000000
--- a/OpenSim/Region/Framework/Scenes/Scripting/ScriptEngineLoader.cs
+++ /dev/null
@@ -1,119 +0,0 @@
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
28/* Original code: Tedd Hansen */
29using System;
30using System.IO;
31using System.Reflection;
32using log4net;
33
34namespace OpenSim.Region.Framework.Scenes.Scripting
35{
36 public class ScriptEngineLoader
37 {
38 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
39
40 public ScriptEngineInterface LoadScriptEngine(string EngineName)
41 {
42 ScriptEngineInterface ret = null;
43 try
44 {
45 ret =
46 LoadAndInitAssembly(
47 Path.Combine("ScriptEngines", "OpenSim.Region.ScriptEngine." + EngineName + ".dll"),
48 "OpenSim.Region.ScriptEngine." + EngineName + ".ScriptEngine");
49 }
50 catch (Exception e)
51 {
52 m_log.Error("[ScriptEngine]: " +
53 "Error loading assembly \"" + EngineName + "\": " + e.Message + ", " +
54 e.StackTrace.ToString());
55 }
56 return ret;
57 }
58
59 /// <summary>
60 /// Does actual loading and initialization of script Assembly
61 /// </summary>
62 /// <param name="FreeAppDomain">AppDomain to load script into</param>
63 /// <param name="FileName">FileName of script assembly (.dll)</param>
64 /// <returns></returns>
65 private ScriptEngineInterface LoadAndInitAssembly(string FileName, string NameSpace)
66 {
67 //Common.SendToDebug("Loading ScriptEngine Assembly " + FileName);
68 // Load .Net Assembly (.dll)
69 // Initialize and return it
70
71 // TODO: Add error handling
72
73 Assembly a;
74 //try
75 //{
76
77
78 // Load to default appdomain (temporary)
79 a = Assembly.LoadFrom(FileName);
80 // Load to specified appdomain
81 // TODO: Insert security
82 //a = FreeAppDomain.Load(FileName);
83 //}
84 //catch (Exception e)
85 //{
86 // m_log.Error("[ScriptEngine]: Error loading assembly \String.Empty + FileName + "\": " + e.ToString());
87 //}
88
89
90 //m_log.Debug("Loading: " + FileName);
91 //foreach (Type _t in a.GetTypes())
92 //{
93 // m_log.Debug("Type: " + _t.ToString());
94 //}
95
96 Type t;
97 //try
98 //{
99 t = a.GetType(NameSpace, true);
100 //}
101 //catch (Exception e)
102 //{
103 // m_log.Error("[ScriptEngine]: Error initializing type \String.Empty + NameSpace + "\" from \String.Empty + FileName + "\": " + e.ToString());
104 //}
105
106 ScriptEngineInterface ret;
107 //try
108 //{
109 ret = (ScriptEngineInterface) Activator.CreateInstance(t);
110 //}
111 //catch (Exception e)
112 //{
113 // m_log.Error("[ScriptEngine]: Error initializing type \String.Empty + NameSpace + "\" from \String.Empty + FileName + "\": " + e.ToString());
114 //}
115
116 return ret;
117 }
118 }
119}
diff --git a/OpenSim/Region/Framework/Scenes/Scripting/ScriptUtils.cs b/OpenSim/Region/Framework/Scenes/Scripting/ScriptUtils.cs
new file mode 100644
index 0000000..f08ba59
--- /dev/null
+++ b/OpenSim/Region/Framework/Scenes/Scripting/ScriptUtils.cs
@@ -0,0 +1,107 @@
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 OpenMetaverse;
31using OpenSim.Framework;
32
33namespace OpenSim.Region.Framework.Scenes.Scripting
34{
35 /// <summary>
36 /// Utility functions for use by scripts manipulating the scene.
37 /// </summary>
38 public static class ScriptUtils
39 {
40 /// <summary>
41 /// Get an asset id given an item name and an item type.
42 /// </summary>
43 /// <returns>UUID.Zero if the name and type did not match any item.</returns>
44 /// <param name='part'></param>
45 /// <param name='name'></param>
46 /// <param name='type'></param>
47 public static UUID GetAssetIdFromItemName(SceneObjectPart part, string name, int type)
48 {
49 TaskInventoryItem item = part.Inventory.GetInventoryItem(name);
50
51 if (item != null && item.Type == type)
52 return item.AssetID;
53 else
54 return UUID.Zero;
55 }
56
57 /// <summary>
58 /// accepts a valid UUID, -or- a name of an inventory item.
59 /// Returns a valid UUID or UUID.Zero if key invalid and item not found
60 /// in prim inventory.
61 /// </summary>
62 /// <param name="part">Scene object part to search for inventory item</param>
63 /// <param name="key"></param>
64 /// <returns></returns>
65 public static UUID GetAssetIdFromKeyOrItemName(SceneObjectPart part, string identifier)
66 {
67 UUID key;
68
69 // if we can parse the string as a key, use it.
70 // else try to locate the name in inventory of object. found returns key,
71 // not found returns UUID.Zero
72 if (!UUID.TryParse(identifier, out key))
73 {
74 TaskInventoryItem item = part.Inventory.GetInventoryItem(identifier);
75
76 if (item != null)
77 key = item.AssetID;
78 else
79 key = UUID.Zero;
80 }
81
82 return key;
83 }
84
85 /// <summary>
86 /// Return the UUID of the asset matching the specified key or name
87 /// and asset type.
88 /// </summary>
89 /// <param name="part">Scene object part to search for inventory item</param>
90 /// <param name="identifier"></param>
91 /// <param name="type"></param>
92 /// <returns></returns>
93 public static UUID GetAssetIdFromKeyOrItemName(SceneObjectPart part, string identifier, AssetType type)
94 {
95 UUID key;
96
97 if (!UUID.TryParse(identifier, out key))
98 {
99 TaskInventoryItem item = part.Inventory.GetInventoryItem(identifier);
100 if (item != null && item.Type == (int)type)
101 key = item.AssetID;
102 }
103
104 return key;
105 }
106 }
107} \ No newline at end of file
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
index 2d4c60a..39420a6 100644
--- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
+++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
@@ -359,6 +359,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
359 m_SOPXmlProcessors.Add("CollisionSound", ProcessCollisionSound); 359 m_SOPXmlProcessors.Add("CollisionSound", ProcessCollisionSound);
360 m_SOPXmlProcessors.Add("CollisionSoundVolume", ProcessCollisionSoundVolume); 360 m_SOPXmlProcessors.Add("CollisionSoundVolume", ProcessCollisionSoundVolume);
361 m_SOPXmlProcessors.Add("MediaUrl", ProcessMediaUrl); 361 m_SOPXmlProcessors.Add("MediaUrl", ProcessMediaUrl);
362 m_SOPXmlProcessors.Add("DynAttrs", ProcessDynAttrs);
362 m_SOPXmlProcessors.Add("TextureAnimation", ProcessTextureAnimation); 363 m_SOPXmlProcessors.Add("TextureAnimation", ProcessTextureAnimation);
363 m_SOPXmlProcessors.Add("ParticleSystem", ProcessParticleSystem); 364 m_SOPXmlProcessors.Add("ParticleSystem", ProcessParticleSystem);
364 m_SOPXmlProcessors.Add("PayPrice0", ProcessPayPrice0); 365 m_SOPXmlProcessors.Add("PayPrice0", ProcessPayPrice0);
@@ -366,6 +367,13 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
366 m_SOPXmlProcessors.Add("PayPrice2", ProcessPayPrice2); 367 m_SOPXmlProcessors.Add("PayPrice2", ProcessPayPrice2);
367 m_SOPXmlProcessors.Add("PayPrice3", ProcessPayPrice3); 368 m_SOPXmlProcessors.Add("PayPrice3", ProcessPayPrice3);
368 m_SOPXmlProcessors.Add("PayPrice4", ProcessPayPrice4); 369 m_SOPXmlProcessors.Add("PayPrice4", ProcessPayPrice4);
370
371 m_SOPXmlProcessors.Add("PhysicsShapeType", ProcessPhysicsShapeType);
372 m_SOPXmlProcessors.Add("Density", ProcessDensity);
373 m_SOPXmlProcessors.Add("Friction", ProcessFriction);
374 m_SOPXmlProcessors.Add("Bounce", ProcessBounce);
375 m_SOPXmlProcessors.Add("GravityModifier", ProcessGravityModifier);
376
369 #endregion 377 #endregion
370 378
371 #region TaskInventoryXmlProcessors initialization 379 #region TaskInventoryXmlProcessors initialization
@@ -593,6 +601,31 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
593 obj.ClickAction = (byte)reader.ReadElementContentAsInt("ClickAction", String.Empty); 601 obj.ClickAction = (byte)reader.ReadElementContentAsInt("ClickAction", String.Empty);
594 } 602 }
595 603
604 private static void ProcessPhysicsShapeType(SceneObjectPart obj, XmlTextReader reader)
605 {
606 obj.PhysicsShapeType = (byte)reader.ReadElementContentAsInt("PhysicsShapeType", String.Empty);
607 }
608
609 private static void ProcessDensity(SceneObjectPart obj, XmlTextReader reader)
610 {
611 obj.Density = reader.ReadElementContentAsFloat("Density", String.Empty);
612 }
613
614 private static void ProcessFriction(SceneObjectPart obj, XmlTextReader reader)
615 {
616 obj.Friction = reader.ReadElementContentAsFloat("Friction", String.Empty);
617 }
618
619 private static void ProcessBounce(SceneObjectPart obj, XmlTextReader reader)
620 {
621 obj.Restitution = reader.ReadElementContentAsFloat("Bounce", String.Empty);
622 }
623
624 private static void ProcessGravityModifier(SceneObjectPart obj, XmlTextReader reader)
625 {
626 obj.GravityModifier = reader.ReadElementContentAsFloat("GravityModifier", String.Empty);
627 }
628
596 private static void ProcessShape(SceneObjectPart obj, XmlTextReader reader) 629 private static void ProcessShape(SceneObjectPart obj, XmlTextReader reader)
597 { 630 {
598 List<string> errorNodeNames; 631 List<string> errorNodeNames;
@@ -722,6 +755,11 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
722 obj.MediaUrl = reader.ReadElementContentAsString("MediaUrl", String.Empty); 755 obj.MediaUrl = reader.ReadElementContentAsString("MediaUrl", String.Empty);
723 } 756 }
724 757
758 private static void ProcessDynAttrs(SceneObjectPart obj, XmlTextReader reader)
759 {
760 obj.DynAttrs.ReadXml(reader);
761 }
762
725 private static void ProcessTextureAnimation(SceneObjectPart obj, XmlTextReader reader) 763 private static void ProcessTextureAnimation(SceneObjectPart obj, XmlTextReader reader)
726 { 764 {
727 obj.TextureAnimation = Convert.FromBase64String(reader.ReadElementContentAsString("TextureAnimation", String.Empty)); 765 obj.TextureAnimation = Convert.FromBase64String(reader.ReadElementContentAsString("TextureAnimation", String.Empty));
@@ -1235,6 +1273,14 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1235 writer.WriteElementString("CollisionSoundVolume", sop.CollisionSoundVolume.ToString()); 1273 writer.WriteElementString("CollisionSoundVolume", sop.CollisionSoundVolume.ToString());
1236 if (sop.MediaUrl != null) 1274 if (sop.MediaUrl != null)
1237 writer.WriteElementString("MediaUrl", sop.MediaUrl.ToString()); 1275 writer.WriteElementString("MediaUrl", sop.MediaUrl.ToString());
1276
1277 if (sop.DynAttrs.Count > 0)
1278 {
1279 writer.WriteStartElement("DynAttrs");
1280 sop.DynAttrs.WriteXml(writer);
1281 writer.WriteEndElement();
1282 }
1283
1238 WriteBytes(writer, "TextureAnimation", sop.TextureAnimation); 1284 WriteBytes(writer, "TextureAnimation", sop.TextureAnimation);
1239 WriteBytes(writer, "ParticleSystem", sop.ParticleSystem); 1285 WriteBytes(writer, "ParticleSystem", sop.ParticleSystem);
1240 writer.WriteElementString("PayPrice0", sop.PayPrice[0].ToString()); 1286 writer.WriteElementString("PayPrice0", sop.PayPrice[0].ToString());
@@ -1243,6 +1289,17 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1243 writer.WriteElementString("PayPrice3", sop.PayPrice[3].ToString()); 1289 writer.WriteElementString("PayPrice3", sop.PayPrice[3].ToString());
1244 writer.WriteElementString("PayPrice4", sop.PayPrice[4].ToString()); 1290 writer.WriteElementString("PayPrice4", sop.PayPrice[4].ToString());
1245 1291
1292 if(sop.PhysicsShapeType != sop.DefaultPhysicsShapeType())
1293 writer.WriteElementString("PhysicsShapeType", sop.PhysicsShapeType.ToString().ToLower());
1294 if (sop.Density != 1000.0f)
1295 writer.WriteElementString("Density", sop.Density.ToString().ToLower());
1296 if (sop.Friction != 0.6f)
1297 writer.WriteElementString("Friction", sop.Friction.ToString().ToLower());
1298 if (sop.Restitution != 0.5f)
1299 writer.WriteElementString("Bounce", sop.Restitution.ToString().ToLower());
1300 if (sop.GravityModifier != 1.0f)
1301 writer.WriteElementString("GravityModifier", sop.GravityModifier.ToString().ToLower());
1302
1246 writer.WriteEndElement(); 1303 writer.WriteEndElement();
1247 } 1304 }
1248 1305
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 0b7b31b..751e463 100644
--- a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStore.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStore.cs
@@ -49,7 +49,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
49 private static readonly ILog m_log = 49 private static readonly ILog m_log =
50 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 50 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
51 51
52 private OSD m_ValueStore; 52 protected virtual OSD ValueStore { get; set; }
53 53
54 protected class TakeValueCallbackClass 54 protected class TakeValueCallbackClass
55 { 55 {
@@ -108,17 +108,18 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
108 /// 108 ///
109 /// </summary> 109 /// </summary>
110 // ----------------------------------------------------------------- 110 // -----------------------------------------------------------------
111 public JsonStore() : this("") {} 111 public JsonStore()
112
113 public JsonStore(string value)
114 { 112 {
115 m_TakeStore = new List<TakeValueCallbackClass>(); 113 m_TakeStore = new List<TakeValueCallbackClass>();
116 m_ReadStore = new List<TakeValueCallbackClass>(); 114 m_ReadStore = new List<TakeValueCallbackClass>();
117 115 }
116
117 public JsonStore(string value)
118 {
118 if (String.IsNullOrEmpty(value)) 119 if (String.IsNullOrEmpty(value))
119 m_ValueStore = new OSDMap(); 120 ValueStore = new OSDMap();
120 else 121 else
121 m_ValueStore = OSDParser.DeserializeJson(value); 122 ValueStore = OSDParser.DeserializeJson(value);
122 } 123 }
123 124
124 // ----------------------------------------------------------------- 125 // -----------------------------------------------------------------
@@ -129,7 +130,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
129 public bool TestPath(string expr, bool useJson) 130 public bool TestPath(string expr, bool useJson)
130 { 131 {
131 Stack<string> path = ParsePathExpression(expr); 132 Stack<string> path = ParsePathExpression(expr);
132 OSD result = ProcessPathExpression(m_ValueStore,path); 133 OSD result = ProcessPathExpression(ValueStore,path);
133 134
134 if (result == null) 135 if (result == null)
135 return false; 136 return false;
@@ -148,7 +149,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
148 public bool GetValue(string expr, out string value, bool useJson) 149 public bool GetValue(string expr, out string value, bool useJson)
149 { 150 {
150 Stack<string> path = ParsePathExpression(expr); 151 Stack<string> path = ParsePathExpression(expr);
151 OSD result = ProcessPathExpression(m_ValueStore,path); 152 OSD result = ProcessPathExpression(ValueStore,path);
152 return ConvertOutputValue(result,out value,useJson); 153 return ConvertOutputValue(result,out value,useJson);
153 } 154 }
154 155
@@ -184,7 +185,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
184 Stack<string> path = ParsePathExpression(expr); 185 Stack<string> path = ParsePathExpression(expr);
185 string pexpr = PathExpressionToKey(path); 186 string pexpr = PathExpressionToKey(path);
186 187
187 OSD result = ProcessPathExpression(m_ValueStore,path); 188 OSD result = ProcessPathExpression(ValueStore,path);
188 if (result == null) 189 if (result == null)
189 { 190 {
190 m_TakeStore.Add(new TakeValueCallbackClass(pexpr,useJson,cback)); 191 m_TakeStore.Add(new TakeValueCallbackClass(pexpr,useJson,cback));
@@ -215,7 +216,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
215 Stack<string> path = ParsePathExpression(expr); 216 Stack<string> path = ParsePathExpression(expr);
216 string pexpr = PathExpressionToKey(path); 217 string pexpr = PathExpressionToKey(path);
217 218
218 OSD result = ProcessPathExpression(m_ValueStore,path); 219 OSD result = ProcessPathExpression(ValueStore,path);
219 if (result == null) 220 if (result == null)
220 { 221 {
221 m_ReadStore.Add(new TakeValueCallbackClass(pexpr,useJson,cback)); 222 m_ReadStore.Add(new TakeValueCallbackClass(pexpr,useJson,cback));
@@ -245,7 +246,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
245 Stack<string> path = ParsePathExpression(expr); 246 Stack<string> path = ParsePathExpression(expr);
246 if (path.Count == 0) 247 if (path.Count == 0)
247 { 248 {
248 m_ValueStore = ovalue; 249 ValueStore = ovalue;
249 return true; 250 return true;
250 } 251 }
251 252
@@ -254,7 +255,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
254 if (pexpr != "") 255 if (pexpr != "")
255 pexpr += "."; 256 pexpr += ".";
256 257
257 OSD result = ProcessPathExpression(m_ValueStore,path); 258 OSD result = ProcessPathExpression(ValueStore,path);
258 if (result == null) 259 if (result == null)
259 return false; 260 return false;
260 261
@@ -522,4 +523,41 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
522 return pkey; 523 return pkey;
523 } 524 }
524 } 525 }
526
527 public class JsonObjectStore : JsonStore
528 {
529 private static readonly ILog m_log =
530 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
531
532 private Scene m_scene;
533 private UUID m_objectID;
534
535 protected override OSD ValueStore
536 {
537 get
538 {
539 SceneObjectPart sop = m_scene.GetSceneObjectPart(m_objectID);
540 if (sop == null)
541 {
542 // This is bad
543 return null;
544 }
545
546 return sop.DynAttrs.TopLevelMap;
547 }
548
549 // cannot set the top level
550 set
551 {
552 m_log.InfoFormat("[JsonStore] cannot set top level value in object store");
553 }
554 }
555
556 public JsonObjectStore(Scene scene, UUID oid) : base()
557 {
558 m_scene = scene;
559 m_objectID = oid;
560 }
561 }
562
525} 563}
diff --git a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreModule.cs b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreModule.cs
index b9b3ebc..a36ef42 100644
--- a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreModule.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreModule.cs
@@ -175,6 +175,34 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
175 /// 175 ///
176 /// </summary> 176 /// </summary>
177 // ----------------------------------------------------------------- 177 // -----------------------------------------------------------------
178 public bool AttachObjectStore(UUID objectID)
179 {
180 if (! m_enabled) return false;
181
182 SceneObjectPart sop = m_scene.GetSceneObjectPart(objectID);
183 if (sop == null)
184 {
185 m_log.InfoFormat("[JsonStore] unable to attach to unknown object; {0}",objectID);
186 return false;
187 }
188
189 lock (m_JsonValueStore)
190 {
191 if (m_JsonValueStore.ContainsKey(objectID))
192 return true;
193
194 JsonStore map = new JsonObjectStore(m_scene,objectID);
195 m_JsonValueStore.Add(objectID,map);
196 }
197
198 return true;
199 }
200
201 // -----------------------------------------------------------------
202 /// <summary>
203 ///
204 /// </summary>
205 // -----------------------------------------------------------------
178 public bool CreateStore(string value, ref UUID result) 206 public bool CreateStore(string value, ref UUID result)
179 { 207 {
180 if (result == UUID.Zero) 208 if (result == UUID.Zero)
diff --git a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreScriptModule.cs b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreScriptModule.cs
index 5b7a79d..48b4a9f 100644
--- a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreScriptModule.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreScriptModule.cs
@@ -39,6 +39,7 @@ using OpenMetaverse.StructuredData;
39using OpenSim.Framework; 39using OpenSim.Framework;
40using OpenSim.Region.Framework.Interfaces; 40using OpenSim.Region.Framework.Interfaces;
41using OpenSim.Region.Framework.Scenes; 41using OpenSim.Region.Framework.Scenes;
42using OpenSim.Region.Framework.Scenes.Scripting;
42using System.Collections.Generic; 43using System.Collections.Generic;
43using System.Text.RegularExpressions; 44using System.Text.RegularExpressions;
44 45
@@ -168,6 +169,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
168 m_comms.RegisterScriptInvocations(this); 169 m_comms.RegisterScriptInvocations(this);
169 170
170 // m_comms.RegisterScriptInvocation(this, "JsonCreateStore"); 171 // m_comms.RegisterScriptInvocation(this, "JsonCreateStore");
172 // m_comms.RegisterScriptInvocation(this, "JsonAttachObjectStore");
171 // m_comms.RegisterScriptInvocation(this, "JsonDestroyStore"); 173 // m_comms.RegisterScriptInvocation(this, "JsonDestroyStore");
172 // m_comms.RegisterScriptInvocation(this, "JsonTestStore"); 174 // m_comms.RegisterScriptInvocation(this, "JsonTestStore");
173 175
@@ -219,6 +221,21 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
219 /// </summary> 221 /// </summary>
220 // ----------------------------------------------------------------- 222 // -----------------------------------------------------------------
221 [ScriptInvocation] 223 [ScriptInvocation]
224 public UUID JsonAttachObjectStore(UUID hostID, UUID scriptID)
225 {
226 UUID uuid = UUID.Zero;
227 if (! m_store.AttachObjectStore(hostID))
228 GenerateRuntimeError("Failed to create Json store");
229
230 return hostID;
231 }
232
233 // -----------------------------------------------------------------
234 /// <summary>
235 ///
236 /// </summary>
237 // -----------------------------------------------------------------
238 [ScriptInvocation]
222 public UUID JsonCreateStore(UUID hostID, UUID scriptID, string value) 239 public UUID JsonCreateStore(UUID hostID, UUID scriptID, string value)
223 { 240 {
224 UUID uuid = UUID.Zero; 241 UUID uuid = UUID.Zero;
@@ -256,10 +273,10 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
256 /// </summary> 273 /// </summary>
257 // ----------------------------------------------------------------- 274 // -----------------------------------------------------------------
258 [ScriptInvocation] 275 [ScriptInvocation]
259 public UUID JsonReadNotecard(UUID hostID, UUID scriptID, UUID storeID, string path, UUID assetID) 276 public UUID JsonReadNotecard(UUID hostID, UUID scriptID, UUID storeID, string path, string notecardIdentifier)
260 { 277 {
261 UUID reqID = UUID.Random(); 278 UUID reqID = UUID.Random();
262 Util.FireAndForget(delegate(object o) { DoJsonReadNotecard(reqID,hostID,scriptID,storeID,path,assetID); }); 279 Util.FireAndForget(o => DoJsonReadNotecard(reqID, hostID, scriptID, storeID, path, notecardIdentifier));
263 return reqID; 280 return reqID;
264 } 281 }
265 282
@@ -463,14 +480,23 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
463 /// 480 ///
464 /// </summary> 481 /// </summary>
465 // ----------------------------------------------------------------- 482 // -----------------------------------------------------------------
466 private void DoJsonReadNotecard(UUID reqID, UUID hostID, UUID scriptID, UUID storeID, string path, UUID assetID) 483 private void DoJsonReadNotecard(
484 UUID reqID, UUID hostID, UUID scriptID, UUID storeID, string path, string notecardIdentifier)
467 { 485 {
486 UUID assetID;
487
488 if (!UUID.TryParse(notecardIdentifier, out assetID))
489 {
490 SceneObjectPart part = m_scene.GetSceneObjectPart(hostID);
491 assetID = ScriptUtils.GetAssetIdFromItemName(part, notecardIdentifier, (int)AssetType.Notecard);
492 }
493
468 AssetBase a = m_scene.AssetService.Get(assetID.ToString()); 494 AssetBase a = m_scene.AssetService.Get(assetID.ToString());
469 if (a == null) 495 if (a == null)
470 GenerateRuntimeError(String.Format("Unable to find notecard asset {0}",assetID)); 496 GenerateRuntimeError(String.Format("Unable to find notecard asset {0}", assetID));
471 497
472 if (a.Type != (sbyte)AssetType.Notecard) 498 if (a.Type != (sbyte)AssetType.Notecard)
473 GenerateRuntimeError(String.Format("Invalid notecard asset {0}",assetID)); 499 GenerateRuntimeError(String.Format("Invalid notecard asset {0}", assetID));
474 500
475 m_log.DebugFormat("[JsonStoreScripts]: read notecard in context {0}",storeID); 501 m_log.DebugFormat("[JsonStoreScripts]: read notecard in context {0}",storeID);
476 502
@@ -483,11 +509,11 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
483 } 509 }
484 catch (Exception e) 510 catch (Exception e)
485 { 511 {
486 m_log.WarnFormat("[JsonStoreScripts]: Json parsing failed; {0}",e.Message); 512 m_log.WarnFormat("[JsonStoreScripts]: Json parsing failed; {0}", e.Message);
487 } 513 }
488 514
489 GenerateRuntimeError(String.Format("Json parsing failed for {0}",assetID.ToString())); 515 GenerateRuntimeError(String.Format("Json parsing failed for {0}", assetID));
490 m_comms.DispatchReply(scriptID,0,"",reqID.ToString()); 516 m_comms.DispatchReply(scriptID, 0, "", reqID.ToString());
491 } 517 }
492 518
493 // ----------------------------------------------------------------- 519 // -----------------------------------------------------------------
diff --git a/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs b/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs
index 8042a93..98b5624 100644
--- a/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs
@@ -54,6 +54,22 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
54 private MockScriptEngine m_engine; 54 private MockScriptEngine m_engine;
55 private ScriptModuleCommsModule m_smcm; 55 private ScriptModuleCommsModule m_smcm;
56 56
57 [TestFixtureSetUp]
58 public void FixtureInit()
59 {
60 // Don't allow tests to be bamboozled by asynchronous events. Execute everything on the same thread.
61 Util.FireAndForgetMethod = FireAndForgetMethod.RegressionTest;
62 }
63
64 [TestFixtureTearDown]
65 public void TearDown()
66 {
67 // We must set this back afterwards, otherwise later tests will fail since they're expecting multiple
68 // threads. Possibly, later tests should be rewritten so none of them require async stuff (which regression
69 // tests really shouldn't).
70 Util.FireAndForgetMethod = Util.DefaultFireAndForgetMethod;
71 }
72
57 [SetUp] 73 [SetUp]
58 public override void SetUp() 74 public override void SetUp()
59 { 75 {
@@ -85,7 +101,12 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
85 101
86 private object InvokeOp(string name, params object[] args) 102 private object InvokeOp(string name, params object[] args)
87 { 103 {
88 return m_smcm.InvokeOperation(UUID.Zero, UUID.Zero, name, args); 104 return InvokeOpOnHost(name, UUID.Zero, args);
105 }
106
107 private object InvokeOpOnHost(string name, UUID hostId, params object[] args)
108 {
109 return m_smcm.InvokeOperation(hostId, UUID.Zero, name, args);
89 } 110 }
90 111
91 [Test] 112 [Test]
@@ -193,6 +214,44 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
193 Assert.That(value, Is.EqualTo("World")); 214 Assert.That(value, Is.EqualTo("World"));
194 } 215 }
195 216
217 /// <summary>
218 /// Test for reading and writing json to a notecard
219 /// </summary>
220 /// <remarks>
221 /// TODO: Really needs to test correct receipt of the link_message event. Could do this by directly fetching
222 /// it via the MockScriptEngine or perhaps by a dummy script instance.
223 /// </remarks>
224 [Test]
225 public void TestJsonWriteReadNotecard()
226 {
227 TestHelpers.InMethod();
228 TestHelpers.EnableLogging();
229
230 string notecardName = "nc1";
231
232 SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, TestHelpers.ParseTail(0x1));
233 m_scene.AddSceneObject(so);
234
235 UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ 'Hello':'World' }");
236
237 // Write notecard
238 UUID writeNotecardRequestId = (UUID)InvokeOpOnHost("JsonWriteNotecard", so.UUID, storeId, "/", notecardName);
239 Assert.That(writeNotecardRequestId, Is.Not.EqualTo(UUID.Zero));
240
241 TaskInventoryItem nc1Item = so.RootPart.Inventory.GetInventoryItem(notecardName);
242 Assert.That(nc1Item, Is.Not.Null);
243
244 // TODO: Should probably independently check the contents.
245
246 // Read notecard
247 UUID receivingStoreId = (UUID)InvokeOp("JsonCreateStore", "{ 'Hello':'World' }");
248 UUID readNotecardRequestId = (UUID)InvokeOpOnHost("JsonReadNotecard", so.UUID, receivingStoreId, "/", notecardName);
249 Assert.That(readNotecardRequestId, Is.Not.EqualTo(UUID.Zero));
250
251 string value = (string)InvokeOp("JsonGetValue", storeId, "Hello");
252 Assert.That(value, Is.EqualTo("World"));
253 }
254
196 public object DummyTestMethod(object o1, object o2, object o3, object o4, object o5) { return null; } 255 public object DummyTestMethod(object o1, object o2, object o3, object o4, object o5) { return null; }
197 } 256 }
198} \ No newline at end of file 257} \ No newline at end of file
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 04e77b8..39e62dd 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSAPIXNA.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSAPIXNA.cs
@@ -1088,7 +1088,7 @@ private sealed class BulletConstraintXNA : BulletConstraint
1088 { 1088 {
1089 CollisionWorld.WorldData.ParamData p = new CollisionWorld.WorldData.ParamData(); 1089 CollisionWorld.WorldData.ParamData p = new CollisionWorld.WorldData.ParamData();
1090 1090
1091 p.angularDamping = o[0].XangularDamping; 1091 p.angularDamping = BSParam.AngularDamping;
1092 p.defaultFriction = o[0].defaultFriction; 1092 p.defaultFriction = o[0].defaultFriction;
1093 p.defaultFriction = o[0].defaultFriction; 1093 p.defaultFriction = o[0].defaultFriction;
1094 p.defaultDensity = o[0].defaultDensity; 1094 p.defaultDensity = o[0].defaultDensity;
@@ -1096,32 +1096,32 @@ private sealed class BulletConstraintXNA : BulletConstraint
1096 p.collisionMargin = o[0].collisionMargin; 1096 p.collisionMargin = o[0].collisionMargin;
1097 p.gravity = o[0].gravity; 1097 p.gravity = o[0].gravity;
1098 1098
1099 p.linearDamping = o[0].XlinearDamping; 1099 p.linearDamping = BSParam.LinearDamping;
1100 p.angularDamping = o[0].XangularDamping; 1100 p.angularDamping = BSParam.AngularDamping;
1101 p.deactivationTime = o[0].XdeactivationTime; 1101 p.deactivationTime = BSParam.DeactivationTime;
1102 p.linearSleepingThreshold = o[0].XlinearSleepingThreshold; 1102 p.linearSleepingThreshold = BSParam.LinearSleepingThreshold;
1103 p.angularSleepingThreshold = o[0].XangularSleepingThreshold; 1103 p.angularSleepingThreshold = BSParam.AngularSleepingThreshold;
1104 p.ccdMotionThreshold = o[0].XccdMotionThreshold; 1104 p.ccdMotionThreshold = BSParam.CcdMotionThreshold;
1105 p.ccdSweptSphereRadius = o[0].XccdSweptSphereRadius; 1105 p.ccdSweptSphereRadius = BSParam.CcdSweptSphereRadius;
1106 p.contactProcessingThreshold = o[0].XcontactProcessingThreshold; 1106 p.contactProcessingThreshold = BSParam.ContactProcessingThreshold;
1107 1107
1108 p.terrainImplementation = o[0].XterrainImplementation; 1108 p.terrainImplementation = BSParam.TerrainImplementation;
1109 p.terrainFriction = o[0].XterrainFriction; 1109 p.terrainFriction = BSParam.TerrainFriction;
1110 1110
1111 p.terrainHitFraction = o[0].XterrainHitFraction; 1111 p.terrainHitFraction = BSParam.TerrainHitFraction;
1112 p.terrainRestitution = o[0].XterrainRestitution; 1112 p.terrainRestitution = BSParam.TerrainRestitution;
1113 p.terrainCollisionMargin = o[0].XterrainCollisionMargin; 1113 p.terrainCollisionMargin = BSParam.TerrainCollisionMargin;
1114 1114
1115 p.avatarFriction = o[0].XavatarFriction; 1115 p.avatarFriction = BSParam.AvatarFriction;
1116 p.avatarStandingFriction = o[0].XavatarStandingFriction; 1116 p.avatarStandingFriction = BSParam.AvatarStandingFriction;
1117 p.avatarDensity = o[0].XavatarDensity; 1117 p.avatarDensity = BSParam.AvatarDensity;
1118 p.avatarRestitution = o[0].XavatarRestitution; 1118 p.avatarRestitution = BSParam.AvatarRestitution;
1119 p.avatarCapsuleWidth = o[0].XavatarCapsuleWidth; 1119 p.avatarCapsuleWidth = BSParam.AvatarCapsuleWidth;
1120 p.avatarCapsuleDepth = o[0].XavatarCapsuleDepth; 1120 p.avatarCapsuleDepth = BSParam.AvatarCapsuleDepth;
1121 p.avatarCapsuleHeight = o[0].XavatarCapsuleHeight; 1121 p.avatarCapsuleHeight = BSParam.AvatarCapsuleHeight;
1122 p.avatarContactProcessingThreshold = o[0].XavatarContactProcessingThreshold; 1122 p.avatarContactProcessingThreshold = BSParam.AvatarContactProcessingThreshold;
1123 1123
1124 p.vehicleAngularDamping = o[0].XvehicleAngularDamping; 1124 p.vehicleAngularDamping = BSParam.VehicleAngularDamping;
1125 1125
1126 p.maxPersistantManifoldPoolSize = o[0].maxPersistantManifoldPoolSize; 1126 p.maxPersistantManifoldPoolSize = o[0].maxPersistantManifoldPoolSize;
1127 p.maxCollisionAlgorithmPoolSize = o[0].maxCollisionAlgorithmPoolSize; 1127 p.maxCollisionAlgorithmPoolSize = o[0].maxCollisionAlgorithmPoolSize;
@@ -1132,15 +1132,15 @@ private sealed class BulletConstraintXNA : BulletConstraint
1132 p.shouldEnableFrictionCaching = o[0].shouldEnableFrictionCaching; 1132 p.shouldEnableFrictionCaching = o[0].shouldEnableFrictionCaching;
1133 p.numberOfSolverIterations = o[0].numberOfSolverIterations; 1133 p.numberOfSolverIterations = o[0].numberOfSolverIterations;
1134 1134
1135 p.linksetImplementation = o[0].XlinksetImplementation; 1135 p.linksetImplementation = BSParam.LinksetImplementation;
1136 p.linkConstraintUseFrameOffset = o[0].XlinkConstraintUseFrameOffset; 1136 p.linkConstraintUseFrameOffset = BSParam.LinkConstraintUseFrameOffset;
1137 p.linkConstraintEnableTransMotor = o[0].XlinkConstraintEnableTransMotor; 1137 p.linkConstraintEnableTransMotor = BSParam.LinkConstraintEnableTransMotor;
1138 p.linkConstraintTransMotorMaxVel = o[0].XlinkConstraintTransMotorMaxVel; 1138 p.linkConstraintTransMotorMaxVel = BSParam.LinkConstraintTransMotorMaxVel;
1139 p.linkConstraintTransMotorMaxForce = o[0].XlinkConstraintTransMotorMaxForce; 1139 p.linkConstraintTransMotorMaxForce = BSParam.LinkConstraintTransMotorMaxForce;
1140 p.linkConstraintERP = o[0].XlinkConstraintERP; 1140 p.linkConstraintERP = BSParam.LinkConstraintERP;
1141 p.linkConstraintCFM = o[0].XlinkConstraintCFM; 1141 p.linkConstraintCFM = BSParam.LinkConstraintCFM;
1142 p.linkConstraintSolverIterations = o[0].XlinkConstraintSolverIterations; 1142 p.linkConstraintSolverIterations = BSParam.LinkConstraintSolverIterations;
1143 p.physicsLoggingFrames = o[0].XphysicsLoggingFrames; 1143 p.physicsLoggingFrames = o[0].physicsLoggingFrames;
1144 DefaultCollisionConstructionInfo ccci = new DefaultCollisionConstructionInfo(); 1144 DefaultCollisionConstructionInfo ccci = new DefaultCollisionConstructionInfo();
1145 1145
1146 DefaultCollisionConfiguration cci = new DefaultCollisionConfiguration(); 1146 DefaultCollisionConfiguration cci = new DefaultCollisionConfiguration();
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSApiTemplate.cs b/OpenSim/Region/Physics/BulletSPlugin/BSApiTemplate.cs
index abbd22c..5e06c1e 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSApiTemplate.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSApiTemplate.cs
@@ -174,32 +174,6 @@ public struct ConfigurationParameters
174 public float collisionMargin; 174 public float collisionMargin;
175 public float gravity; 175 public float gravity;
176 176
177 public float XlinearDamping;
178 public float XangularDamping;
179 public float XdeactivationTime;
180 public float XlinearSleepingThreshold;
181 public float XangularSleepingThreshold;
182 public float XccdMotionThreshold;
183 public float XccdSweptSphereRadius;
184 public float XcontactProcessingThreshold;
185
186 public float XterrainImplementation;
187 public float XterrainFriction;
188 public float XterrainHitFraction;
189 public float XterrainRestitution;
190 public float XterrainCollisionMargin;
191
192 public float XavatarFriction;
193 public float XavatarStandingFriction;
194 public float XavatarDensity;
195 public float XavatarRestitution;
196 public float XavatarCapsuleWidth;
197 public float XavatarCapsuleDepth;
198 public float XavatarCapsuleHeight;
199 public float XavatarContactProcessingThreshold;
200
201 public float XvehicleAngularDamping;
202
203 public float maxPersistantManifoldPoolSize; 177 public float maxPersistantManifoldPoolSize;
204 public float maxCollisionAlgorithmPoolSize; 178 public float maxCollisionAlgorithmPoolSize;
205 public float shouldDisableContactPoolDynamicAllocation; 179 public float shouldDisableContactPoolDynamicAllocation;
@@ -208,17 +182,9 @@ public struct ConfigurationParameters
208 public float shouldSplitSimulationIslands; 182 public float shouldSplitSimulationIslands;
209 public float shouldEnableFrictionCaching; 183 public float shouldEnableFrictionCaching;
210 public float numberOfSolverIterations; 184 public float numberOfSolverIterations;
185 public float useSingleSidedMeshes;
211 186
212 public float XlinksetImplementation; 187 public float physicsLoggingFrames;
213 public float XlinkConstraintUseFrameOffset;
214 public float XlinkConstraintEnableTransMotor;
215 public float XlinkConstraintTransMotorMaxVel;
216 public float XlinkConstraintTransMotorMaxForce;
217 public float XlinkConstraintERP;
218 public float XlinkConstraintCFM;
219 public float XlinkConstraintSolverIterations;
220
221 public float XphysicsLoggingFrames;
222 188
223 public const float numericTrue = 1f; 189 public const float numericTrue = 1f;
224 public const float numericFalse = 0f; 190 public const float numericFalse = 0f;
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
index 8ecf2ff..b51e9fd 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
@@ -1326,7 +1326,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
1326 // If verticalError.Z is negative, the vehicle is upside down. Add additional push. 1326 // If verticalError.Z is negative, the vehicle is upside down. Add additional push.
1327 if (verticalError.Z < 0f) 1327 if (verticalError.Z < 0f)
1328 { 1328 {
1329 vertContributionV.X += PIOverFour; 1329 vertContributionV.X += Math.Sign(vertContributionV.X) * PIOverFour;
1330 // vertContribution.Y -= PIOverFour; 1330 // vertContribution.Y -= PIOverFour;
1331 } 1331 }
1332 1332
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs
index 8c098b2..965c382 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs
@@ -39,6 +39,7 @@ public static class BSParam
39{ 39{
40 // Level of Detail values kept as float because that's what the Meshmerizer wants 40 // Level of Detail values kept as float because that's what the Meshmerizer wants
41 public static float MeshLOD { get; private set; } 41 public static float MeshLOD { get; private set; }
42 public static float MeshCircularLOD { get; private set; }
42 public static float MeshMegaPrimLOD { get; private set; } 43 public static float MeshMegaPrimLOD { get; private set; }
43 public static float MeshMegaPrimThreshold { get; private set; } 44 public static float MeshMegaPrimThreshold { get; private set; }
44 public static float SculptLOD { get; private set; } 45 public static float SculptLOD { get; private set; }
@@ -61,6 +62,7 @@ public static class BSParam
61 public static bool ShouldMeshSculptedPrim { get; private set; } // cause scuplted prims to get meshed 62 public static bool ShouldMeshSculptedPrim { get; private set; } // cause scuplted prims to get meshed
62 public static bool ShouldForceSimplePrimMeshing { get; private set; } // if a cube or sphere, let Bullet do internal shapes 63 public static bool ShouldForceSimplePrimMeshing { get; private set; } // if a cube or sphere, let Bullet do internal shapes
63 public static bool ShouldUseHullsForPhysicalObjects { get; private set; } // 'true' if should create hulls for physical objects 64 public static bool ShouldUseHullsForPhysicalObjects { get; private set; } // 'true' if should create hulls for physical objects
65 public static bool ShouldRemoveZeroWidthTriangles { get; private set; }
64 66
65 public static float TerrainImplementation { get; private set; } 67 public static float TerrainImplementation { get; private set; }
66 public static float TerrainFriction { get; private set; } 68 public static float TerrainFriction { get; private set; }
@@ -68,6 +70,24 @@ public static class BSParam
68 public static float TerrainRestitution { get; private set; } 70 public static float TerrainRestitution { get; private set; }
69 public static float TerrainCollisionMargin { get; private set; } 71 public static float TerrainCollisionMargin { get; private set; }
70 72
73 public static float DefaultFriction;
74 public static float DefaultDensity;
75 public static float DefaultRestitution;
76 public static float CollisionMargin;
77 public static float Gravity;
78
79 // Physics Engine operation
80 public static float MaxPersistantManifoldPoolSize;
81 public static float MaxCollisionAlgorithmPoolSize;
82 public static float ShouldDisableContactPoolDynamicAllocation;
83 public static float ShouldForceUpdateAllAabbs;
84 public static float ShouldRandomizeSolverOrder;
85 public static float ShouldSplitSimulationIslands;
86 public static float ShouldEnableFrictionCaching;
87 public static float NumberOfSolverIterations;
88 public static bool UseSingleSidedMeshes { get { return UseSingleSidedMeshesF != ConfigurationParameters.numericFalse; } }
89 public static float UseSingleSidedMeshesF;
90
71 // Avatar parameters 91 // Avatar parameters
72 public static float AvatarFriction { get; private set; } 92 public static float AvatarFriction { get; private set; }
73 public static float AvatarStandingFriction { get; private set; } 93 public static float AvatarStandingFriction { get; private set; }
@@ -199,22 +219,32 @@ public static class BSParam
199 (s,cf,p,v) => { ShouldUseHullsForPhysicalObjects = cf.GetBoolean(p, BSParam.BoolNumeric(v)); }, 219 (s,cf,p,v) => { ShouldUseHullsForPhysicalObjects = cf.GetBoolean(p, BSParam.BoolNumeric(v)); },
200 (s) => { return BSParam.NumericBool(ShouldUseHullsForPhysicalObjects); }, 220 (s) => { return BSParam.NumericBool(ShouldUseHullsForPhysicalObjects); },
201 (s,p,l,v) => { ShouldUseHullsForPhysicalObjects = BSParam.BoolNumeric(v); } ), 221 (s,p,l,v) => { ShouldUseHullsForPhysicalObjects = BSParam.BoolNumeric(v); } ),
222 new ParameterDefn("ShouldRemoveZeroWidthTriangles", "If true, remove degenerate triangles from meshes",
223 ConfigurationParameters.numericTrue,
224 (s,cf,p,v) => { ShouldRemoveZeroWidthTriangles = cf.GetBoolean(p, BSParam.BoolNumeric(v)); },
225 (s) => { return BSParam.NumericBool(ShouldRemoveZeroWidthTriangles); },
226 (s,p,l,v) => { ShouldRemoveZeroWidthTriangles = BSParam.BoolNumeric(v); } ),
202 227
203 new ParameterDefn("MeshLevelOfDetail", "Level of detail to render meshes (32, 16, 8 or 4. 32=most detailed)", 228 new ParameterDefn("MeshLevelOfDetail", "Level of detail to render meshes (32, 16, 8 or 4. 32=most detailed)",
204 8f, 229 32f,
205 (s,cf,p,v) => { MeshLOD = (float)cf.GetInt(p, (int)v); }, 230 (s,cf,p,v) => { MeshLOD = (float)cf.GetInt(p, (int)v); },
206 (s) => { return MeshLOD; }, 231 (s) => { return MeshLOD; },
207 (s,p,l,v) => { MeshLOD = v; } ), 232 (s,p,l,v) => { MeshLOD = v; } ),
208 new ParameterDefn("MeshLevelOfDetailMegaPrim", "Level of detail to render meshes larger than threshold meters", 233 new ParameterDefn("MeshLevelOfDetailCircular", "Level of detail for prims with circular cuts or shapes",
209 16f, 234 32f,
210 (s,cf,p,v) => { MeshMegaPrimLOD = (float)cf.GetInt(p, (int)v); }, 235 (s,cf,p,v) => { MeshCircularLOD = (float)cf.GetInt(p, (int)v); },
211 (s) => { return MeshMegaPrimLOD; }, 236 (s) => { return MeshCircularLOD; },
212 (s,p,l,v) => { MeshMegaPrimLOD = v; } ), 237 (s,p,l,v) => { MeshCircularLOD = v; } ),
213 new ParameterDefn("MeshLevelOfDetailMegaPrimThreshold", "Size (in meters) of a mesh before using MeshMegaPrimLOD", 238 new ParameterDefn("MeshLevelOfDetailMegaPrimThreshold", "Size (in meters) of a mesh before using MeshMegaPrimLOD",
214 10f, 239 10f,
215 (s,cf,p,v) => { MeshMegaPrimThreshold = (float)cf.GetInt(p, (int)v); }, 240 (s,cf,p,v) => { MeshMegaPrimThreshold = (float)cf.GetInt(p, (int)v); },
216 (s) => { return MeshMegaPrimThreshold; }, 241 (s) => { return MeshMegaPrimThreshold; },
217 (s,p,l,v) => { MeshMegaPrimThreshold = v; } ), 242 (s,p,l,v) => { MeshMegaPrimThreshold = v; } ),
243 new ParameterDefn("MeshLevelOfDetailMegaPrim", "Level of detail to render meshes larger than threshold meters",
244 32f,
245 (s,cf,p,v) => { MeshMegaPrimLOD = (float)cf.GetInt(p, (int)v); },
246 (s) => { return MeshMegaPrimLOD; },
247 (s,p,l,v) => { MeshMegaPrimLOD = v; } ),
218 new ParameterDefn("SculptLevelOfDetail", "Level of detail to render sculpties (32, 16, 8 or 4. 32=most detailed)", 248 new ParameterDefn("SculptLevelOfDetail", "Level of detail to render sculpties (32, 16, 8 or 4. 32=most detailed)",
219 32f, 249 32f,
220 (s,cf,p,v) => { SculptLOD = (float)cf.GetInt(p, (int)v); }, 250 (s,cf,p,v) => { SculptLOD = (float)cf.GetInt(p, (int)v); },
@@ -287,29 +317,29 @@ public static class BSParam
287 317
288 new ParameterDefn("DefaultFriction", "Friction factor used on new objects", 318 new ParameterDefn("DefaultFriction", "Friction factor used on new objects",
289 0.2f, 319 0.2f,
290 (s,cf,p,v) => { s.UnmanagedParams[0].defaultFriction = cf.GetFloat(p, v); }, 320 (s,cf,p,v) => { DefaultFriction = cf.GetFloat(p, v); },
291 (s) => { return s.UnmanagedParams[0].defaultFriction; }, 321 (s) => { return DefaultFriction; },
292 (s,p,l,v) => { s.UnmanagedParams[0].defaultFriction = v; } ), 322 (s,p,l,v) => { DefaultFriction = v; s.UnmanagedParams[0].defaultFriction = v; } ),
293 new ParameterDefn("DefaultDensity", "Density for new objects" , 323 new ParameterDefn("DefaultDensity", "Density for new objects" ,
294 10.000006836f, // Aluminum g/cm3 324 10.000006836f, // Aluminum g/cm3
295 (s,cf,p,v) => { s.UnmanagedParams[0].defaultDensity = cf.GetFloat(p, v); }, 325 (s,cf,p,v) => { DefaultDensity = cf.GetFloat(p, v); },
296 (s) => { return s.UnmanagedParams[0].defaultDensity; }, 326 (s) => { return DefaultDensity; },
297 (s,p,l,v) => { s.UnmanagedParams[0].defaultDensity = v; } ), 327 (s,p,l,v) => { DefaultDensity = v; s.UnmanagedParams[0].defaultDensity = v; } ),
298 new ParameterDefn("DefaultRestitution", "Bouncyness of an object" , 328 new ParameterDefn("DefaultRestitution", "Bouncyness of an object" ,
299 0f, 329 0f,
300 (s,cf,p,v) => { s.UnmanagedParams[0].defaultRestitution = cf.GetFloat(p, v); }, 330 (s,cf,p,v) => { DefaultRestitution = cf.GetFloat(p, v); },
301 (s) => { return s.UnmanagedParams[0].defaultRestitution; }, 331 (s) => { return DefaultRestitution; },
302 (s,p,l,v) => { s.UnmanagedParams[0].defaultRestitution = v; } ), 332 (s,p,l,v) => { DefaultRestitution = v; s.UnmanagedParams[0].defaultRestitution = v; } ),
303 new ParameterDefn("CollisionMargin", "Margin around objects before collisions are calculated (must be zero!)", 333 new ParameterDefn("CollisionMargin", "Margin around objects before collisions are calculated (must be zero!)",
304 0.04f, 334 0.04f,
305 (s,cf,p,v) => { s.UnmanagedParams[0].collisionMargin = cf.GetFloat(p, v); }, 335 (s,cf,p,v) => { CollisionMargin = cf.GetFloat(p, v); },
306 (s) => { return s.UnmanagedParams[0].collisionMargin; }, 336 (s) => { return CollisionMargin; },
307 (s,p,l,v) => { s.UnmanagedParams[0].collisionMargin = v; } ), 337 (s,p,l,v) => { CollisionMargin = v; s.UnmanagedParams[0].collisionMargin = v; } ),
308 new ParameterDefn("Gravity", "Vertical force of gravity (negative means down)", 338 new ParameterDefn("Gravity", "Vertical force of gravity (negative means down)",
309 -9.80665f, 339 -9.80665f,
310 (s,cf,p,v) => { s.UnmanagedParams[0].gravity = cf.GetFloat(p, v); }, 340 (s,cf,p,v) => { Gravity = cf.GetFloat(p, v); },
311 (s) => { return s.UnmanagedParams[0].gravity; }, 341 (s) => { return Gravity; },
312 (s,p,l,v) => { s.UpdateParameterObject((x)=>{s.UnmanagedParams[0].gravity=x;}, p, PhysParameterEntry.APPLY_TO_NONE, v); }, 342 (s,p,l,v) => { Gravity = v; s.UnmanagedParams[0].gravity = v; },
313 (s,o,v) => { s.PE.SetGravity(o.PhysBody, new Vector3(0f,0f,v)); } ), 343 (s,o,v) => { s.PE.SetGravity(o.PhysBody, new Vector3(0f,0f,v)); } ),
314 344
315 345
@@ -317,49 +347,49 @@ public static class BSParam
317 0f, 347 0f,
318 (s,cf,p,v) => { LinearDamping = cf.GetFloat(p, v); }, 348 (s,cf,p,v) => { LinearDamping = cf.GetFloat(p, v); },
319 (s) => { return LinearDamping; }, 349 (s) => { return LinearDamping; },
320 (s,p,l,v) => { s.UpdateParameterObject((x)=>{LinearDamping=x;}, p, l, v); }, 350 (s,p,l,v) => { LinearDamping = v; },
321 (s,o,v) => { s.PE.SetDamping(o.PhysBody, v, AngularDamping); } ), 351 (s,o,v) => { s.PE.SetDamping(o.PhysBody, v, AngularDamping); } ),
322 new ParameterDefn("AngularDamping", "Factor to damp angular movement per second (0.0 - 1.0)", 352 new ParameterDefn("AngularDamping", "Factor to damp angular movement per second (0.0 - 1.0)",
323 0f, 353 0f,
324 (s,cf,p,v) => { AngularDamping = cf.GetFloat(p, v); }, 354 (s,cf,p,v) => { AngularDamping = cf.GetFloat(p, v); },
325 (s) => { return AngularDamping; }, 355 (s) => { return AngularDamping; },
326 (s,p,l,v) => { s.UpdateParameterObject((x)=>{AngularDamping=x;}, p, l, v); }, 356 (s,p,l,v) => { AngularDamping = v; },
327 (s,o,v) => { s.PE.SetDamping(o.PhysBody, LinearDamping, v); } ), 357 (s,o,v) => { s.PE.SetDamping(o.PhysBody, LinearDamping, v); } ),
328 new ParameterDefn("DeactivationTime", "Seconds before considering an object potentially static", 358 new ParameterDefn("DeactivationTime", "Seconds before considering an object potentially static",
329 0.2f, 359 0.2f,
330 (s,cf,p,v) => { DeactivationTime = cf.GetFloat(p, v); }, 360 (s,cf,p,v) => { DeactivationTime = cf.GetFloat(p, v); },
331 (s) => { return DeactivationTime; }, 361 (s) => { return DeactivationTime; },
332 (s,p,l,v) => { s.UpdateParameterObject((x)=>{DeactivationTime=x;}, p, l, v); }, 362 (s,p,l,v) => { DeactivationTime = v; },
333 (s,o,v) => { s.PE.SetDeactivationTime(o.PhysBody, v); } ), 363 (s,o,v) => { s.PE.SetDeactivationTime(o.PhysBody, v); } ),
334 new ParameterDefn("LinearSleepingThreshold", "Seconds to measure linear movement before considering static", 364 new ParameterDefn("LinearSleepingThreshold", "Seconds to measure linear movement before considering static",
335 0.8f, 365 0.8f,
336 (s,cf,p,v) => { LinearSleepingThreshold = cf.GetFloat(p, v); }, 366 (s,cf,p,v) => { LinearSleepingThreshold = cf.GetFloat(p, v); },
337 (s) => { return LinearSleepingThreshold; }, 367 (s) => { return LinearSleepingThreshold; },
338 (s,p,l,v) => { s.UpdateParameterObject((x)=>{LinearSleepingThreshold=x;}, p, l, v); }, 368 (s,p,l,v) => { LinearSleepingThreshold = v;},
339 (s,o,v) => { s.PE.SetSleepingThresholds(o.PhysBody, v, v); } ), 369 (s,o,v) => { s.PE.SetSleepingThresholds(o.PhysBody, v, v); } ),
340 new ParameterDefn("AngularSleepingThreshold", "Seconds to measure angular movement before considering static", 370 new ParameterDefn("AngularSleepingThreshold", "Seconds to measure angular movement before considering static",
341 1.0f, 371 1.0f,
342 (s,cf,p,v) => { AngularSleepingThreshold = cf.GetFloat(p, v); }, 372 (s,cf,p,v) => { AngularSleepingThreshold = cf.GetFloat(p, v); },
343 (s) => { return AngularSleepingThreshold; }, 373 (s) => { return AngularSleepingThreshold; },
344 (s,p,l,v) => { s.UpdateParameterObject((x)=>{AngularSleepingThreshold=x;}, p, l, v); }, 374 (s,p,l,v) => { AngularSleepingThreshold = v;},
345 (s,o,v) => { s.PE.SetSleepingThresholds(o.PhysBody, v, v); } ), 375 (s,o,v) => { s.PE.SetSleepingThresholds(o.PhysBody, v, v); } ),
346 new ParameterDefn("CcdMotionThreshold", "Continuious collision detection threshold (0 means no CCD)" , 376 new ParameterDefn("CcdMotionThreshold", "Continuious collision detection threshold (0 means no CCD)" ,
347 0.0f, // set to zero to disable 377 0.0f, // set to zero to disable
348 (s,cf,p,v) => { CcdMotionThreshold = cf.GetFloat(p, v); }, 378 (s,cf,p,v) => { CcdMotionThreshold = cf.GetFloat(p, v); },
349 (s) => { return CcdMotionThreshold; }, 379 (s) => { return CcdMotionThreshold; },
350 (s,p,l,v) => { s.UpdateParameterObject((x)=>{CcdMotionThreshold=x;}, p, l, v); }, 380 (s,p,l,v) => { CcdMotionThreshold = v;},
351 (s,o,v) => { s.PE.SetCcdMotionThreshold(o.PhysBody, v); } ), 381 (s,o,v) => { s.PE.SetCcdMotionThreshold(o.PhysBody, v); } ),
352 new ParameterDefn("CcdSweptSphereRadius", "Continuious collision detection test radius" , 382 new ParameterDefn("CcdSweptSphereRadius", "Continuious collision detection test radius" ,
353 0.2f, 383 0.2f,
354 (s,cf,p,v) => { CcdSweptSphereRadius = cf.GetFloat(p, v); }, 384 (s,cf,p,v) => { CcdSweptSphereRadius = cf.GetFloat(p, v); },
355 (s) => { return CcdSweptSphereRadius; }, 385 (s) => { return CcdSweptSphereRadius; },
356 (s,p,l,v) => { s.UpdateParameterObject((x)=>{CcdSweptSphereRadius=x;}, p, l, v); }, 386 (s,p,l,v) => { CcdSweptSphereRadius = v;},
357 (s,o,v) => { s.PE.SetCcdSweptSphereRadius(o.PhysBody, v); } ), 387 (s,o,v) => { s.PE.SetCcdSweptSphereRadius(o.PhysBody, v); } ),
358 new ParameterDefn("ContactProcessingThreshold", "Distance above which contacts can be discarded (0 means no discard)" , 388 new ParameterDefn("ContactProcessingThreshold", "Distance above which contacts can be discarded (0 means no discard)" ,
359 0.0f, 389 0.0f,
360 (s,cf,p,v) => { ContactProcessingThreshold = cf.GetFloat(p, v); }, 390 (s,cf,p,v) => { ContactProcessingThreshold = cf.GetFloat(p, v); },
361 (s) => { return ContactProcessingThreshold; }, 391 (s) => { return ContactProcessingThreshold; },
362 (s,p,l,v) => { s.UpdateParameterObject((x)=>{ContactProcessingThreshold=x;}, p, l, v); }, 392 (s,p,l,v) => { ContactProcessingThreshold = v;},
363 (s,o,v) => { s.PE.SetContactProcessingThreshold(o.PhysBody, v); } ), 393 (s,o,v) => { s.PE.SetContactProcessingThreshold(o.PhysBody, v); } ),
364 394
365 new ParameterDefn("TerrainImplementation", "Type of shape to use for terrain (0=heightmap, 1=mesh)", 395 new ParameterDefn("TerrainImplementation", "Type of shape to use for terrain (0=heightmap, 1=mesh)",
@@ -392,7 +422,7 @@ public static class BSParam
392 0.2f, 422 0.2f,
393 (s,cf,p,v) => { AvatarFriction = cf.GetFloat(p, v); }, 423 (s,cf,p,v) => { AvatarFriction = cf.GetFloat(p, v); },
394 (s) => { return AvatarFriction; }, 424 (s) => { return AvatarFriction; },
395 (s,p,l,v) => { s.UpdateParameterObject((x)=>{AvatarFriction=x;}, p, l, v); } ), 425 (s,p,l,v) => { AvatarFriction = v; } ),
396 new ParameterDefn("AvatarStandingFriction", "Avatar friction when standing. Changed on avatar recreation.", 426 new ParameterDefn("AvatarStandingFriction", "Avatar friction when standing. Changed on avatar recreation.",
397 10.0f, 427 10.0f,
398 (s,cf,p,v) => { AvatarStandingFriction = cf.GetFloat(p, v); }, 428 (s,cf,p,v) => { AvatarStandingFriction = cf.GetFloat(p, v); },
@@ -407,32 +437,32 @@ public static class BSParam
407 3.5f, 437 3.5f,
408 (s,cf,p,v) => { AvatarDensity = cf.GetFloat(p, v); }, 438 (s,cf,p,v) => { AvatarDensity = cf.GetFloat(p, v); },
409 (s) => { return AvatarDensity; }, 439 (s) => { return AvatarDensity; },
410 (s,p,l,v) => { s.UpdateParameterObject((x)=>{AvatarDensity=x;}, p, l, v); } ), 440 (s,p,l,v) => { AvatarDensity = v; } ),
411 new ParameterDefn("AvatarRestitution", "Bouncyness. Changed on avatar recreation.", 441 new ParameterDefn("AvatarRestitution", "Bouncyness. Changed on avatar recreation.",
412 0f, 442 0f,
413 (s,cf,p,v) => { AvatarRestitution = cf.GetFloat(p, v); }, 443 (s,cf,p,v) => { AvatarRestitution = cf.GetFloat(p, v); },
414 (s) => { return AvatarRestitution; }, 444 (s) => { return AvatarRestitution; },
415 (s,p,l,v) => { s.UpdateParameterObject((x)=>{AvatarRestitution=x;}, p, l, v); } ), 445 (s,p,l,v) => { AvatarRestitution = v; } ),
416 new ParameterDefn("AvatarCapsuleWidth", "The distance between the sides of the avatar capsule", 446 new ParameterDefn("AvatarCapsuleWidth", "The distance between the sides of the avatar capsule",
417 0.6f, 447 0.6f,
418 (s,cf,p,v) => { AvatarCapsuleWidth = cf.GetFloat(p, v); }, 448 (s,cf,p,v) => { AvatarCapsuleWidth = cf.GetFloat(p, v); },
419 (s) => { return AvatarCapsuleWidth; }, 449 (s) => { return AvatarCapsuleWidth; },
420 (s,p,l,v) => { s.UpdateParameterObject((x)=>{AvatarCapsuleWidth=x;}, p, l, v); } ), 450 (s,p,l,v) => { AvatarCapsuleWidth = v; } ),
421 new ParameterDefn("AvatarCapsuleDepth", "The distance between the front and back of the avatar capsule", 451 new ParameterDefn("AvatarCapsuleDepth", "The distance between the front and back of the avatar capsule",
422 0.45f, 452 0.45f,
423 (s,cf,p,v) => { AvatarCapsuleDepth = cf.GetFloat(p, v); }, 453 (s,cf,p,v) => { AvatarCapsuleDepth = cf.GetFloat(p, v); },
424 (s) => { return AvatarCapsuleDepth; }, 454 (s) => { return AvatarCapsuleDepth; },
425 (s,p,l,v) => { s.UpdateParameterObject((x)=>{AvatarCapsuleDepth=x;}, p, l, v); } ), 455 (s,p,l,v) => { AvatarCapsuleDepth = v; } ),
426 new ParameterDefn("AvatarCapsuleHeight", "Default height of space around avatar", 456 new ParameterDefn("AvatarCapsuleHeight", "Default height of space around avatar",
427 1.5f, 457 1.5f,
428 (s,cf,p,v) => { AvatarCapsuleHeight = cf.GetFloat(p, v); }, 458 (s,cf,p,v) => { AvatarCapsuleHeight = cf.GetFloat(p, v); },
429 (s) => { return AvatarCapsuleHeight; }, 459 (s) => { return AvatarCapsuleHeight; },
430 (s,p,l,v) => { s.UpdateParameterObject((x)=>{AvatarCapsuleHeight=x;}, p, l, v); } ), 460 (s,p,l,v) => { AvatarCapsuleHeight = v; } ),
431 new ParameterDefn("AvatarContactProcessingThreshold", "Distance from capsule to check for collisions", 461 new ParameterDefn("AvatarContactProcessingThreshold", "Distance from capsule to check for collisions",
432 0.1f, 462 0.1f,
433 (s,cf,p,v) => { AvatarContactProcessingThreshold = cf.GetFloat(p, v); }, 463 (s,cf,p,v) => { AvatarContactProcessingThreshold = cf.GetFloat(p, v); },
434 (s) => { return AvatarContactProcessingThreshold; }, 464 (s) => { return AvatarContactProcessingThreshold; },
435 (s,p,l,v) => { s.UpdateParameterObject((x)=>{AvatarContactProcessingThreshold=x;}, p, l, v); } ), 465 (s,p,l,v) => { AvatarContactProcessingThreshold = v; } ),
436 new ParameterDefn("AvatarStepHeight", "Height of a step obstacle to consider step correction", 466 new ParameterDefn("AvatarStepHeight", "Height of a step obstacle to consider step correction",
437 0.3f, 467 0.3f,
438 (s,cf,p,v) => { AvatarStepHeight = cf.GetFloat(p, v); }, 468 (s,cf,p,v) => { AvatarStepHeight = cf.GetFloat(p, v); },
@@ -497,44 +527,49 @@ public static class BSParam
497 527
498 new ParameterDefn("MaxPersistantManifoldPoolSize", "Number of manifolds pooled (0 means default of 4096)", 528 new ParameterDefn("MaxPersistantManifoldPoolSize", "Number of manifolds pooled (0 means default of 4096)",
499 0f, 529 0f,
500 (s,cf,p,v) => { s.UnmanagedParams[0].maxPersistantManifoldPoolSize = cf.GetFloat(p, v); }, 530 (s,cf,p,v) => { MaxPersistantManifoldPoolSize = cf.GetFloat(p, v); },
501 (s) => { return s.UnmanagedParams[0].maxPersistantManifoldPoolSize; }, 531 (s) => { return MaxPersistantManifoldPoolSize; },
502 (s,p,l,v) => { s.UnmanagedParams[0].maxPersistantManifoldPoolSize = v; } ), 532 (s,p,l,v) => { MaxPersistantManifoldPoolSize = v; s.UnmanagedParams[0].maxPersistantManifoldPoolSize = v; } ),
503 new ParameterDefn("MaxCollisionAlgorithmPoolSize", "Number of collisions pooled (0 means default of 4096)", 533 new ParameterDefn("MaxCollisionAlgorithmPoolSize", "Number of collisions pooled (0 means default of 4096)",
504 0f, 534 0f,
505 (s,cf,p,v) => { s.UnmanagedParams[0].maxCollisionAlgorithmPoolSize = cf.GetFloat(p, v); }, 535 (s,cf,p,v) => { MaxCollisionAlgorithmPoolSize = cf.GetFloat(p, v); },
506 (s) => { return s.UnmanagedParams[0].maxCollisionAlgorithmPoolSize; }, 536 (s) => { return MaxCollisionAlgorithmPoolSize; },
507 (s,p,l,v) => { s.UnmanagedParams[0].maxCollisionAlgorithmPoolSize = v; } ), 537 (s,p,l,v) => { MaxCollisionAlgorithmPoolSize = v; s.UnmanagedParams[0].maxCollisionAlgorithmPoolSize = v; } ),
508 new ParameterDefn("ShouldDisableContactPoolDynamicAllocation", "Enable to allow large changes in object count", 538 new ParameterDefn("ShouldDisableContactPoolDynamicAllocation", "Enable to allow large changes in object count",
509 ConfigurationParameters.numericFalse, 539 ConfigurationParameters.numericFalse,
510 (s,cf,p,v) => { s.UnmanagedParams[0].shouldDisableContactPoolDynamicAllocation = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); }, 540 (s,cf,p,v) => { ShouldDisableContactPoolDynamicAllocation = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); },
511 (s) => { return s.UnmanagedParams[0].shouldDisableContactPoolDynamicAllocation; }, 541 (s) => { return ShouldDisableContactPoolDynamicAllocation; },
512 (s,p,l,v) => { s.UnmanagedParams[0].shouldDisableContactPoolDynamicAllocation = v; } ), 542 (s,p,l,v) => { ShouldDisableContactPoolDynamicAllocation = v; s.UnmanagedParams[0].shouldDisableContactPoolDynamicAllocation = v; } ),
513 new ParameterDefn("ShouldForceUpdateAllAabbs", "Enable to recomputer AABBs every simulator step", 543 new ParameterDefn("ShouldForceUpdateAllAabbs", "Enable to recomputer AABBs every simulator step",
514 ConfigurationParameters.numericFalse, 544 ConfigurationParameters.numericFalse,
515 (s,cf,p,v) => { s.UnmanagedParams[0].shouldForceUpdateAllAabbs = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); }, 545 (s,cf,p,v) => { ShouldForceUpdateAllAabbs = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); },
516 (s) => { return s.UnmanagedParams[0].shouldForceUpdateAllAabbs; }, 546 (s) => { return ShouldForceUpdateAllAabbs; },
517 (s,p,l,v) => { s.UnmanagedParams[0].shouldForceUpdateAllAabbs = v; } ), 547 (s,p,l,v) => { ShouldForceUpdateAllAabbs = v; s.UnmanagedParams[0].shouldForceUpdateAllAabbs = v; } ),
518 new ParameterDefn("ShouldRandomizeSolverOrder", "Enable for slightly better stacking interaction", 548 new ParameterDefn("ShouldRandomizeSolverOrder", "Enable for slightly better stacking interaction",
519 ConfigurationParameters.numericTrue, 549 ConfigurationParameters.numericTrue,
520 (s,cf,p,v) => { s.UnmanagedParams[0].shouldRandomizeSolverOrder = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); }, 550 (s,cf,p,v) => { ShouldRandomizeSolverOrder = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); },
521 (s) => { return s.UnmanagedParams[0].shouldRandomizeSolverOrder; }, 551 (s) => { return ShouldRandomizeSolverOrder; },
522 (s,p,l,v) => { s.UnmanagedParams[0].shouldRandomizeSolverOrder = v; } ), 552 (s,p,l,v) => { ShouldRandomizeSolverOrder = v; s.UnmanagedParams[0].shouldRandomizeSolverOrder = v; } ),
523 new ParameterDefn("ShouldSplitSimulationIslands", "Enable splitting active object scanning islands", 553 new ParameterDefn("ShouldSplitSimulationIslands", "Enable splitting active object scanning islands",
524 ConfigurationParameters.numericTrue, 554 ConfigurationParameters.numericTrue,
525 (s,cf,p,v) => { s.UnmanagedParams[0].shouldSplitSimulationIslands = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); }, 555 (s,cf,p,v) => { ShouldSplitSimulationIslands = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); },
526 (s) => { return s.UnmanagedParams[0].shouldSplitSimulationIslands; }, 556 (s) => { return ShouldSplitSimulationIslands; },
527 (s,p,l,v) => { s.UnmanagedParams[0].shouldSplitSimulationIslands = v; } ), 557 (s,p,l,v) => { ShouldSplitSimulationIslands = v; s.UnmanagedParams[0].shouldSplitSimulationIslands = v; } ),
528 new ParameterDefn("ShouldEnableFrictionCaching", "Enable friction computation caching", 558 new ParameterDefn("ShouldEnableFrictionCaching", "Enable friction computation caching",
529 ConfigurationParameters.numericTrue, 559 ConfigurationParameters.numericTrue,
530 (s,cf,p,v) => { s.UnmanagedParams[0].shouldEnableFrictionCaching = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); }, 560 (s,cf,p,v) => { ShouldEnableFrictionCaching = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); },
531 (s) => { return s.UnmanagedParams[0].shouldEnableFrictionCaching; }, 561 (s) => { return ShouldEnableFrictionCaching; },
532 (s,p,l,v) => { s.UnmanagedParams[0].shouldEnableFrictionCaching = v; } ), 562 (s,p,l,v) => { ShouldEnableFrictionCaching = v; s.UnmanagedParams[0].shouldEnableFrictionCaching = v; } ),
533 new ParameterDefn("NumberOfSolverIterations", "Number of internal iterations (0 means default)", 563 new ParameterDefn("NumberOfSolverIterations", "Number of internal iterations (0 means default)",
534 0f, // zero says use Bullet default 564 0f, // zero says use Bullet default
535 (s,cf,p,v) => { s.UnmanagedParams[0].numberOfSolverIterations = cf.GetFloat(p, v); }, 565 (s,cf,p,v) => { NumberOfSolverIterations = cf.GetFloat(p, v); },
536 (s) => { return s.UnmanagedParams[0].numberOfSolverIterations; }, 566 (s) => { return NumberOfSolverIterations; },
537 (s,p,l,v) => { s.UnmanagedParams[0].numberOfSolverIterations = v; } ), 567 (s,p,l,v) => { NumberOfSolverIterations = v; s.UnmanagedParams[0].numberOfSolverIterations = v; } ),
568 new ParameterDefn("UseSingleSidedMeshes", "Whether to compute collisions based on single sided meshes.",
569 ConfigurationParameters.numericTrue,
570 (s,cf,p,v) => { UseSingleSidedMeshesF = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); },
571 (s) => { return UseSingleSidedMeshesF; },
572 (s,p,l,v) => { UseSingleSidedMeshesF = v; s.UnmanagedParams[0].useSingleSidedMeshes = v; } ),
538 573
539 new ParameterDefn("LinksetImplementation", "Type of linkset implementation (0=Constraint, 1=Compound, 2=Manual)", 574 new ParameterDefn("LinksetImplementation", "Type of linkset implementation (0=Constraint, 1=Compound, 2=Manual)",
540 (float)BSLinkset.LinksetImplementation.Compound, 575 (float)BSLinkset.LinksetImplementation.Compound,
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs
index 823402b..ec25aa9 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs
@@ -75,6 +75,7 @@ public abstract class BSPhysObject : PhysicsActor
75 PhysicsScene = parentScene; 75 PhysicsScene = parentScene;
76 LocalID = localID; 76 LocalID = localID;
77 PhysObjectName = name; 77 PhysObjectName = name;
78 Name = name; // PhysicsActor also has the name of the object. Someday consolidate.
78 TypeName = typeName; 79 TypeName = typeName;
79 80
80 // We don't have any physical representation yet. 81 // We don't have any physical representation yet.
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
index a4690ba..6cd72f2 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
@@ -882,41 +882,41 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
882 BSParam.ParameterDefn theParam; 882 BSParam.ParameterDefn theParam;
883 if (BSParam.TryGetParameter(parm, out theParam)) 883 if (BSParam.TryGetParameter(parm, out theParam))
884 { 884 {
885 // Set the value in the C# code
885 theParam.setter(this, parm, localID, val); 886 theParam.setter(this, parm, localID, val);
887
888 // Optionally set the parameter in the unmanaged code
889 if (theParam.onObject != null)
890 {
891 // update all the localIDs specified
892 // If the local ID is APPLY_TO_NONE, just change the default value
893 // If the localID is APPLY_TO_ALL change the default value and apply the new value to all the lIDs
894 // If the localID is a specific object, apply the parameter change to only that object
895 List<uint> objectIDs = new List<uint>();
896 switch (localID)
897 {
898 case PhysParameterEntry.APPLY_TO_NONE:
899 // This will cause a call into the physical world if some operation is specified (SetOnObject).
900 objectIDs.Add(TERRAIN_ID);
901 TaintedUpdateParameter(parm, objectIDs, val);
902 break;
903 case PhysParameterEntry.APPLY_TO_ALL:
904 lock (PhysObjects) objectIDs = new List<uint>(PhysObjects.Keys);
905 TaintedUpdateParameter(parm, objectIDs, val);
906 break;
907 default:
908 // setting only one localID
909 objectIDs.Add(localID);
910 TaintedUpdateParameter(parm, objectIDs, val);
911 break;
912 }
913 }
914
886 ret = true; 915 ret = true;
887 } 916 }
888 return ret; 917 return ret;
889 } 918 }
890 919
891 // update all the localIDs specified
892 // If the local ID is APPLY_TO_NONE, just change the default value
893 // If the localID is APPLY_TO_ALL change the default value and apply the new value to all the lIDs
894 // If the localID is a specific object, apply the parameter change to only that object
895 internal delegate void AssignVal(float x);
896 internal void UpdateParameterObject(AssignVal setDefault, string parm, uint localID, float val)
897 {
898 List<uint> objectIDs = new List<uint>();
899 switch (localID)
900 {
901 case PhysParameterEntry.APPLY_TO_NONE:
902 setDefault(val); // setting only the default value
903 // This will cause a call into the physical world if some operation is specified (SetOnObject).
904 objectIDs.Add(TERRAIN_ID);
905 TaintedUpdateParameter(parm, objectIDs, val);
906 break;
907 case PhysParameterEntry.APPLY_TO_ALL:
908 setDefault(val); // setting ALL also sets the default value
909 lock (PhysObjects) objectIDs = new List<uint>(PhysObjects.Keys);
910 TaintedUpdateParameter(parm, objectIDs, val);
911 break;
912 default:
913 // setting only one localID
914 objectIDs.Add(localID);
915 TaintedUpdateParameter(parm, objectIDs, val);
916 break;
917 }
918 }
919
920 // schedule the actual updating of the paramter to when the phys engine is not busy 920 // schedule the actual updating of the paramter to when the phys engine is not busy
921 private void TaintedUpdateParameter(string parm, List<uint> lIDs, float val) 921 private void TaintedUpdateParameter(string parm, List<uint> lIDs, float val)
922 { 922 {
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs b/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs
index 9febd90..15747c9 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs
@@ -602,13 +602,13 @@ public sealed class BSShapeCollection : IDisposable
602 if (newMeshKey == prim.PhysShape.shapeKey && prim.PhysShape.type == BSPhysicsShapeType.SHAPE_MESH) 602 if (newMeshKey == prim.PhysShape.shapeKey && prim.PhysShape.type == BSPhysicsShapeType.SHAPE_MESH)
603 return false; 603 return false;
604 604
605 if (DDetail) DetailLog("{0},BSShapeCollection.GetReferenceToMesh,create,oldKey={1},newKey={2}", 605 if (DDetail) DetailLog("{0},BSShapeCollection.GetReferenceToMesh,create,oldKey={1},newKey={2},size={3},lod={4}",
606 prim.LocalID, prim.PhysShape.shapeKey.ToString("X"), newMeshKey.ToString("X")); 606 prim.LocalID, prim.PhysShape.shapeKey.ToString("X"), newMeshKey.ToString("X"), prim.Size, lod);
607 607
608 // 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
609 DereferenceShape(prim.PhysShape, shapeCallback); 609 DereferenceShape(prim.PhysShape, shapeCallback);
610 610
611 newShape = CreatePhysicalMesh(prim.PhysObjectName, newMeshKey, prim.BaseShape, prim.Size, lod); 611 newShape = CreatePhysicalMesh(prim, newMeshKey, prim.BaseShape, prim.Size, lod);
612 // Take evasive action if the mesh was not constructed. 612 // Take evasive action if the mesh was not constructed.
613 newShape = VerifyMeshCreated(newShape, prim); 613 newShape = VerifyMeshCreated(newShape, prim);
614 614
@@ -619,10 +619,9 @@ public sealed class BSShapeCollection : IDisposable
619 return true; // 'true' means a new shape has been added to this prim 619 return true; // 'true' means a new shape has been added to this prim
620 } 620 }
621 621
622 private BulletShape CreatePhysicalMesh(string objName, System.UInt64 newMeshKey, PrimitiveBaseShape pbs, OMV.Vector3 size, float lod) 622 private BulletShape CreatePhysicalMesh(BSPhysObject prim, System.UInt64 newMeshKey, PrimitiveBaseShape pbs, OMV.Vector3 size, float lod)
623 { 623 {
624 BulletShape newShape = new BulletShape(); 624 BulletShape newShape = new BulletShape();
625 IMesh meshData = null;
626 625
627 MeshDesc meshDesc; 626 MeshDesc meshDesc;
628 if (Meshes.TryGetValue(newMeshKey, out meshDesc)) 627 if (Meshes.TryGetValue(newMeshKey, out meshDesc))
@@ -632,27 +631,63 @@ public sealed class BSShapeCollection : IDisposable
632 } 631 }
633 else 632 else
634 { 633 {
635 meshData = PhysicsScene.mesher.CreateMesh(objName, pbs, size, lod, true, false); 634 IMesh meshData = PhysicsScene.mesher.CreateMesh(prim.PhysObjectName, pbs, size, lod,
635 false, // say it is not physical so a bounding box is not built
636 false // do not cache the mesh and do not use previously built versions
637 );
636 638
637 if (meshData != null) 639 if (meshData != null)
638 { 640 {
641
639 int[] indices = meshData.getIndexListAsInt(); 642 int[] indices = meshData.getIndexListAsInt();
640 List<OMV.Vector3> vertices = meshData.getVertexList(); 643 int realIndicesIndex = indices.Length;
644 float[] verticesAsFloats = meshData.getVertexListAsFloat();
641 645
642 float[] verticesAsFloats = new float[vertices.Count * 3]; 646 if (BSParam.ShouldRemoveZeroWidthTriangles)
643 int vi = 0;
644 foreach (OMV.Vector3 vv in vertices)
645 { 647 {
646 verticesAsFloats[vi++] = vv.X; 648 // Remove degenerate triangles. These are triangles with two of the vertices
647 verticesAsFloats[vi++] = vv.Y; 649 // are the same. This is complicated by the problem that vertices are not
648 verticesAsFloats[vi++] = vv.Z; 650 // made unique in sculpties so we have to compare the values in the vertex.
651 realIndicesIndex = 0;
652 for (int tri = 0; tri < indices.Length; tri += 3)
653 {
654 // Compute displacements into vertex array for each vertex of the triangle
655 int v1 = indices[tri + 0] * 3;
656 int v2 = indices[tri + 1] * 3;
657 int v3 = indices[tri + 2] * 3;
658 // Check to see if any two of the vertices are the same
659 if (!( ( verticesAsFloats[v1 + 0] == verticesAsFloats[v2 + 0]
660 && verticesAsFloats[v1 + 1] == verticesAsFloats[v2 + 1]
661 && verticesAsFloats[v1 + 2] == verticesAsFloats[v2 + 2])
662 || ( verticesAsFloats[v2 + 0] == verticesAsFloats[v3 + 0]
663 && verticesAsFloats[v2 + 1] == verticesAsFloats[v3 + 1]
664 && verticesAsFloats[v2 + 2] == verticesAsFloats[v3 + 2])
665 || ( verticesAsFloats[v1 + 0] == verticesAsFloats[v3 + 0]
666 && verticesAsFloats[v1 + 1] == verticesAsFloats[v3 + 1]
667 && verticesAsFloats[v1 + 2] == verticesAsFloats[v3 + 2]) )
668 )
669 {
670 // None of the vertices of the triangles are the same. This is a good triangle;
671 indices[realIndicesIndex + 0] = indices[tri + 0];
672 indices[realIndicesIndex + 1] = indices[tri + 1];
673 indices[realIndicesIndex + 2] = indices[tri + 2];
674 realIndicesIndex += 3;
675 }
676 }
649 } 677 }
678 DetailLog("{0},BSShapeCollection.CreatePhysicalMesh,origTri={1},realTri={2},numVerts={3}",
679 BSScene.DetailLogZero, indices.Length / 3, realIndicesIndex / 3, verticesAsFloats.Length / 3);
650 680
651 // m_log.DebugFormat("{0}: BSShapeCollection.CreatePhysicalMesh: calling CreateMesh. lid={1}, key={2}, indices={3}, vertices={4}", 681 if (realIndicesIndex != 0)
652 // LogHeader, prim.LocalID, newMeshKey, indices.Length, vertices.Count); 682 {
653 683 newShape = PhysicsScene.PE.CreateMeshShape(PhysicsScene.World,
654 newShape = PhysicsScene.PE.CreateMeshShape(PhysicsScene.World, 684 realIndicesIndex, indices, verticesAsFloats.Length / 3, verticesAsFloats);
655 indices.GetLength(0), indices, vertices.Count, verticesAsFloats); 685 }
686 else
687 {
688 PhysicsScene.Logger.ErrorFormat("{0} All mesh triangles degenerate. Prim {1} at {2} in {3}",
689 LogHeader, prim.PhysObjectName, prim.RawPosition, PhysicsScene.Name);
690 }
656 } 691 }
657 } 692 }
658 newShape.shapeKey = newMeshKey; 693 newShape.shapeKey = newMeshKey;
@@ -831,6 +866,11 @@ public sealed class BSShapeCollection : IDisposable
831 { 866 {
832 // level of detail based on size and type of the object 867 // level of detail based on size and type of the object
833 float lod = BSParam.MeshLOD; 868 float lod = BSParam.MeshLOD;
869
870 // prims with curvy internal cuts need higher lod
871 if (pbs.HollowShape == HollowShape.Circle)
872 lod = BSParam.MeshCircularLOD;
873
834 if (pbs.SculptEntry) 874 if (pbs.SculptEntry)
835 lod = BSParam.SculptLOD; 875 lod = BSParam.SculptLOD;
836 876
@@ -865,9 +905,11 @@ public sealed class BSShapeCollection : IDisposable
865 // If this mesh has an underlying asset and we have not failed getting it before, fetch the asset 905 // If this mesh has an underlying asset and we have not failed getting it before, fetch the asset
866 if (prim.BaseShape.SculptEntry && !prim.LastAssetBuildFailed && prim.BaseShape.SculptTexture != OMV.UUID.Zero) 906 if (prim.BaseShape.SculptEntry && !prim.LastAssetBuildFailed && prim.BaseShape.SculptTexture != OMV.UUID.Zero)
867 { 907 {
908 DetailLog("{0},BSShapeCollection.VerifyMeshCreated,fetchAsset,lastFailed={1}", prim.LocalID, prim.LastAssetBuildFailed);
909 // This will prevent looping through this code as we keep trying to get the failed shape
868 prim.LastAssetBuildFailed = true; 910 prim.LastAssetBuildFailed = true;
911
869 BSPhysObject xprim = prim; 912 BSPhysObject xprim = prim;
870 DetailLog("{0},BSShapeCollection.VerifyMeshCreated,fetchAsset,lastFailed={1}", prim.LocalID, prim.LastAssetBuildFailed);
871 Util.FireAndForget(delegate 913 Util.FireAndForget(delegate
872 { 914 {
873 RequestAssetDelegate assetProvider = PhysicsScene.RequestAssetMethod; 915 RequestAssetDelegate assetProvider = PhysicsScene.RequestAssetMethod;
@@ -878,7 +920,7 @@ public sealed class BSShapeCollection : IDisposable
878 { 920 {
879 bool assetFound = false; // DEBUG DEBUG 921 bool assetFound = false; // DEBUG DEBUG
880 string mismatchIDs = String.Empty; // DEBUG DEBUG 922 string mismatchIDs = String.Empty; // DEBUG DEBUG
881 if (yprim.BaseShape.SculptEntry) 923 if (asset != null && yprim.BaseShape.SculptEntry)
882 { 924 {
883 if (yprim.BaseShape.SculptTexture.ToString() == asset.ID) 925 if (yprim.BaseShape.SculptTexture.ToString() == asset.ID)
884 { 926 {
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSTerrainMesh.cs b/OpenSim/Region/Physics/BulletSPlugin/BSTerrainMesh.cs
index 8244f02..d7e800d 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSTerrainMesh.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSTerrainMesh.cs
@@ -96,7 +96,7 @@ public sealed class BSTerrainMesh : BSTerrainPhys
96 { 96 {
97 // DISASTER!! 97 // DISASTER!!
98 PhysicsScene.DetailLog("{0},BSTerrainMesh.create,failedCreationOfShape", ID); 98 PhysicsScene.DetailLog("{0},BSTerrainMesh.create,failedCreationOfShape", ID);
99 physicsScene.Logger.ErrorFormat("{0} Failed creation of terrain mesh! base={1}", LogHeader, TerrainBase); 99 PhysicsScene.Logger.ErrorFormat("{0} Failed creation of terrain mesh! base={1}", LogHeader, TerrainBase);
100 // Something is very messed up and a crash is in our future. 100 // Something is very messed up and a crash is in our future.
101 return; 101 return;
102 } 102 }
@@ -108,7 +108,7 @@ public sealed class BSTerrainMesh : BSTerrainPhys
108 if (!m_terrainBody.HasPhysicalBody) 108 if (!m_terrainBody.HasPhysicalBody)
109 { 109 {
110 // DISASTER!! 110 // DISASTER!!
111 physicsScene.Logger.ErrorFormat("{0} Failed creation of terrain body! base={1}", LogHeader, TerrainBase); 111 PhysicsScene.Logger.ErrorFormat("{0} Failed creation of terrain body! base={1}", LogHeader, TerrainBase);
112 // Something is very messed up and a crash is in our future. 112 // Something is very messed up and a crash is in our future.
113 return; 113 return;
114 } 114 }
@@ -131,6 +131,12 @@ public sealed class BSTerrainMesh : BSTerrainPhys
131 m_terrainBody.collisionType = CollisionType.Terrain; 131 m_terrainBody.collisionType = CollisionType.Terrain;
132 m_terrainBody.ApplyCollisionMask(PhysicsScene); 132 m_terrainBody.ApplyCollisionMask(PhysicsScene);
133 133
134 if (BSParam.UseSingleSidedMeshes)
135 {
136 PhysicsScene.DetailLog("{0},BSTerrainMesh.settingCustomMaterial", id);
137 PhysicsScene.PE.AddToCollisionFlags(m_terrainBody, CollisionFlags.CF_CUSTOM_MATERIAL_CALLBACK);
138 }
139
134 // Make it so the terrain will not move or be considered for movement. 140 // Make it so the terrain will not move or be considered for movement.
135 PhysicsScene.PE.ForceActivationState(m_terrainBody, ActivationState.DISABLE_SIMULATION); 141 PhysicsScene.PE.ForceActivationState(m_terrainBody, ActivationState.DISABLE_SIMULATION);
136 } 142 }
@@ -176,8 +182,7 @@ public sealed class BSTerrainMesh : BSTerrainPhys
176 182
177 // Convert the passed heightmap to mesh information suitable for CreateMeshShape2(). 183 // Convert the passed heightmap to mesh information suitable for CreateMeshShape2().
178 // Return 'true' if successfully created. 184 // Return 'true' if successfully created.
179 public static bool ConvertHeightmapToMesh( 185 public static bool ConvertHeightmapToMesh( BSScene physicsScene,
180 BSScene physicsScene,
181 float[] heightMap, int sizeX, int sizeY, // parameters of incoming heightmap 186 float[] heightMap, int sizeX, int sizeY, // parameters of incoming heightmap
182 float extentX, float extentY, // zero based range for output vertices 187 float extentX, float extentY, // zero based range for output vertices
183 Vector3 extentBase, // base to be added to all vertices 188 Vector3 extentBase, // base to be added to all vertices
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BulletSimData.cs b/OpenSim/Region/Physics/BulletSPlugin/BulletSimData.cs
index c7a2f7e..8012d91 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BulletSimData.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BulletSimData.cs
@@ -217,6 +217,10 @@ public static class BulletSimData
217{ 217{
218 218
219// Map of collisionTypes to flags for collision groups and masks. 219// Map of collisionTypes to flags for collision groups and masks.
220// An object's 'group' is the collison groups this object belongs to
221// An object's 'filter' is the groups another object has to belong to in order to collide with me
222// A collision happens if ((obj1.group & obj2.filter) != 0) || ((obj2.group & obj1.filter) != 0)
223//
220// As mentioned above, don't use the CollisionFilterGroups definitions directly in the code 224// As mentioned above, don't use the CollisionFilterGroups definitions directly in the code
221// but, instead, use references to this dictionary. Finding and debugging 225// but, instead, use references to this dictionary. Finding and debugging
222// collision flag problems will be made easier. 226// collision flag problems will be made easier.
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt b/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt
index a3b3556..bda7c47 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt
+++ b/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt
@@ -65,6 +65,8 @@ Vehicle attributes are not restored when a vehicle is rezzed on region creation
65 65
66GENERAL TODO LIST: 66GENERAL TODO LIST:
67================================================= 67=================================================
68Level-of-detail for mesh creation. Prims with circular interiors require lod of 32.
69 Is much saved with lower LODs? At the moment, all set to 32.
68Collisions are inconsistant: arrows are supposed to hit and report collision. Often don't. 70Collisions 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, 71 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. 72 both arrow and prim report it. The arrow bounces off the prim 9 out of 10 times.
@@ -128,6 +130,9 @@ Physical and phantom will drop through the terrain
128LINKSETS 130LINKSETS
129====================================================== 131======================================================
130Child prims do not report collisions 132Child prims do not report collisions
133Allow children of a linkset to be phantom:
134 http://opensim-dev.2196679.n2.nabble.com/Setting-a-single-child-prim-to-Phantom-tp7578513.html
135 Add OS_STATUS_PHANTOM_PRIM to llSetLinkPrimitaveParamsFast.
131Editing a child of a linkset causes the child to go phantom 136Editing a child of a linkset causes the child to go phantom
132 Move a child prim once when it is physical and can never move it again without it going phantom 137 Move a child prim once when it is physical and can never move it again without it going phantom
133Offset the center of the linkset to be the geometric center of all the prims 138Offset the center of the linkset to be the geometric center of all the prims
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/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/IMesher.cs b/OpenSim/Region/Physics/Manager/IMesher.cs
index 10c4bd3..2e7bb5d 100644
--- a/OpenSim/Region/Physics/Manager/IMesher.cs
+++ b/OpenSim/Region/Physics/Manager/IMesher.cs
@@ -59,6 +59,7 @@ namespace OpenSim.Region.Physics.Manager
59 List<Vector3> getVertexList(); 59 List<Vector3> getVertexList();
60 int[] getIndexListAsInt(); 60 int[] getIndexListAsInt();
61 int[] getIndexListAsIntLocked(); 61 int[] getIndexListAsIntLocked();
62 float[] getVertexListAsFloat();
62 float[] getVertexListAsFloatLocked(); 63 float[] getVertexListAsFloatLocked();
63 void getIndexListAsPtrToIntArray(out IntPtr indices, out int triStride, out int indexCount); 64 void getIndexListAsPtrToIntArray(out IntPtr indices, out int triStride, out int indexCount);
64 void getVertexListAsPtrToFloatArray(out IntPtr vertexList, out int vertexStride, out int vertexCount); 65 void getVertexListAsPtrToFloatArray(out IntPtr vertexList, out int vertexStride, out int vertexCount);
diff --git a/OpenSim/Region/Physics/Meshing/Mesh.cs b/OpenSim/Region/Physics/Meshing/Mesh.cs
index f781ff9..bd8e306 100644
--- a/OpenSim/Region/Physics/Meshing/Mesh.cs
+++ b/OpenSim/Region/Physics/Meshing/Mesh.cs
@@ -152,7 +152,7 @@ namespace OpenSim.Region.Physics.Meshing
152 return result; 152 return result;
153 } 153 }
154 154
155 private float[] getVertexListAsFloat() 155 public float[] getVertexListAsFloat()
156 { 156 {
157 if (m_vertices == null) 157 if (m_vertices == null)
158 throw new NotSupportedException(); 158 throw new NotSupportedException();
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/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 0db6fe3..be6ac0a 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -45,6 +45,7 @@ using OpenSim.Region.CoreModules.World.Terrain;
45using OpenSim.Region.Framework.Interfaces; 45using OpenSim.Region.Framework.Interfaces;
46using OpenSim.Region.Framework.Scenes; 46using OpenSim.Region.Framework.Scenes;
47using OpenSim.Region.Framework.Scenes.Animation; 47using OpenSim.Region.Framework.Scenes.Animation;
48using OpenSim.Region.Framework.Scenes.Scripting;
48using OpenSim.Region.Physics.Manager; 49using OpenSim.Region.Physics.Manager;
49using OpenSim.Region.ScriptEngine.Shared; 50using OpenSim.Region.ScriptEngine.Shared;
50using OpenSim.Region.ScriptEngine.Shared.Api.Plugins; 51using OpenSim.Region.ScriptEngine.Shared.Api.Plugins;
@@ -333,79 +334,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
333 } 334 }
334 } 335 }
335 336
336 protected UUID InventoryKey(string name, int type)
337 {
338 TaskInventoryItem item = m_host.Inventory.GetInventoryItem(name);
339
340 if (item != null && item.Type == type)
341 return item.AssetID;
342 else
343 return UUID.Zero;
344 }
345
346 /// <summary>
347 /// accepts a valid UUID, -or- a name of an inventory item.
348 /// Returns a valid UUID or UUID.Zero if key invalid and item not found
349 /// in prim inventory.
350 /// </summary>
351 /// <param name="k"></param>
352 /// <returns></returns>
353 protected UUID KeyOrName(string k)
354 {
355 UUID key;
356
357 // if we can parse the string as a key, use it.
358 // else try to locate the name in inventory of object. found returns key,
359 // not found returns UUID.Zero
360 if (!UUID.TryParse(k, out key))
361 {
362 TaskInventoryItem item = m_host.Inventory.GetInventoryItem(k);
363
364 if (item != null)
365 key = item.AssetID;
366 else
367 key = UUID.Zero;
368 }
369
370 return key;
371 }
372
373 /// <summary>
374 /// Return the UUID of the asset matching the specified key or name
375 /// and asset type.
376 /// </summary>
377 /// <param name="k"></param>
378 /// <param name="type"></param>
379 /// <returns></returns>
380 protected UUID KeyOrName(string k, AssetType type)
381 {
382 UUID key;
383
384 if (!UUID.TryParse(k, out key))
385 {
386 TaskInventoryItem item = m_host.Inventory.GetInventoryItem(k);
387 if (item != null && item.Type == (int)type)
388 key = item.AssetID;
389 }
390 else
391 {
392 lock (m_host.TaskInventory)
393 {
394 foreach (KeyValuePair<UUID, TaskInventoryItem> item in m_host.TaskInventory)
395 {
396 if (item.Value.Type == (int)type && item.Value.Name == k)
397 {
398 key = item.Value.ItemID;
399 break;
400 }
401 }
402 }
403 }
404
405
406 return key;
407 }
408
409 //These are the implementations of the various ll-functions used by the LSL scripts. 337 //These are the implementations of the various ll-functions used by the LSL scripts.
410 public LSL_Float llSin(double f) 338 public LSL_Float llSin(double f)
411 { 339 {
@@ -1816,7 +1744,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1816 { 1744 {
1817 UUID textureID = new UUID(); 1745 UUID textureID = new UUID();
1818 1746
1819 textureID = InventoryKey(texture, (int)AssetType.Texture); 1747 textureID = ScriptUtils.GetAssetIdFromItemName(m_host, texture, (int)AssetType.Texture);
1820 if (textureID == UUID.Zero) 1748 if (textureID == UUID.Zero)
1821 { 1749 {
1822 if (!UUID.TryParse(texture, out textureID)) 1750 if (!UUID.TryParse(texture, out textureID))
@@ -2450,7 +2378,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2450 if (m_SoundModule != null) 2378 if (m_SoundModule != null)
2451 { 2379 {
2452 m_SoundModule.SendSound(m_host.UUID, 2380 m_SoundModule.SendSound(m_host.UUID,
2453 KeyOrName(sound, AssetType.Sound), volume, false, 0, 2381 ScriptUtils.GetAssetIdFromKeyOrItemName(m_host, sound, AssetType.Sound), volume, false, 0,
2454 0, false, false); 2382 0, false, false);
2455 } 2383 }
2456 } 2384 }
@@ -2460,7 +2388,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2460 m_host.AddScriptLPS(1); 2388 m_host.AddScriptLPS(1);
2461 if (m_SoundModule != null) 2389 if (m_SoundModule != null)
2462 { 2390 {
2463 m_SoundModule.LoopSound(m_host.UUID, KeyOrName(sound), 2391 m_SoundModule.LoopSound(m_host.UUID, ScriptUtils.GetAssetIdFromKeyOrItemName(m_host, sound),
2464 volume, 20, false); 2392 volume, 20, false);
2465 } 2393 }
2466 } 2394 }
@@ -2470,7 +2398,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2470 m_host.AddScriptLPS(1); 2398 m_host.AddScriptLPS(1);
2471 if (m_SoundModule != null) 2399 if (m_SoundModule != null)
2472 { 2400 {
2473 m_SoundModule.LoopSound(m_host.UUID, KeyOrName(sound), 2401 m_SoundModule.LoopSound(m_host.UUID, ScriptUtils.GetAssetIdFromKeyOrItemName(m_host, sound),
2474 volume, 20, true); 2402 volume, 20, true);
2475 } 2403 }
2476 } 2404 }
@@ -2492,7 +2420,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2492 if (m_SoundModule != null) 2420 if (m_SoundModule != null)
2493 { 2421 {
2494 m_SoundModule.SendSound(m_host.UUID, 2422 m_SoundModule.SendSound(m_host.UUID,
2495 KeyOrName(sound, AssetType.Sound), volume, false, 0, 2423 ScriptUtils.GetAssetIdFromKeyOrItemName(m_host, sound, AssetType.Sound), volume, false, 0,
2496 0, true, false); 2424 0, true, false);
2497 } 2425 }
2498 } 2426 }
@@ -2504,7 +2432,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2504 if (m_SoundModule != null) 2432 if (m_SoundModule != null)
2505 { 2433 {
2506 m_SoundModule.SendSound(m_host.UUID, 2434 m_SoundModule.SendSound(m_host.UUID,
2507 KeyOrName(sound, AssetType.Sound), volume, true, 0, 0, 2435 ScriptUtils.GetAssetIdFromKeyOrItemName(m_host, sound, AssetType.Sound), volume, true, 0, 0,
2508 false, false); 2436 false, false);
2509 } 2437 }
2510 } 2438 }
@@ -2521,7 +2449,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2521 { 2449 {
2522 m_host.AddScriptLPS(1); 2450 m_host.AddScriptLPS(1);
2523 if (m_SoundModule != null) 2451 if (m_SoundModule != null)
2524 m_SoundModule.PreloadSound(m_host.UUID, KeyOrName(sound), 0); 2452 m_SoundModule.PreloadSound(m_host.UUID, ScriptUtils.GetAssetIdFromKeyOrItemName(m_host, sound), 0);
2525 ScriptSleep(1000); 2453 ScriptSleep(1000);
2526 } 2454 }
2527 2455
@@ -3352,7 +3280,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3352 if (presence != null) 3280 if (presence != null)
3353 { 3281 {
3354 // Do NOT try to parse UUID, animations cannot be triggered by ID 3282 // Do NOT try to parse UUID, animations cannot be triggered by ID
3355 UUID animID = InventoryKey(anim, (int)AssetType.Animation); 3283 UUID animID = ScriptUtils.GetAssetIdFromItemName(m_host, anim, (int)AssetType.Animation);
3356 if (animID == UUID.Zero) 3284 if (animID == UUID.Zero)
3357 presence.Animator.AddAnimation(anim, m_host.UUID); 3285 presence.Animator.AddAnimation(anim, m_host.UUID);
3358 else 3286 else
@@ -3374,7 +3302,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3374 3302
3375 if (presence != null) 3303 if (presence != null)
3376 { 3304 {
3377 UUID animID = KeyOrName(anim); 3305 UUID animID = ScriptUtils.GetAssetIdFromKeyOrItemName(m_host, anim);
3378 3306
3379 if (animID == UUID.Zero) 3307 if (animID == UUID.Zero)
3380 presence.Animator.RemoveAnimation(anim); 3308 presence.Animator.RemoveAnimation(anim);
@@ -4319,7 +4247,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4319 4247
4320 private void DoLLTeleport(ScenePresence sp, string destination, Vector3 targetPos, Vector3 targetLookAt) 4248 private void DoLLTeleport(ScenePresence sp, string destination, Vector3 targetPos, Vector3 targetLookAt)
4321 { 4249 {
4322 UUID assetID = KeyOrName(destination); 4250 UUID assetID = ScriptUtils.GetAssetIdFromKeyOrItemName(m_host, destination);
4323 4251
4324 // The destinaion is not an asset ID and also doesn't name a landmark. 4252 // The destinaion is not an asset ID and also doesn't name a landmark.
4325 // Use it as a sim name 4253 // Use it as a sim name
@@ -4386,7 +4314,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4386 m_host.AddScriptLPS(1); 4314 m_host.AddScriptLPS(1);
4387 4315
4388 // TODO: Parameter check logic required. 4316 // TODO: Parameter check logic required.
4389 m_host.CollisionSound = KeyOrName(impact_sound, AssetType.Sound); 4317 m_host.CollisionSound = ScriptUtils.GetAssetIdFromKeyOrItemName(m_host, impact_sound, AssetType.Sound);
4390 m_host.CollisionSoundVolume = (float)impact_volume; 4318 m_host.CollisionSoundVolume = (float)impact_volume;
4391 } 4319 }
4392 4320
@@ -5912,7 +5840,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5912 if (m_SoundModule != null) 5840 if (m_SoundModule != null)
5913 { 5841 {
5914 m_SoundModule.TriggerSoundLimited(m_host.UUID, 5842 m_SoundModule.TriggerSoundLimited(m_host.UUID,
5915 KeyOrName(sound, AssetType.Sound), volume, 5843 ScriptUtils.GetAssetIdFromKeyOrItemName(m_host, sound, AssetType.Sound), volume,
5916 bottom_south_west, top_north_east); 5844 bottom_south_west, top_north_east);
5917 } 5845 }
5918 } 5846 }
@@ -6346,7 +6274,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6346 break; 6274 break;
6347 6275
6348 case (int)ScriptBaseClass.PSYS_SRC_TEXTURE: 6276 case (int)ScriptBaseClass.PSYS_SRC_TEXTURE:
6349 prules.Texture = KeyOrName(rules.GetLSLStringItem(i + 1)); 6277 prules.Texture = ScriptUtils.GetAssetIdFromKeyOrItemName(m_host, rules.GetLSLStringItem(i + 1));
6350 break; 6278 break;
6351 6279
6352 case (int)ScriptBaseClass.PSYS_SRC_BURST_RATE: 6280 case (int)ScriptBaseClass.PSYS_SRC_BURST_RATE:
@@ -7269,9 +7197,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7269 UUID sculptId; 7197 UUID sculptId;
7270 7198
7271 if (!UUID.TryParse(map, out sculptId)) 7199 if (!UUID.TryParse(map, out sculptId))
7272 { 7200 sculptId = ScriptUtils.GetAssetIdFromItemName(m_host, map, (int)AssetType.Texture);
7273 sculptId = InventoryKey(map, (int)AssetType.Texture);
7274 }
7275 7201
7276 if (sculptId == UUID.Zero) 7202 if (sculptId == UUID.Zero)
7277 return; 7203 return;
@@ -7668,6 +7594,22 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7668 part.ScriptSetPhysicsStatus(physics); 7594 part.ScriptSetPhysicsStatus(physics);
7669 break; 7595 break;
7670 7596
7597 case (int)ScriptBaseClass.PRIM_PHYSICS_SHAPE_TYPE:
7598 if (remain < 1)
7599 return null;
7600
7601 int shape_type = rules.GetLSLIntegerItem(idx++);
7602
7603 ExtraPhysicsData physdata = new ExtraPhysicsData();
7604 physdata.Density = part.Density;
7605 physdata.Bounce = part.Restitution;
7606 physdata.GravitationModifier = part.GravityModifier;
7607 physdata.PhysShapeType = (PhysShapeType)shape_type;
7608
7609 part.UpdateExtraPhysics(physdata);
7610
7611 break;
7612
7671 case (int)ScriptBaseClass.PRIM_TEMP_ON_REZ: 7613 case (int)ScriptBaseClass.PRIM_TEMP_ON_REZ:
7672 if (remain < 1) 7614 if (remain < 1)
7673 return null; 7615 return null;
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs
index 9045672..2fe6948 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs
@@ -29,8 +29,10 @@ using System;
29using System.Reflection; 29using System.Reflection;
30using System.Collections; 30using System.Collections;
31using System.Collections.Generic; 31using System.Collections.Generic;
32using System.Reflection;
32using System.Runtime.Remoting.Lifetime; 33using System.Runtime.Remoting.Lifetime;
33using System.Threading; 34using System.Threading;
35using log4net;
34using OpenMetaverse; 36using OpenMetaverse;
35using Nini.Config; 37using Nini.Config;
36using OpenSim; 38using OpenSim;
@@ -56,6 +58,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
56 [Serializable] 58 [Serializable]
57 public class MOD_Api : MarshalByRefObject, IMOD_Api, IScriptApi 59 public class MOD_Api : MarshalByRefObject, IMOD_Api, IScriptApi
58 { 60 {
61// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
62
59 internal IScriptEngine m_ScriptEngine; 63 internal IScriptEngine m_ScriptEngine;
60 internal SceneObjectPart m_host; 64 internal SceneObjectPart m_host;
61 internal TaskInventoryItem m_item; 65 internal TaskInventoryItem m_item;
@@ -109,8 +113,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
109 if (message.Length > 1023) 113 if (message.Length > 1023)
110 message = message.Substring(0, 1023); 114 message = message.Substring(0, 1023);
111 115
112 World.SimChat(Utils.StringToBytes(message), 116 World.SimChat(
113 ChatTypeEnum.Shout, ScriptBaseClass.DEBUG_CHANNEL, m_host.ParentGroup.RootPart.AbsolutePosition, m_host.Name, m_host.UUID, true); 117 Utils.StringToBytes(message),
118 ChatTypeEnum.Shout, ScriptBaseClass.DEBUG_CHANNEL,
119 m_host.ParentGroup.RootPart.AbsolutePosition, m_host.Name, m_host.UUID, false);
114 120
115 IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>(); 121 IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>();
116 wComm.DeliverMessage(ChatTypeEnum.Shout, ScriptBaseClass.DEBUG_CHANNEL, m_host.Name, m_host.UUID, message); 122 wComm.DeliverMessage(ChatTypeEnum.Shout, ScriptBaseClass.DEBUG_CHANNEL, m_host.Name, m_host.UUID, message);
@@ -124,6 +130,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
124 /// <returns>string result of the invocation</returns> 130 /// <returns>string result of the invocation</returns>
125 public void modInvokeN(string fname, params object[] parms) 131 public void modInvokeN(string fname, params object[] parms)
126 { 132 {
133// m_log.DebugFormat(
134// "[MOD API]: Invoking dynamic function {0}, args '{1}' with {2} return type",
135// fname,
136// string.Join(",", Array.ConvertAll<object, string>(parms, o => o.ToString())),
137// ((MethodInfo)MethodBase.GetCurrentMethod()).ReturnType);
138
127 Type returntype = m_comms.LookupReturnType(fname); 139 Type returntype = m_comms.LookupReturnType(fname);
128 if (returntype != typeof(string)) 140 if (returntype != typeof(string))
129 MODError(String.Format("return type mismatch for {0}",fname)); 141 MODError(String.Format("return type mismatch for {0}",fname));
@@ -133,6 +145,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
133 145
134 public LSL_String modInvokeS(string fname, params object[] parms) 146 public LSL_String modInvokeS(string fname, params object[] parms)
135 { 147 {
148// m_log.DebugFormat(
149// "[MOD API]: Invoking dynamic function {0}, args '{1}' with {2} return type",
150// fname,
151// string.Join(",", Array.ConvertAll<object, string>(parms, o => o.ToString())),
152// ((MethodInfo)MethodBase.GetCurrentMethod()).ReturnType);
153
136 Type returntype = m_comms.LookupReturnType(fname); 154 Type returntype = m_comms.LookupReturnType(fname);
137 if (returntype != typeof(string)) 155 if (returntype != typeof(string))
138 MODError(String.Format("return type mismatch for {0}",fname)); 156 MODError(String.Format("return type mismatch for {0}",fname));
@@ -143,6 +161,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
143 161
144 public LSL_Integer modInvokeI(string fname, params object[] parms) 162 public LSL_Integer modInvokeI(string fname, params object[] parms)
145 { 163 {
164// m_log.DebugFormat(
165// "[MOD API]: Invoking dynamic function {0}, args '{1}' with {2} return type",
166// fname,
167// string.Join(",", Array.ConvertAll<object, string>(parms, o => o.ToString())),
168// ((MethodInfo)MethodBase.GetCurrentMethod()).ReturnType);
169
146 Type returntype = m_comms.LookupReturnType(fname); 170 Type returntype = m_comms.LookupReturnType(fname);
147 if (returntype != typeof(int)) 171 if (returntype != typeof(int))
148 MODError(String.Format("return type mismatch for {0}",fname)); 172 MODError(String.Format("return type mismatch for {0}",fname));
@@ -153,6 +177,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
153 177
154 public LSL_Float modInvokeF(string fname, params object[] parms) 178 public LSL_Float modInvokeF(string fname, params object[] parms)
155 { 179 {
180// m_log.DebugFormat(
181// "[MOD API]: Invoking dynamic function {0}, args '{1}' with {2} return type",
182// fname,
183// string.Join(",", Array.ConvertAll<object, string>(parms, o => o.ToString())),
184// ((MethodInfo)MethodBase.GetCurrentMethod()).ReturnType);
185
156 Type returntype = m_comms.LookupReturnType(fname); 186 Type returntype = m_comms.LookupReturnType(fname);
157 if (returntype != typeof(float)) 187 if (returntype != typeof(float))
158 MODError(String.Format("return type mismatch for {0}",fname)); 188 MODError(String.Format("return type mismatch for {0}",fname));
@@ -163,6 +193,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
163 193
164 public LSL_Key modInvokeK(string fname, params object[] parms) 194 public LSL_Key modInvokeK(string fname, params object[] parms)
165 { 195 {
196// m_log.DebugFormat(
197// "[MOD API]: Invoking dynamic function {0}, args '{1}' with {2} return type",
198// fname,
199// string.Join(",", Array.ConvertAll<object, string>(parms, o => o.ToString())),
200// ((MethodInfo)MethodBase.GetCurrentMethod()).ReturnType);
201
166 Type returntype = m_comms.LookupReturnType(fname); 202 Type returntype = m_comms.LookupReturnType(fname);
167 if (returntype != typeof(UUID)) 203 if (returntype != typeof(UUID))
168 MODError(String.Format("return type mismatch for {0}",fname)); 204 MODError(String.Format("return type mismatch for {0}",fname));
@@ -173,6 +209,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
173 209
174 public LSL_Vector modInvokeV(string fname, params object[] parms) 210 public LSL_Vector modInvokeV(string fname, params object[] parms)
175 { 211 {
212// m_log.DebugFormat(
213// "[MOD API]: Invoking dynamic function {0}, args '{1}' with {2} return type",
214// fname,
215// string.Join(",", Array.ConvertAll<object, string>(parms, o => o.ToString())),
216// ((MethodInfo)MethodBase.GetCurrentMethod()).ReturnType);
217
176 Type returntype = m_comms.LookupReturnType(fname); 218 Type returntype = m_comms.LookupReturnType(fname);
177 if (returntype != typeof(OpenMetaverse.Vector3)) 219 if (returntype != typeof(OpenMetaverse.Vector3))
178 MODError(String.Format("return type mismatch for {0}",fname)); 220 MODError(String.Format("return type mismatch for {0}",fname));
@@ -183,6 +225,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
183 225
184 public LSL_Rotation modInvokeR(string fname, params object[] parms) 226 public LSL_Rotation modInvokeR(string fname, params object[] parms)
185 { 227 {
228// m_log.DebugFormat(
229// "[MOD API]: Invoking dynamic function {0}, args '{1}' with {2} return type",
230// fname,
231// string.Join(",", Array.ConvertAll<object, string>(parms, o => o.ToString())),
232// ((MethodInfo)MethodBase.GetCurrentMethod()).ReturnType);
233
186 Type returntype = m_comms.LookupReturnType(fname); 234 Type returntype = m_comms.LookupReturnType(fname);
187 if (returntype != typeof(OpenMetaverse.Quaternion)) 235 if (returntype != typeof(OpenMetaverse.Quaternion))
188 MODError(String.Format("return type mismatch for {0}",fname)); 236 MODError(String.Format("return type mismatch for {0}",fname));
@@ -193,6 +241,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
193 241
194 public LSL_List modInvokeL(string fname, params object[] parms) 242 public LSL_List modInvokeL(string fname, params object[] parms)
195 { 243 {
244// m_log.DebugFormat(
245// "[MOD API]: Invoking dynamic function {0}, args '{1}' with {2} return type",
246// fname,
247// string.Join(",", Array.ConvertAll<object, string>(parms, o => o.ToString())),
248// ((MethodInfo)MethodBase.GetCurrentMethod()).ReturnType);
249
196 Type returntype = m_comms.LookupReturnType(fname); 250 Type returntype = m_comms.LookupReturnType(fname);
197 if (returntype != typeof(object[])) 251 if (returntype != typeof(object[]))
198 MODError(String.Format("return type mismatch for {0}",fname)); 252 MODError(String.Format("return type mismatch for {0}",fname));
@@ -250,6 +304,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
250 return ""; 304 return "";
251 } 305 }
252 306
307// m_log.DebugFormat(
308// "[MOD API]: Invoking dynamic function {0}, args '{1}' with {2} return type",
309// fname,
310// string.Join(",", Array.ConvertAll<object, string>(parms, o => o.ToString())),
311// ((MethodInfo)MethodBase.GetCurrentMethod()).ReturnType);
312
253 Type[] signature = m_comms.LookupTypeSignature(fname); 313 Type[] signature = m_comms.LookupTypeSignature(fname);
254 if (signature.Length != parms.Length) 314 if (signature.Length != parms.Length)
255 MODError(String.Format("wrong number of parameters to function {0}",fname)); 315 MODError(String.Format("wrong number of parameters to function {0}",fname));
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/LSL_Constants.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
index 9bf1a64..bd66ba3 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
@@ -661,6 +661,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
661 public const int PRIM_MEDIA_PERM_GROUP = 2; 661 public const int PRIM_MEDIA_PERM_GROUP = 2;
662 public const int PRIM_MEDIA_PERM_ANYONE = 4; 662 public const int PRIM_MEDIA_PERM_ANYONE = 4;
663 663
664 public const int PRIM_PHYSICS_SHAPE_TYPE = 30;
665 public const int PRIM_PHYSICS_SHAPE_PRIM = 0;
666 public const int PRIM_PHYSICS_SHAPE_CONVEX = 2;
667 public const int PRIM_PHYSICS_SHAPE_NONE = 1;
668
669 public const int PRIM_PHYSICS_MATERIAL = 31;
670 public const int DENSITY = 1;
671 public const int FRICTION = 2;
672 public const int RESTITUTION = 4;
673 public const int GRAVITY_MULTIPLIER = 8;
674
664 // extra constants for llSetPrimMediaParams 675 // extra constants for llSetPrimMediaParams
665 public static readonly LSLInteger LSL_STATUS_OK = new LSLInteger(0); 676 public static readonly LSLInteger LSL_STATUS_OK = new LSLInteger(0);
666 public static readonly LSLInteger LSL_STATUS_MALFORMED_PARAMS = new LSLInteger(1000); 677 public static readonly LSLInteger LSL_STATUS_MALFORMED_PARAMS = new LSLInteger(1000);
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/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/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/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/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/Region/UserStatistics/WebStatsModule.cs b/OpenSim/Region/UserStatistics/WebStatsModule.cs
index 438ef48..b98b762 100644
--- a/OpenSim/Region/UserStatistics/WebStatsModule.cs
+++ b/OpenSim/Region/UserStatistics/WebStatsModule.cs
@@ -420,7 +420,7 @@ namespace OpenSim.Region.UserStatistics
420 Encoding encoding = Encoding.ASCII; 420 Encoding encoding = Encoding.ASCII;
421 int sizeOfChar = encoding.GetByteCount("\n"); 421 int sizeOfChar = encoding.GetByteCount("\n");
422 byte[] buffer = encoding.GetBytes("\n"); 422 byte[] buffer = encoding.GetBytes("\n");
423 string logfile = Util.logDir() + "/" + "OpenSim.log"; 423 string logfile = Util.logFile();
424 FileStream fs = new FileStream(logfile, FileMode.Open, FileAccess.Read, FileShare.ReadWrite); 424 FileStream fs = new FileStream(logfile, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
425 Int64 tokenCount = 0; 425 Int64 tokenCount = 0;
426 Int64 endPosition = fs.Length / sizeOfChar; 426 Int64 endPosition = fs.Length / sizeOfChar;