Merge branch 'master' into careminster

Conflicts:
	OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
	OpenSim/Region/Framework/Scenes/Scene.cs
avinationmerge
Melanie 2012-06-29 22:24:53 +01:00
commit 6137f37028
13 changed files with 131 additions and 123 deletions

View File

@ -301,6 +301,7 @@ namespace OpenSim.Capabilities.Handlers
InventoryItemBase linkedItem InventoryItemBase linkedItem
= m_InventoryService.GetItem(new InventoryItemBase(link.AssetID)); = m_InventoryService.GetItem(new InventoryItemBase(link.AssetID));
if (linkedItem != null)
itemsToReturn.Insert(0, linkedItem); itemsToReturn.Insert(0, linkedItem);
} }
} }

View File

@ -56,6 +56,11 @@ namespace OpenSim.Framework
public interface IScene public interface IScene
{ {
/// <summary>
/// The name of this scene.
/// </summary>
string Name { get; }
RegionInfo RegionInfo { get; } RegionInfo RegionInfo { get; }
RegionStatus RegionStatus { get; set; } RegionStatus RegionStatus { get; set; }

View File

@ -44,9 +44,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
} }
protected int m_objectNameCallsReceived; protected int m_objectNameCallsReceived;
public MockScene() public MockScene() : base(new RegionInfo(1000, 1000, null, null))
{ {
m_regInfo = new RegionInfo(1000, 1000, null, null);
m_regStatus = RegionStatus.Up; m_regStatus = RegionStatus.Up;
} }

View File

