Merge branch 'master' into 0.7.3-post-fixes

0.7.3-post-fixes
Justin Clark-Casey (justincc) 2012-02-24 23:35:47 +00:00
commit dafcb3bcd7
55 changed files with 518 additions and 1194 deletions

View File

@ -81,6 +81,9 @@ namespace OpenSim.Data.SQLite
/// <param name="dbconnect">connect string</param>
override public void Initialise(string dbconnect)
{
if (Util.IsWindows())
Util.LoadArchSpecificWindowsDll("sqlite3.dll");
if (dbconnect == string.Empty)
{
dbconnect = "URI=file:Asset.db,version=3";

View File

@ -65,6 +65,9 @@ namespace OpenSim.Data.SQLite
if (!m_initialized)
{
if (Util.IsWindows())
Util.LoadArchSpecificWindowsDll("sqlite3.dll");
m_Connection = new SqliteConnection(connectionString);
m_Connection.Open();

View File

@ -69,6 +69,9 @@ namespace OpenSim.Data.SQLite
public void Initialise(string connectionString)
{
if (Util.IsWindows())
Util.LoadArchSpecificWindowsDll("sqlite3.dll");
m_connectionString = connectionString;
m_log.Info("[ESTATE DB]: Sqlite - connecting: "+m_connectionString);

View File

@ -48,6 +48,8 @@ namespace OpenSim.Data.SQLite
protected SQLiteFramework(string connectionString)
{
if (Util.IsWindows())
Util.LoadArchSpecificWindowsDll("sqlite3.dll");
}
//////////////////////////////////////////////////////////////

View File

@ -77,6 +77,9 @@ namespace OpenSim.Data.SQLite
{
m_Initialized = true;
if (Util.IsWindows())
Util.LoadArchSpecificWindowsDll("sqlite3.dll");
if (dbconnect == string.Empty)
{
dbconnect = "URI=file:inventoryStore.db,version=3";

View File

@ -110,6 +110,9 @@ namespace OpenSim.Data.SQLite
{
try
{
if (Util.IsWindows())
Util.LoadArchSpecificWindowsDll("sqlite3.dll");
m_connectionString = connectionString;
ds = new DataSet("Region");

View File

@ -52,6 +52,9 @@ namespace OpenSim.Data.SQLite
public SQLiteXInventoryData(string conn, string realm)
{
if (Util.IsWindows())
Util.LoadArchSpecificWindowsDll("sqlite3.dll");
m_Folders = new SQLiteGenericTableHandler<XInventoryFolder>(
conn, "inventoryfolders", "XInventoryStore");
m_Items = new SqliteItemHandler(

View File

@ -247,7 +247,7 @@ namespace OpenSim.Framework.Servers
string reportFormat = "{0,6} {1,35} {2,16} {3,13} {4,10} {5,30}";
StringBuilder sb = new StringBuilder();
Watchdog.ThreadWatchdogInfo[] threads = Watchdog.GetThreads();
Watchdog.ThreadWatchdogInfo[] threads = Watchdog.GetThreadsInfo();
sb.Append(threads.Length + " threads are being tracked:" + Environment.NewLine);
@ -308,7 +308,9 @@ namespace OpenSim.Framework.Servers
// clr version potentially is more confusing than helpful, since it doesn't tell us if we're running under Mono/MS .NET and
// the clr version number doesn't match the project version number under Mono.
//m_log.Info("[STARTUP]: Virtual machine runtime version: " + Environment.Version + Environment.NewLine);
m_log.Info("[STARTUP]: Operating system version: " + Environment.OSVersion + Environment.NewLine);
m_log.InfoFormat(
"[STARTUP]: Operating system version: {0}, .NET platform {1}, {2}-bit\n",
Environment.OSVersion, Environment.OSVersion.Platform, Util.Is64BitProcess() ? "64" : "32");
StartupSpecific();

View File

@ -65,6 +65,7 @@ namespace OpenSim.Framework.Servers.HttpServer
String.Format("PollServiceWorkerThread{0}", i),
ThreadPriority.Normal,
false,
true,
int.MaxValue);
}
@ -73,6 +74,7 @@ namespace OpenSim.Framework.Servers.HttpServer
"PollServiceWatcherThread",
ThreadPriority.Normal,
false,
true,
1000 * 60 * 10);
}

View File

@ -35,7 +35,8 @@ using System.IO;
using System.IO.Compression;
using System.Net;
using System.Net.Sockets;
using System.Reflection;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Formatters.Binary;
using System.Security.Cryptography;
@ -375,6 +376,50 @@ namespace OpenSim.Framework
}
return sb.ToString();
}
/// <summary>
/// Is the platform Windows?
/// </summary>
/// <returns>true if so, false otherwise</returns>
public static bool IsWindows()
{
PlatformID platformId = Environment.OSVersion.Platform;
return (platformId == PlatformID.Win32NT
|| platformId == PlatformID.Win32S
|| platformId == PlatformID.Win32Windows
|| platformId == PlatformID.WinCE);
}
public static bool LoadArchSpecificWindowsDll(string libraryName)
{
// We do this so that OpenSimulator on Windows loads the correct native library depending on whether
// it's running as a 32-bit process or a 64-bit one. By invoking LoadLibary here, later DLLImports
// will find it already loaded later on.
//
// This isn't necessary for other platforms (e.g. Mac OSX and Linux) since the DLL used can be
// controlled in config files.
string nativeLibraryPath;
if (Util.Is64BitProcess())
nativeLibraryPath = "lib64/" + libraryName;
else
nativeLibraryPath = "lib32/" + libraryName;
m_log.DebugFormat("[UTIL]: Loading native Windows library at {0}", nativeLibraryPath);
if (Util.LoadLibrary(nativeLibraryPath) == IntPtr.Zero)
{
m_log.ErrorFormat(
"[UTIL]: Couldn't find native Windows library at {0}", nativeLibraryPath);
return false;
}
else
{
return true;
}
}
public static bool IsEnvironmentSupported(ref string reason)
@ -1457,6 +1502,27 @@ namespace OpenSim.Framework
}
return data;
}
/// <summary>
/// Used to trigger an early library load on Windows systems.
/// </summary>
/// <remarks>
/// Required to get 32-bit and 64-bit processes to automatically use the
/// appropriate native library.
/// </remarks>
/// <param name="dllToLoad"></param>
/// <returns></returns>
[DllImport("kernel32.dll")]
public static extern IntPtr LoadLibrary(string dllToLoad);
/// <summary>
/// Determine whether the current process is 64 bit
/// </summary>
/// <returns>true if so, false if not</returns>
public static bool Is64BitProcess()
{
return IntPtr.Size == 8;
}
#region FireAndForget Threading Pattern

View File

@ -72,6 +72,11 @@ namespace OpenSim.Framework
/// </summary>
public bool IsTimedOut { get; set; }
/// <summary>
/// Will this thread trigger the alarm function if it has timed out?
/// </summary>
public bool AlarmIfTimeout { get; set; }
public ThreadWatchdogInfo(Thread thread, int timeout)
{
Thread = thread;
@ -112,12 +117,13 @@ namespace OpenSim.Framework
/// <param name="start">The method that will be executed in a new thread</param>
/// <param name="name">A name to give to the new thread</param>
/// <param name="priority">Priority to run the thread at</param>
/// <param name="isBackground">True to run this thread as a background
/// thread, otherwise false</param>
/// <param name="isBackground">True to run this thread as a background thread, otherwise false</param>
/// <param name="alarmIfTimeout">Trigger an alarm function is we have timed out</param>
/// <returns>The newly created Thread object</returns>
public static Thread StartThread(ThreadStart start, string name, ThreadPriority priority, bool isBackground)
public static Thread StartThread(
ThreadStart start, string name, ThreadPriority priority, bool isBackground, bool alarmIfTimeout)
{
return StartThread(start, name, priority, isBackground, WATCHDOG_TIMEOUT_MS);
return StartThread(start, name, priority, isBackground, alarmIfTimeout, WATCHDOG_TIMEOUT_MS);
}
/// <summary>
@ -128,21 +134,21 @@ namespace OpenSim.Framework
/// <param name="priority">Priority to run the thread at</param>
/// <param name="isBackground">True to run this thread as a background
/// thread, otherwise false</param>
/// <param name="timeout">
/// Number of milliseconds to wait until we issue a warning about timeout.
/// </para>
/// <param name="alarmIfTimeout">Trigger an alarm function is we have timed out</param>
/// <param name="timeout">Number of milliseconds to wait until we issue a warning about timeout.</param>
/// <returns>The newly created Thread object</returns>
public static Thread StartThread(
ThreadStart start, string name, ThreadPriority priority, bool isBackground, int timeout)
ThreadStart start, string name, ThreadPriority priority, bool isBackground, bool alarmIfTimeout, int timeout)
{
Thread thread = new Thread(start);
thread.Name = name;
thread.Priority = priority;
thread.IsBackground = isBackground;
ThreadWatchdogInfo twi = new ThreadWatchdogInfo(thread, timeout);
ThreadWatchdogInfo twi = new ThreadWatchdogInfo(thread, timeout) { AlarmIfTimeout = alarmIfTimeout };
m_log.Debug("[WATCHDOG]: Started tracking thread \"" + twi.Thread.Name + "\" (ID " + twi.Thread.ManagedThreadId + ")");
m_log.DebugFormat(
"[WATCHDOG]: Started tracking thread {0}, ID {1}", twi.Thread.Name, twi.Thread.ManagedThreadId);
lock (m_threads)
m_threads.Add(twi.Thread.ManagedThreadId, twi);
@ -224,19 +230,39 @@ namespace OpenSim.Framework
/// Get currently watched threads for diagnostic purposes
/// </summary>
/// <returns></returns>
public static ThreadWatchdogInfo[] GetThreads()
public static ThreadWatchdogInfo[] GetThreadsInfo()
{
lock (m_threads)
return m_threads.Values.ToArray();
}
/// <summary>
/// Return the current thread's watchdog info.
/// </summary>
/// <returns>The watchdog info. null if the thread isn't being monitored.</returns>
public static ThreadWatchdogInfo GetCurrentThreadInfo()
{
lock (m_threads)
{
if (m_threads.ContainsKey(Thread.CurrentThread.ManagedThreadId))
return m_threads[Thread.CurrentThread.ManagedThreadId];
}
return null;
}
/// <summary>
/// Check watched threads. Fire alarm if appropriate.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private static void WatchdogTimerElapsed(object sender, System.Timers.ElapsedEventArgs e)
{
WatchdogTimeout callback = OnWatchdogTimeout;
if (callback != null)
{
ThreadWatchdogInfo timedOut = null;
List<ThreadWatchdogInfo> callbackInfos = null;
lock (m_threads)
{
@ -246,21 +272,31 @@ namespace OpenSim.Framework
{
if (threadInfo.Thread.ThreadState == ThreadState.Stopped)
{
timedOut = threadInfo;
RemoveThread(threadInfo.Thread.ManagedThreadId);
break;
if (callbackInfos == null)
callbackInfos = new List<ThreadWatchdogInfo>();
callbackInfos.Add(threadInfo);
}
else if (!threadInfo.IsTimedOut && now - threadInfo.LastTick >= threadInfo.Timeout)
{
threadInfo.IsTimedOut = true;
timedOut = threadInfo;
break;
if (threadInfo.AlarmIfTimeout)
{
if (callbackInfos == null)
callbackInfos = new List<ThreadWatchdogInfo>();
callbackInfos.Add(threadInfo);
}
}
}
}
if (timedOut != null)
callback(timedOut.Thread, timedOut.LastTick);
if (callbackInfos != null)
foreach (ThreadWatchdogInfo callbackInfo in callbackInfos)
callback(callbackInfo.Thread, callbackInfo.LastTick);
}
m_watchdogTimer.Start();

View File

@ -244,8 +244,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
base.Start(m_recvBufferSize, m_asyncPacketHandling);
// Start the packet processing threads
Watchdog.StartThread(IncomingPacketHandler, "Incoming Packets (" + m_scene.RegionInfo.RegionName + ")", ThreadPriority.Normal, false);
Watchdog.StartThread(OutgoingPacketHandler, "Outgoing Packets (" + m_scene.RegionInfo.RegionName + ")", ThreadPriority.Normal, false);
Watchdog.StartThread(
IncomingPacketHandler, "Incoming Packets (" + m_scene.RegionInfo.RegionName + ")", ThreadPriority.Normal, false, true);
Watchdog.StartThread(
OutgoingPacketHandler, "Outgoing Packets (" + m_scene.RegionInfo.RegionName + ")", ThreadPriority.Normal, false, true);
m_elapsedMSSinceLastStatReport = Environment.TickCount;
}

View File

@ -496,6 +496,10 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
SetAppearanceAssets(sp.UUID, sp.Appearance);
m_scene.AvatarService.SetAppearance(agentid, sp.Appearance);
// Trigger this here because it's the final step in the set/queue/save process for appearance setting.
// Everything has been updated and stored. Ensures bakes have been persisted (if option is set to persist bakes).
m_scene.EventManager.TriggerAvatarAppearanceChanged(sp);
}
private void SetAppearanceAssets(UUID userID, AvatarAppearance appearance)

View File

@ -1704,14 +1704,13 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
// Offset the positions for the new region across the border
Vector3 oldGroupPosition = grp.RootPart.GroupPosition;
grp.RootPart.GroupPosition = pos;
// If we fail to cross the border, then reset the position of the scene object on that border.
uint x = 0, y = 0;
Utils.LongToUInts(newRegionHandle, out x, out y);
GridRegion destination = scene.GridService.GetRegionByPosition(scene.RegionInfo.ScopeID, (int)x, (int)y);
if (destination == null || !CrossPrimGroupIntoNewRegion(destination, grp, silent))
if (destination == null || !CrossPrimGroupIntoNewRegion(destination, pos, grp, silent))
{
m_log.InfoFormat("[ENTITY TRANSFER MODULE] cross region transfer failed for object {0}",grp.UUID);
@ -1741,7 +1740,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
/// true if the crossing itself was successful, false on failure
/// FIMXE: we still return true if the crossing object was not successfully deleted from the originating region
/// </returns>
protected bool CrossPrimGroupIntoNewRegion(GridRegion destination, SceneObjectGroup grp, bool silent)
protected bool CrossPrimGroupIntoNewRegion(GridRegion destination, Vector3 newPosition, SceneObjectGroup grp, bool silent)
{
//m_log.Debug(" >>> CrossPrimGroupIntoNewRegion <<<");
@ -1766,7 +1765,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
//if (m_interregionCommsOut != null)
// successYN = m_interregionCommsOut.SendCreateObject(newRegionHandle, grp, true);
if (m_aScene.SimulationService != null)
successYN = m_aScene.SimulationService.CreateObject(destination, grp, true);
successYN = m_aScene.SimulationService.CreateObject(destination, newPosition, grp, true);
if (successYN)
{
@ -1825,7 +1824,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
gobj.IsAttachment = false;
//gobj.RootPart.LastOwnerID = gobj.GetFromAssetID();
m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Sending attachment {0} to region {1}", gobj.UUID, destination.RegionName);
CrossPrimGroupIntoNewRegion(destination, gobj, silent);
CrossPrimGroupIntoNewRegion(destination, Vector3.Zero, gobj, silent);
}
}

View File

@ -1210,7 +1210,7 @@ namespace OpenSim.Region.CoreModules.InterGrid
if (homeScene.TryGetScenePresence(avatarId,out avatar))
{
KillAUser ku = new KillAUser(avatar,mod);
Watchdog.StartThread(ku.ShutdownNoLogout, "OGPShutdown", ThreadPriority.Normal, true);
Watchdog.StartThread(ku.ShutdownNoLogout, "OGPShutdown", ThreadPriority.Normal, true, true);
}
}

View File

@ -315,7 +315,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
* Object-related communications
*/
public bool CreateObject(GridRegion destination, ISceneObject sog, bool isLocalCall)
public bool CreateObject(GridRegion destination, Vector3 newPosition, ISceneObject sog, bool isLocalCall)
{
if (destination == null)
return false;
@ -330,12 +330,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
// We need to make a local copy of the object
ISceneObject sogClone = sog.CloneForNewScene();
sogClone.SetState(sog.GetStateSnapshot(), s);
return s.IncomingCreateObject(sogClone);
return s.IncomingCreateObject(newPosition, sogClone);
}
else
{
// Use the object as it came through the wire
return s.IncomingCreateObject(sog);
return s.IncomingCreateObject(newPosition, sog);
}
}
}

