Merge branch 'ubitworkmaster'

avinationmerge
Melanie Thielker 2014-09-22 18:50:06 +02:00
commit 4cc552162e
7 changed files with 80 additions and 55 deletions

View File

@ -308,7 +308,8 @@ namespace OpenSim.Data.MySQL
/// <param name="uuid">the Item UUID</param>
private void RemoveItems(UUID uuid)
{
lock (m_dbLock)
// locked by caller
// lock (m_dbLock)
{
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{

View File

@ -2548,6 +2548,11 @@ namespace OpenSim.Region.Framework.Scenes
return false;
}
public void updateScenePartGroup(SceneObjectPart part, SceneObjectGroup grp)
{
m_sceneGraph.updateScenePartGroup(part, grp);
}
/// <summary>
/// Move the given scene object into a new region depending on which region its absolute position has moved
/// into.

View File

@ -296,13 +296,15 @@ namespace OpenSim.Region.Framework.Scenes
}
}
bool ret = AddSceneObject(sceneObject, attachToBackup, sendClientUpdates);
if (attachToBackup && (!alreadyPersisted))
{
sceneObject.ForceInventoryPersistence();
sceneObject.HasGroupChanged = true;
}
return AddSceneObject(sceneObject, attachToBackup, sendClientUpdates);
return ret;
}
/// <summary>
@ -319,12 +321,17 @@ namespace OpenSim.Region.Framework.Scenes
/// </returns>
protected internal bool AddNewSceneObject(SceneObjectGroup sceneObject, bool attachToBackup, bool sendClientUpdates)
{
// Ensure that we persist this new scene object if it's not an
bool ret = AddSceneObject(sceneObject, attachToBackup, sendClientUpdates);
// Ensure that we persist this new scene object if it's not an
// attachment
if (attachToBackup)
sceneObject.HasGroupChanged = true;
return AddSceneObject(sceneObject, attachToBackup, sendClientUpdates);
return ret;
}
/// <summary>
@ -432,13 +439,9 @@ namespace OpenSim.Region.Framework.Scenes
sceneObject.AttachToScene(m_parentScene);
if (sendClientUpdates)
sceneObject.ScheduleGroupForFullUpdate();
Entities.Add(sceneObject);
if (attachToBackup)
sceneObject.AttachToBackup();
lock (SceneObjectGroupsByFullID)
SceneObjectGroupsByFullID[sceneObject.UUID] = sceneObject;
@ -459,9 +462,29 @@ namespace OpenSim.Region.Framework.Scenes
SceneObjectGroupsByLocalPartID[part.LocalId] = sceneObject;
}
if (sendClientUpdates)
sceneObject.ScheduleGroupForFullUpdate();
if (attachToBackup)
sceneObject.AttachToBackup();
return true;
}
public void updateScenePartGroup(SceneObjectPart part, SceneObjectGroup grp)
{
// no tests, caller has responsability...
lock (SceneObjectGroupsByFullPartID)
{
SceneObjectGroupsByFullPartID[part.UUID] = grp;
}
lock (SceneObjectGroupsByLocalPartID)
{
SceneObjectGroupsByLocalPartID[part.LocalId] = grp;
}
}
/// <summary>
/// Delete an object from the scene
/// </summary>
@ -1804,7 +1827,7 @@ namespace OpenSim.Region.Framework.Scenes
List<SceneObjectGroup> childGroups = new List<SceneObjectGroup>();
// We do this in reverse to get the link order of the prims correct
for (int i = 0 ; i < children.Count ; i++)
for (int i = 0; i < children.Count; i++)
{
SceneObjectGroup child = children[i].ParentGroup;
@ -1850,12 +1873,13 @@ namespace OpenSim.Region.Framework.Scenes
}
finally
{
/*
lock (SceneObjectGroupsByLocalPartID)
{
foreach (SceneObjectPart part in parentGroup.Parts)
SceneObjectGroupsByLocalPartID[part.LocalId] = parentGroup;
}
*/
parentGroup.AdjustChildPrimPermissions();
parentGroup.HasGroupChanged = true;
parentGroup.ProcessBackup(m_parentScene.SimulationDataService, true);
@ -1938,19 +1962,16 @@ namespace OpenSim.Region.Framework.Scenes
// slated for unlink, we need to do this
// Unlink the remaining set
//
bool sendEventsToRemainder = true;
if (numChildren > 1)
sendEventsToRemainder = false;
bool sendEventsToRemainder = false;
if (numChildren == 2) // only one child prim no re-link needed
sendEventsToRemainder = true;
foreach (SceneObjectPart p in newSet)
{
if (p != group.RootPart)
{
group.DelinkFromGroup(p, sendEventsToRemainder);
if (numChildren > 2)
{
}
else
if (sendEventsToRemainder) // finish single child prim now
{
p.ParentGroup.HasGroupChanged = true;
p.ParentGroup.ScheduleGroupForFullUpdate();
@ -1984,8 +2005,8 @@ namespace OpenSim.Region.Framework.Scenes
newChild.ClearUpdateSchedule();
LinkObjects(newRoot, newSet);
if (!affectedGroups.Contains(newRoot.ParentGroup))
affectedGroups.Add(newRoot.ParentGroup);
// if (!affectedGroups.Contains(newRoot.ParentGroup))
// affectedGroups.Add(newRoot.ParentGroup);
}
}

View File

@ -2560,11 +2560,8 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="cGroupID"></param>
public SceneObjectPart CopyPart(SceneObjectPart part, UUID cAgentID, UUID cGroupID, bool userExposed)
{
// give new ID to the new part, letting old keep original
// SceneObjectPart newPart = part.Copy(m_scene.AllocateLocalId(), OwnerID, GroupID, m_parts.Count, userExposed);
SceneObjectPart newPart = part.Copy(part.LocalId, OwnerID, GroupID, m_parts.Count, userExposed);
newPart.LocalId = m_scene.AllocateLocalId();
newPart.SetParent(this);
AddPart(newPart);
@ -2977,6 +2974,8 @@ namespace OpenSim.Region.Framework.Scenes
m_parts.Add(linkPart.UUID, linkPart);
linkPart.SetParent(this);
m_scene.updateScenePartGroup(linkPart, this);
linkPart.CreateSelected = true;
// let physics know preserve part volume dtc messy since UpdatePrimFlags doesn't look to parent changes for now
@ -3178,9 +3177,6 @@ namespace OpenSim.Region.Framework.Scenes
m_scene.AddNewSceneObject(objectGroup, true);
if (sendEvents)
linkPart.TriggerScriptChangedEvent(Changed.LINK);
linkPart.Rezzed = RootPart.Rezzed;
// When we delete a group, we currently have to force persist to the database if the object id has changed
@ -3195,6 +3191,9 @@ namespace OpenSim.Region.Framework.Scenes
objectGroup.HasGroupChangedDueToDelink = true;
if (sendEvents)
linkPart.TriggerScriptChangedEvent(Changed.LINK);
return objectGroup;
}
@ -3239,8 +3238,11 @@ namespace OpenSim.Region.Framework.Scenes
part.ParentID = m_rootPart.LocalId;
m_parts.Add(part.UUID, part);
part.LinkNum = linkNum;
m_scene.updateScenePartGroup(part, this);
// Compute the new position of this SOP relative to the group position
part.OffsetPosition = newPos - AbsolutePosition;

View File

@ -505,35 +505,24 @@ namespace OpenSim.Region.Framework.Scenes
private void CreateScriptInstanceInternal(UUID itemId, int startParam, bool postOnRez, string engine, int stateSource)
{
m_items.LockItemsForRead(true);
if (m_items.ContainsKey(itemId))
{
if (m_items.ContainsKey(itemId))
{
m_items.LockItemsForRead(false);
CreateScriptInstance(m_items[itemId], startParam, postOnRez, engine, stateSource);
}
else
{
m_items.LockItemsForRead(false);
string msg = String.Format("couldn't be found for prim {0}, {1} at {2} in {3}", m_part.Name, m_part.UUID,
m_part.AbsolutePosition, m_part.ParentGroup.Scene.RegionInfo.RegionName);
StoreScriptError(itemId, msg);
m_log.ErrorFormat(
"[PRIM INVENTORY]: " +
"Couldn't start script with ID {0} since it {1}", itemId, msg);
}
TaskInventoryItem it = m_items[itemId];
m_items.LockItemsForRead(false);
CreateScriptInstance(it, startParam, postOnRez, engine, stateSource);
}
else
{
m_items.LockItemsForRead(false);
string msg = String.Format("couldn't be found for prim {0}, {1}", m_part.Name, m_part.UUID);
string msg = String.Format("couldn't be found for prim {0}, {1} at {2} in {3}", m_part.Name, m_part.UUID,
m_part.AbsolutePosition, m_part.ParentGroup.Scene.RegionInfo.RegionName);
StoreScriptError(itemId, msg);
m_log.ErrorFormat(
"[PRIM INVENTORY]: Couldn't start script with ID {0} since it couldn't be found for prim {1}, {2} at {3} in {4}",
itemId, m_part.Name, m_part.UUID,
m_part.AbsolutePosition, m_part.ParentGroup.Scene.RegionInfo.RegionName);
"[PRIM INVENTORY]: " +
"Couldn't start script with ID {0} since it {1}", itemId, msg);
}
}
/// <summary>
@ -1144,26 +1133,28 @@ namespace OpenSim.Region.Framework.Scenes
if (m_inventorySerial == 0) // No inventory
{
client.SendTaskInventory(m_part.UUID, 0, new byte[0]);
Items.LockItemsForRead(false);
client.SendTaskInventory(m_part.UUID, 0, new byte[0]);
return;
}
if (m_items.Count == 0) // No inventory
{
client.SendTaskInventory(m_part.UUID, 0, new byte[0]);
Items.LockItemsForRead(false);
client.SendTaskInventory(m_part.UUID, 0, new byte[0]);
return;
}
if (!changed)
{
Items.LockItemsForRead(false);
xferManager.AddNewFile(filename,
m_inventoryFileData);
client.SendTaskInventory(m_part.UUID, (short)m_inventoryFileNameSerial,
Util.StringToBytes256(filename));
Items.LockItemsForRead(false);
return;
}
@ -1249,10 +1240,17 @@ namespace OpenSim.Region.Framework.Scenes
// if (HasInventoryChanged)
// {
Items.LockItemsForRead(true);
datastore.StorePrimInventory(m_part.UUID, Items.Values);
Items.LockItemsForRead(false);
try
{
datastore.StorePrimInventory(m_part.UUID, Items.Values);
}
catch {}
HasInventoryChanged = false;
Items.LockItemsForRead(false);
// }
}

View File

@ -5283,7 +5283,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
return item.AssetID.ToString();
}
m_host.TaskInventory.LockItemsForRead(false);
return UUID.Zero.ToString();
}
@ -10203,7 +10202,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
case 4:
return (int)item.NextPermissions;
}
m_host.TaskInventory.LockItemsForRead(false);
return -1;
}

View File

@ -991,7 +991,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
else
animID = UUID.Zero;
}
m_host.TaskInventory.LockItemsForRead(false);
if (animID == UUID.Zero)
target.Animator.RemoveAnimation(animation);