@ -366,10 +366,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
// At the moment we can only deal with a single attachment // At the moment we can only deal with a single attachment
if (attachments.Count != 0) if (attachments.Count != 0)
{ {
UUID oldAttachmentItemID = attachments[0].FromItemID; if (attachments[0].FromItemID != UUID.Zero)
DetachSingleAttachmentToInvInternal(sp, attachments[0]);
if (oldAttachmentItemID != UUID.Zero)
DetachSingleAttachmentToInvInternal(sp, oldAttachmentItemID);
else else
m_log.WarnFormat( m_log.WarnFormat(
"[ATTACHMENTS MODULE]: When detaching existing attachment {0} {1} at point {2} to make way for {3} {4} for {5}, couldn't find the associated item ID to adjust inventory attachment record!", "[ATTACHMENTS MODULE]: When detaching existing attachment {0} {1} at point {2} to make way for {3} {4} for {5}, couldn't find the associated item ID to adjust inventory attachment record!",
@ -434,12 +432,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
return null; return null;
} }
SceneObjectGroup att = RezSingleAttachmentFromInventoryInternal(sp, itemID, UUID.Zero, AttachmentPt, doc); return RezSingleAttachmentFromInventoryInternal(sp, itemID, UUID.Zero, AttachmentPt, doc);
if (att == null)
DetachSingleAttachmentToInv(sp, itemID);
return att;
} }
public void RezMultipleAttachmentsFromInventory(IScenePresence sp, List<KeyValuePair<UUID, uint>> rezlist) public void RezMultipleAttachmentsFromInventory(IScenePresence sp, List<KeyValuePair<UUID, uint>> rezlist)
@ -516,18 +509,27 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
m_scene.EventManager.TriggerOnAttach(so.LocalId, so.UUID, UUID.Zero); m_scene.EventManager.TriggerOnAttach(so.LocalId, so.UUID, UUID.Zero);
} }
public void DetachSingleAttachmentToInv(IScenePresence sp, UUID itemID) public void DetachSingleAttachmentToInv(IScenePresence sp, SceneObjectGroup so)
{ {
lock (sp.AttachmentsSyncLock) lock (sp.AttachmentsSyncLock)
{ {
// Save avatar attachment information // Save avatar attachment information
// m_log.Debug("[ATTACHMENTS MODULE]: Detaching from UserID: " + sp.UUID + ", ItemID: " + itemID); // m_log.Debug("[ATTACHMENTS MODULE]: Detaching from UserID: " + sp.UUID + ", ItemID: " + itemID);
bool changed = sp.Appearance.DetachAttachment(itemID); if (so.AttachedAvatar != sp.UUID)
{
m_log.WarnFormat(
"[ATTACHMENTS MODULE]: Tried to detach object {0} from {1} {2} but attached avatar id was {3} in {4}",
so.Name, sp.Name, sp.UUID, so.AttachedAvatar, m_scene.RegionInfo.RegionName);
return;
}
bool changed = sp.Appearance.DetachAttachment(so.FromItemID);
if (changed && m_scene.AvatarFactory != null) if (changed && m_scene.AvatarFactory != null)
m_scene.AvatarFactory.QueueAppearanceSave(sp.UUID); m_scene.AvatarFactory.QueueAppearanceSave(sp.UUID);
DetachSingleAttachmentToInvInternal(sp, itemID); DetachSingleAttachmentToInvInternal(sp, so);
} }
} }
@ -794,46 +796,21 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
return item; return item;
} }
// What makes this method odd and unique is it tries to detach using an UUID.... Yay for standards. private void DetachSingleAttachmentToInvInternal(IScenePresence sp, SceneObjectGroup so)
// To LocalId or UUID, *THAT* is the question. How now Brown UUID??
private void DetachSingleAttachmentToInvInternal(IScenePresence sp, UUID itemID)
{ {
// m_log.DebugFormat("[ATTACHMENTS MODULE]: Detaching item {0} to inventory for {1}", itemID, sp.Name); // m_log.DebugFormat("[ATTACHMENTS MODULE]: Detaching item {0} to inventory for {1}", itemID, sp.Name);
if (itemID == UUID.Zero) // If this happened, someone made a mistake.... m_scene.EventManager.TriggerOnAttach(so.LocalId, so.FromItemID, UUID.Zero);
return; sp.RemoveAttachment(so);
m_scene.DeleteSceneObject(so, false);
// We can NOT use the dictionries here, as we are looking
// for an entity by the fromAssetID, which is NOT the prim UUID
EntityBase[] detachEntities = m_scene.GetEntities();
SceneObjectGroup group;
lock (sp.AttachmentsSyncLock)
{
foreach (EntityBase entity in detachEntities)
{
if (entity is SceneObjectGroup)
{
group = (SceneObjectGroup)entity;
if (group.FromItemID == itemID)
{
m_scene.EventManager.TriggerOnAttach(group.LocalId, itemID, UUID.Zero);
sp.RemoveAttachment(group);
m_scene.DeleteSceneObject(group, false);
// Prepare sog for storage // Prepare sog for storage
group.AttachedAvatar = UUID.Zero; so.AttachedAvatar = UUID.Zero;
group.RootPart.SetParentLocalId(0); so.RootPart.SetParentLocalId(0);
group.IsAttachment = false; so.IsAttachment = false;
group.AbsolutePosition = group.RootPart.AttachedPos; so.AbsolutePosition = so.RootPart.AttachedPos;
UpdateKnownItem(sp, group, true); UpdateKnownItem(sp, so, true);
return;
}
}
}
}
} }
protected SceneObjectGroup RezSingleAttachmentFromInventoryInternal( protected SceneObjectGroup RezSingleAttachmentFromInventoryInternal(
@ -1047,8 +1024,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
ScenePresence sp = m_scene.GetScenePresence(remoteClient.AgentId); ScenePresence sp = m_scene.GetScenePresence(remoteClient.AgentId);
SceneObjectGroup group = m_scene.GetGroupByPrim(objectLocalID); SceneObjectGroup group = m_scene.GetGroupByPrim(objectLocalID);
if (sp != null && group != null) if (sp != null && group != null)
DetachSingleAttachmentToInv(sp, group.FromItemID); DetachSingleAttachmentToInv(sp, group);
} }
private void Client_OnDetachAttachmentIntoInv(UUID itemID, IClientAPI remoteClient) private void Client_OnDetachAttachmentIntoInv(UUID itemID, IClientAPI remoteClient)
@ -1058,7 +1036,21 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
ScenePresence sp = m_scene.GetScenePresence(remoteClient.AgentId); ScenePresence sp = m_scene.GetScenePresence(remoteClient.AgentId);
if (sp != null) if (sp != null)
DetachSingleAttachmentToInv(sp, itemID); {
lock (sp.AttachmentsSyncLock)
{
List<SceneObjectGroup> attachments = sp.GetAttachments();
foreach (SceneObjectGroup group in attachments)
{
if (group.FromItemID == itemID)
{
DetachSingleAttachmentToInv(sp, group);
return;
}
}
}
}
} }
private void Client_OnObjectDrop(uint soLocalId, IClientAPI remoteClient) private void Client_OnObjectDrop(uint soLocalId, IClientAPI remoteClient)