View File

@ -282,13 +282,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
* Object-related communications
*/
public bool CreateObject(GridRegion destination, ISceneObject sog, bool isLocalCall)
public bool CreateObject(GridRegion destination, Vector3 newPosition, ISceneObject sog, bool isLocalCall)
{
if (destination == null)
return false;
// Try local first
if (m_localBackend.CreateObject(destination, sog, isLocalCall))
if (m_localBackend.CreateObject(destination, newPosition, sog, isLocalCall))
{
//m_log.Debug("[REST COMMS]: LocalBackEnd SendCreateObject succeeded");
return true;
@ -296,7 +296,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
// else do the remote thing
if (!m_localBackend.IsLocalRegion(destination.RegionHandle))
return m_remoteConnector.CreateObject(destination, sog, isLocalCall);
return m_remoteConnector.CreateObject(destination, newPosition, sog, isLocalCall);
return false;
}

View File

@ -94,8 +94,11 @@ namespace OpenSim.Region.CoreModules.World.Land
// caches ExtendedLandData
private Cache parcelInfoCache;
private Dictionary<UUID, Vector3> forcedPosition =
new Dictionary<UUID, Vector3>();
/// <summary>
/// Record positions that avatar's are currently being forced to move to due to parcel entry restrictions.
/// </summary>
private Dictionary<UUID, Vector3> forcedPosition = new Dictionary<UUID, Vector3>();
#region INonSharedRegionModule Members
@ -224,22 +227,34 @@ namespace OpenSim.Region.CoreModules.World.Land
//When the avatar walks into a ban line on the ground, it prevents getting stuck
agentData.ControlFlags = (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY;
//Make sure we stop if they get about to the right place to prevent yoyo and prevents getting stuck on banlines
if (Vector3.Distance(clientAvatar.AbsolutePosition, forcedPosition[remoteClient.AgentId]) < .2)
{
Debug.WriteLine(string.Format("Stopping force position because {0} is close enough to position {1}", forcedPosition[remoteClient.AgentId], clientAvatar.AbsolutePosition));
// m_log.DebugFormat(
// "[LAND MANAGEMENT MODULE]: Stopping force position of {0} because {1} is close enough to {2}",
// clientAvatar.Name, clientAvatar.AbsolutePosition, forcedPosition[remoteClient.AgentId]);
forcedPosition.Remove(remoteClient.AgentId);
}
//if we are far away, teleport
else if (Vector3.Distance(clientAvatar.AbsolutePosition, forcedPosition[remoteClient.AgentId]) > 3)
{
Debug.WriteLine(string.Format("Teleporting out because {0} is too far from avatar position {1}", forcedPosition[remoteClient.AgentId], clientAvatar.AbsolutePosition));
clientAvatar.Teleport(forcedPosition[remoteClient.AgentId]);
Vector3 forcePosition = forcedPosition[remoteClient.AgentId];
// m_log.DebugFormat(
// "[LAND MANAGEMENT MODULE]: Teleporting out {0} because {1} is too far from avatar position {2}",
// clientAvatar.Name, clientAvatar.AbsolutePosition, forcePosition);
m_scene.RequestTeleportLocation(remoteClient, m_scene.RegionInfo.RegionHandle,
forcePosition, clientAvatar.Lookat, (uint)Constants.TeleportFlags.ForceRedirect);
forcedPosition.Remove(remoteClient.AgentId);
}
else
{
// m_log.DebugFormat(
// "[LAND MANAGEMENT MODULE]: Forcing {0} from {1} to {2}",
// clientAvatar.Name, clientAvatar.AbsolutePosition, forcedPosition[remoteClient.AgentId]);
//Forces them toward the forced position we want if they aren't there yet
agentData.UseClientAgentPosition = true;
agentData.ClientAgentPosition = forcedPosition[remoteClient.AgentId];

View File

@ -677,18 +677,12 @@ namespace OpenSim.Region.CoreModules.World.Permissions
bool permission = false;
bool locked = false;
if (!m_scene.Entities.ContainsKey(objId))
{
return false;
}
SceneObjectPart part = m_scene.GetSceneObjectPart(objId);
// If it's not an object, we cant edit it.
if ((!(m_scene.Entities[objId] is SceneObjectGroup)))
{
if (part == null)
return false;
}
SceneObjectGroup group = (SceneObjectGroup)m_scene.Entities[objId];
SceneObjectGroup group = part.ParentGroup;
UUID objectOwner = group.OwnerID;
locked = ((group.RootPart.OwnerMask & PERM_LOCKED) == 0);
@ -977,16 +971,6 @@ namespace OpenSim.Region.CoreModules.World.Permissions
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
if (m_bypassPermissions) return m_bypassPermissionsValue;
SceneObjectPart part = m_scene.GetSceneObjectPart(objectID);
// If we selected a sub-prim to edit, the objectID won't represent the object, but only a part.
// We have to check the permissions of the group, though.
if (part.ParentID != 0)
{
objectID = part.ParentUUID;
part = m_scene.GetSceneObjectPart(objectID);
}
return GenericObjectPermission(editorID, objectID, false);
}

View File

@ -351,6 +351,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
process,
string.Format("MapItemRequestThread ({0})", m_scene.RegionInfo.RegionName),
ThreadPriority.BelowNormal,
true,
true);
}

