diff options
author | Diva Canto | 2010-10-13 15:44:25 -0700 |
---|---|---|
committer | Diva Canto | 2010-10-13 15:44:25 -0700 |
commit | 45e0cdfcada82e0771e559614d798438d87b6ad3 (patch) | |
tree | 843fe10c297614a75600f12eb11796e406e432f5 /OpenSim | |
parent | fix build break (diff) | |
download | opensim-SC_OLD-45e0cdfcada82e0771e559614d798438d87b6ad3.zip opensim-SC_OLD-45e0cdfcada82e0771e559614d798438d87b6ad3.tar.gz opensim-SC_OLD-45e0cdfcada82e0771e559614d798438d87b6ad3.tar.bz2 opensim-SC_OLD-45e0cdfcada82e0771e559614d798438d87b6ad3.tar.xz |
Added SOP.MediaUrl and Shape.Media to the deserialization
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs | 218 |
1 files changed, 14 insertions, 204 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs index 3fd61da..efd5a8e 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs | |||
@@ -361,6 +361,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
361 | m_SOPXmlProcessors.Add("Flags", ProcessFlags); | 361 | m_SOPXmlProcessors.Add("Flags", ProcessFlags); |
362 | m_SOPXmlProcessors.Add("CollisionSound", ProcessCollisionSound); | 362 | m_SOPXmlProcessors.Add("CollisionSound", ProcessCollisionSound); |
363 | m_SOPXmlProcessors.Add("CollisionSoundVolume", ProcessCollisionSoundVolume); | 363 | m_SOPXmlProcessors.Add("CollisionSoundVolume", ProcessCollisionSoundVolume); |
364 | m_SOPXmlProcessors.Add("MediaUrl", ProcessMediaUrl); | ||
364 | #endregion | 365 | #endregion |
365 | 366 | ||
366 | #region TaskInventoryXmlProcessors initialization | 367 | #region TaskInventoryXmlProcessors initialization |
@@ -436,6 +437,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
436 | m_ShapeXmlProcessors.Add("FlexiEntry", ProcessShpFlexiEntry); | 437 | m_ShapeXmlProcessors.Add("FlexiEntry", ProcessShpFlexiEntry); |
437 | m_ShapeXmlProcessors.Add("LightEntry", ProcessShpLightEntry); | 438 | m_ShapeXmlProcessors.Add("LightEntry", ProcessShpLightEntry); |
438 | m_ShapeXmlProcessors.Add("SculptEntry", ProcessShpSculptEntry); | 439 | m_ShapeXmlProcessors.Add("SculptEntry", ProcessShpSculptEntry); |
440 | m_ShapeXmlProcessors.Add("Media", ProcessShpMedia); | ||
439 | #endregion | 441 | #endregion |
440 | } | 442 | } |
441 | 443 | ||
@@ -703,6 +705,11 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
703 | { | 705 | { |
704 | obj.CollisionSoundVolume = reader.ReadElementContentAsFloat("CollisionSoundVolume", String.Empty); | 706 | obj.CollisionSoundVolume = reader.ReadElementContentAsFloat("CollisionSoundVolume", String.Empty); |
705 | } | 707 | } |
708 | |||
709 | private static void ProcessMediaUrl(SceneObjectPart obj, XmlTextReader reader) | ||
710 | { | ||
711 | obj.MediaUrl = reader.ReadElementContentAsString("MediaUrl", String.Empty); | ||
712 | } | ||
706 | #endregion | 713 | #endregion |
707 | 714 | ||
708 | #region TaskInventoryXmlProcessors | 715 | #region TaskInventoryXmlProcessors |
@@ -1063,6 +1070,13 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
1063 | shp.SculptEntry = reader.ReadElementContentAsBoolean("SculptEntry", String.Empty); | 1070 | shp.SculptEntry = reader.ReadElementContentAsBoolean("SculptEntry", String.Empty); |
1064 | } | 1071 | } |
1065 | 1072 | ||
1073 | private static void ProcessShpMedia(PrimitiveBaseShape shp, XmlTextReader reader) | ||
1074 | { | ||
1075 | string value = reader.ReadElementContentAsString("Media", String.Empty); | ||
1076 | shp.Media = PrimitiveBaseShape.MediaList.FromXml(value); | ||
1077 | } | ||
1078 | |||
1079 | |||
1066 | #endregion | 1080 | #endregion |
1067 | 1081 | ||
1068 | ////////// Write ///////// | 1082 | ////////// Write ///////// |
@@ -1305,210 +1319,6 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
1305 | return true; | 1319 | return true; |
1306 | } | 1320 | } |
1307 | 1321 | ||
1308 | public static SceneObjectPart Xml2ToSOPPull(XmlTextReader reader) | ||
1309 | { | ||
1310 | SceneObjectPart obj = new SceneObjectPart(); | ||
1311 | |||
1312 | reader.ReadStartElement("SceneObjectPart"); | ||
1313 | |||
1314 | if (reader.Name == "AllowedDrop") | ||
1315 | obj.AllowedDrop = reader.ReadElementContentAsBoolean("AllowedDrop", String.Empty); | ||
1316 | else | ||
1317 | obj.AllowedDrop = true; | ||
1318 | |||
1319 | obj.CreatorID = ReadUUID(reader, "CreatorID"); | ||
1320 | obj.FolderID = ReadUUID(reader, "FolderID"); | ||
1321 | obj.InventorySerial = (uint)reader.ReadElementContentAsInt("InventorySerial", String.Empty); | ||
1322 | |||
1323 | #region Task Inventory | ||
1324 | |||
1325 | obj.TaskInventory = new TaskInventoryDictionary(); | ||
1326 | //List<PrimObject.InventoryBlock.ItemBlock> invItems = new List<PrimObject.InventoryBlock.ItemBlock>(); | ||
1327 | |||
1328 | reader.ReadStartElement("TaskInventory", String.Empty); | ||
1329 | while (reader.Name == "TaskInventoryItem") | ||
1330 | { | ||
1331 | TaskInventoryItem item = new TaskInventoryItem(); | ||
1332 | reader.ReadStartElement("TaskInventoryItem", String.Empty); | ||
1333 | |||
1334 | item.AssetID = ReadUUID(reader, "AssetID"); | ||
1335 | item.BasePermissions = (uint)reader.ReadElementContentAsInt("BasePermissions", String.Empty); | ||
1336 | item.CreationDate = (uint)reader.ReadElementContentAsInt("CreationDate", String.Empty); | ||
1337 | item.CreatorID = ReadUUID(reader, "CreatorID"); | ||
1338 | item.Description = reader.ReadElementContentAsString("Description", String.Empty); | ||
1339 | item.EveryonePermissions = (uint)reader.ReadElementContentAsInt("EveryonePermissions", String.Empty); | ||
1340 | item.Flags = (uint)reader.ReadElementContentAsInt("Flags", String.Empty); | ||
1341 | item.GroupID = ReadUUID(reader, "GroupID"); | ||
1342 | item.GroupPermissions = (uint)reader.ReadElementContentAsInt("GroupPermissions", String.Empty); | ||
1343 | item.InvType = reader.ReadElementContentAsInt("InvType", String.Empty); | ||
1344 | item.ItemID = ReadUUID(reader, "ItemID"); | ||
1345 | UUID oldItemID = ReadUUID(reader, "OldItemID"); // TODO: Is this useful? | ||
1346 | item.LastOwnerID = ReadUUID(reader, "LastOwnerID"); | ||
1347 | item.Name = reader.ReadElementContentAsString("Name", String.Empty); | ||
1348 | item.NextPermissions = (uint)reader.ReadElementContentAsInt("NextPermissions", String.Empty); | ||
1349 | item.OwnerID = ReadUUID(reader, "OwnerID"); | ||
1350 | item.CurrentPermissions = (uint)reader.ReadElementContentAsInt("CurrentPermissions", String.Empty); | ||
1351 | UUID parentID = ReadUUID(reader, "ParentID"); | ||
1352 | UUID parentPartID = ReadUUID(reader, "ParentPartID"); | ||
1353 | item.PermsGranter = ReadUUID(reader, "PermsGranter"); | ||
1354 | item.PermsMask = reader.ReadElementContentAsInt("PermsMask", String.Empty); | ||
1355 | item.Type = reader.ReadElementContentAsInt("Type", String.Empty); | ||
1356 | |||
1357 | reader.ReadEndElement(); | ||
1358 | obj.TaskInventory.Add(item.ItemID, item); | ||
1359 | } | ||
1360 | if (reader.NodeType == XmlNodeType.EndElement) | ||
1361 | reader.ReadEndElement(); | ||
1362 | |||
1363 | #endregion Task Inventory | ||
1364 | |||
1365 | obj.Flags = (PrimFlags)reader.ReadElementContentAsInt("ObjectFlags", String.Empty); | ||
1366 | |||
1367 | obj.UUID = ReadUUID(reader, "UUID"); | ||
1368 | obj.LocalId = (uint)reader.ReadElementContentAsLong("LocalId", String.Empty); | ||
1369 | obj.Name = reader.ReadElementString("Name"); | ||
1370 | obj.Material = (byte)reader.ReadElementContentAsInt("Material", String.Empty); | ||
1371 | |||
1372 | if (reader.Name == "PassTouches") | ||
1373 | obj.PassTouches = reader.ReadElementContentAsBoolean("PassTouches", String.Empty); | ||
1374 | else | ||
1375 | obj.PassTouches = false; | ||
1376 | |||
1377 | obj.RegionHandle = (ulong)reader.ReadElementContentAsLong("RegionHandle", String.Empty); | ||
1378 | obj.ScriptAccessPin = reader.ReadElementContentAsInt("ScriptAccessPin", String.Empty); | ||
1379 | |||
1380 | if (reader.Name == "PlaySoundSlavePrims") | ||
1381 | reader.ReadInnerXml(); | ||
1382 | if (reader.Name == "LoopSoundSlavePrims") | ||
1383 | reader.ReadInnerXml(); | ||
1384 | |||
1385 | Vector3 groupPosition = ReadVector(reader, "GroupPosition"); | ||
1386 | Vector3 offsetPosition = ReadVector(reader, "OffsetPosition"); | ||
1387 | obj.RotationOffset = ReadQuaternion(reader, "RotationOffset"); | ||
1388 | obj.Velocity = ReadVector(reader, "Velocity"); | ||
1389 | if (reader.Name == "RotationalVelocity") | ||
1390 | ReadVector(reader, "RotationalVelocity"); | ||
1391 | obj.AngularVelocity = ReadVector(reader, "AngularVelocity"); | ||
1392 | obj.Acceleration = ReadVector(reader, "Acceleration"); | ||
1393 | obj.Description = reader.ReadElementString("Description"); | ||
1394 | reader.ReadStartElement("Color"); | ||
1395 | if (reader.Name == "R") | ||
1396 | { | ||
1397 | obj.Color = Color.FromArgb((int)reader.ReadElementContentAsFloat("A", String.Empty), | ||
1398 | (int)reader.ReadElementContentAsFloat("R", String.Empty), | ||
1399 | (int)reader.ReadElementContentAsFloat("G", String.Empty), | ||
1400 | (int)reader.ReadElementContentAsFloat("B", String.Empty)); | ||
1401 | reader.ReadEndElement(); | ||
1402 | } | ||
1403 | obj.Text = reader.ReadElementString("Text", String.Empty); | ||
1404 | obj.SitName = reader.ReadElementString("SitName", String.Empty); | ||
1405 | obj.TouchName = reader.ReadElementString("TouchName", String.Empty); | ||
1406 | |||
1407 | obj.LinkNum = reader.ReadElementContentAsInt("LinkNum", String.Empty); | ||
1408 | obj.ClickAction = (byte)reader.ReadElementContentAsInt("ClickAction", String.Empty); | ||
1409 | |||
1410 | reader.ReadStartElement("Shape"); | ||
1411 | obj.Shape.ProfileCurve = (byte)reader.ReadElementContentAsInt("ProfileCurve", String.Empty); | ||
1412 | |||
1413 | byte[] teData = Convert.FromBase64String(reader.ReadElementString("TextureEntry")); | ||
1414 | obj.Shape.Textures = new Primitive.TextureEntry(teData, 0, teData.Length); | ||
1415 | |||
1416 | reader.ReadInnerXml(); // ExtraParams | ||
1417 | |||
1418 | obj.Shape.PathBegin = (ushort)reader.ReadElementContentAsInt("PathBegin", String.Empty); | ||
1419 | obj.Shape.PathCurve = (byte)reader.ReadElementContentAsInt("PathCurve", String.Empty); | ||
1420 | obj.Shape.PathEnd = (ushort)reader.ReadElementContentAsInt("PathEnd", String.Empty); | ||
1421 | obj.Shape.PathRadiusOffset = (sbyte)reader.ReadElementContentAsInt("PathRadiusOffset", String.Empty); | ||
1422 | obj.Shape.PathRevolutions = (byte)reader.ReadElementContentAsInt("PathRevolutions", String.Empty); | ||
1423 | obj.Shape.PathScaleX = (byte)reader.ReadElementContentAsInt("PathScaleX", String.Empty); | ||
1424 | obj.Shape.PathScaleY = (byte)reader.ReadElementContentAsInt("PathScaleY", String.Empty); | ||
1425 | obj.Shape.PathShearX = (byte)reader.ReadElementContentAsInt("PathShearX", String.Empty); | ||
1426 | obj.Shape.PathShearY = (byte)reader.ReadElementContentAsInt("PathShearY", String.Empty); | ||
1427 | obj.Shape.PathSkew = (sbyte)reader.ReadElementContentAsInt("PathSkew", String.Empty); | ||
1428 | obj.Shape.PathTaperX = (sbyte)reader.ReadElementContentAsInt("PathTaperX", String.Empty); | ||
1429 | obj.Shape.PathTaperY = (sbyte)reader.ReadElementContentAsInt("PathTaperY", String.Empty); | ||
1430 | obj.Shape.PathTwist = (sbyte)reader.ReadElementContentAsInt("PathTwist", String.Empty); | ||
1431 | obj.Shape.PathTwistBegin = (sbyte)reader.ReadElementContentAsInt("PathTwistBegin", String.Empty); | ||
1432 | obj.Shape.PCode = (byte)reader.ReadElementContentAsInt("PCode", String.Empty); | ||
1433 | obj.Shape.ProfileBegin = (ushort)reader.ReadElementContentAsInt("ProfileBegin", String.Empty); | ||
1434 | obj.Shape.ProfileEnd = (ushort)reader.ReadElementContentAsInt("ProfileEnd", String.Empty); | ||
1435 | obj.Shape.ProfileHollow = (ushort)reader.ReadElementContentAsInt("ProfileHollow", String.Empty); | ||
1436 | obj.Scale = ReadVector(reader, "Scale"); | ||
1437 | obj.Shape.State = (byte)reader.ReadElementContentAsInt("State", String.Empty); | ||
1438 | |||
1439 | obj.Shape.ProfileCurve = (byte)reader.ReadElementContentAsInt("ProfileCurve", String.Empty); | ||
1440 | obj.Shape.ProfileShape = (ProfileShape)reader.ReadElementContentAsInt("ProfileShape", String.Empty); | ||
1441 | obj.Shape.HollowShape = (HollowShape)reader.ReadElementContentAsInt("HollowShape", String.Empty); | ||
1442 | |||
1443 | UUID sculptTexture = ReadUUID(reader, "SculptTexture"); | ||
1444 | SculptType sculptType = (SculptType)reader.ReadElementContentAsInt("SculptType", String.Empty); | ||
1445 | if (sculptTexture != UUID.Zero) | ||
1446 | { | ||
1447 | obj.Shape.SculptTexture = sculptTexture; | ||
1448 | obj.Shape.SculptType = (byte)sculptType; | ||
1449 | } | ||
1450 | |||
1451 | reader.ReadInnerXml(); // SculptData | ||
1452 | |||
1453 | obj.Shape.FlexiSoftness = reader.ReadElementContentAsInt("FlexiSoftness", String.Empty); | ||
1454 | obj.Shape.FlexiTension = reader.ReadElementContentAsFloat("FlexiTension", String.Empty); | ||
1455 | obj.Shape.FlexiDrag = reader.ReadElementContentAsFloat("FlexiDrag", String.Empty); | ||
1456 | obj.Shape.FlexiGravity = reader.ReadElementContentAsFloat("FlexiGravity", String.Empty); | ||
1457 | obj.Shape.FlexiWind = reader.ReadElementContentAsFloat("FlexiWind", String.Empty); | ||
1458 | obj.Shape.FlexiForceX = reader.ReadElementContentAsFloat("FlexiForceX", String.Empty); | ||
1459 | obj.Shape.FlexiForceY = reader.ReadElementContentAsFloat("FlexiForceY", String.Empty); | ||
1460 | obj.Shape.FlexiForceZ = reader.ReadElementContentAsFloat("FlexiForceZ", String.Empty); | ||
1461 | |||
1462 | obj.Shape.LightColorR = reader.ReadElementContentAsFloat("LightColorR", String.Empty); | ||
1463 | obj.Shape.LightColorG = reader.ReadElementContentAsFloat("LightColorG", String.Empty); | ||
1464 | obj.Shape.LightColorB = reader.ReadElementContentAsFloat("LightColorB", String.Empty); | ||
1465 | obj.Shape.LightColorA = reader.ReadElementContentAsFloat("LightColorA", String.Empty); | ||
1466 | obj.Shape.LightRadius = reader.ReadElementContentAsFloat("LightRadius", String.Empty); | ||
1467 | obj.Shape.LightCutoff = reader.ReadElementContentAsFloat("LightCutoff", String.Empty); | ||
1468 | obj.Shape.LightFalloff = reader.ReadElementContentAsFloat("LightFalloff", String.Empty); | ||
1469 | obj.Shape.LightIntensity = reader.ReadElementContentAsFloat("LightIntensity", String.Empty); | ||
1470 | |||
1471 | bool hasFlexi = reader.ReadElementContentAsBoolean("FlexiEntry", String.Empty); | ||
1472 | bool hasLight = reader.ReadElementContentAsBoolean("LightEntry", String.Empty); | ||
1473 | reader.ReadInnerXml(); // SculptEntry | ||
1474 | |||
1475 | reader.ReadEndElement(); | ||
1476 | |||
1477 | obj.Scale = ReadVector(reader, "Scale"); // Yes, again | ||
1478 | obj.UpdateFlag = (byte)reader.ReadElementContentAsInt("UpdateFlag", String.Empty); // UpdateFlag | ||
1479 | |||
1480 | obj.SitTargetOrientation = ReadQuaternion(reader, "SitTargetOrientation"); | ||
1481 | obj.SitTargetPosition = ReadVector(reader, "SitTargetPosition"); | ||
1482 | obj.SitTargetPositionLL = ReadVector(reader, "SitTargetPositionLL"); | ||
1483 | obj.SitTargetOrientationLL = ReadQuaternion(reader, "SitTargetOrientationLL"); | ||
1484 | obj.ParentID = (uint)reader.ReadElementContentAsLong("ParentID", String.Empty); | ||
1485 | obj.CreationDate = reader.ReadElementContentAsInt("CreationDate", String.Empty); | ||
1486 | int category = reader.ReadElementContentAsInt("Category", String.Empty); | ||
1487 | obj.SalePrice = reader.ReadElementContentAsInt("SalePrice", String.Empty); | ||
1488 | obj.ObjectSaleType = (byte)reader.ReadElementContentAsInt("ObjectSaleType", String.Empty); | ||
1489 | int ownershipCost = reader.ReadElementContentAsInt("OwnershipCost", String.Empty); | ||
1490 | obj.GroupID = ReadUUID(reader, "GroupID"); | ||
1491 | obj.OwnerID = ReadUUID(reader, "OwnerID"); | ||
1492 | obj.LastOwnerID = ReadUUID(reader, "LastOwnerID"); | ||
1493 | obj.BaseMask = (uint)reader.ReadElementContentAsInt("BaseMask", String.Empty); | ||
1494 | obj.OwnerMask = (uint)reader.ReadElementContentAsInt("OwnerMask", String.Empty); | ||
1495 | obj.GroupMask = (uint)reader.ReadElementContentAsInt("GroupMask", String.Empty); | ||
1496 | obj.EveryoneMask = (uint)reader.ReadElementContentAsInt("EveryoneMask", String.Empty); | ||
1497 | obj.NextOwnerMask = (uint)reader.ReadElementContentAsInt("NextOwnerMask", String.Empty); | ||
1498 | |||
1499 | obj.Flags = (PrimFlags)reader.ReadElementContentAsInt("Flags", String.Empty); | ||
1500 | |||
1501 | obj.CollisionSound = ReadUUID(reader, "CollisionSound"); | ||
1502 | obj.CollisionSoundVolume = reader.ReadElementContentAsFloat("CollisionSoundVolume", String.Empty); | ||
1503 | |||
1504 | reader.ReadEndElement(); | ||
1505 | |||
1506 | obj.GroupPosition = groupPosition; | ||
1507 | obj.OffsetPosition = offsetPosition; | ||
1508 | |||
1509 | return obj; | ||
1510 | } | ||
1511 | |||
1512 | public static SceneObjectPart Xml2ToSOP(XmlTextReader reader) | 1322 | public static SceneObjectPart Xml2ToSOP(XmlTextReader reader) |
1513 | { | 1323 | { |
1514 | SceneObjectPart obj = new SceneObjectPart(); | 1324 | SceneObjectPart obj = new SceneObjectPart(); |