View File

@ -227,9 +227,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
InventoryItemBase attItem = CreateAttachmentItem(scene, ua1.PrincipalID, "att", 0x10, 0x20); InventoryItemBase attItem = CreateAttachmentItem(scene, ua1.PrincipalID, "att", 0x10, 0x20);
scene.AttachmentsModule.RezSingleAttachmentFromInventory( SceneObjectGroup so
= (SceneObjectGroup)scene.AttachmentsModule.RezSingleAttachmentFromInventory(
sp, attItem.ID, (uint)AttachmentPoint.Chest); sp, attItem.ID, (uint)AttachmentPoint.Chest);
scene.AttachmentsModule.DetachSingleAttachmentToInv(sp, attItem.ID); scene.AttachmentsModule.DetachSingleAttachmentToInv(sp, so);
// Check status on scene presence // Check status on scene presence
Assert.That(sp.HasAttachments(), Is.False); Assert.That(sp.HasAttachments(), Is.False);

View File

@ -114,11 +114,11 @@ namespace OpenSim.Region.Framework.Interfaces
void DetachSingleAttachmentToGround(IScenePresence sp, uint objectLocalID); void DetachSingleAttachmentToGround(IScenePresence sp, uint objectLocalID);
/// <summary> /// <summary>
/// Detach the given item so that it remains in the user's inventory. /// Detach the given attachment so that it remains in the user's inventory.
/// </summary> /// </summary>
/// <param name="sp">/param> /// <param name="sp">/param>
/// <param name="itemID"></param> /// <param name="grp">The attachment to detach.</param>
void DetachSingleAttachmentToInv(IScenePresence sp, UUID itemID); void DetachSingleAttachmentToInv(IScenePresence sp, SceneObjectGroup grp);
/// Update the position of an attachment. /// Update the position of an attachment.
/// </summary> /// </summary>

View File

@ -72,6 +72,10 @@ namespace OpenSim.Region.Framework.Interfaces
/// <returns></returns> /// <returns></returns>
List<SceneObjectGroup> GetAttachments(uint attachmentPoint); List<SceneObjectGroup> GetAttachments(uint attachmentPoint);
/// <summary>
/// Does this avatar have any attachments?
/// </summary>
/// <returns></returns>
bool HasAttachments(); bool HasAttachments();
// Don't use these methods directly. Instead, use the AttachmentsModule // Don't use these methods directly. Instead, use the AttachmentsModule

View File