View File

@ -173,6 +173,9 @@ namespace OpenSim.Region.Framework.Scenes
public delegate void AvatarEnteringNewParcel(ScenePresence avatar, int localLandID, UUID regionID);
public event AvatarEnteringNewParcel OnAvatarEnteringNewParcel;
public delegate void AvatarAppearanceChange(ScenePresence avatar);
public event AvatarAppearanceChange OnAvatarAppearanceChange;
public event Action<ScenePresence> OnSignificantClientMovement;
public delegate void IncomingInstantMessage(GridInstantMessage message);
@ -184,10 +187,62 @@ namespace OpenSim.Region.Framework.Scenes
public event ClientClosed OnClientClosed;
// Fired when a script is created
// The indication that a new script exists in this region.
public delegate void NewScript(UUID clientID, SceneObjectPart part, UUID itemID);
public event NewScript OnNewScript;
public virtual void TriggerNewScript(UUID clientID, SceneObjectPart part, UUID itemID)
{
NewScript handlerNewScript = OnNewScript;
if (handlerNewScript != null)
{
foreach (NewScript d in handlerNewScript.GetInvocationList())
{
try
{
d(clientID, part, itemID);
}
catch (Exception e)
{
m_log.ErrorFormat(
"[EVENT MANAGER]: Delegate for TriggerNewScript failed - continuing. {0} {1}",
e.Message, e.StackTrace);
}
}
}
}
//TriggerUpdateScript: triggered after Scene receives client's upload of updated script and stores it as asset
// An indication that the script has changed.
public delegate void UpdateScript(UUID clientID, UUID itemId, UUID primId, bool isScriptRunning, UUID newAssetID);
public event UpdateScript OnUpdateScript;
public virtual void TriggerUpdateScript(UUID clientId, UUID itemId, UUID primId, bool isScriptRunning, UUID newAssetID)
{
UpdateScript handlerUpdateScript = OnUpdateScript;
if (handlerUpdateScript != null)
{
foreach (UpdateScript d in handlerUpdateScript.GetInvocationList())
{
try
{
d(clientId, itemId, primId, isScriptRunning, newAssetID);
}
catch (Exception e)
{
m_log.ErrorFormat(
"[EVENT MANAGER]: Delegate for TriggerUpdateScript failed - continuing. {0} {1}",
e.Message, e.StackTrace);
}
}
}
}
/// <summary>
/// This is fired when a scene object property that a script might be interested in (such as color, scale or
/// inventory) changes. Only enough information is sent for the LSL changed event
/// (see http://lslwiki.net/lslwiki/wakka.php?wakka=changed)
/// ScriptChangedEvent is fired when a scene object property that a script might be interested
/// in (such as color, scale or inventory) changes. Only enough information sent is for the LSL changed event.
/// This is not an indication that the script has changed (see OnUpdateScript for that).
/// This event is sent to a script to tell it that some property changed on
/// the object the script is in. See http://lslwiki.net/lslwiki/wakka.php?wakka=changed .
/// </summary>
public event ScriptChangedEvent OnScriptChangedEvent;
public delegate void ScriptChangedEvent(uint localID, uint change);
@ -1238,6 +1293,27 @@ namespace OpenSim.Region.Framework.Scenes
}
}
public void TriggerAvatarAppearanceChanged(ScenePresence avatar)
{
AvatarAppearanceChange handler = OnAvatarAppearanceChange;
if (handler != null)
{
foreach (AvatarAppearanceChange d in handler.GetInvocationList())
{
try
{
d(avatar);
}
catch (Exception e)
{
m_log.ErrorFormat(
"[EVENT MANAGER]: Delegate for TriggerAvatarAppearanceChanged failed - continuing. {0} {1}",
e.Message, e.StackTrace);
}
}
}
}
public void TriggerIncomingInstantMessage(GridInstantMessage message)
{
IncomingInstantMessage handlerIncomingInstantMessage = OnIncomingInstantMessage;

View File

@ -283,6 +283,10 @@ namespace OpenSim.Region.Framework.Scenes
{
remoteClient.SendAgentAlertMessage("Script saved", false);
}
// Tell anyone managing scripts that a script has been reloaded/changed
EventManager.TriggerUpdateScript(remoteClient.AgentId, itemId, primId, isScriptRunning, item.AssetID);
part.ParentGroup.ResumeScripts();
return errors;
}
@ -1151,8 +1155,7 @@ namespace OpenSim.Region.Framework.Scenes
return;
}
TaskInventoryItem item = part.Inventory.GetInventoryItem(itemId);
if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0)
if ((taskItem.CurrentPermissions & (uint)PermissionMask.Copy) == 0)
{
// If the item to be moved is no copy, we need to be able to
// edit the prim.
@ -1624,9 +1627,13 @@ namespace OpenSim.Region.Framework.Scenes
// have state in inventory
part.Inventory.CreateScriptInstance(copyID, 0, false, DefaultScriptEngine, 0);
// tell anyone watching that there is a new script in town
EventManager.TriggerNewScript(agentID, part, copyID);
// m_log.InfoFormat("[PRIMINVENTORY]: " +
// "Rezzed script {0} into prim local ID {1} for user {2}",
// item.inventoryName, localID, remoteClient.Name);
part.ParentGroup.ResumeScripts();
return part;
@ -1707,6 +1714,10 @@ namespace OpenSim.Region.Framework.Scenes
part.Inventory.AddInventoryItem(taskItem, false);
part.Inventory.CreateScriptInstance(taskItem, 0, false, DefaultScriptEngine, 0);
// tell anyone managing scripts that a new script exists
EventManager.TriggerNewScript(agentID, part, taskItem.ItemID);
part.ParentGroup.ResumeScripts();
return part;

View File

@ -864,16 +864,16 @@ namespace OpenSim.Region.Framework.Scenes
try
{
ForEachRootScenePresence(delegate(ScenePresence agent)
{
//agent.ControllingClient.new
//this.CommsManager.InterRegion.InformRegionOfChildAgent(otherRegion.RegionHandle, agent.ControllingClient.RequestClientInfo());
{
//agent.ControllingClient.new
//this.CommsManager.InterRegion.InformRegionOfChildAgent(otherRegion.RegionHandle, agent.ControllingClient.RequestClientInfo());
List<ulong> old = new List<ulong>();
old.Add(otherRegion.RegionHandle);
agent.DropOldNeighbours(old);
if (m_teleportModule != null)
m_teleportModule.EnableChildAgent(agent, otherRegion);
});
List<ulong> old = new List<ulong>();
old.Add(otherRegion.RegionHandle);
agent.DropOldNeighbours(old);
if (m_teleportModule != null && agent.PresenceType != PresenceType.Npc)
m_teleportModule.EnableChildAgent(agent, otherRegion);
});
}
catch (NullReferenceException)
{
@ -881,7 +881,6 @@ namespace OpenSim.Region.Framework.Scenes
// This shouldn't happen too often anymore.
m_log.Error("[SCENE]: Couldn't inform client of regionup because we got a null reference exception");
}
}
else
{
@ -1009,10 +1008,10 @@ namespace OpenSim.Region.Framework.Scenes
try
{
ForEachRootScenePresence(delegate(ScenePresence agent)
{
if (m_teleportModule != null)
m_teleportModule.EnableChildAgent(agent, r);
});
{
if (m_teleportModule != null && agent.PresenceType != PresenceType.Npc)
m_teleportModule.EnableChildAgent(agent, r);
});
}
catch (NullReferenceException)
{
@ -1141,7 +1140,7 @@ namespace OpenSim.Region.Framework.Scenes
HeartbeatThread
= Watchdog.StartThread(
Heartbeat, string.Format("Heartbeat ({0})", RegionInfo.RegionName), ThreadPriority.Normal, false);
Heartbeat, string.Format("Heartbeat ({0})", RegionInfo.RegionName), ThreadPriority.Normal, false, false);
}
/// <summary>
@ -1179,6 +1178,13 @@ namespace OpenSim.Region.Framework.Scenes
try
{
m_eventManager.TriggerOnRegionStarted(this);
// The first frame can take a very long time due to physics actors being added on startup. Therefore,
// don't turn on the watchdog alarm for this thread until the second frame, in order to prevent false
// alarms for scenes with many objects.
Update();
Watchdog.GetCurrentThreadInfo().AlarmIfTimeout = true;
while (!shuttingdown)
Update();
@ -1207,7 +1213,7 @@ namespace OpenSim.Region.Framework.Scenes
++Frame;
// m_log.DebugFormat("[SCENE]: Processing frame {0}", Frame);
// m_log.DebugFormat("[SCENE]: Processing frame {0} in {1}", Frame, RegionInfo.RegionName);
try
{
@ -1362,26 +1368,10 @@ namespace OpenSim.Region.Framework.Scenes
{
throw;
}
catch (AccessViolationException e)
{
m_log.ErrorFormat(
"[REGION]: Failed on region {0} with exception {1}{2}",
RegionInfo.RegionName, e.Message, e.StackTrace);
}
//catch (NullReferenceException e)
//{
// m_log.Error("[REGION]: Failed with exception " + e.ToString() + " On Region: " + RegionInfo.RegionName);
//}
catch (InvalidOperationException e)
{
m_log.ErrorFormat(
"[REGION]: Failed on region {0} with exception {1}{2}",
RegionInfo.RegionName, e.Message, e.StackTrace);
}
catch (Exception e)
{
m_log.ErrorFormat(
"[REGION]: Failed on region {0} with exception {1}{2}",
"[SCENE]: Failed on region {0} with exception {1}{2}",
RegionInfo.RegionName, e.Message, e.StackTrace);
}
@ -1419,7 +1409,6 @@ namespace OpenSim.Region.Framework.Scenes
entry.checkAtTargets();
}
/// <summary>
/// Send out simstats data to all clients
/// </summary>
@ -2318,7 +2307,7 @@ namespace OpenSim.Region.Framework.Scenes
/// </summary>
/// <param name="sog"></param>
/// <returns></returns>
public bool IncomingCreateObject(ISceneObject sog)
public bool IncomingCreateObject(Vector3 newPosition, ISceneObject sog)
{
//m_log.DebugFormat(" >>> IncomingCreateObject(sog) <<< {0} deleted? {1} isAttach? {2}", ((SceneObjectGroup)sog).AbsolutePosition,
// ((SceneObjectGroup)sog).IsDeleted, ((SceneObjectGroup)sog).RootPart.IsAttachment);
@ -2334,6 +2323,9 @@ namespace OpenSim.Region.Framework.Scenes
return false;
}
if (newPosition != Vector3.Zero)
newObject.RootPart.GroupPosition = newPosition;
if (!AddSceneObject(newObject))
{
m_log.DebugFormat("[SCENE]: Problem adding scene object {0} in {1} ", sog.UUID, RegionInfo.RegionName);
@ -4258,10 +4250,7 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="action"></param>
public void ForEachRootScenePresence(Action<ScenePresence> action)
{
if (m_sceneGraph != null)
{
m_sceneGraph.ForEachAvatar(action);
}
m_sceneGraph.ForEachAvatar(action);
}
/// <summary>
@ -4270,10 +4259,7 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="action"></param>
public void ForEachScenePresence(Action<ScenePresence> action)
{
if (m_sceneGraph != null)
{
m_sceneGraph.ForEachScenePresence(action);
}
m_sceneGraph.ForEachScenePresence(action);
}
/// <summary>
@ -4703,7 +4689,10 @@ namespace OpenSim.Region.Framework.Scenes
Vector3? nearestPoint = GetNearestPointInParcelAlongDirectionFromPoint(avatar.AbsolutePosition, dir, nearestParcel);
if (nearestPoint != null)
{
Debug.WriteLine("Found a sane previous position based on velocity, sending them to: " + nearestPoint.ToString());
// m_log.DebugFormat(
// "[SCENE]: Found a sane previous position based on velocity for {0}, sending them to {1} in {2}",
// avatar.Name, nearestPoint, nearestParcel.LandData.Name);
return nearestPoint.Value;
}
@ -4713,12 +4702,16 @@ namespace OpenSim.Region.Framework.Scenes
nearestPoint = GetNearestPointInParcelAlongDirectionFromPoint(avatar.AbsolutePosition, dir, nearestParcel);
if (nearestPoint != null)
{
Debug.WriteLine("They had a zero velocity, sending them to: " + nearestPoint.ToString());
// m_log.DebugFormat(
// "[SCENE]: {0} had a zero velocity, sending them to {1}", avatar.Name, nearestPoint);
return nearestPoint.Value;
}
//Ultimate backup if we have no idea where they are
Debug.WriteLine("Have no idea where they are, sending them to: " + avatar.lastKnownAllowedPosition.ToString());
//Ultimate backup if we have no idea where they are
// m_log.DebugFormat(
// "[SCENE]: No idea where {0} is, sending them to {1}", avatar.Name, avatar.lastKnownAllowedPosition);
return avatar.lastKnownAllowedPosition;
}
@ -5124,7 +5117,7 @@ namespace OpenSim.Region.Framework.Scenes
// presence.Name, presence.AbsolutePosition, presence.MoveToPositionTarget);
Vector3 agent_control_v3 = new Vector3();
presence.HandleMoveToTargetUpdate(ref agent_control_v3);
presence.HandleMoveToTargetUpdate(1, ref agent_control_v3);
presence.AddNewMovement(agent_control_v3);
}
}

