aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs6
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs43
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneGraph.cs34
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneManager.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs4
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs17
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs59
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs17
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs6
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneViewer.cs10
12 files changed, 169 insertions, 33 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index cedf405..2aad4f0 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -1225,6 +1225,7 @@ namespace OpenSim.Region.Framework.Scenes
1225 item = CommsManager.UserProfileCacheService.LibraryRoot.FindItem(itemID); 1225 item = CommsManager.UserProfileCacheService.LibraryRoot.FindItem(itemID);
1226 } 1226 }
1227 1227
1228 // If we've found the item in the user's inventory or in the library
1228 if (item != null) 1229 if (item != null)
1229 { 1230 {
1230 part.ParentGroup.AddInventoryItem(remoteClient, primLocalID, item, copyID); 1231 part.ParentGroup.AddInventoryItem(remoteClient, primLocalID, item, copyID);
@@ -2458,6 +2459,8 @@ namespace OpenSim.Region.Framework.Scenes
2458 return; 2459 return;
2459 } 2460 }
2460 2461
2462// m_log.DebugFormat("[SCENE INVENTORY]: {0} {1} IsAttachment={2}", att.Name, att.LocalId, att.IsAttachment);
2463// Console.WriteLine("HERE X");
2461 ScenePresence presence; 2464 ScenePresence presence;
2462 if (TryGetAvatar(remoteClient.AgentId, out presence)) 2465 if (TryGetAvatar(remoteClient.AgentId, out presence))
2463 { 2466 {
@@ -2465,9 +2468,12 @@ namespace OpenSim.Region.Framework.Scenes
2465 InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); 2468 InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId);
2466 item = InventoryService.GetItem(item); 2469 item = InventoryService.GetItem(item);
2467 presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /*att.UUID*/); 2470 presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /*att.UUID*/);
2471// Console.WriteLine("HERE Y");
2468 2472
2469 if (m_AvatarFactory != null) 2473 if (m_AvatarFactory != null)
2470 m_AvatarFactory.UpdateDatabase(remoteClient.AgentId, presence.Appearance); 2474 m_AvatarFactory.UpdateDatabase(remoteClient.AgentId, presence.Appearance);
2475
2476// Console.WriteLine("HERE Z");
2471 } 2477 }
2472 } 2478 }
2473 2479
diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
index ac04dc7..869efd7 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
@@ -116,6 +116,8 @@ namespace OpenSim.Region.Framework.Scenes
116 /// <param name="remoteClient"></param> 116 /// <param name="remoteClient"></param>
117 public void RequestPrim(uint primLocalID, IClientAPI remoteClient) 117 public void RequestPrim(uint primLocalID, IClientAPI remoteClient)
118 { 118 {
119// m_log.DebugFormat("[SCENE]: {0} requested full update for {1}", remoteClient.Name, primLocalID);
120
119 List<EntityBase> EntityList = GetEntities(); 121 List<EntityBase> EntityList = GetEntities();
120 122
121 foreach (EntityBase ent in EntityList) 123 foreach (EntityBase ent in EntityList)
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 4bd3222..221eb47 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -1891,9 +1891,31 @@ namespace OpenSim.Region.Framework.Scenes
1891 /// true if the object was added, false if an object with the same uuid was already in the scene 1891 /// true if the object was added, false if an object with the same uuid was already in the scene
1892 /// </returns> 1892 /// </returns>
1893 public bool AddRestoredSceneObject( 1893 public bool AddRestoredSceneObject(
1894 SceneObjectGroup sceneObject, bool attachToBackup, bool alreadyPersisted, bool sendClientUpdates)
1895 {
1896 return m_sceneGraph.AddRestoredSceneObject(sceneObject, attachToBackup, alreadyPersisted, sendClientUpdates);
1897 }
1898
1899 /// <summary>
1900 /// Add an object into the scene that has come from storage
1901 /// </summary>
1902 ///
1903 /// <param name="sceneObject"></param>
1904 /// <param name="attachToBackup">
1905 /// If true, changes to the object will be reflected in its persisted data
1906 /// If false, the persisted data will not be changed even if the object in the scene is changed
1907 /// </param>
1908 /// <param name="alreadyPersisted">
1909 /// If true, we won't persist this object until it changes
1910 /// If false, we'll persist this object immediately
1911 /// </param>
1912 /// <returns>
1913 /// true if the object was added, false if an object with the same uuid was already in the scene
1914 /// </returns>
1915 public bool AddRestoredSceneObject(
1894 SceneObjectGroup sceneObject, bool attachToBackup, bool alreadyPersisted) 1916 SceneObjectGroup sceneObject, bool attachToBackup, bool alreadyPersisted)
1895 { 1917 {
1896 return m_sceneGraph.AddRestoredSceneObject(sceneObject, attachToBackup, alreadyPersisted); 1918 return AddRestoredSceneObject(sceneObject, attachToBackup, alreadyPersisted, true);
1897 } 1919 }
1898 1920
1899 /// <summary> 1921 /// <summary>
@@ -2506,7 +2528,7 @@ namespace OpenSim.Region.Framework.Scenes
2506 /// <returns></returns> 2528 /// <returns></returns>
2507 public bool IncomingCreateObject(ISceneObject sog) 2529 public bool IncomingCreateObject(ISceneObject sog)
2508 { 2530 {
2509 //m_log.Debug(" >>> IncomingCreateObject(sog) <<< " + ((SceneObjectGroup)sog).AbsolutePosition + " deleted? " + ((SceneObjectGroup)sog).IsDeleted); 2531// m_log.Debug(" >>> IncomingCreateObject(sog) <<< " + ((SceneObjectGroup)sog).AbsolutePosition + " deleted? " + ((SceneObjectGroup)sog).IsDeleted);
2510 SceneObjectGroup newObject; 2532 SceneObjectGroup newObject;
2511 try 2533 try
2512 { 2534 {
@@ -2578,10 +2600,12 @@ namespace OpenSim.Region.Framework.Scenes
2578 2600
2579 if (sceneObject.IsAttachmentCheckFull()) // Attachment 2601 if (sceneObject.IsAttachmentCheckFull()) // Attachment
2580 { 2602 {
2603// m_log.DebugFormat("[SCENE]: Adding attachment {0} {1}", sceneObject.Name, sceneObject.LocalId);
2604
2581 sceneObject.RootPart.AddFlag(PrimFlags.TemporaryOnRez); 2605 sceneObject.RootPart.AddFlag(PrimFlags.TemporaryOnRez);
2582 sceneObject.RootPart.AddFlag(PrimFlags.Phantom); 2606 sceneObject.RootPart.AddFlag(PrimFlags.Phantom);
2583 2607
2584 AddRestoredSceneObject(sceneObject, false, false); 2608 AddRestoredSceneObject(sceneObject, false, false, false);
2585 2609
2586 // Handle attachment special case 2610 // Handle attachment special case
2587 SceneObjectPart RootPrim = sceneObject.RootPart; 2611 SceneObjectPart RootPrim = sceneObject.RootPart;
@@ -2589,6 +2613,8 @@ namespace OpenSim.Region.Framework.Scenes
2589 // Fix up attachment Parent Local ID 2613 // Fix up attachment Parent Local ID
2590 ScenePresence sp = GetScenePresence(sceneObject.OwnerID); 2614 ScenePresence sp = GetScenePresence(sceneObject.OwnerID);
2591 2615
2616// Console.WriteLine("AAAA");
2617
2592 //uint parentLocalID = 0; 2618 //uint parentLocalID = 0;
2593 if (sp != null) 2619 if (sp != null)
2594 { 2620 {
@@ -2607,20 +2633,25 @@ namespace OpenSim.Region.Framework.Scenes
2607 //grp.SetFromAssetID(grp.RootPart.LastOwnerID); 2633 //grp.SetFromAssetID(grp.RootPart.LastOwnerID);
2608 m_log.DebugFormat( 2634 m_log.DebugFormat(
2609 "[ATTACHMENT]: Attach to avatar {0} at position {1}", sp.UUID, grp.AbsolutePosition); 2635 "[ATTACHMENT]: Attach to avatar {0} at position {1}", sp.UUID, grp.AbsolutePosition);
2610 2636
2637 RootPrim.RemFlag(PrimFlags.TemporaryOnRez);
2611 AttachObject( 2638 AttachObject(
2612 sp.ControllingClient, grp.LocalId, (uint)0, grp.GroupRotation, grp.AbsolutePosition, false); 2639 sp.ControllingClient, grp.LocalId, (uint)0, grp.GroupRotation, grp.AbsolutePosition, false);
2613 RootPrim.RemFlag(PrimFlags.TemporaryOnRez); 2640
2614 grp.SendGroupFullUpdate(); 2641 //grp.SendGroupFullUpdate();
2615 } 2642 }
2616 else 2643 else
2617 { 2644 {
2618 RootPrim.RemFlag(PrimFlags.TemporaryOnRez); 2645 RootPrim.RemFlag(PrimFlags.TemporaryOnRez);
2619 RootPrim.AddFlag(PrimFlags.TemporaryOnRez); 2646 RootPrim.AddFlag(PrimFlags.TemporaryOnRez);
2620 } 2647 }
2648
2649// Console.WriteLine("BBBB");
2621 } 2650 }
2622 else 2651 else
2623 { 2652 {
2653// m_log.DebugFormat("[SCENE]: Adding ordinary object {0} {1}", sceneObject.Name, sceneObject.LocalId);
2654
2624 AddRestoredSceneObject(sceneObject, true, false); 2655 AddRestoredSceneObject(sceneObject, true, false);
2625 2656
2626 if (!Permissions.CanObjectEntry(sceneObject.UUID, 2657 if (!Permissions.CanObjectEntry(sceneObject.UUID,
diff --git a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
index 04626d3..1ba1953 100644
--- a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
@@ -1410,7 +1410,9 @@ namespace OpenSim.Region.Framework.Scenes
1410 // now we have a child agent in this region. Request all interesting data about other (root) agents 1410 // now we have a child agent in this region. Request all interesting data about other (root) agents
1411 agent.SendInitialFullUpdateToAllClients(); 1411 agent.SendInitialFullUpdateToAllClients();
1412 1412
1413// Console.WriteLine("SCS 1");
1413 agent.CrossAttachmentsIntoNewRegion(neighbourHandle, true); 1414 agent.CrossAttachmentsIntoNewRegion(neighbourHandle, true);
1415// Console.WriteLine("SCS 2");
1414 1416
1415 // m_scene.SendKillObject(m_localId); 1417 // m_scene.SendKillObject(m_localId);
1416 1418
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index 730ec31..5a1922a 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -216,11 +216,15 @@ namespace OpenSim.Region.Framework.Scenes
216 /// If true, we won't persist this object until it changes 216 /// If true, we won't persist this object until it changes
217 /// If false, we'll persist this object immediately 217 /// If false, we'll persist this object immediately
218 /// </param> 218 /// </param>
219 /// <param name="sendClientUpdate">
220 /// If true, we send updates to the client to tell it about this object
221 /// If false, we leave it up to the caller to do this
222 /// </param>
219 /// <returns> 223 /// <returns>
220 /// true if the object was added, false if an object with the same uuid was already in the scene 224 /// true if the object was added, false if an object with the same uuid was already in the scene
221 /// </returns> 225 /// </returns>
222 protected internal bool AddRestoredSceneObject( 226 protected internal bool AddRestoredSceneObject(
223 SceneObjectGroup sceneObject, bool attachToBackup, bool alreadyPersisted) 227 SceneObjectGroup sceneObject, bool attachToBackup, bool alreadyPersisted, bool sendClientUpdates)
224 { 228 {
225 // KF: Check for out-of-region, move inside and make static. 229 // KF: Check for out-of-region, move inside and make static.
226 Vector3 npos = new Vector3(sceneObject.RootPart.GroupPosition.X, 230 Vector3 npos = new Vector3(sceneObject.RootPart.GroupPosition.X,
@@ -252,8 +256,29 @@ namespace OpenSim.Region.Framework.Scenes
252 sceneObject.HasGroupChanged = true; 256 sceneObject.HasGroupChanged = true;
253 } 257 }
254 258
255 return AddSceneObject(sceneObject, attachToBackup, true); 259 return AddSceneObject(sceneObject, attachToBackup, sendClientUpdates);
256 } 260 }
261
262// /// <summary>
263// /// Add an object into the scene that has come from storage
264// /// </summary>
265// /// <param name="sceneObject"></param>
266// /// <param name="attachToBackup">
267// /// If true, changes to the object will be reflected in its persisted data
268// /// If false, the persisted data will not be changed even if the object in the scene is changed
269// /// </param>
270// /// <param name="alreadyPersisted">
271// /// If true, we won't persist this object until it changes
272// /// If false, we'll persist this object immediately
273// /// </param>
274// /// <returns>
275// /// true if the object was added, false if an object with the same uuid was already in the scene
276// /// </returns>
277// protected internal bool AddRestoredSceneObject(
278// SceneObjectGroup sceneObject, bool attachToBackup, bool alreadyPersisted)
279// {
280// AddRestoredSceneObject(sceneObject, attachToBackup, alreadyPersisted, true);
281// }
257 282
258 /// <summary> 283 /// <summary>
259 /// Add a newly created object to the scene. This will both update the scene, and send information about the 284 /// Add a newly created object to the scene. This will both update the scene, and send information about the
@@ -647,11 +672,13 @@ namespace OpenSim.Region.Framework.Scenes
647 protected internal bool AttachObject( 672 protected internal bool AttachObject(
648 IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, Quaternion rot, Vector3 attachPos, bool silent) 673 IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, Quaternion rot, Vector3 attachPos, bool silent)
649 { 674 {
675// Console.WriteLine("HERE A");
650 SceneObjectGroup group = GetGroupByPrim(objectLocalID); 676 SceneObjectGroup group = GetGroupByPrim(objectLocalID);
651 if (group != null) 677 if (group != null)
652 { 678 {
653 if (m_parentScene.Permissions.CanTakeObject(group.UUID, remoteClient.AgentId)) 679 if (m_parentScene.Permissions.CanTakeObject(group.UUID, remoteClient.AgentId))
654 { 680 {
681// Console.WriteLine("HERE -1");
655 // If the attachment point isn't the same as the one previously used 682 // If the attachment point isn't the same as the one previously used
656 // set it's offset position = 0 so that it appears on the attachment point 683 // set it's offset position = 0 so that it appears on the attachment point
657 // and not in a weird location somewhere unknown. 684 // and not in a weird location somewhere unknown.
@@ -690,9 +717,12 @@ namespace OpenSim.Region.Framework.Scenes
690 itemId = group.GetFromItemID(); 717 itemId = group.GetFromItemID();
691 } 718 }
692 719
720// Console.WriteLine("HERE 0");
693 m_parentScene.AttachObject(remoteClient, AttachmentPt, itemId, group); 721 m_parentScene.AttachObject(remoteClient, AttachmentPt, itemId, group);
694 722
723// Console.WriteLine("HERE 1");
695 group.AttachToAgent(remoteClient.AgentId, AttachmentPt, attachPos, silent); 724 group.AttachToAgent(remoteClient.AgentId, AttachmentPt, attachPos, silent);
725// Console.WriteLine("HERE 2");
696 // In case it is later dropped again, don't let 726 // In case it is later dropped again, don't let
697 // it get cleaned up 727 // it get cleaned up
698 // 728 //
diff --git a/OpenSim/Region/Framework/Scenes/SceneManager.cs b/OpenSim/Region/Framework/Scenes/SceneManager.cs
index c2e3370..92c278e 100644
--- a/OpenSim/Region/Framework/Scenes/SceneManager.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneManager.cs
@@ -422,7 +422,7 @@ namespace OpenSim.Region.Framework.Scenes
422 422
423 if (!scenePresence.IsChildAgent) 423 if (!scenePresence.IsChildAgent)
424 { 424 {
425 m_log.ErrorFormat("Packet debug for {0} {1} set to {2}", 425 m_log.DebugFormat("Packet debug for {0} {1} set to {2}",
426 scenePresence.Firstname, 426 scenePresence.Firstname,
427 scenePresence.Lastname, 427 scenePresence.Lastname,
428 newDebug); 428 newDebug);
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
index 8b58b3e..8b65445 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
@@ -171,7 +171,9 @@ namespace OpenSim.Region.Framework.Scenes
171 item.NextPermissions; 171 item.NextPermissions;
172 taskItem.NextPermissions = item.NextPermissions; 172 taskItem.NextPermissions = item.NextPermissions;
173 taskItem.CurrentPermissions |= 8; 173 taskItem.CurrentPermissions |= 8;
174 } else { 174 }
175 else
176 {
175 taskItem.BasePermissions = item.BasePermissions; 177 taskItem.BasePermissions = item.BasePermissions;
176 taskItem.CurrentPermissions = item.CurrentPermissions; 178 taskItem.CurrentPermissions = item.CurrentPermissions;
177 taskItem.CurrentPermissions |= 8; 179 taskItem.CurrentPermissions |= 8;
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index edaf1a0..93f45e0 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -1651,6 +1651,10 @@ namespace OpenSim.Region.Framework.Scenes
1651 1651
1652 public void SendFullUpdateToClient(IClientAPI remoteClient) 1652 public void SendFullUpdateToClient(IClientAPI remoteClient)
1653 { 1653 {
1654// if (IsAttachment)
1655// m_log.DebugFormat(
1656// "[SOG]: Sending full update to client {0} for {1} {2}", remoteClient.Name, Name, LocalId);
1657
1654 SendPartFullUpdate(remoteClient, RootPart, m_scene.Permissions.GenerateClientFlags(remoteClient.AgentId, RootPart.UUID)); 1658 SendPartFullUpdate(remoteClient, RootPart, m_scene.Permissions.GenerateClientFlags(remoteClient.AgentId, RootPart.UUID));
1655 1659
1656 lockPartsForRead(true); 1660 lockPartsForRead(true);
@@ -1673,8 +1677,9 @@ namespace OpenSim.Region.Framework.Scenes
1673 /// <param name="part"></param> 1677 /// <param name="part"></param>
1674 internal void SendPartFullUpdate(IClientAPI remoteClient, SceneObjectPart part, uint clientFlags) 1678 internal void SendPartFullUpdate(IClientAPI remoteClient, SceneObjectPart part, uint clientFlags)
1675 { 1679 {
1676// m_log.DebugFormat( 1680// if (IsAttachment)
1677// "[SOG]: Sending part full update to {0} for {1} {2}", remoteClient.Name, part.Name, part.LocalId); 1681// m_log.DebugFormat(
1682// "[SOG]: Sending part full update to {0} for {1} {2}", remoteClient.Name, part.Name, part.LocalId);
1678 1683
1679 if (m_rootPart.UUID == part.UUID) 1684 if (m_rootPart.UUID == part.UUID)
1680 { 1685 {
@@ -2186,7 +2191,8 @@ namespace OpenSim.Region.Framework.Scenes
2186 2191
2187 public void ScheduleFullUpdateToAvatar(ScenePresence presence) 2192 public void ScheduleFullUpdateToAvatar(ScenePresence presence)
2188 { 2193 {
2189// m_log.DebugFormat("[SOG]: Scheduling full update for {0} {1} just to avatar {2}", Name, UUID, presence.Name); 2194// if (IsAttachment)
2195// m_log.DebugFormat("[SOG]: Scheduling full update for {0} {1} just to avatar {2}", Name, UUID, presence.Name);
2190 2196
2191 RootPart.AddFullUpdateToAvatar(presence); 2197 RootPart.AddFullUpdateToAvatar(presence);
2192 2198
@@ -2222,7 +2228,8 @@ namespace OpenSim.Region.Framework.Scenes
2222 /// </summary> 2228 /// </summary>
2223 public void ScheduleGroupForFullUpdate() 2229 public void ScheduleGroupForFullUpdate()
2224 { 2230 {
2225// m_log.DebugFormat("[SOG]: Scheduling full update for {0} {1}", Name, UUID); 2231// if (IsAttachment)
2232// m_log.DebugFormat("[SOG]: Scheduling full update for {0} {1}", Name, LocalId);
2226 2233
2227 checkAtTargets(); 2234 checkAtTargets();
2228 RootPart.ScheduleFullUpdate(); 2235 RootPart.ScheduleFullUpdate();
@@ -2265,7 +2272,7 @@ namespace OpenSim.Region.Framework.Scenes
2265 if (IsDeleted) 2272 if (IsDeleted)
2266 return; 2273 return;
2267 2274
2268// m_log.DebugFormat("[SOG]: Sending immediate full group update for {0} {1}", Name, UUID); 2275// m_log.DebugFormat("[SOG]: Sending immediate full group update for {0} {1}", Name, LocalId);
2269 2276
2270 RootPart.SendFullUpdateToAllClients(); 2277 RootPart.SendFullUpdateToAllClients();
2271 2278
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 548a64f..9862785 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -1270,16 +1270,17 @@ namespace OpenSim.Region.Framework.Scenes
1270 /// Tell all scene presences that they should send updates for this part to their clients 1270 /// Tell all scene presences that they should send updates for this part to their clients
1271 /// </summary> 1271 /// </summary>
1272 public void AddFullUpdateToAllAvatars() 1272 public void AddFullUpdateToAllAvatars()
1273 { 1273 {
1274 ScenePresence[] avatars = m_parentGroup.Scene.GetScenePresences(); 1274 ScenePresence[] avatars = m_parentGroup.Scene.GetScenePresences();
1275 for (int i = 0; i < avatars.Length; i++) 1275 for (int i = 0; i < avatars.Length; i++)
1276 { 1276 AddFullUpdateToAvatar(avatars[i]);
1277 avatars[i].SceneViewer.QueuePartForUpdate(this);
1278 }
1279 } 1277 }
1280 1278
1281 public void AddFullUpdateToAvatar(ScenePresence presence) 1279 public void AddFullUpdateToAvatar(ScenePresence presence)
1282 { 1280 {
1281// if (IsAttachment)
1282// m_log.DebugFormat("AddFullUpdateToAllAvatar() {0} for {1} {2}", presence.Name, Name, LocalId);
1283
1283 presence.SceneViewer.QueuePartForUpdate(this); 1284 presence.SceneViewer.QueuePartForUpdate(this);
1284 } 1285 }
1285 1286
@@ -1298,13 +1299,14 @@ namespace OpenSim.Region.Framework.Scenes
1298 { 1299 {
1299 ScenePresence[] avatars = m_parentGroup.Scene.GetScenePresences(); 1300 ScenePresence[] avatars = m_parentGroup.Scene.GetScenePresences();
1300 for (int i = 0; i < avatars.Length; i++) 1301 for (int i = 0; i < avatars.Length; i++)
1301 { 1302 AddTerseUpdateToAvatar(avatars[i]);
1302 avatars[i].SceneViewer.QueuePartForUpdate(this);
1303 }
1304 } 1303 }
1305 1304
1306 public void AddTerseUpdateToAvatar(ScenePresence presence) 1305 public void AddTerseUpdateToAvatar(ScenePresence presence)
1307 { 1306 {
1307// if (IsAttachment)
1308// m_log.DebugFormat("AddTerseUpdateToAvatar() {0} for {1} {2}", presence.Name, Name, LocalId);
1309
1308 presence.SceneViewer.QueuePartForUpdate(this); 1310 presence.SceneViewer.QueuePartForUpdate(this);
1309 } 1311 }
1310 1312
@@ -2713,7 +2715,8 @@ namespace OpenSim.Region.Framework.Scenes
2713 /// </summary> 2715 /// </summary>
2714 public void ScheduleFullUpdate() 2716 public void ScheduleFullUpdate()
2715 { 2717 {
2716// m_log.DebugFormat("[SCENE OBJECT PART]: Scheduling full update for {0} {1}", Name, LocalId); 2718// if (IsAttachment)
2719// m_log.DebugFormat("[SOP]: Scheduling full update for {0} {1}", Name, LocalId);
2717 2720
2718 if (m_parentGroup != null) 2721 if (m_parentGroup != null)
2719 { 2722 {
@@ -2826,6 +2829,10 @@ namespace OpenSim.Region.Framework.Scenes
2826 /// <param name="remoteClient"></param> 2829 /// <param name="remoteClient"></param>
2827 public void SendFullUpdate(IClientAPI remoteClient, uint clientFlags) 2830 public void SendFullUpdate(IClientAPI remoteClient, uint clientFlags)
2828 { 2831 {
2832// if (IsAttachment)
2833// m_log.DebugFormat(
2834// "[SCENE OBJECT PART]: Sending part full update to {0} for {1} {2}", remoteClient.Name, Name, LocalId);
2835
2829 m_parentGroup.SendPartFullUpdate(remoteClient, this, clientFlags); 2836 m_parentGroup.SendPartFullUpdate(remoteClient, this, clientFlags);
2830 } 2837 }
2831 2838
@@ -2834,6 +2841,10 @@ namespace OpenSim.Region.Framework.Scenes
2834 /// </summary> 2841 /// </summary>
2835 public void SendFullUpdateToAllClients() 2842 public void SendFullUpdateToAllClients()
2836 { 2843 {
2844// if (IsAttachment)
2845// m_log.DebugFormat(
2846// "[SCENE OBJECT PART]: Sending full update for {0} {1} for all clients", Name, LocalId);
2847
2837 ScenePresence[] avatars = m_parentGroup.Scene.GetScenePresences(); 2848 ScenePresence[] avatars = m_parentGroup.Scene.GetScenePresences();
2838 for (int i = 0; i < avatars.Length; i++) 2849 for (int i = 0; i < avatars.Length; i++)
2839 { 2850 {
@@ -2845,6 +2856,10 @@ namespace OpenSim.Region.Framework.Scenes
2845 2856
2846 public void SendFullUpdateToAllClientsExcept(UUID agentID) 2857 public void SendFullUpdateToAllClientsExcept(UUID agentID)
2847 { 2858 {
2859// if (IsAttachment)
2860// m_log.DebugFormat(
2861// "[SCENE OBJECT PART]: Sending full update for {0} {1} to all clients except {2}", Name, LocalId, agentID);
2862
2848 ScenePresence[] avatars = m_parentGroup.Scene.GetScenePresences(); 2863 ScenePresence[] avatars = m_parentGroup.Scene.GetScenePresences();
2849 for (int i = 0; i < avatars.Length; i++) 2864 for (int i = 0; i < avatars.Length; i++)
2850 { 2865 {
@@ -2900,10 +2915,27 @@ namespace OpenSim.Region.Framework.Scenes
2900 //isattachment = ParentGroup.RootPart.IsAttachment; 2915 //isattachment = ParentGroup.RootPart.IsAttachment;
2901 2916
2902 byte[] color = new byte[] {m_color.R, m_color.G, m_color.B, m_color.A}; 2917 byte[] color = new byte[] {m_color.R, m_color.G, m_color.B, m_color.A};
2903 remoteClient.SendPrimitiveToClient(new SendPrimitiveData(m_regionHandle, m_parentGroup.GetTimeDilation(), LocalId, m_shape, 2918
2904 lPos, Velocity, Acceleration, RotationOffset, AngularVelocity, clientFlags, m_uuid, _ownerID, 2919 double priority = ParentGroup.GetUpdatePriority(remoteClient);
2905 m_text, color, _parentID, m_particleSystem, m_clickAction, (byte)m_material, m_TextureAnimation, IsAttachment, 2920 if (IsRoot && IsAttachment)
2906 AttachmentPoint,FromItemID, Sound, SoundGain, SoundFlags, SoundRadius, ParentGroup.GetUpdatePriority(remoteClient))); 2921 {
2922 if (double.MinValue == priority)
2923 {
2924 m_log.WarnFormat(
2925 "[SOP]: Couldn't raise update priority of root part for attachment {0} {1} because priority is already highest value",
2926 Name, LocalId);
2927 }
2928 else
2929 {
2930 priority = double.MinValue;
2931 }
2932 }
2933
2934 remoteClient.SendPrimitiveToClient(
2935 new SendPrimitiveData(m_regionHandle, m_parentGroup.GetTimeDilation(), LocalId, m_shape,
2936 lPos, Velocity, Acceleration, RotationOffset, AngularVelocity, clientFlags, m_uuid, _ownerID,
2937 m_text, color, _parentID, m_particleSystem, m_clickAction, (byte)m_material, m_TextureAnimation, IsAttachment,
2938 AttachmentPoint,FromItemID, Sound, SoundGain, SoundFlags, SoundRadius, priority));
2907 } 2939 }
2908 2940
2909 /// <summary> 2941 /// <summary>
@@ -2953,6 +2985,9 @@ namespace OpenSim.Region.Framework.Scenes
2953 { 2985 {
2954 if (m_updateFlag == 2) // is a new prim, just created/reloaded or has major changes 2986 if (m_updateFlag == 2) // is a new prim, just created/reloaded or has major changes
2955 { 2987 {
2988// if (IsAttachment)
2989// m_log.DebugFormat("[SOP]: Sending scheduled full update for {0} {1}", Name, LocalId);
2990
2956 AddFullUpdateToAllAvatars(); 2991 AddFullUpdateToAllAvatars();
2957 m_updateFlag = 0; //Same here 2992 m_updateFlag = 0; //Same here
2958 } 2993 }
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
index a2fceb7..9b16281 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
@@ -31,6 +31,7 @@ using System.IO;
31using System.Collections.Generic; 31using System.Collections.Generic;
32using System.Collections; 32using System.Collections;
33using System.Reflection; 33using System.Reflection;
34using System.Threading;
34using OpenMetaverse; 35using OpenMetaverse;
35using log4net; 36using log4net;
36using OpenSim.Framework; 37using OpenSim.Framework;
@@ -209,6 +210,11 @@ namespace OpenSim.Region.Framework.Scenes
209 if ((int)InventoryType.LSL == item.InvType) 210 if ((int)InventoryType.LSL == item.InvType)
210 { 211 {
211 CreateScriptInstance(item, startParam, postOnRez, engine, stateSource); 212 CreateScriptInstance(item, startParam, postOnRez, engine, stateSource);
213 if ((int)InventoryType.LSL == item.InvType)
214 {
215 CreateScriptInstance(item, startParam, postOnRez, engine, stateSource);
216 Thread.Sleep(10); // workaround for Mono cpu utilization > 100% bug
217 }
212 } 218 }
213 } 219 }
214 } 220 }
@@ -269,7 +275,7 @@ namespace OpenSim.Region.Framework.Scenes
269 // m_log.InfoFormat( 275 // m_log.InfoFormat(
270 // "[PRIM INVENTORY]: " + 276 // "[PRIM INVENTORY]: " +
271 // "Starting script {0}, {1} in prim {2}, {3}", 277 // "Starting script {0}, {1} in prim {2}, {3}",
272 // item.Name, item.ItemID, Name, UUID); 278 // item.Name, item.ItemID, m_part.Name, m_part.UUID);
273 279
274 if (!m_part.ParentGroup.Scene.Permissions.CanRunScript(item.ItemID, m_part.UUID, item.OwnerID)) 280 if (!m_part.ParentGroup.Scene.Permissions.CanRunScript(item.ItemID, m_part.UUID, item.OwnerID))
275 { 281 {
@@ -654,6 +660,7 @@ namespace OpenSim.Region.Framework.Scenes
654 item.ParentID = m_part.UUID; 660 item.ParentID = m_part.UUID;
655 item.ParentPartID = m_part.UUID; 661 item.ParentPartID = m_part.UUID;
656 item.Name = name; 662 item.Name = name;
663 item.GroupID = m_part.GroupID;
657 664
658 m_items.LockItemsForWrite(true); 665 m_items.LockItemsForWrite(true);
659 m_items.Add(item.ItemID, item); 666 m_items.Add(item.ItemID, item);
@@ -743,6 +750,11 @@ namespace OpenSim.Region.Framework.Scenes
743 item.ParentID = m_part.UUID; 750 item.ParentID = m_part.UUID;
744 item.ParentPartID = m_part.UUID; 751 item.ParentPartID = m_part.UUID;
745 item.Flags = m_items[item.ItemID].Flags; 752 item.Flags = m_items[item.ItemID].Flags;
753 // If group permissions have been set on, check that the groupID is up to date in case it has
754 // changed since permissions were last set.
755 if (item.GroupPermissions != (uint)PermissionMask.None)
756 item.GroupID = m_part.GroupID;
757
746 if (item.AssetID == UUID.Zero) 758 if (item.AssetID == UUID.Zero)
747 { 759 {
748 item.AssetID = m_items[item.ItemID].AssetID; 760 item.AssetID = m_items[item.ItemID].AssetID;
@@ -896,6 +908,7 @@ namespace OpenSim.Region.Framework.Scenes
896 uint everyoneMask = 0; 908 uint everyoneMask = 0;
897 uint baseMask = item.BasePermissions; 909 uint baseMask = item.BasePermissions;
898 uint ownerMask = item.CurrentPermissions; 910 uint ownerMask = item.CurrentPermissions;
911 uint groupMask = item.GroupPermissions;
899 912
900 invString.AddItemStart(); 913 invString.AddItemStart();
901 invString.AddNameValueLine("item_id", item.ItemID.ToString()); 914 invString.AddNameValueLine("item_id", item.ItemID.ToString());
@@ -905,7 +918,7 @@ namespace OpenSim.Region.Framework.Scenes
905 918
906 invString.AddNameValueLine("base_mask", Utils.UIntToHexString(baseMask)); 919 invString.AddNameValueLine("base_mask", Utils.UIntToHexString(baseMask));
907 invString.AddNameValueLine("owner_mask", Utils.UIntToHexString(ownerMask)); 920 invString.AddNameValueLine("owner_mask", Utils.UIntToHexString(ownerMask));
908 invString.AddNameValueLine("group_mask", Utils.UIntToHexString(0)); 921 invString.AddNameValueLine("group_mask", Utils.UIntToHexString(groupMask));
909 invString.AddNameValueLine("everyone_mask", Utils.UIntToHexString(everyoneMask)); 922 invString.AddNameValueLine("everyone_mask", Utils.UIntToHexString(everyoneMask));
910 invString.AddNameValueLine("next_owner_mask", Utils.UIntToHexString(item.NextPermissions)); 923 invString.AddNameValueLine("next_owner_mask", Utils.UIntToHexString(item.NextPermissions));
911 924
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 68acabe..a187844 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -885,7 +885,7 @@ namespace OpenSim.Region.Framework.Scenes
885 if (!(pos.Y < 0)) 885 if (!(pos.Y < 0))
886 emergencyPos.Y = pos.Y; 886 emergencyPos.Y = pos.Y;
887 if (!(pos.Z < 0)) 887 if (!(pos.Z < 0))
888 emergencyPos.X = pos.X; 888 emergencyPos.Z = pos.Z;
889 } 889 }
890 if (pos.Y < 0) 890 if (pos.Y < 0)
891 { 891 {
@@ -903,7 +903,7 @@ namespace OpenSim.Region.Framework.Scenes
903 emergencyPos.Y = pos.Y; 903 emergencyPos.Y = pos.Y;
904 //Leave as 128 904 //Leave as 128
905 } 905 }
906 906
907 m_log.WarnFormat( 907 m_log.WarnFormat(
908 "[SCENE PRESENCE]: MakeRootAgent() was given an illegal position of {0} for avatar {1}, {2}. Substituting {3}", 908 "[SCENE PRESENCE]: MakeRootAgent() was given an illegal position of {0} for avatar {1}, {2}. Substituting {3}",
909 pos, Name, UUID, emergencyPos); 909 pos, Name, UUID, emergencyPos);
@@ -4103,6 +4103,8 @@ namespace OpenSim.Region.Framework.Scenes
4103 4103
4104 private double UpdatePriority(UpdatePriorityData data) 4104 private double UpdatePriority(UpdatePriorityData data)
4105 { 4105 {
4106// m_log.DebugFormat("[SCENE PRESENCE]: Reprioritizing updates to client {0} for {1}", Name, data.localID);
4107
4106 EntityBase entity; 4108 EntityBase entity;
4107 SceneObjectGroup group; 4109 SceneObjectGroup group;
4108 4110
diff --git a/OpenSim/Region/Framework/Scenes/SceneViewer.cs b/OpenSim/Region/Framework/Scenes/SceneViewer.cs
index 1cff0eb..9799872 100644
--- a/OpenSim/Region/Framework/Scenes/SceneViewer.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneViewer.cs
@@ -1,4 +1,4 @@
1/* 1/*
2 * Copyright (c) Contributors, http://opensimulator.org/ 2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders. 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 * 4 *
@@ -27,6 +27,7 @@
27 27
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Reflection;
30using OpenMetaverse; 31using OpenMetaverse;
31using log4net; 32using log4net;
32using OpenSim.Framework; 33using OpenSim.Framework;
@@ -39,6 +40,8 @@ namespace OpenSim.Region.Framework.Scenes
39{ 40{
40 public class SceneViewer : ISceneViewer 41 public class SceneViewer : ISceneViewer
41 { 42 {
43 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
44
42 protected ScenePresence m_presence; 45 protected ScenePresence m_presence;
43 protected UpdateQueue m_partsUpdateQueue = new UpdateQueue(); 46 protected UpdateQueue m_partsUpdateQueue = new UpdateQueue();
44 protected Queue<SceneObjectGroup> m_pendingObjects; 47 protected Queue<SceneObjectGroup> m_pendingObjects;
@@ -60,6 +63,9 @@ namespace OpenSim.Region.Framework.Scenes
60 /// <param name="part"></param> 63 /// <param name="part"></param>
61 public void QueuePartForUpdate(SceneObjectPart part) 64 public void QueuePartForUpdate(SceneObjectPart part)
62 { 65 {
66// if (part.IsAttachment)
67// m_log.DebugFormat("[SCENE VIEWER]: Queueing part {0} {1} for update", part.Name, part.LocalId);
68
63 lock (m_partsUpdateQueue) 69 lock (m_partsUpdateQueue)
64 { 70 {
65 m_partsUpdateQueue.Enqueue(part); 71 m_partsUpdateQueue.Enqueue(part);
@@ -134,7 +140,7 @@ namespace OpenSim.Region.Framework.Scenes
134 } 140 }
135 else if (update.LastTerseUpdateTime <= part.TimeStampTerse) 141 else if (update.LastTerseUpdateTime <= part.TimeStampTerse)
136 { 142 {
137// m_log.DebugFormat( 143// m_log.DebugFormat(AddFullUpdateToAvatar
138// "[SCENE PRESENCE]: Tersely updating prim {0}, {1} - part timestamp {2}", 144// "[SCENE PRESENCE]: Tersely updating prim {0}, {1} - part timestamp {2}",
139// part.Name, part.UUID, part.TimeStampTerse); 145// part.Name, part.UUID, part.TimeStampTerse);
140 146