@ -637,7 +637,6 @@ namespace OpenSim.Region.Framework.Scenes
m_SimulationDataService = simDataService; m_SimulationDataService = simDataService;
m_EstateDataService = estateDataService; m_EstateDataService = estateDataService;
m_regionHandle = m_regInfo.RegionHandle; m_regionHandle = m_regInfo.RegionHandle;
m_regionName = m_regInfo.RegionName;
m_lastIncoming = 0; m_lastIncoming = 0;
m_lastOutgoing = 0; m_lastOutgoing = 0;
@ -654,7 +653,7 @@ namespace OpenSim.Region.Framework.Scenes
// resave. // resave.
// FIXME: It shouldn't be up to the database plugins to create this data - we should do it when a new // FIXME: It shouldn't be up to the database plugins to create this data - we should do it when a new
// region is set up and avoid these gyrations. // region is set up and avoid these gyrations.
RegionSettings rs = simDataService.LoadRegionSettings(m_regInfo.RegionID); RegionSettings rs = simDataService.LoadRegionSettings(RegionInfo.RegionID);
bool updatedTerrainTextures = false; bool updatedTerrainTextures = false;
if (rs.TerrainTexture1 == UUID.Zero) if (rs.TerrainTexture1 == UUID.Zero)
{ {
@ -683,10 +682,10 @@ namespace OpenSim.Region.Framework.Scenes
if (updatedTerrainTextures) if (updatedTerrainTextures)
rs.Save(); rs.Save();
m_regInfo.RegionSettings = rs; RegionInfo.RegionSettings = rs;
if (estateDataService != null) if (estateDataService != null)
m_regInfo.EstateSettings = estateDataService.LoadEstateSettings(m_regInfo.RegionID, false); RegionInfo.EstateSettings = estateDataService.LoadEstateSettings(RegionInfo.RegionID, false);
#endregion Region Settings #endregion Region Settings
@ -861,7 +860,7 @@ namespace OpenSim.Region.Framework.Scenes
StatsReporter.OnStatsIncorrect += m_sceneGraph.RecalculateStats; StatsReporter.OnStatsIncorrect += m_sceneGraph.RecalculateStats;
} }
public Scene(RegionInfo regInfo) public Scene(RegionInfo regInfo) : base(regInfo)
{ {
PhysicalPrims = true; PhysicalPrims = true;
CollidablePrims = true; CollidablePrims = true;
@ -888,7 +887,6 @@ namespace OpenSim.Region.Framework.Scenes
WestBorders.Add(westBorder); WestBorders.Add(westBorder);
BordersLocked = false; BordersLocked = false;
m_regInfo = regInfo;
m_eventManager = new EventManager(); m_eventManager = new EventManager();
m_permissions = new ScenePermissions(this); m_permissions = new ScenePermissions(this);
@ -1232,8 +1230,8 @@ namespace OpenSim.Region.Framework.Scenes
m_sceneGraph.Close(); m_sceneGraph.Close();
if (!GridService.DeregisterRegion(m_regInfo.RegionID)) if (!GridService.DeregisterRegion(RegionInfo.RegionID))
m_log.WarnFormat("[SCENE]: Deregister from grid failed for region {0}", m_regInfo.RegionName); m_log.WarnFormat("[SCENE]: Deregister from grid failed for region {0}", Name);
// call the base class Close method. // call the base class Close method.
base.Close(); base.Close();
@ -1770,14 +1768,14 @@ namespace OpenSim.Region.Framework.Scenes
public void StoreWindlightProfile(RegionLightShareData wl) public void StoreWindlightProfile(RegionLightShareData wl)
{ {
m_regInfo.WindlightSettings = wl; RegionInfo.WindlightSettings = wl;
SimulationDataService.StoreRegionWindlightSettings(wl); SimulationDataService.StoreRegionWindlightSettings(wl);
m_eventManager.TriggerOnSaveNewWindlightProfile(); m_eventManager.TriggerOnSaveNewWindlightProfile();
} }
public void LoadWindlightProfile() public void LoadWindlightProfile()
{ {
m_regInfo.WindlightSettings = SimulationDataService.LoadRegionWindlightSettings(RegionInfo.RegionID); RegionInfo.WindlightSettings = SimulationDataService.LoadRegionWindlightSettings(RegionInfo.RegionID);
m_eventManager.TriggerOnSaveNewWindlightProfile(); m_eventManager.TriggerOnSaveNewWindlightProfile();
} }
@ -2318,7 +2316,7 @@ namespace OpenSim.Region.Framework.Scenes
ForceSceneObjectBackup(so); ForceSceneObjectBackup(so);
so.DetachFromBackup(); so.DetachFromBackup();
SimulationDataService.RemoveObject(so.UUID, m_regInfo.RegionID); SimulationDataService.RemoveObject(so.UUID, RegionInfo.RegionID);
} }
// We need to keep track of this state in case this group is still queued for further backup. // We need to keep track of this state in case this group is still queued for further backup.
@ -2662,7 +2660,7 @@ namespace OpenSim.Region.Framework.Scenes
// enter. Period. // enter. Period.
// //
int flags = GetUserFlags(sceneObject.OwnerID); int flags = GetUserFlags(sceneObject.OwnerID);
if (m_regInfo.EstateSettings.IsBanned(sceneObject.OwnerID, flags)) if (RegionInfo.EstateSettings.IsBanned(sceneObject.OwnerID, flags))
{ {
m_log.InfoFormat("[INTERREGION]: Denied prim crossing for banned avatar {0}", sceneObject.OwnerID); m_log.InfoFormat("[INTERREGION]: Denied prim crossing for banned avatar {0}", sceneObject.OwnerID);
@ -3908,9 +3906,9 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
if (m_regInfo.EstateSettings != null) if (RegionInfo.EstateSettings != null)
{ {
if (m_regInfo.EstateSettings.IsBanned(agent.AgentID,0)) if (RegionInfo.EstateSettings.IsBanned(agent.AgentID, 0))
{ {
m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user is on the banlist", m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user is on the banlist",
agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName); agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName);
@ -3942,7 +3940,7 @@ namespace OpenSim.Region.Framework.Scenes
} }
bool groupAccess = false; bool groupAccess = false;
UUID[] estateGroups = m_regInfo.EstateSettings.EstateGroups; UUID[] estateGroups = RegionInfo.EstateSettings.EstateGroups;
if (estateGroups != null) if (estateGroups != null)
{ {
@ -3960,8 +3958,8 @@ namespace OpenSim.Region.Framework.Scenes
m_log.ErrorFormat("[CONNECTION BEGIN]: EstateGroups is null!"); m_log.ErrorFormat("[CONNECTION BEGIN]: EstateGroups is null!");
} }
if (!m_regInfo.EstateSettings.PublicAccess && if (!RegionInfo.EstateSettings.PublicAccess &&
!m_regInfo.EstateSettings.HasAccess(agent.AgentID) && !RegionInfo.EstateSettings.HasAccess(agent.AgentID) &&
!groupAccess) !groupAccess)
{ {
m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user does not have access to the estate", m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user does not have access to the estate",
@ -4034,7 +4032,7 @@ namespace OpenSim.Region.Framework.Scenes
// if (loggingOffUser != null) // if (loggingOffUser != null)
// { // {
// UUID localRegionSecret = UUID.Zero; // UUID localRegionSecret = UUID.Zero;
// bool parsedsecret = UUID.TryParse(m_regInfo.regionSecret, out localRegionSecret); // bool parsedsecret = UUID.TryParse(RegionInfo.regionSecret, out localRegionSecret);
// //
// // Region Secret is used here in case a new sessionid overwrites an old one on the user server. // // Region Secret is used here in case a new sessionid overwrites an old one on the user server.
// // Will update the user server in a few revisions to use it. // // Will update the user server in a few revisions to use it.
@ -4272,13 +4270,13 @@ namespace OpenSim.Region.Framework.Scenes
ScenePresence sp = GetScenePresence(remoteClient.AgentId); ScenePresence sp = GetScenePresence(remoteClient.AgentId);
if (sp != null) if (sp != null)
{ {
uint regionX = m_regInfo.RegionLocX; uint regionX = RegionInfo.RegionLocX;
uint regionY = m_regInfo.RegionLocY; uint regionY = RegionInfo.RegionLocY;
Utils.LongToUInts(regionHandle, out regionX, out regionY); Utils.LongToUInts(regionHandle, out regionX, out regionY);
int shiftx = (int) regionX - (int) m_regInfo.RegionLocX * (int)Constants.RegionSize; int shiftx = (int) regionX - (int) RegionInfo.RegionLocX * (int)Constants.RegionSize;
int shifty = (int) regionY - (int) m_regInfo.RegionLocY * (int)Constants.RegionSize; int shifty = (int) regionY - (int) RegionInfo.RegionLocY * (int)Constants.RegionSize;
position.X += shiftx; position.X += shiftx;
position.Y += shifty; position.Y += shifty;
@ -4301,7 +4299,7 @@ namespace OpenSim.Region.Framework.Scenes
if (!result) if (!result)
{ {
regionHandle = m_regInfo.RegionHandle; regionHandle = RegionInfo.RegionHandle;
} }
else else
{ {
@ -4807,7 +4805,7 @@ namespace OpenSim.Region.Framework.Scenes
public void DeleteFromStorage(UUID uuid) public void DeleteFromStorage(UUID uuid)
{ {
SimulationDataService.RemoveObject(uuid, m_regInfo.RegionID); SimulationDataService.RemoveObject(uuid, RegionInfo.RegionID);
} }
public int GetHealth(out int flags, out string message) public int GetHealth(out int flags, out string message)
@ -5288,7 +5286,7 @@ Environment.Exit(1);
IEstateDataService estateDataService = EstateDataService; IEstateDataService estateDataService = EstateDataService;
if (estateDataService != null) if (estateDataService != null)
{ {
m_regInfo.EstateSettings = estateDataService.LoadEstateSettings(m_regInfo.RegionID, false); RegionInfo.EstateSettings = estateDataService.LoadEstateSettings(RegionInfo.RegionID, false);
TriggerEstateSunUpdate(); TriggerEstateSunUpdate();
} }
} }

View File

@ -52,6 +52,8 @@ namespace OpenSim.Region.Framework.Scenes
#region Fields #region Fields
public string Name { get { return RegionInfo.RegionName; } }
public IConfigSource Config public IConfigSource Config
{ {
get { return GetConfig(); } get { return GetConfig(); }
@ -148,6 +150,11 @@ namespace OpenSim.Region.Framework.Scenes
#endregion #endregion
public SceneBase(RegionInfo regInfo)
{
RegionInfo = regInfo;
}
#region Update Methods #region Update Methods
/// <summary> /// <summary>
@ -211,10 +218,7 @@ namespace OpenSim.Region.Framework.Scenes
/// ///
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
public virtual RegionInfo RegionInfo public virtual RegionInfo RegionInfo { get; private set; }
{
get { return m_regInfo; }
}
#region admin stuff #region admin stuff

View File

@ -1270,7 +1270,7 @@ namespace OpenSim.Region.Physics.OdePlugin
public override void UnSubscribeEvents() public override void UnSubscribeEvents()
{ {
CollisionEventsThisFrame.Clear(); _parent_scene.RemoveCollisionEventReporting(this);
// Don't clear collision event reporting here. This is called directly from scene code and so can lead // Don't clear collision event reporting here. This is called directly from scene code and so can lead
// to a race condition with the simulate loop // to a race condition with the simulate loop

View File

@ -387,12 +387,12 @@ namespace OpenSim.Region.Physics.OdePlugin
/// <summary> /// <summary>
/// A dictionary of actors that should receive collision events. /// A dictionary of actors that should receive collision events.
/// </summary> /// </summary>
private readonly Dictionary<uint, PhysicsActor> _collisionEventPrim = new Dictionary<uint, PhysicsActor>(); private readonly Dictionary<uint, PhysicsActor> m_collisionEventActors = new Dictionary<uint, PhysicsActor>();
/// <summary> /// <summary>
/// A dictionary of collision event changes that are waiting to be processed. /// A dictionary of collision event changes that are waiting to be processed.
/// </summary> /// </summary>
private readonly Dictionary<uint, PhysicsActor> _collisionEventPrimChanges = new Dictionary<uint, PhysicsActor>(); private readonly Dictionary<uint, PhysicsActor> m_collisionEventActorsChanges = new Dictionary<uint, PhysicsActor>();
/// <summary> /// <summary>
/// Maps a unique geometry id (a memory location) to a physics actor name. /// Maps a unique geometry id (a memory location) to a physics actor name.
@ -1908,8 +1908,8 @@ namespace OpenSim.Region.Physics.OdePlugin
{ {
// m_log.DebugFormat("[PHYSICS]: Adding {0} {1} to collision event reporting", obj.SOPName, obj.LocalID); // m_log.DebugFormat("[PHYSICS]: Adding {0} {1} to collision event reporting", obj.SOPName, obj.LocalID);
lock (_collisionEventPrimChanges) lock (m_collisionEventActorsChanges)
_collisionEventPrimChanges[obj.LocalID] = obj; m_collisionEventActorsChanges[obj.LocalID] = obj;
} }
/// <summary> /// <summary>
@ -1920,8 +1920,8 @@ namespace OpenSim.Region.Physics.OdePlugin
{ {
// m_log.DebugFormat("[PHYSICS]: Removing {0} {1} from collision event reporting", obj.SOPName, obj.LocalID); // m_log.DebugFormat("[PHYSICS]: Removing {0} {1} from collision event reporting", obj.SOPName, obj.LocalID);
lock (_collisionEventPrimChanges) lock (m_collisionEventActorsChanges)
_collisionEventPrimChanges[obj.LocalID] = null; m_collisionEventActorsChanges[obj.LocalID] = null;
} }
#region Add/Remove Entities #region Add/Remove Entities
@ -2930,17 +2930,17 @@ namespace OpenSim.Region.Physics.OdePlugin
// We change _collisionEventPrimChanges to avoid locking _collisionEventPrim itself and causing potential // We change _collisionEventPrimChanges to avoid locking _collisionEventPrim itself and causing potential
// deadlock if the collision event tries to lock something else later on which is already locked by a // deadlock if the collision event tries to lock something else later on which is already locked by a
// caller that is adding or removing the collision event. // caller that is adding or removing the collision event.
lock (_collisionEventPrimChanges) lock (m_collisionEventActorsChanges)
{ {
foreach (KeyValuePair<uint, PhysicsActor> kvp in _collisionEventPrimChanges) foreach (KeyValuePair<uint, PhysicsActor> kvp in m_collisionEventActorsChanges)
{ {
if (kvp.Value == null) if (kvp.Value == null)
_collisionEventPrim.Remove(kvp.Key); m_collisionEventActors.Remove(kvp.Key);
else else
_collisionEventPrim[kvp.Key] = kvp.Value; m_collisionEventActors[kvp.Key] = kvp.Value;
} }
_collisionEventPrimChanges.Clear(); m_collisionEventActorsChanges.Clear();
} }
if (SupportsNINJAJoints) if (SupportsNINJAJoints)
@ -3092,7 +3092,7 @@ namespace OpenSim.Region.Physics.OdePlugin
tempTick = tempTick2; tempTick = tempTick2;
} }
foreach (PhysicsActor obj in _collisionEventPrim.Values) foreach (PhysicsActor obj in m_collisionEventActors.Values)
{ {
// m_log.DebugFormat("[PHYSICS]: Assessing {0} {1} for collision events", obj.SOPName, obj.LocalID); // m_log.DebugFormat("[PHYSICS]: Assessing {0} {1} for collision events", obj.SOPName, obj.LocalID);
@ -3227,10 +3227,10 @@ namespace OpenSim.Region.Physics.OdePlugin
} }
tickCountFrameRun = Util.EnvironmentTickCount(); tickCountFrameRun = Util.EnvironmentTickCount();
}
if (CollectStats) if (CollectStats)
m_stats[ODETotalFrameMsStatName] += Util.EnvironmentTickCountSubtract(startFrameTick); m_stats[ODETotalFrameMsStatName] += Util.EnvironmentTickCountSubtract(startFrameTick);
}
return fps; return fps;
} }

View File

@ -3266,16 +3266,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
} }
private void DetachWrapper(object o) private void DetachWrapper(object o)
{
if (World.AttachmentsModule != null)
{ {
SceneObjectPart host = (SceneObjectPart)o; SceneObjectPart host = (SceneObjectPart)o;
SceneObjectGroup grp = host.ParentGroup;
UUID itemID = grp.FromItemID;
ScenePresence presence = World.GetScenePresence(host.OwnerID); ScenePresence presence = World.GetScenePresence(host.OwnerID);
World.AttachmentsModule.DetachSingleAttachmentToInv(presence, host.ParentGroup);
IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule; }
if (attachmentsModule != null)
attachmentsModule.DetachSingleAttachmentToInv(presence, itemID);
} }
public void llAttachToAvatar(int attachmentPoint) public void llAttachToAvatar(int attachmentPoint)

View File

@ -847,27 +847,34 @@ namespace OpenSim.Region.ScriptEngine.XEngine
if (engine == ScriptEngineName) if (engine == ScriptEngineName)
{ {
// If we are falling back on XEngine as the default engine, then only complain to the user // If we are falling back on XEngine as the default engine, then only complain to the user
// if a script language has been explicitly set and it's one that we recognize. If it's // if a script language has been explicitly set and it's one that we recognize or there are
// no non-whitespace characters after the colon.
//
// If the script is
// explicitly not allowed or the script is not in LSL then the user will be informed by a later compiler message. // explicitly not allowed or the script is not in LSL then the user will be informed by a later compiler message.
// //
// If the colon ends the line then we'll risk the false positive as this is more likely
// to signal a real scriptengine line where the user wants to use the default compile language.
//
// This avoids the overwhelming number of false positives where we're in this code because // This avoids the overwhelming number of false positives where we're in this code because
// there's a colon in a comment in the first line of a script for entirely // there's a colon in a comment in the first line of a script for entirely
// unrelated reasons (e.g. vim settings). // unrelated reasons (e.g. vim settings).
// //
// TODO: A better fix would be to deprecate simple : detection and look for some less likely // TODO: A better fix would be to deprecate simple : detection and look for some less likely
// string to begin the comment (like #! in unix shell scripts). // string to begin the comment (like #! in unix shell scripts).
bool scriptExplicitlyInXEngineLanguage = false; bool warnRunningInXEngine = false;
string restOfScript = script.Substring(colon + 1); string restOfFirstLine = firstline.Substring(colon + 1);
// FIXME: These are hardcoded because they are currently hardcoded in Compiler.cs // FIXME: These are hardcoded because they are currently hardcoded in Compiler.cs
if (restOfScript.StartsWith("c#") if (restOfFirstLine.StartsWith("c#")
|| restOfScript.StartsWith("vb") || restOfFirstLine.StartsWith("vb")
|| restOfScript.StartsWith("lsl") || restOfFirstLine.StartsWith("lsl")
|| restOfScript.StartsWith("js") || restOfFirstLine.StartsWith("js")
|| restOfScript.StartsWith("yp")) || restOfFirstLine.StartsWith("yp")
scriptExplicitlyInXEngineLanguage = true; || restOfFirstLine.Length == 0)
warnRunningInXEngine = true;
if (scriptExplicitlyInXEngineLanguage) if (warnRunningInXEngine)
{ {
SceneObjectPart part = SceneObjectPart part =
m_Scene.GetSceneObjectPart( m_Scene.GetSceneObjectPart(