View File

@ -156,8 +156,9 @@ namespace OpenSim.Region.Framework.Scenes
// that the region position is cached or performance will degrade
Utils.LongToUInts(regionHandle, out x, out y);
GridRegion dest = m_scene.GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y);
bool v = true;
if (! simulatorList.Contains(dest.ServerURI))
// bool v = true;
if (!simulatorList.Contains(dest.ServerURI))
{
// we havent seen this simulator before, add it to the list
// and send it an update

View File

@ -1592,7 +1592,7 @@ namespace OpenSim.Region.Framework.Scenes
if (group != null)
{
if (m_parentScene.Permissions.CanEditObject(group.UUID,agentID))
if (m_parentScene.Permissions.CanEditObject(group.UUID, agentID))
{
group.UpdateExtraParam(primLocalID, type, inUse, data);
}
@ -1609,7 +1609,7 @@ namespace OpenSim.Region.Framework.Scenes
SceneObjectGroup group = GetGroupByPrim(primLocalID);
if (group != null)
{
if (m_parentScene.Permissions.CanEditObject(group.GetPartsFullID(primLocalID), agentID))
if (m_parentScene.Permissions.CanEditObject(group.UUID, agentID))
{
ObjectShapePacket.ObjectDataBlock shapeData = new ObjectShapePacket.ObjectDataBlock();
shapeData.ObjectLocalID = shapeBlock.ObjectLocalID;

View File

@ -1048,7 +1048,7 @@ namespace OpenSim.Region.Framework.Scenes
}
/// <summary>
///
/// Do not call this directly. Call Scene.RequestTeleportLocation() instead.
/// </summary>
/// <param name="pos"></param>
public void Teleport(Vector3 pos)
@ -1522,7 +1522,10 @@ namespace OpenSim.Region.Framework.Scenes
}
else if (bAllowUpdateMoveToPosition)
{
if (HandleMoveToTargetUpdate(ref agent_control_v3))
// The UseClientAgentPosition is set if parcel ban is forcing the avatar to move to a
// certain position. It's only check for tolerance on returning to that position is 0.2
// rather than 1, at which point it removes its force target.
if (HandleMoveToTargetUpdate(agentData.UseClientAgentPosition ? 0.2 : 1, ref agent_control_v3))
update_movementflag = true;
}
}
@ -1584,7 +1587,7 @@ namespace OpenSim.Region.Framework.Scenes
/// </remarks>
/// <param value="agent_control_v3">Cumulative agent movement that this method will update.</param>
/// <returns>True if movement has been updated in some way. False otherwise.</returns>
public bool HandleMoveToTargetUpdate(ref Vector3 agent_control_v3)
public bool HandleMoveToTargetUpdate(double tolerance, ref Vector3 agent_control_v3)
{
// m_log.DebugFormat("[SCENE PRESENCE]: Called HandleMoveToTargetUpdate() for {0}", Name);
@ -1601,7 +1604,7 @@ namespace OpenSim.Region.Framework.Scenes
// Name, AbsolutePosition, MoveToPositionTarget, distanceToTarget);
// Check the error term of the current position in relation to the target position
if (distanceToTarget <= 1)
if (distanceToTarget <= tolerance)
{
// We are close enough to the target
AbsolutePosition = MoveToPositionTarget;
@ -1777,7 +1780,7 @@ namespace OpenSim.Region.Framework.Scenes
// m_log.DebugFormat("[SCENE PRESENCE]: Body rot for {0} set to {1}", Name, Rotation);
Vector3 agent_control_v3 = new Vector3();
HandleMoveToTargetUpdate(ref agent_control_v3);
HandleMoveToTargetUpdate(1, ref agent_control_v3);
AddNewMovement(agent_control_v3);
}
@ -3223,7 +3226,7 @@ namespace OpenSim.Region.Framework.Scenes
((SceneObjectGroup)so).LocalId = 0;
((SceneObjectGroup)so).RootPart.ClearUpdateSchedule();
so.SetState(cAgent.AttachmentObjectStates[i++], m_scene);
m_scene.IncomingCreateObject(so);
m_scene.IncomingCreateObject(Vector3.Zero, so);
}
}
}

