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> /// <param name="uuid">the Item UUID</param>
private void RemoveItems(UUID uuid) private void RemoveItems(UUID uuid)
{ {
lock (m_dbLock) // locked by caller
// lock (m_dbLock)
{ {
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{ {

View File

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

View File

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

View File

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

View File

@ -505,12 +505,13 @@ namespace OpenSim.Region.Framework.Scenes
private void CreateScriptInstanceInternal(UUID itemId, int startParam, bool postOnRez, string engine, int stateSource) private void CreateScriptInstanceInternal(UUID itemId, int startParam, bool postOnRez, string engine, int stateSource)
{ {
m_items.LockItemsForRead(true); m_items.LockItemsForRead(true);
if (m_items.ContainsKey(itemId)) if (m_items.ContainsKey(itemId))
{ {
if (m_items.ContainsKey(itemId)) TaskInventoryItem it = m_items[itemId];
{
m_items.LockItemsForRead(false); m_items.LockItemsForRead(false);
CreateScriptInstance(m_items[itemId], startParam, postOnRez, engine, stateSource);
CreateScriptInstance(it, startParam, postOnRez, engine, stateSource);
} }
else else
{ {
@ -523,18 +524,6 @@ namespace OpenSim.Region.Framework.Scenes
"Couldn't start script with ID {0} since it {1}", itemId, msg); "Couldn't start script with ID {0} since it {1}", itemId, msg);
} }
} }
else
{
m_items.LockItemsForRead(false);
string msg = String.Format("couldn't be found for prim {0}, {1}", m_part.Name, m_part.UUID);
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);
}
}
/// <summary> /// <summary>
/// Start a script which is in this prim's inventory and return any compilation error messages. /// Start a script which is in this prim's inventory and return any compilation error messages.
@ -1144,26 +1133,28 @@ namespace OpenSim.Region.Framework.Scenes
if (m_inventorySerial == 0) // No inventory if (m_inventorySerial == 0) // No inventory
{ {
client.SendTaskInventory(m_part.UUID, 0, new byte[0]);
Items.LockItemsForRead(false); Items.LockItemsForRead(false);
client.SendTaskInventory(m_part.UUID, 0, new byte[0]);
return; return;
} }
if (m_items.Count == 0) // No inventory if (m_items.Count == 0) // No inventory
{ {
client.SendTaskInventory(m_part.UUID, 0, new byte[0]);
Items.LockItemsForRead(false); Items.LockItemsForRead(false);
client.SendTaskInventory(m_part.UUID, 0, new byte[0]);
return; return;
} }
if (!changed) if (!changed)
{ {
Items.LockItemsForRead(false);
xferManager.AddNewFile(filename, xferManager.AddNewFile(filename,
m_inventoryFileData); m_inventoryFileData);
client.SendTaskInventory(m_part.UUID, (short)m_inventoryFileNameSerial, client.SendTaskInventory(m_part.UUID, (short)m_inventoryFileNameSerial,
Util.StringToBytes256(filename)); Util.StringToBytes256(filename));
Items.LockItemsForRead(false);
return; return;
} }
@ -1249,10 +1240,17 @@ namespace OpenSim.Region.Framework.Scenes
// if (HasInventoryChanged) // if (HasInventoryChanged)
// { // {
Items.LockItemsForRead(true); Items.LockItemsForRead(true);
try
{
datastore.StorePrimInventory(m_part.UUID, Items.Values); datastore.StorePrimInventory(m_part.UUID, Items.Values);
Items.LockItemsForRead(false); }
catch {}
HasInventoryChanged = false; HasInventoryChanged = false;
Items.LockItemsForRead(false);
// } // }
} }

View File

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

View File

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