aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorMelanie Thielker2014-09-22 18:50:06 +0200
committerMelanie Thielker2014-09-22 18:50:06 +0200
commit4cc552162ed898305b2997b841483bd513296af4 (patch)
tree7d6ada0ef70a46322eeeb11d8596f7c95a1cc6fb /OpenSim/Region
parentWhen a ghosted avatar is removed, also remove any remaining CAPS (diff)
parent a few more changes on link/unlink (diff)
downloadopensim-SC_OLD-4cc552162ed898305b2997b841483bd513296af4.zip
opensim-SC_OLD-4cc552162ed898305b2997b841483bd513296af4.tar.gz
opensim-SC_OLD-4cc552162ed898305b2997b841483bd513296af4.tar.bz2
opensim-SC_OLD-4cc552162ed898305b2997b841483bd513296af4.tar.xz
Merge branch 'ubitworkmaster'
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs5
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneGraph.cs61
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs14
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs48
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs2
6 files changed, 78 insertions, 54 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 769b4e8..087df70 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -2548,6 +2548,11 @@ namespace OpenSim.Region.Framework.Scenes
2548 return false; 2548 return false;
2549 } 2549 }
2550 2550
2551
2552 public void updateScenePartGroup(SceneObjectPart part, SceneObjectGroup grp)
2553 {
2554 m_sceneGraph.updateScenePartGroup(part, grp);
2555 }
2551 /// <summary> 2556 /// <summary>
2552 /// Move the given scene object into a new region depending on which region its absolute position has moved 2557 /// Move the given scene object into a new region depending on which region its absolute position has moved
2553 /// into. 2558 /// into.
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index 973891b..8a65b06 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -296,13 +296,15 @@ namespace OpenSim.Region.Framework.Scenes
296 } 296 }
297 } 297 }
298 298
299 bool ret = AddSceneObject(sceneObject, attachToBackup, sendClientUpdates);
300
299 if (attachToBackup && (!alreadyPersisted)) 301 if (attachToBackup && (!alreadyPersisted))
300 { 302 {
301 sceneObject.ForceInventoryPersistence(); 303 sceneObject.ForceInventoryPersistence();
302 sceneObject.HasGroupChanged = true; 304 sceneObject.HasGroupChanged = true;
303 } 305 }
304 306
305 return AddSceneObject(sceneObject, attachToBackup, sendClientUpdates); 307 return ret;
306 } 308 }
307 309
308 /// <summary> 310 /// <summary>
@@ -319,12 +321,17 @@ namespace OpenSim.Region.Framework.Scenes
319 /// </returns> 321 /// </returns>
320 protected internal bool AddNewSceneObject(SceneObjectGroup sceneObject, bool attachToBackup, bool sendClientUpdates) 322 protected internal bool AddNewSceneObject(SceneObjectGroup sceneObject, bool attachToBackup, bool sendClientUpdates)
321 { 323 {
322 // Ensure that we persist this new scene object if it's not an 324
325
326 bool ret = AddSceneObject(sceneObject, attachToBackup, sendClientUpdates);
327
328 // Ensure that we persist this new scene object if it's not an
323 // attachment 329 // attachment
330
324 if (attachToBackup) 331 if (attachToBackup)
325 sceneObject.HasGroupChanged = true; 332 sceneObject.HasGroupChanged = true;
326 333
327 return AddSceneObject(sceneObject, attachToBackup, sendClientUpdates); 334 return ret;
328 } 335 }
329 336
330 /// <summary> 337 /// <summary>
@@ -432,13 +439,9 @@ namespace OpenSim.Region.Framework.Scenes
432 439
433 sceneObject.AttachToScene(m_parentScene); 440 sceneObject.AttachToScene(m_parentScene);
434 441
435 if (sendClientUpdates)
436 sceneObject.ScheduleGroupForFullUpdate();
437 442
438 Entities.Add(sceneObject); 443 Entities.Add(sceneObject);
439 444
440 if (attachToBackup)
441 sceneObject.AttachToBackup();
442 445
443 lock (SceneObjectGroupsByFullID) 446 lock (SceneObjectGroupsByFullID)
444 SceneObjectGroupsByFullID[sceneObject.UUID] = sceneObject; 447 SceneObjectGroupsByFullID[sceneObject.UUID] = sceneObject;
@@ -459,9 +462,29 @@ namespace OpenSim.Region.Framework.Scenes
459 SceneObjectGroupsByLocalPartID[part.LocalId] = sceneObject; 462 SceneObjectGroupsByLocalPartID[part.LocalId] = sceneObject;
460 } 463 }
461 464
465 if (sendClientUpdates)
466 sceneObject.ScheduleGroupForFullUpdate();
467
468 if (attachToBackup)
469 sceneObject.AttachToBackup();
470
462 return true; 471 return true;
463 } 472 }
464 473
474 public void updateScenePartGroup(SceneObjectPart part, SceneObjectGroup grp)
475 {
476 // no tests, caller has responsability...
477 lock (SceneObjectGroupsByFullPartID)
478 {
479 SceneObjectGroupsByFullPartID[part.UUID] = grp;
480 }
481
482 lock (SceneObjectGroupsByLocalPartID)
483 {
484 SceneObjectGroupsByLocalPartID[part.LocalId] = grp;
485 }
486 }
487
465 /// <summary> 488 /// <summary>
466 /// Delete an object from the scene 489 /// Delete an object from the scene
467 /// </summary> 490 /// </summary>
@@ -1804,7 +1827,7 @@ namespace OpenSim.Region.Framework.Scenes
1804 List<SceneObjectGroup> childGroups = new List<SceneObjectGroup>(); 1827 List<SceneObjectGroup> childGroups = new List<SceneObjectGroup>();
1805 1828
1806 // We do this in reverse to get the link order of the prims correct 1829 // We do this in reverse to get the link order of the prims correct
1807 for (int i = 0 ; i < children.Count ; i++) 1830 for (int i = 0; i < children.Count; i++)
1808 { 1831 {
1809 SceneObjectGroup child = children[i].ParentGroup; 1832 SceneObjectGroup child = children[i].ParentGroup;
1810 1833
@@ -1815,7 +1838,7 @@ namespace OpenSim.Region.Framework.Scenes
1815 // Make sure no child prim is set for sale 1838 // Make sure no child prim is set for sale
1816 // So that, on delink, no prims are unwittingly 1839 // So that, on delink, no prims are unwittingly
1817 // left for sale and sold off 1840 // left for sale and sold off
1818 1841
1819 if (child != null) 1842 if (child != null)
1820 { 1843 {
1821 child.RootPart.ObjectSaleType = 0; 1844 child.RootPart.ObjectSaleType = 0;
@@ -1850,12 +1873,13 @@ namespace OpenSim.Region.Framework.Scenes
1850 } 1873 }
1851 finally 1874 finally
1852 { 1875 {
1876/*
1853 lock (SceneObjectGroupsByLocalPartID) 1877 lock (SceneObjectGroupsByLocalPartID)
1854 { 1878 {
1855 foreach (SceneObjectPart part in parentGroup.Parts) 1879 foreach (SceneObjectPart part in parentGroup.Parts)
1856 SceneObjectGroupsByLocalPartID[part.LocalId] = parentGroup; 1880 SceneObjectGroupsByLocalPartID[part.LocalId] = parentGroup;
1857 } 1881 }
1858 1882*/
1859 parentGroup.AdjustChildPrimPermissions(); 1883 parentGroup.AdjustChildPrimPermissions();
1860 parentGroup.HasGroupChanged = true; 1884 parentGroup.HasGroupChanged = true;
1861 parentGroup.ProcessBackup(m_parentScene.SimulationDataService, true); 1885 parentGroup.ProcessBackup(m_parentScene.SimulationDataService, true);
@@ -1938,20 +1962,17 @@ namespace OpenSim.Region.Framework.Scenes
1938 // slated for unlink, we need to do this 1962 // slated for unlink, we need to do this
1939 // Unlink the remaining set 1963 // Unlink the remaining set
1940 // 1964 //
1941 bool sendEventsToRemainder = true; 1965 bool sendEventsToRemainder = false;
1942 if (numChildren > 1) 1966 if (numChildren == 2) // only one child prim no re-link needed
1943 sendEventsToRemainder = false; 1967 sendEventsToRemainder = true;
1944 1968
1945 foreach (SceneObjectPart p in newSet) 1969 foreach (SceneObjectPart p in newSet)
1946 { 1970 {
1947 if (p != group.RootPart) 1971 if (p != group.RootPart)
1948 { 1972 {
1949 group.DelinkFromGroup(p, sendEventsToRemainder); 1973 group.DelinkFromGroup(p, sendEventsToRemainder);
1950 if (numChildren > 2) 1974 if (sendEventsToRemainder) // finish single child prim now
1951 { 1975 {
1952 }
1953 else
1954 {
1955 p.ParentGroup.HasGroupChanged = true; 1976 p.ParentGroup.HasGroupChanged = true;
1956 p.ParentGroup.ScheduleGroupForFullUpdate(); 1977 p.ParentGroup.ScheduleGroupForFullUpdate();
1957 } 1978 }
@@ -1984,8 +2005,8 @@ namespace OpenSim.Region.Framework.Scenes
1984 newChild.ClearUpdateSchedule(); 2005 newChild.ClearUpdateSchedule();
1985 2006
1986 LinkObjects(newRoot, newSet); 2007 LinkObjects(newRoot, newSet);
1987 if (!affectedGroups.Contains(newRoot.ParentGroup)) 2008// if (!affectedGroups.Contains(newRoot.ParentGroup))
1988 affectedGroups.Add(newRoot.ParentGroup); 2009// affectedGroups.Add(newRoot.ParentGroup);
1989 } 2010 }
1990 } 2011 }
1991 2012
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 15349e3..ca6f457 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -2560,11 +2560,8 @@ namespace OpenSim.Region.Framework.Scenes
2560 /// <param name="cGroupID"></param> 2560 /// <param name="cGroupID"></param>
2561 public SceneObjectPart CopyPart(SceneObjectPart part, UUID cAgentID, UUID cGroupID, bool userExposed) 2561 public SceneObjectPart CopyPart(SceneObjectPart part, UUID cAgentID, UUID cGroupID, bool userExposed)
2562 { 2562 {
2563 // give new ID to the new part, letting old keep original
2564 // SceneObjectPart newPart = part.Copy(m_scene.AllocateLocalId(), OwnerID, GroupID, m_parts.Count, userExposed);
2565 SceneObjectPart newPart = part.Copy(part.LocalId, OwnerID, GroupID, m_parts.Count, userExposed); 2563 SceneObjectPart newPart = part.Copy(part.LocalId, OwnerID, GroupID, m_parts.Count, userExposed);
2566 newPart.LocalId = m_scene.AllocateLocalId(); 2564 newPart.LocalId = m_scene.AllocateLocalId();
2567 newPart.SetParent(this);
2568 2565
2569 AddPart(newPart); 2566 AddPart(newPart);
2570 2567
@@ -2977,6 +2974,8 @@ namespace OpenSim.Region.Framework.Scenes
2977 m_parts.Add(linkPart.UUID, linkPart); 2974 m_parts.Add(linkPart.UUID, linkPart);
2978 2975
2979 linkPart.SetParent(this); 2976 linkPart.SetParent(this);
2977 m_scene.updateScenePartGroup(linkPart, this);
2978
2980 linkPart.CreateSelected = true; 2979 linkPart.CreateSelected = true;
2981 2980
2982 // let physics know preserve part volume dtc messy since UpdatePrimFlags doesn't look to parent changes for now 2981 // 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
3178 3177
3179 m_scene.AddNewSceneObject(objectGroup, true); 3178 m_scene.AddNewSceneObject(objectGroup, true);
3180 3179
3181 if (sendEvents)
3182 linkPart.TriggerScriptChangedEvent(Changed.LINK);
3183
3184 linkPart.Rezzed = RootPart.Rezzed; 3180 linkPart.Rezzed = RootPart.Rezzed;
3185 3181
3186 // When we delete a group, we currently have to force persist to the database if the object id has changed 3182 // 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
3195 3191
3196 objectGroup.HasGroupChangedDueToDelink = true; 3192 objectGroup.HasGroupChangedDueToDelink = true;
3197 3193
3194 if (sendEvents)
3195 linkPart.TriggerScriptChangedEvent(Changed.LINK);
3196
3198 return objectGroup; 3197 return objectGroup;
3199 } 3198 }
3200 3199
@@ -3238,9 +3237,12 @@ namespace OpenSim.Region.Framework.Scenes
3238 part.SetParent(this); 3237 part.SetParent(this);
3239 part.ParentID = m_rootPart.LocalId; 3238 part.ParentID = m_rootPart.LocalId;
3240 m_parts.Add(part.UUID, part); 3239 m_parts.Add(part.UUID, part);
3240
3241 3241
3242 part.LinkNum = linkNum; 3242 part.LinkNum = linkNum;
3243 3243
3244 m_scene.updateScenePartGroup(part, this);
3245
3244 // Compute the new position of this SOP relative to the group position 3246 // Compute the new position of this SOP relative to the group position
3245 part.OffsetPosition = newPos - AbsolutePosition; 3247 part.OffsetPosition = newPos - AbsolutePosition;
3246 3248
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
index 7328a39..2fa9139 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
@@ -505,35 +505,24 @@ namespace OpenSim.Region.Framework.Scenes
505 private void CreateScriptInstanceInternal(UUID itemId, int startParam, bool postOnRez, string engine, int stateSource) 505 private void CreateScriptInstanceInternal(UUID itemId, int startParam, bool postOnRez, string engine, int stateSource)
506 { 506 {
507 m_items.LockItemsForRead(true); 507 m_items.LockItemsForRead(true);
508
508 if (m_items.ContainsKey(itemId)) 509 if (m_items.ContainsKey(itemId))
509 { 510 {
510 if (m_items.ContainsKey(itemId)) 511 TaskInventoryItem it = m_items[itemId];
511 { 512 m_items.LockItemsForRead(false);
512 m_items.LockItemsForRead(false); 513
513 CreateScriptInstance(m_items[itemId], startParam, postOnRez, engine, stateSource); 514 CreateScriptInstance(it, startParam, postOnRez, engine, stateSource);
514 }
515 else
516 {
517 m_items.LockItemsForRead(false);
518 string msg = String.Format("couldn't be found for prim {0}, {1} at {2} in {3}", m_part.Name, m_part.UUID,
519 m_part.AbsolutePosition, m_part.ParentGroup.Scene.RegionInfo.RegionName);
520 StoreScriptError(itemId, msg);
521 m_log.ErrorFormat(
522 "[PRIM INVENTORY]: " +
523 "Couldn't start script with ID {0} since it {1}", itemId, msg);
524 }
525 } 515 }
526 else 516 else
527 { 517 {
528 m_items.LockItemsForRead(false); 518 m_items.LockItemsForRead(false);
529 string msg = String.Format("couldn't be found for prim {0}, {1}", m_part.Name, m_part.UUID); 519 string msg = String.Format("couldn't be found for prim {0}, {1} at {2} in {3}", m_part.Name, m_part.UUID,
520 m_part.AbsolutePosition, m_part.ParentGroup.Scene.RegionInfo.RegionName);
530 StoreScriptError(itemId, msg); 521 StoreScriptError(itemId, msg);
531 m_log.ErrorFormat( 522 m_log.ErrorFormat(
532 "[PRIM INVENTORY]: Couldn't start script with ID {0} since it couldn't be found for prim {1}, {2} at {3} in {4}", 523 "[PRIM INVENTORY]: " +
533 itemId, m_part.Name, m_part.UUID, 524 "Couldn't start script with ID {0} since it {1}", itemId, msg);
534 m_part.AbsolutePosition, m_part.ParentGroup.Scene.RegionInfo.RegionName);
535 } 525 }
536
537 } 526 }
538 527
539 /// <summary> 528 /// <summary>
@@ -1144,26 +1133,28 @@ namespace OpenSim.Region.Framework.Scenes
1144 1133
1145 if (m_inventorySerial == 0) // No inventory 1134 if (m_inventorySerial == 0) // No inventory
1146 { 1135 {
1147 client.SendTaskInventory(m_part.UUID, 0, new byte[0]);
1148 Items.LockItemsForRead(false); 1136 Items.LockItemsForRead(false);
1137 client.SendTaskInventory(m_part.UUID, 0, new byte[0]);
1138
1149 return; 1139 return;
1150 } 1140 }
1151 1141
1152 if (m_items.Count == 0) // No inventory 1142 if (m_items.Count == 0) // No inventory
1153 { 1143 {
1154 client.SendTaskInventory(m_part.UUID, 0, new byte[0]);
1155 Items.LockItemsForRead(false); 1144 Items.LockItemsForRead(false);
1145 client.SendTaskInventory(m_part.UUID, 0, new byte[0]);
1156 return; 1146 return;
1157 } 1147 }
1158 1148
1159 if (!changed) 1149 if (!changed)
1160 { 1150 {
1151 Items.LockItemsForRead(false);
1152
1161 xferManager.AddNewFile(filename, 1153 xferManager.AddNewFile(filename,
1162 m_inventoryFileData); 1154 m_inventoryFileData);
1163 client.SendTaskInventory(m_part.UUID, (short)m_inventoryFileNameSerial, 1155 client.SendTaskInventory(m_part.UUID, (short)m_inventoryFileNameSerial,
1164 Util.StringToBytes256(filename)); 1156 Util.StringToBytes256(filename));
1165 1157
1166 Items.LockItemsForRead(false);
1167 return; 1158 return;
1168 } 1159 }
1169 1160
@@ -1249,10 +1240,17 @@ namespace OpenSim.Region.Framework.Scenes
1249// if (HasInventoryChanged) 1240// if (HasInventoryChanged)
1250// { 1241// {
1251 Items.LockItemsForRead(true); 1242 Items.LockItemsForRead(true);
1252 datastore.StorePrimInventory(m_part.UUID, Items.Values); 1243 try
1253 Items.LockItemsForRead(false); 1244 {
1245 datastore.StorePrimInventory(m_part.UUID, Items.Values);
1246 }
1247 catch {}
1254 1248
1255 HasInventoryChanged = false; 1249 HasInventoryChanged = false;
1250
1251 Items.LockItemsForRead(false);
1252
1253
1256// } 1254// }
1257 } 1255 }
1258 1256
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index ca682d3..eb6cf23 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -5283,7 +5283,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5283 { 5283 {
5284 return item.AssetID.ToString(); 5284 return item.AssetID.ToString();
5285 } 5285 }
5286 m_host.TaskInventory.LockItemsForRead(false);
5287 5286
5288 return UUID.Zero.ToString(); 5287 return UUID.Zero.ToString();
5289 } 5288 }
@@ -10203,7 +10202,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
10203 case 4: 10202 case 4:
10204 return (int)item.NextPermissions; 10203 return (int)item.NextPermissions;
10205 } 10204 }
10206 m_host.TaskInventory.LockItemsForRead(false);
10207 10205
10208 return -1; 10206 return -1;
10209 } 10207 }
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index 7081416..d2a5980 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -991,7 +991,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
991 else 991 else
992 animID = UUID.Zero; 992 animID = UUID.Zero;
993 } 993 }
994 m_host.TaskInventory.LockItemsForRead(false); 994
995 995
996 if (animID == UUID.Zero) 996 if (animID == UUID.Zero)
997 target.Animator.RemoveAnimation(animation); 997 target.Animator.RemoveAnimation(animation);