View File

@ -70,7 +70,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
m_client = client;
m_scene = scene;
Watchdog.StartThread(InternalLoop, "IRCClientView", ThreadPriority.Normal, false);
Watchdog.StartThread(InternalLoop, "IRCClientView", ThreadPriority.Normal, false, true);
}
private void SendServerCommand(string command)

View File

@ -57,7 +57,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
m_listener.Start(50);
Watchdog.StartThread(ListenLoop, "IRCServer", ThreadPriority.Normal, false);
Watchdog.StartThread(ListenLoop, "IRCServer", ThreadPriority.Normal, false, true);
m_baseScene = baseScene;
}

View File

@ -51,6 +51,9 @@ public class BSPlugin : IPhysicsPlugin
{
if (_mScene == null)
{
if (Util.IsWindows())
Util.LoadArchSpecificWindowsDll("BulletSim.dll");
_mScene = new BSScene(sceneIdentifier);
}
return (_mScene);

View File

@ -30,7 +30,8 @@ using System.Collections.Generic;
using System.IO;
using System.Reflection;
using Nini.Config;
using log4net;
using log4net;
using OpenSim.Framework;
namespace OpenSim.Region.Physics.Manager
{

View File

@ -1474,6 +1474,8 @@ Console.WriteLine("CreateGeom:");
/// </summary>
private void changeadd()
{
// m_log.DebugFormat("[ODE PRIM]: Adding prim {0}", Name);
int[] iprimspaceArrItem = _parent_scene.calculateSpaceArrayItemFromPos(_position);
IntPtr targetspace = _parent_scene.calculateSpaceForGeom(_position);

View File

@ -46,7 +46,7 @@ namespace OpenSim.Region.Physics.OdePlugin
/// </summary>
public class OdePlugin : IPhysicsPlugin
{
//private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
private OdeScene m_scene;
@ -59,13 +59,23 @@ namespace OpenSim.Region.Physics.OdePlugin
{
if (m_scene == null)
{
// We do this so that OpenSimulator on Windows loads the correct native ODE library depending on whether
// it's running as a 32-bit process or a 64-bit one. By invoking LoadLibary here, later DLLImports
// will find it already loaded later on.
//
// This isn't necessary for other platforms (e.g. Mac OSX and Linux) since the DLL used can be
// controlled in Ode.NET.dll.config
if (Util.IsWindows())
Util.LoadArchSpecificWindowsDll("ode.dll");
// Initializing ODE only when a scene is created allows alternative ODE plugins to co-habit (according to
// http://opensimulator.org/mantis/view.php?id=2750).
d.InitODE();
m_scene = new OdeScene(sceneIdentifier);
}
return (m_scene);
return m_scene;
}
public string GetName()

View File

@ -1,58 +0,0 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSimulator Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System.Reflection;
using System.Runtime.InteropServices;
// Information about this assembly is defined by the following
// attributes.
//
// change them to the information which is associated with the assembly
// you compile.
[assembly : AssemblyTitle("RealPhysXplugin")]
[assembly : AssemblyDescription("")]
[assembly : AssemblyConfiguration("")]
[assembly : AssemblyCompany("http://opensimulator.org")]
[assembly : AssemblyProduct("RealPhysXplugin")]
[assembly : AssemblyCopyright("Copyright (c) OpenSimulator.org Developers 2007-2009")]
[assembly : AssemblyTrademark("")]
[assembly : AssemblyCulture("")]
// This sets the default COM visibility of types in the assembly to invisible.
// If you need to expose a type to COM, use [ComVisible(true)] on that type.
[assembly : ComVisible(false)]
// The assembly version has following format :
//
// Major.Minor.Build.Revision
//
// You can specify all values by your own or you can build default build and revision
// numbers with the '*' character (the default):
[assembly : AssemblyVersion("0.6.5.*")]

View File

@ -1,349 +0,0 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSimulator Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Collections.Generic;
using Nini.Config;
using OpenSim.Framework;
using OpenSim.Region.Physics.Manager;
using PhysXWrapper;
using Quaternion=OpenMetaverse.Quaternion;
using System.Reflection;
using log4net;
using OpenMetaverse;
namespace OpenSim.Region.Physics.PhysXPlugin
{
public class PhysXCharacter : PhysicsActor
{
private Vector3 _position;
private Vector3 _velocity;
private Vector3 m_rotationalVelocity = Vector3.Zero;
private Vector3 _acceleration;
private NxCharacter _character;
private bool flying;
private bool iscolliding = false;
private float gravityAccel;
public PhysXCharacter(NxCharacter character)
{
_character = character;
}
public override int PhysicsActorType
{
get { return (int) ActorTypes.Agent; }
set { return; }
}
public override bool SetAlwaysRun
{
get { return false; }
set { return; }
}
public override uint LocalID
{
set { return; }
}
public override bool Grabbed
{
set { return; }
}
public override bool Selected
{
set { return; }
}
public override float Buoyancy
{
get { return 0f; }
set { return; }
}
public override bool FloatOnWater
{
set { return; }
}
public override bool IsPhysical
{
get { return false; }
set { return; }
}
public override bool ThrottleUpdates
{
get { return false; }
set { return; }
}
public override bool Flying
{
get { return flying; }
set { flying = value; }
}
public override bool IsColliding
{
get { return iscolliding; }
set { iscolliding = value; }
}
public override bool CollidingGround
{
get { return false; }
set { return; }
}
public override bool CollidingObj
{
get { return false; }
set { return; }
}
public override Vector3 RotationalVelocity
{
get { return m_rotationalVelocity; }
set { m_rotationalVelocity = value; }
}
public override bool Stopped
{
get { return false; }
}
public override Vector3 Position
{
get { return _position; }
set
{
_position = value;
Vec3 ps = new Vec3();
ps.X = value.X;
ps.Y = value.Y;
ps.Z = value.Z;
_character.Position = ps;
}
}
public override Vector3 Size
{
get { return Vector3.Zero; }
set { }
}
public override float Mass
{
get { return 0f; }
}
public override Vector3 Force
{
get { return Vector3.Zero; }
set { return; }
}
public override int VehicleType
{
get { return 0; }
set { return; }
}
public override void VehicleFloatParam(int param, float value)
{
}
public override void VehicleVectorParam(int param, Vector3 value)
{
}
public override void VehicleRotationParam(int param, Quaternion rotation)
{
}
public override void VehicleFlags(int param, bool remove)
{
}
public override void SetVolumeDetect(int param)
{
}
public override Vector3 CenterOfMass
{
get { return Vector3.Zero; }
}
public override Vector3 GeometricCenter
{
get { return Vector3.Zero; }
}
public override Vector3 Velocity
{
get { return _velocity; }
set { _velocity = value; }
}
public override float CollisionScore
{
get { return 0f; }
set { }
}
public override bool Kinematic
{
get { return false; }
set { }
}
public override Quaternion Orientation
{
get { return Quaternion.Identity; }
set { }
}
public override Vector3 Acceleration
{
get { return _acceleration; }
set { _acceleration = value; }
}
public override void AddForce(Vector3 force, bool pushforce)
{
}
public override Vector3 Torque
{
get { return Vector3.Zero; }
set { return; }
}
public override void AddAngularForce(Vector3 force, bool pushforce)
{
}
public override void link(PhysicsActor obj)
{
}
public override void delink()
{
}
public override void LockAngularMotion(Vector3 axis)
{
}
public override void SetMomentum(Vector3 momentum)
{
}
public void Move(float timeStep)
{
Vec3 vec = new Vec3();
vec.X = _velocity.X*timeStep;
vec.Y = _velocity.Y*timeStep;
if (flying)
{
vec.Z = (_velocity.Z)*timeStep;
}
else
{
gravityAccel += -9.8f;
vec.Z = (gravityAccel + _velocity.Z)*timeStep;
}
int res = _character.Move(vec);
if (res == 1)
{
gravityAccel = 0;
}
}
public override PrimitiveBaseShape Shape
{
set { return; }
}
public void UpdatePosition()
{
Vec3 vec = _character.Position;
_position.X = vec.X;
_position.Y = vec.Y;
_position.Z = vec.Z;
}
public override void CrossingFailure()
{
}
public override Vector3 PIDTarget { set { return; } }
public override bool PIDActive { set { return; } }
public override float PIDTau { set { return; } }
public override float PIDHoverHeight { set { return; } }
public override bool PIDHoverActive { set { return; } }
public override PIDHoverType PIDHoverType { set { return; } }
public override float PIDHoverTau { set { return; } }
public override Quaternion APIDTarget
{
set { return; }
}
public override bool APIDActive
{
set { return; }
}
public override float APIDStrength
{
set { return; }
}
public override float APIDDamping
{
set { return; }
}
public override void SubscribeEvents(int ms)
{
}
public override void UnSubscribeEvents()
{
}
public override bool SubscribedEvents()
{
return false;
}
}
}

View File

@ -1,76 +0,0 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSimulator Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Collections.Generic;
using Nini.Config;
using OpenSim.Framework;
using OpenSim.Region.Physics.Manager;
using PhysXWrapper;
using Quaternion=OpenMetaverse.Quaternion;
using System.Reflection;
using log4net;
using OpenMetaverse;
namespace OpenSim.Region.Physics.PhysXPlugin
{
/// <summary>
/// Will be the PhysX plugin but for now will be a very basic physics engine
/// </summary>
public class PhysXPlugin : IPhysicsPlugin
{
//private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private PhysXScene _mScene;
public PhysXPlugin()
{
}
public bool Init()
{
return true;
}
public PhysicsScene GetScene(string sceneIdentifier)
{
if (_mScene == null)
{
_mScene = new PhysXScene(sceneIdentifier);
}
return (_mScene);
}
public string GetName()
{
return ("RealPhysX");
}
public void Dispose()
{
}
}
}

View File

@ -1,341 +0,0 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSimulator Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Collections.Generic;
using Nini.Config;
using OpenSim.Framework;
using OpenSim.Region.Physics.Manager;
using PhysXWrapper;
using Quaternion=OpenMetaverse.Quaternion;
using System.Reflection;
using log4net;
using OpenMetaverse;
namespace OpenSim.Region.Physics.PhysXPlugin
{
public class PhysXPrim : PhysicsActor
{
private Vector3 _velocity;
private Vector3 _acceleration;
private Vector3 m_rotationalVelocity;
private NxActor _prim;
public PhysXPrim(NxActor prim)
{
_velocity = Vector3.Zero;
_acceleration = Vector3.Zero;
_prim = prim;
}
public override int PhysicsActorType
{
get { return (int) ActorTypes.Prim; }
set { return; }
}
public override bool IsPhysical
{
get { return false; }
set { return; }
}
public override bool SetAlwaysRun
{
get { return false; }
set { return; }
}
public override uint LocalID
{
set { return; }
}
public override bool Grabbed
{
set { return; }
}
public override bool Selected
{
set { return; }
}
public override float Buoyancy
{
get { return 0f; }
set { return; }
}
public override bool FloatOnWater
{
set { return; }
}
public override bool ThrottleUpdates
{
get { return false; }
set { return; }
}
public override Vector3 RotationalVelocity
{
get { return m_rotationalVelocity; }
set { m_rotationalVelocity = value; }
}
public override bool Flying
{
get { return false; //no flying prims for you
}
set { }
}
public override bool IsColliding
{
get { return false; }
set { }
}
public override bool CollidingGround
{
get { return false; }
set { return; }
}
public override bool CollidingObj
{
get { return false; }
set { return; }
}
public override bool Stopped
{
get { return false; }
}
public override Vector3 Position
{
get
{
Vector3 pos = Vector3.Zero;
Vec3 vec = _prim.Position;
pos.X = vec.X;
pos.Y = vec.Y;
pos.Z = vec.Z;
return pos;
}
set
{
Vector3 vec = value;
Vec3 pos = new Vec3();
pos.X = vec.X;
pos.Y = vec.Y;
pos.Z = vec.Z;
_prim.Position = pos;
}
}
public override PrimitiveBaseShape Shape
{
set { return; }
}
public override Vector3 Velocity
{
get { return _velocity; }
set { _velocity = value; }
}
public override Vector3 Torque
{
get { return Vector3.Zero; }
set { return; }
}
public override float CollisionScore
{
get { return 0f; }
set { }
}
public override bool Kinematic
{
get { return _prim.Kinematic; }
set { _prim.Kinematic = value; }
}
public override Quaternion Orientation
{
get
{
Quaternion res;
PhysXWrapper.Quaternion quat = _prim.GetOrientation();
res.W = quat.W;
res.X = quat.X;
res.Y = quat.Y;
res.Z = quat.Z;
return res;
}
set { }
}
public override Vector3 Acceleration
{
get { return _acceleration; }
set { _acceleration = value; }
}
public override void AddForce(Vector3 force, bool pushforce)
{
}
public override void AddAngularForce(Vector3 force, bool pushforce)
{
}
public override void SetMomentum(Vector3 momentum)
{
}
public override Vector3 Size
{
get { return Vector3.Zero; }
set { }
}
public override void link(PhysicsActor obj)
{
}
public override void delink()
{
}
public override void LockAngularMotion(Vector3 axis)
{
}
public override float Mass
{
get { return 0f; }
}
public override Vector3 Force
{
get { return Vector3.Zero; }
set { return; }
}
public override int VehicleType
{
get { return 0; }
set { return; }
}
public override void VehicleFloatParam(int param, float value)
{
}
public override void VehicleVectorParam(int param, Vector3 value)
{
}
public override void VehicleRotationParam(int param, Quaternion rotation)
{
}
public override void VehicleFlags(int param, bool remove) { }
public override void SetVolumeDetect(int param)
{
}
public override Vector3 CenterOfMass
{
get { return Vector3.Zero; }
}
public override Vector3 GeometricCenter
{
get { return Vector3.Zero; }
}
public override void CrossingFailure()
{
}
public override Vector3 PIDTarget { set { return; } }
public override bool PIDActive { set { return; } }
public override float PIDTau { set { return; } }
public override float PIDHoverHeight { set { return; } }
public override bool PIDHoverActive { set { return; } }
public override PIDHoverType PIDHoverType { set { return; } }
public override float PIDHoverTau { set { return; } }
public override Quaternion APIDTarget
{
set { return; }
}
public override bool APIDActive
{
set { return; }
}
public override float APIDStrength
{
set { return; }
}
public override float APIDDamping
{
set { return; }
}
public override void SubscribeEvents(int ms)
{
}
public override void UnSubscribeEvents()
{
}
public override bool SubscribedEvents()
{
return false;
}
}
}

View File

@ -1,177 +0,0 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSimulator Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Collections.Generic;
using Nini.Config;
using OpenSim.Framework;
using OpenSim.Region.Physics.Manager;
using PhysXWrapper;
using Quaternion=OpenMetaverse.Quaternion;
using System.Reflection;
using log4net;
using OpenMetaverse;
namespace OpenSim.Region.Physics.PhysXPlugin
{
public class PhysXScene : PhysicsScene
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private List<PhysXCharacter> _characters = new List<PhysXCharacter>();
private List<PhysXPrim> _prims = new List<PhysXPrim>();
private float[] _heightMap = null;
private NxPhysicsSDK mySdk;
private NxScene scene;
// protected internal string sceneIdentifier;
public PhysXScene(string _sceneIdentifier)
{
//sceneIdentifier = _sceneIdentifier;
mySdk = NxPhysicsSDK.CreateSDK();
m_log.Info("Sdk created - now creating scene");
scene = mySdk.CreateScene();
}
public override void Initialise(IMesher meshmerizer, IConfigSource config)
{
// Does nothing right now
}
public override void Dispose()
{
}
public override void SetWaterLevel(float baseheight)
{
}
public override PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 size, bool isFlying)
{
Vec3 pos = new Vec3();
pos.X = position.X;
pos.Y = position.Y;
pos.Z = position.Z;
PhysXCharacter act = new PhysXCharacter(scene.AddCharacter(pos));
act.Flying = isFlying;
act.Position = position;
_characters.Add(act);
return act;
}
public override void RemovePrim(PhysicsActor prim)
{
}
public override void RemoveAvatar(PhysicsActor actor)
{
}
private PhysicsActor AddPrim(Vector3 position, Vector3 size, Quaternion rotation)
{
Vec3 pos = new Vec3();
pos.X = position.X;
pos.Y = position.Y;
pos.Z = position.Z;
Vec3 siz = new Vec3();
siz.X = size.X;
siz.Y = size.Y;
siz.Z = size.Z;
PhysXPrim act = new PhysXPrim(scene.AddNewBox(pos, siz));
_prims.Add(act);
return act;
}
public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
Vector3 size, Quaternion rotation, bool isPhysical, uint localid)
{
return AddPrim(position, size, rotation);
}
public override void AddPhysicsActorTaint(PhysicsActor prim)
{
}
public override float Simulate(float timeStep)
{
float fps = 0f;
try
{
foreach (PhysXCharacter actor in _characters)
{
actor.Move(timeStep);
}
scene.Simulate(timeStep);
scene.FetchResults();
scene.UpdateControllers();
foreach (PhysXCharacter actor in _characters)
{
actor.UpdatePosition();
}
}
catch (Exception e)
{
m_log.Error(e.Message);
}
return fps;
}
public override void GetResults()
{
}
public override bool IsThreaded
{
// for now we won't be multithreaded
get { return (false); }
}
public override void SetTerrain(float[] heightMap)
{
if (_heightMap != null)
{
m_log.Debug("PhysX - deleting old terrain");
scene.DeleteTerrain();
}
_heightMap = heightMap;
scene.AddTerrain(heightMap);
}
public override void DeleteTerrain()
{
scene.DeleteTerrain();
}
public override Dictionary<uint, float> GetTopColliders()
{
Dictionary<uint, float> returncolliders = new Dictionary<uint, float>();
return returncolliders;
}
}
}

View File

@ -137,7 +137,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (cmdHandlerThread == null)
{
// Start the thread that will be doing the work
cmdHandlerThread = Watchdog.StartThread(CmdHandlerThreadLoop, "AsyncLSLCmdHandlerThread", ThreadPriority.Normal, true);
cmdHandlerThread
= Watchdog.StartThread(
CmdHandlerThreadLoop, "AsyncLSLCmdHandlerThread", ThreadPriority.Normal, true, true);
}
}

