aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes')
-rw-r--r--OpenSim/Region/Framework/Scenes/EventManager.cs31
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs23
-rw-r--r--OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/UuidGatherer.cs32
4 files changed, 66 insertions, 22 deletions
diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs
index 4fec44f..1018b54 100644
--- a/OpenSim/Region/Framework/Scenes/EventManager.cs
+++ b/OpenSim/Region/Framework/Scenes/EventManager.cs
@@ -1026,6 +1026,16 @@ namespace OpenSim.Region.Framework.Scenes
1026 /// </remarks> 1026 /// </remarks>
1027 public event TeleportFail OnTeleportFail; 1027 public event TeleportFail OnTeleportFail;
1028 1028
1029// public delegate void GatherUuids(SceneObjectPart sop, IDictionary<UUID, AssetType> assetUuids);
1030//
1031// /// <summary>
1032// /// Triggered when UUIDs referenced by a scene object are being gathered for archiving, hg transfer, etc.
1033// /// </summary>
1034// /// <remarks>
1035// /// The listener should add references to the IDictionary<UUID, AssetType> as appropriate.
1036// /// </remarks>
1037// public event GatherUuids OnGatherUuids;
1038
1029 public class MoneyTransferArgs : EventArgs 1039 public class MoneyTransferArgs : EventArgs
1030 { 1040 {
1031 public UUID sender; 1041 public UUID sender;
@@ -3274,5 +3284,26 @@ namespace OpenSim.Region.Framework.Scenes
3274 handler(scenePresence); 3284 handler(scenePresence);
3275 } 3285 }
3276 } 3286 }
3287
3288// public void TriggerGatherUuids(SceneObjectPart sop, IDictionary<UUID, AssetType> assetUuids)
3289// {
3290// GatherUuids handler = OnGatherUuids;
3291//
3292// if (handler != null)
3293// {
3294// foreach (GatherUuids d in handler.GetInvocationList())
3295// {
3296// try
3297// {
3298// d(sop, assetUuids);
3299// }
3300// catch (Exception e)
3301// {
3302// m_log.ErrorFormat("[EVENT MANAGER]: Delegate for TriggerUuidGather failed - continuing {0} - {1}",
3303// e.Message, e.StackTrace);
3304// }
3305// }
3306// }
3307// }
3277 } 3308 }
3278} 3309}
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 0a18d8a..9e3d875 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -3810,20 +3810,23 @@ namespace OpenSim.Region.Framework.Scenes
3810 /// <summary> 3810 /// <summary>
3811 /// Update just the root prim position in a linkset 3811 /// Update just the root prim position in a linkset
3812 /// </summary> 3812 /// </summary>
3813 /// <param name="pos"></param> 3813 /// <param name="newPos"></param>
3814 public void UpdateRootPosition(Vector3 pos) 3814 public void UpdateRootPosition(Vector3 newPos)
3815 { 3815 {
3816 // needs to be called with phys building true 3816 // needs to be called with phys building true
3817 Vector3 newPos = new Vector3(pos.X, pos.Y, pos.Z); 3817 Vector3 oldPos;
3818 Vector3 oldPos = 3818
3819 new Vector3(AbsolutePosition.X + m_rootPart.OffsetPosition.X, 3819 // FIXME: This improves the situation where editing just the root prim of an attached object would send
3820 AbsolutePosition.Y + m_rootPart.OffsetPosition.Y, 3820 // all the other parts to oblivion after detach/reattach. However, a problem remains since the root prim
3821 AbsolutePosition.Z + m_rootPart.OffsetPosition.Z); 3821 // still ends up in the wrong position on reattach.
3822 if (IsAttachment)
3823 oldPos = RootPart.OffsetPosition;
3824 else
3825 oldPos = AbsolutePosition + RootPart.OffsetPosition;
3826
3822 Vector3 diff = oldPos - newPos; 3827 Vector3 diff = oldPos - newPos;
3823 Vector3 axDiff = new Vector3(diff.X, diff.Y, diff.Z);
3824 Quaternion partRotation = m_rootPart.RotationOffset; 3828 Quaternion partRotation = m_rootPart.RotationOffset;
3825 axDiff *= Quaternion.Inverse(partRotation); 3829 diff *= Quaternion.Inverse(partRotation);
3826 diff = axDiff;
3827 3830
3828 SceneObjectPart[] parts = m_parts.GetArray(); 3831 SceneObjectPart[] parts = m_parts.GetArray();
3829 for (int i = 0; i < parts.Length; i++) 3832 for (int i = 0; i < parts.Length; i++)
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
index ce4fb40..68918d3 100644
--- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
+++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
@@ -1346,7 +1346,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1346 if (sop.MediaUrl != null) 1346 if (sop.MediaUrl != null)
1347 writer.WriteElementString("MediaUrl", sop.MediaUrl.ToString()); 1347 writer.WriteElementString("MediaUrl", sop.MediaUrl.ToString());
1348 1348
1349 if (sop.DynAttrs.Count > 0) 1349 if (sop.DynAttrs.CountNamespaces > 0)
1350 { 1350 {
1351 writer.WriteStartElement("DynAttrs"); 1351 writer.WriteStartElement("DynAttrs");
1352 sop.DynAttrs.WriteXml(writer); 1352 sop.DynAttrs.WriteXml(writer);
diff --git a/OpenSim/Region/Framework/Scenes/UuidGatherer.cs b/OpenSim/Region/Framework/Scenes/UuidGatherer.cs
index 7b47275..e60a025 100644
--- a/OpenSim/Region/Framework/Scenes/UuidGatherer.cs
+++ b/OpenSim/Region/Framework/Scenes/UuidGatherer.cs
@@ -182,7 +182,12 @@ namespace OpenSim.Region.Framework.Scenes
182 GatherAssetUuids(tii.AssetID, (AssetType)tii.Type, assetUuids); 182 GatherAssetUuids(tii.AssetID, (AssetType)tii.Type, assetUuids);
183 } 183 }
184 184
185 // get any texture UUIDs used for materials such as normal and specular maps 185 // FIXME: We need to make gathering modular but we cannot yet, since gatherers are not guaranteed
186 // to be called with scene objects that are in a scene (e.g. in the case of hg asset mapping and
187 // inventory transfer. There needs to be a way for a module to register a method without assuming a
188 // Scene.EventManager is present.
189// part.ParentGroup.Scene.EventManager.TriggerGatherUuids(part, assetUuids);
190
186 GatherMaterialsUuids(part, assetUuids); 191 GatherMaterialsUuids(part, assetUuids);
187 } 192 }
188 catch (Exception e) 193 catch (Exception e)
@@ -208,7 +213,6 @@ namespace OpenSim.Region.Framework.Scenes
208// } 213// }
209// } 214// }
210 215
211
212 /// <summary> 216 /// <summary>
213 /// Gather all of the texture asset UUIDs used to reference "Materials" such as normal and specular maps 217 /// Gather all of the texture asset UUIDs used to reference "Materials" such as normal and specular maps
214 /// </summary> 218 /// </summary>
@@ -217,20 +221,27 @@ namespace OpenSim.Region.Framework.Scenes
217 public void GatherMaterialsUuids(SceneObjectPart part, IDictionary<UUID, AssetType> assetUuids) 221 public void GatherMaterialsUuids(SceneObjectPart part, IDictionary<UUID, AssetType> assetUuids)
218 { 222 {
219 // scan thru the dynAttrs map of this part for any textures used as materials 223 // scan thru the dynAttrs map of this part for any textures used as materials
220 OSDMap OSMaterials = null; 224 OSD osdMaterials = null;
221 225
222 lock (part.DynAttrs) 226 lock (part.DynAttrs)
223 { 227 {
224 if (part.DynAttrs.ContainsKey("OS:Materials")) 228 if (part.DynAttrs.ContainsStore("OpenSim", "Materials"))
225 OSMaterials = part.DynAttrs["OS:Materials"]; 229 {
226 if (OSMaterials != null && OSMaterials.ContainsKey("Materials")) 230 OSDMap materialsStore = part.DynAttrs.GetStore("OpenSim", "Materials");
231
232 if (materialsStore == null)
233 return;
234
235 materialsStore.TryGetValue("Materials", out osdMaterials);
236 }
237
238 if (osdMaterials != null)
227 { 239 {
228 OSD osd = OSMaterials["Materials"];
229 //m_log.Info("[UUID Gatherer]: found Materials: " + OSDParser.SerializeJsonString(osd)); 240 //m_log.Info("[UUID Gatherer]: found Materials: " + OSDParser.SerializeJsonString(osd));
230 241
231 if (osd is OSDArray) 242 if (osdMaterials is OSDArray)
232 { 243 {
233 OSDArray matsArr = osd as OSDArray; 244 OSDArray matsArr = osdMaterials as OSDArray;
234 foreach (OSDMap matMap in matsArr) 245 foreach (OSDMap matMap in matsArr)
235 { 246 {
236 try 247 try
@@ -268,8 +279,7 @@ namespace OpenSim.Region.Framework.Scenes
268 } 279 }
269 } 280 }
270 } 281 }
271 282
272
273 /// <summary> 283 /// <summary>
274 /// Get an asset synchronously, potentially using an asynchronous callback. If the 284 /// Get an asset synchronously, potentially using an asynchronous callback. If the
275 /// asynchronous callback is used, we will wait for it to complete. 285 /// asynchronous callback is used, we will wait for it to complete.