View File

@ -3845,7 +3845,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
// Single prim
if (m_host.LinkNum == 0)
{
if (linknum == 0)
if (linknum == 0 || linknum == ScriptBaseClass.LINK_ROOT)
return m_host.Name;
else
return UUID.Zero.ToString();
@ -6376,16 +6376,38 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
}
public void llSitTarget(LSL_Vector offset, LSL_Rotation rot)
protected void SitTarget(SceneObjectPart part, LSL_Vector offset, LSL_Rotation rot)
{
m_host.AddScriptLPS(1);
// LSL quaternions can normalize to 0, normal Quaternions can't.
if (rot.s == 0 && rot.x == 0 && rot.y == 0 && rot.z == 0)
rot.z = 1; // ZERO_ROTATION = 0,0,0,1
m_host.SitTargetPosition = new Vector3((float)offset.x, (float)offset.y, (float)offset.z);
m_host.SitTargetOrientation = Rot2Quaternion(rot);
m_host.ParentGroup.HasGroupChanged = true;
part.SitTargetPosition = new Vector3((float)offset.x, (float)offset.y, (float)offset.z);
part.SitTargetOrientation = Rot2Quaternion(rot);
part.ParentGroup.HasGroupChanged = true;
}
public void llSitTarget(LSL_Vector offset, LSL_Rotation rot)
{
m_host.AddScriptLPS(1);
SitTarget(m_host, offset, rot);
}
public void llLinkSitTarget(LSL_Integer link, LSL_Vector offset, LSL_Rotation rot)
{
m_host.AddScriptLPS(1);
if (link == ScriptBaseClass.LINK_ROOT)
SitTarget(m_host.ParentGroup.RootPart, offset, rot);
else if (link == ScriptBaseClass.LINK_THIS)
SitTarget(m_host, offset, rot);
else
{
SceneObjectPart part = m_host.ParentGroup.GetLinkNumPart(link);
if (null != part)
{
SitTarget(part, offset, rot);
}
}
}
public LSL_String llAvatarOnSitTarget()
@ -8151,23 +8173,40 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
m_host.AddScriptLPS(1);
ScriptSleep(1000);
return GetPrimMediaParams(m_host, face, rules);
}
public LSL_List llGetLinkMedia(LSL_Integer link, LSL_Integer face, LSL_List rules)
{
m_host.AddScriptLPS(1);
ScriptSleep(1000);
if (link == ScriptBaseClass.LINK_ROOT)
return GetPrimMediaParams(m_host.ParentGroup.RootPart, face, rules);
else if (link == ScriptBaseClass.LINK_THIS)
return GetPrimMediaParams(m_host, face, rules);
else
{
SceneObjectPart part = m_host.ParentGroup.GetLinkNumPart(link);
if (null != part)
return GetPrimMediaParams(part, face, rules);
}
return new LSL_List();
}
private LSL_List GetPrimMediaParams(SceneObjectPart part, int face, LSL_List rules)
{
// LSL Spec http://wiki.secondlife.com/wiki/LlGetPrimMediaParams says to fail silently if face is invalid
// TODO: Need to correctly handle case where a face has no media (which gives back an empty list).
// Assuming silently fail means give back an empty list. Ideally, need to check this.
if (face < 0 || face > m_host.GetNumberOfSides() - 1)
if (face < 0 || face > part.GetNumberOfSides() - 1)
return new LSL_List();
return GetPrimMediaParams(face, rules);
}
private LSL_List GetPrimMediaParams(int face, LSL_List rules)
{
IMoapModule module = m_ScriptEngine.World.RequestModuleInterface<IMoapModule>();
if (null == module)
throw new Exception("Media on a prim functions not available");
return new LSL_List();
MediaEntry me = module.GetMediaEntry(m_host, face);
MediaEntry me = module.GetMediaEntry(part, face);
// As per http://wiki.secondlife.com/wiki/LlGetPrimMediaParams
if (null == me)
@ -8249,33 +8288,52 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
case ScriptBaseClass.PRIM_MEDIA_PERMS_CONTROL:
res.Add(new LSL_Integer((int)me.ControlPermissions));
break;
default: return ScriptBaseClass.LSL_STATUS_MALFORMED_PARAMS;
}
}
return res;
}
public LSL_Integer llSetPrimMediaParams(int face, LSL_List rules)
public LSL_Integer llSetPrimMediaParams(LSL_Integer face, LSL_List rules)
{
m_host.AddScriptLPS(1);
ScriptSleep(1000);
return SetPrimMediaParams(m_host, face, rules);
}
public LSL_Integer llSetLinkMedia(LSL_Integer link, LSL_Integer face, LSL_List rules)
{
m_host.AddScriptLPS(1);
ScriptSleep(1000);
if (link == ScriptBaseClass.LINK_ROOT)
return SetPrimMediaParams(m_host.ParentGroup.RootPart, face, rules);
else if (link == ScriptBaseClass.LINK_THIS)
return SetPrimMediaParams(m_host, face, rules);
else
{
SceneObjectPart part = m_host.ParentGroup.GetLinkNumPart(link);
if (null != part)
return SetPrimMediaParams(part, face, rules);
}
return ScriptBaseClass.LSL_STATUS_NOT_FOUND;
}
private LSL_Integer SetPrimMediaParams(SceneObjectPart part, LSL_Integer face, LSL_List rules)
{
// LSL Spec http://wiki.secondlife.com/wiki/LlSetPrimMediaParams says to fail silently if face is invalid
// Assuming silently fail means sending back LSL_STATUS_OK. Ideally, need to check this.
// Don't perform the media check directly
if (face < 0 || face > m_host.GetNumberOfSides() - 1)
return ScriptBaseClass.LSL_STATUS_OK;
if (face < 0 || face > part.GetNumberOfSides() - 1)
return ScriptBaseClass.LSL_STATUS_NOT_FOUND;
return SetPrimMediaParams(face, rules);
}
private LSL_Integer SetPrimMediaParams(int face, LSL_List rules)
{
IMoapModule module = m_ScriptEngine.World.RequestModuleInterface<IMoapModule>();
if (null == module)
throw new Exception("Media on a prim functions not available");
return ScriptBaseClass.LSL_STATUS_NOT_SUPPORTED;
MediaEntry me = module.GetMediaEntry(m_host, face);
MediaEntry me = module.GetMediaEntry(part, face);
if (null == me)
me = new MediaEntry();
@ -8354,10 +8412,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
case ScriptBaseClass.PRIM_MEDIA_PERMS_CONTROL:
me.ControlPermissions = (MediaPermission)(byte)(int)rules.GetLSLIntegerItem(i++);
break;
default: return ScriptBaseClass.LSL_STATUS_MALFORMED_PARAMS;
}
}
module.SetMediaEntry(m_host, face, me);
module.SetMediaEntry(part, face, me);
return ScriptBaseClass.LSL_STATUS_OK;
}
@ -8366,18 +8426,40 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
m_host.AddScriptLPS(1);
ScriptSleep(1000);
return ClearPrimMedia(m_host, face);
}
public LSL_Integer llClearLinkMedia(LSL_Integer link, LSL_Integer face)
{
m_host.AddScriptLPS(1);
ScriptSleep(1000);
if (link == ScriptBaseClass.LINK_ROOT)
return ClearPrimMedia(m_host.ParentGroup.RootPart, face);
else if (link == ScriptBaseClass.LINK_THIS)
return ClearPrimMedia(m_host, face);
else
{
SceneObjectPart part = m_host.ParentGroup.GetLinkNumPart(link);
if (null != part)
return ClearPrimMedia(part, face);
}
return ScriptBaseClass.LSL_STATUS_NOT_FOUND;
}
private LSL_Integer ClearPrimMedia(SceneObjectPart part, LSL_Integer face)
{
// LSL Spec http://wiki.secondlife.com/wiki/LlClearPrimMedia says to fail silently if face is invalid
// Assuming silently fail means sending back LSL_STATUS_OK. Ideally, need to check this.
// FIXME: Don't perform the media check directly
if (face < 0 || face > m_host.GetNumberOfSides() - 1)
return ScriptBaseClass.LSL_STATUS_OK;
if (face < 0 || face > part.GetNumberOfSides() - 1)
return ScriptBaseClass.LSL_STATUS_NOT_FOUND;
IMoapModule module = m_ScriptEngine.World.RequestModuleInterface<IMoapModule>();
if (null == module)
throw new Exception("Media on a prim functions not available");
return ScriptBaseClass.LSL_STATUS_NOT_SUPPORTED;
module.ClearMediaEntry(m_host, face);
module.ClearMediaEntry(part, face);
return ScriptBaseClass.LSL_STATUS_OK;
}

View File

@ -2740,7 +2740,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
CheckThreatLevel(ThreatLevel.Moderate, "osSetSpeed");
m_host.AddScriptLPS(1);
ScenePresence avatar = World.GetScenePresence(new UUID(UUID));
avatar.SpeedModifier = (float)SpeedModifier;
if (avatar != null)
avatar.SpeedModifier = (float)SpeedModifier;
}
public void osKickAvatar(string FirstName,string SurName,string alert)

View File

@ -64,6 +64,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
LSL_List llCastRay(LSL_Vector start, LSL_Vector end, LSL_List options);
LSL_Integer llCeil(double f);
void llClearCameraParams();
LSL_Integer llClearLinkMedia(LSL_Integer link, LSL_Integer face);
LSL_Integer llClearPrimMedia(LSL_Integer face);
void llCloseRemoteDataChannel(string channel);
LSL_Float llCloud(LSL_Vector offset);
@ -139,7 +140,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
LSL_String llGetLinkName(int linknum);
LSL_Integer llGetLinkNumber();
LSL_Integer llGetLinkNumberOfSides(int link);
LSL_List llGetLinkPrimitiveParams(int linknum, LSL_List rules);
LSL_List llGetLinkMedia(LSL_Integer link, LSL_Integer face, LSL_List rules);
LSL_List llGetLinkPrimitiveParams(int linknum, LSL_List rules);
LSL_Integer llGetListEntryType(LSL_List src, int index);
LSL_Integer llGetListLength(LSL_List src);
LSL_Vector llGetLocalPos();
@ -218,6 +220,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
LSL_String llGetDisplayName(string id);
LSL_String llRequestDisplayName(string id);
void llLinkParticleSystem(int linknum, LSL_List rules);
void llLinkSitTarget(LSL_Integer link, LSL_Vector offset, LSL_Rotation rot);
LSL_String llList2CSV(LSL_List src);
LSL_Float llList2Float(LSL_List src, int index);
LSL_Integer llList2Integer(LSL_List src, int index);
@ -334,6 +337,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
void llSetInventoryPermMask(string item, int mask, int value);
void llSetLinkAlpha(int linknumber, double alpha, int face);
void llSetLinkColor(int linknumber, LSL_Vector color, int face);
LSL_Integer llSetLinkMedia(LSL_Integer link, LSL_Integer face, LSL_List rules);
void llSetLinkPrimitiveParams(int linknumber, LSL_List rules);
void llSetLinkTexture(int linknumber, string texture, int face);
void llSetLinkTextureAnim(int linknum, int mode, int face, int sizex, int sizey, double start, double length, double rate);
@ -344,7 +348,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
void llSetParcelMusicURL(string url);
void llSetPayPrice(int price, LSL_List quick_pay_buttons);
void llSetPos(LSL_Vector pos);
LSL_Integer llSetPrimMediaParams(int face, LSL_List rules);
LSL_Integer llSetPrimMediaParams(LSL_Integer face, LSL_List rules);
void llSetPrimitiveParams(LSL_List rules);
void llSetLinkPrimitiveParamsFast(int linknum, LSL_List rules);
void llSetPrimURL(string url);

View File

@ -1688,6 +1688,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
m_LSL_Functions.llSitTarget(offset, rot);
}
public void llLinkSitTarget(LSL_Integer link, LSL_Vector offset, LSL_Rotation rot)
{
m_LSL_Functions.llLinkSitTarget(link, offset, rot);
}
public void llSleep(double sec)
{
m_LSL_Functions.llSleep(sec);
@ -1882,17 +1887,32 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
{
return m_LSL_Functions.llGetPrimMediaParams(face, rules);
}
public LSL_List llGetLinkMedia(LSL_Integer link, LSL_Integer face, LSL_List rules)
{
return m_LSL_Functions.llGetLinkMedia(link, face, rules);
}
public LSL_Integer llSetPrimMediaParams(int face, LSL_List rules)
{
return m_LSL_Functions.llSetPrimMediaParams(face, rules);
}
public LSL_Integer llSetLinkMedia(LSL_Integer link, LSL_Integer face, LSL_List rules)
{
return m_LSL_Functions.llSetLinkMedia(link, face, rules);
}
public LSL_Integer llClearPrimMedia(LSL_Integer face)
{
return m_LSL_Functions.llClearPrimMedia(face);
}
public LSL_Integer llClearLinkMedia(LSL_Integer link, LSL_Integer face)
{
return m_LSL_Functions.llClearLinkMedia(link, face);
}
public void print(string str)
{
m_LSL_Functions.print(str);

View File

@ -83,6 +83,9 @@ namespace OpenSim.Region.UserStatistics
{
if (m_scenes.Count == 0)
{
if (Util.IsWindows())
Util.LoadArchSpecificWindowsDll("sqlite3.dll");
//IConfig startupConfig = config.Configs["Startup"];
dbConn = new SqliteConnection("URI=file:LocalUserStatistics.db,version=3");

View File

@ -136,6 +136,8 @@ namespace OpenSim.Server.Handlers.Simulation
int x = 0, y = 0;
UUID uuid = UUID.Zero;
string regionname = string.Empty;
Vector3 newPosition = Vector3.Zero;
if (args.ContainsKey("destination_x") && args["destination_x"] != null)
Int32.TryParse(args["destination_x"].AsString(), out x);
if (args.ContainsKey("destination_y") && args["destination_y"] != null)
@ -144,6 +146,8 @@ namespace OpenSim.Server.Handlers.Simulation
UUID.TryParse(args["destination_uuid"].AsString(), out uuid);
if (args.ContainsKey("destination_name") && args["destination_name"] != null)
regionname = args["destination_name"].ToString();
if (args.ContainsKey("new_position") && args["new_position"] != null)
Vector3.TryParse(args["new_position"], out newPosition);
GridRegion destination = new GridRegion();
destination.RegionID = uuid;
@ -199,7 +203,7 @@ namespace OpenSim.Server.Handlers.Simulation
try
{
// This is the meaning of POST object
result = CreateObject(destination, sog);
result = CreateObject(destination, newPosition, sog);
}
catch (Exception e)
{
@ -211,9 +215,9 @@ namespace OpenSim.Server.Handlers.Simulation
}
// subclasses can override this
protected virtual bool CreateObject(GridRegion destination, ISceneObject sog)
protected virtual bool CreateObject(GridRegion destination, Vector3 newPosition, ISceneObject sog)
{
return m_SimulationService.CreateObject(destination, sog, false);
return m_SimulationService.CreateObject(destination, newPosition, sog, false);
}
protected virtual void DoObjectPut(Hashtable request, Hashtable responsedata, UUID regionID)

View File

@ -408,7 +408,7 @@ namespace OpenSim.Services.Connectors.Simulation
/// <summary>
///
/// </summary>
public bool CreateObject(GridRegion destination, ISceneObject sog, bool isLocalCall)
public bool CreateObject(GridRegion destination, Vector3 newPosition, ISceneObject sog, bool isLocalCall)
{
// m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: CreateObject start");
@ -421,6 +421,7 @@ namespace OpenSim.Services.Connectors.Simulation
args["sog"] = OSD.FromString(sog.ToXml2());
args["extra"] = OSD.FromString(sog.ExtraToXmlString());
args["modified"] = OSD.FromBoolean(sog.HasGroupChanged);
args["new_position"] = newPosition.ToString();
string state = sog.GetStateSnapshot();
if (state.Length > 0)

View File

@ -98,7 +98,7 @@ namespace OpenSim.Services.Interfaces
/// <param name="sog"></param>
/// <param name="isLocalCall"></param>
/// <returns></returns>
bool CreateObject(GridRegion destination, ISceneObject sog, bool isLocalCall);
bool CreateObject(GridRegion destination, Vector3 newPosition, ISceneObject sog, bool isLocalCall);
/// <summary>
/// Create an object from the user's inventory in the destination region.

Binary file not shown.

Binary file not shown.

BIN
bin/lib64/ode.dll Executable file

Binary file not shown.

BIN
bin/lib64/sqlite3.dll Executable file

Binary file not shown.

View File

@ -521,31 +521,6 @@
</Files>
</Project>
<Project frameworkVersion="v3_5" name="OpenSim.Region.Physics.PhysXPlugin" path="OpenSim/Region/Physics/PhysXPlugin" type="Library">
<Configuration name="Debug">
<Options>
<OutputPath>../../../../bin/Physics/</OutputPath>
</Options>
</Configuration>
<Configuration name="Release">
<Options>
<OutputPath>../../../../bin/Physics/</OutputPath>
</Options>
</Configuration>
<ReferencePath>../../../../bin/</ReferencePath>
<Reference name="System"/>
<Reference name="OpenMetaverseTypes" path="../../../../bin/"/>
<Reference name="Nini" path="../../../../bin/"/>
<Reference name="PhysX_Wrapper_Dotnet" path="../../../../bin/"/>
<Reference name="OpenSim.Framework"/>
<Reference name="OpenSim.Region.Physics.Manager"/>
<Reference name="log4net" path="../../../../bin/"/>
<Files>
<Match pattern="*.cs" recurse="true"/>
</Files>
</Project>
<Project frameworkVersion="v3_5" name="OpenSim.Region.Physics.OdePlugin" path="OpenSim/Region/Physics/OdePlugin" type="Library">
<Configuration name="Debug">
<Options>