aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/Serialization
diff options
context:
space:
mode:
authorMelanie2010-10-16 02:27:51 +0100
committerMelanie2010-10-16 02:27:51 +0100
commit455a2ba7ded01ffce92bf54cb3e11e73ae086e22 (patch)
tree9d695e2b8108b3b626ade78c3e65b654076e2074 /OpenSim/Region/Framework/Scenes/Serialization
parentAdd a setter to OldItemID so it can be deserialized (diff)
parentAdding projected light filters to prim propeties (diff)
downloadopensim-SC_OLD-455a2ba7ded01ffce92bf54cb3e11e73ae086e22.zip
opensim-SC_OLD-455a2ba7ded01ffce92bf54cb3e11e73ae086e22.tar.gz
opensim-SC_OLD-455a2ba7ded01ffce92bf54cb3e11e73ae086e22.tar.bz2
opensim-SC_OLD-455a2ba7ded01ffce92bf54cb3e11e73ae086e22.tar.xz
Merge branch 'master' into careminster-presence-refactor
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Serialization')
-rw-r--r--OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs479
-rw-r--r--OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs8
2 files changed, 178 insertions, 309 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
index 0c21fd9..cd7a1ca 100644
--- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
+++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
@@ -316,7 +316,6 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
316 m_SOPXmlProcessors.Add("FolderID", ProcessFolderID); 316 m_SOPXmlProcessors.Add("FolderID", ProcessFolderID);
317 m_SOPXmlProcessors.Add("InventorySerial", ProcessInventorySerial); 317 m_SOPXmlProcessors.Add("InventorySerial", ProcessInventorySerial);
318 m_SOPXmlProcessors.Add("TaskInventory", ProcessTaskInventory); 318 m_SOPXmlProcessors.Add("TaskInventory", ProcessTaskInventory);
319 m_SOPXmlProcessors.Add("ObjectFlags", ProcessObjectFlags);
320 m_SOPXmlProcessors.Add("UUID", ProcessUUID); 319 m_SOPXmlProcessors.Add("UUID", ProcessUUID);
321 m_SOPXmlProcessors.Add("LocalId", ProcessLocalId); 320 m_SOPXmlProcessors.Add("LocalId", ProcessLocalId);
322 m_SOPXmlProcessors.Add("Name", ProcessName); 321 m_SOPXmlProcessors.Add("Name", ProcessName);
@@ -361,6 +360,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
361 m_SOPXmlProcessors.Add("Flags", ProcessFlags); 360 m_SOPXmlProcessors.Add("Flags", ProcessFlags);
362 m_SOPXmlProcessors.Add("CollisionSound", ProcessCollisionSound); 361 m_SOPXmlProcessors.Add("CollisionSound", ProcessCollisionSound);
363 m_SOPXmlProcessors.Add("CollisionSoundVolume", ProcessCollisionSoundVolume); 362 m_SOPXmlProcessors.Add("CollisionSoundVolume", ProcessCollisionSoundVolume);
363 m_SOPXmlProcessors.Add("MediaUrl", ProcessMediaUrl);
364 #endregion 364 #endregion
365 365
366 #region TaskInventoryXmlProcessors initialization 366 #region TaskInventoryXmlProcessors initialization
@@ -436,6 +436,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
436 m_ShapeXmlProcessors.Add("FlexiEntry", ProcessShpFlexiEntry); 436 m_ShapeXmlProcessors.Add("FlexiEntry", ProcessShpFlexiEntry);
437 m_ShapeXmlProcessors.Add("LightEntry", ProcessShpLightEntry); 437 m_ShapeXmlProcessors.Add("LightEntry", ProcessShpLightEntry);
438 m_ShapeXmlProcessors.Add("SculptEntry", ProcessShpSculptEntry); 438 m_ShapeXmlProcessors.Add("SculptEntry", ProcessShpSculptEntry);
439 m_ShapeXmlProcessors.Add("Media", ProcessShpMedia);
439 #endregion 440 #endregion
440 } 441 }
441 442
@@ -465,11 +466,6 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
465 obj.TaskInventory = ReadTaskInventory(reader, "TaskInventory"); 466 obj.TaskInventory = ReadTaskInventory(reader, "TaskInventory");
466 } 467 }
467 468
468 private static void ProcessObjectFlags(SceneObjectPart obj, XmlTextReader reader)
469 {
470 obj.Flags = (PrimFlags)reader.ReadElementContentAsInt("ObjectFlags", String.Empty);
471 }
472
473 private static void ProcessUUID(SceneObjectPart obj, XmlTextReader reader) 469 private static void ProcessUUID(SceneObjectPart obj, XmlTextReader reader)
474 { 470 {
475 obj.UUID = ReadUUID(reader, "UUID"); 471 obj.UUID = ReadUUID(reader, "UUID");
@@ -703,6 +699,11 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
703 { 699 {
704 obj.CollisionSoundVolume = reader.ReadElementContentAsFloat("CollisionSoundVolume", String.Empty); 700 obj.CollisionSoundVolume = reader.ReadElementContentAsFloat("CollisionSoundVolume", String.Empty);
705 } 701 }
702
703 private static void ProcessMediaUrl(SceneObjectPart obj, XmlTextReader reader)
704 {
705 obj.MediaUrl = reader.ReadElementContentAsString("MediaUrl", String.Empty);
706 }
706 #endregion 707 #endregion
707 708
708 #region TaskInventoryXmlProcessors 709 #region TaskInventoryXmlProcessors
@@ -1063,6 +1064,13 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1063 shp.SculptEntry = reader.ReadElementContentAsBoolean("SculptEntry", String.Empty); 1064 shp.SculptEntry = reader.ReadElementContentAsBoolean("SculptEntry", String.Empty);
1064 } 1065 }
1065 1066
1067 private static void ProcessShpMedia(PrimitiveBaseShape shp, XmlTextReader reader)
1068 {
1069 string value = reader.ReadElementContentAsString("Media", String.Empty);
1070 shp.Media = PrimitiveBaseShape.MediaList.FromXml(value);
1071 }
1072
1073
1066 #endregion 1074 #endregion
1067 1075
1068 ////////// Write ///////// 1076 ////////// Write /////////
@@ -1075,7 +1083,8 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1075 1083
1076 sog.ForEachPart(delegate(SceneObjectPart sop) 1084 sog.ForEachPart(delegate(SceneObjectPart sop)
1077 { 1085 {
1078 SOPToXml2(writer, sop, sog.RootPart); 1086 if (sop.UUID != sog.RootPart.UUID)
1087 SOPToXml2(writer, sop, sog.RootPart);
1079 }); 1088 });
1080 1089
1081 writer.WriteEndElement(); 1090 writer.WriteEndElement();
@@ -1088,19 +1097,18 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1088 writer.WriteAttributeString("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance"); 1097 writer.WriteAttributeString("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");
1089 writer.WriteAttributeString("xmlns:xsd", "http://www.w3.org/2001/XMLSchema"); 1098 writer.WriteAttributeString("xmlns:xsd", "http://www.w3.org/2001/XMLSchema");
1090 1099
1100 writer.WriteElementString("AllowedDrop", sop.AllowedDrop.ToString().ToLower());
1091 WriteUUID(writer, "CreatorID", sop.CreatorID); 1101 WriteUUID(writer, "CreatorID", sop.CreatorID);
1092 WriteUUID(writer, "FolderID", sop.FolderID); 1102 WriteUUID(writer, "FolderID", sop.FolderID);
1093 writer.WriteElementString("InventorySerial", (sop.Inventory != null) ? sop.InventorySerial.ToString() : "0"); 1103 writer.WriteElementString("InventorySerial", sop.InventorySerial.ToString());
1094
1095 // FIXME: Task inventory
1096 writer.WriteStartElement("TaskInventory"); writer.WriteEndElement();
1097 1104
1098 writer.WriteElementString("ObjectFlags", ((int)sop.Flags).ToString()); 1105 WriteTaskInventory(writer, sop.TaskInventory);
1099 1106
1100 WriteUUID(writer, "UUID", sop.UUID); 1107 WriteUUID(writer, "UUID", sop.UUID);
1101 writer.WriteElementString("LocalId", sop.LocalId.ToString()); 1108 writer.WriteElementString("LocalId", sop.LocalId.ToString());
1102 writer.WriteElementString("Name", sop.Name); 1109 writer.WriteElementString("Name", sop.Name);
1103 writer.WriteElementString("Material", ((int)sop.Material).ToString()); 1110 writer.WriteElementString("Material", sop.Material.ToString());
1111 writer.WriteElementString("PassTouches", sop.PassTouches.ToString().ToLower());
1104 writer.WriteElementString("RegionHandle", sop.RegionHandle.ToString()); 1112 writer.WriteElementString("RegionHandle", sop.RegionHandle.ToString());
1105 writer.WriteElementString("ScriptAccessPin", sop.ScriptAccessPin.ToString()); 1113 writer.WriteElementString("ScriptAccessPin", sop.ScriptAccessPin.ToString());
1106 1114
@@ -1109,115 +1117,40 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1109 1117
1110 WriteQuaternion(writer, "RotationOffset", sop.RotationOffset); 1118 WriteQuaternion(writer, "RotationOffset", sop.RotationOffset);
1111 WriteVector(writer, "Velocity", sop.Velocity); 1119 WriteVector(writer, "Velocity", sop.Velocity);
1112 WriteVector(writer, "RotationalVelocity", Vector3.Zero);
1113 WriteVector(writer, "AngularVelocity", sop.AngularVelocity); 1120 WriteVector(writer, "AngularVelocity", sop.AngularVelocity);
1114 WriteVector(writer, "Acceleration", sop.Acceleration); 1121 WriteVector(writer, "Acceleration", sop.Acceleration);
1115 writer.WriteElementString("Description", sop.Description); 1122 writer.WriteElementString("Description", sop.Description);
1116 writer.WriteStartElement("Color"); 1123 if (sop.Color != null)
1117 writer.WriteElementString("R", sop.Color.R.ToString(Utils.EnUsCulture)); 1124 {
1118 writer.WriteElementString("G", sop.Color.G.ToString(Utils.EnUsCulture)); 1125 writer.WriteStartElement("Color");
1119 writer.WriteElementString("B", sop.Color.B.ToString(Utils.EnUsCulture)); 1126 writer.WriteElementString("R", sop.Color.R.ToString(Utils.EnUsCulture));
1120 writer.WriteElementString("A", sop.Color.G.ToString(Utils.EnUsCulture)); 1127 writer.WriteElementString("G", sop.Color.G.ToString(Utils.EnUsCulture));
1121 writer.WriteEndElement(); 1128 writer.WriteElementString("B", sop.Color.B.ToString(Utils.EnUsCulture));
1129 writer.WriteElementString("A", sop.Color.G.ToString(Utils.EnUsCulture));
1130 writer.WriteEndElement();
1131 }
1132
1122 writer.WriteElementString("Text", sop.Text); 1133 writer.WriteElementString("Text", sop.Text);
1123 writer.WriteElementString("SitName", sop.SitName); 1134 writer.WriteElementString("SitName", sop.SitName);
1124 writer.WriteElementString("TouchName", sop.TouchName); 1135 writer.WriteElementString("TouchName", sop.TouchName);
1125 1136
1126 writer.WriteElementString("LinkNum", sop.LinkNum.ToString()); 1137 writer.WriteElementString("LinkNum", sop.LinkNum.ToString());
1127 writer.WriteElementString("ClickAction", sop.ClickAction.ToString()); 1138 writer.WriteElementString("ClickAction", sop.ClickAction.ToString());
1128 writer.WriteStartElement("Shape");
1129 1139
1130 writer.WriteElementString("ProfileCurve", sop.Shape.ProfileCurve.ToString()); 1140 WriteShape(writer, sop.Shape);
1131 1141
1132 writer.WriteStartElement("TextureEntry");
1133 byte[] te;
1134 if (sop.Shape.TextureEntry != null)
1135 te = sop.Shape.TextureEntry;
1136 else
1137 te = Utils.EmptyBytes;
1138 writer.WriteBase64(te, 0, te.Length);
1139 writer.WriteEndElement(); // TextureEntry
1140
1141 writer.WriteStartElement("ExtraParams");
1142 byte[] ep;
1143 if (sop.Shape.ExtraParams != null)
1144 ep = sop.Shape.ExtraParams;
1145 else
1146 ep = Utils.EmptyBytes;
1147 writer.WriteBase64(ep, 0, ep.Length);
1148 writer.WriteEndElement(); // ExtraParams
1149
1150 writer.WriteElementString("PathBegin", Primitive.PackBeginCut(sop.Shape.PathBegin).ToString());
1151 writer.WriteElementString("PathCurve", sop.Shape.PathCurve.ToString());
1152 writer.WriteElementString("PathEnd", Primitive.PackEndCut(sop.Shape.PathEnd).ToString());
1153 writer.WriteElementString("PathRadiusOffset", Primitive.PackPathTwist(sop.Shape.PathRadiusOffset).ToString());
1154 writer.WriteElementString("PathRevolutions", Primitive.PackPathRevolutions(sop.Shape.PathRevolutions).ToString());
1155 writer.WriteElementString("PathScaleX", Primitive.PackPathScale(sop.Shape.PathScaleX).ToString());
1156 writer.WriteElementString("PathScaleY", Primitive.PackPathScale(sop.Shape.PathScaleY).ToString());
1157 writer.WriteElementString("PathShearX", ((byte)Primitive.PackPathShear(sop.Shape.PathShearX)).ToString());
1158 writer.WriteElementString("PathShearY", ((byte)Primitive.PackPathShear(sop.Shape.PathShearY)).ToString());
1159 writer.WriteElementString("PathSkew", Primitive.PackPathTwist(sop.Shape.PathSkew).ToString());
1160 writer.WriteElementString("PathTaperX", Primitive.PackPathTaper(sop.Shape.PathTaperX).ToString());
1161 writer.WriteElementString("PathTaperY", Primitive.PackPathTaper(sop.Shape.PathTaperY).ToString());
1162 writer.WriteElementString("PathTwist", Primitive.PackPathTwist(sop.Shape.PathTwist).ToString());
1163 writer.WriteElementString("PathTwistBegin", Primitive.PackPathTwist(sop.Shape.PathTwistBegin).ToString());
1164 writer.WriteElementString("PCode", sop.Shape.PCode.ToString());
1165 writer.WriteElementString("ProfileBegin", Primitive.PackBeginCut(sop.Shape.ProfileBegin).ToString());
1166 writer.WriteElementString("ProfileEnd", Primitive.PackEndCut(sop.Shape.ProfileEnd).ToString());
1167 writer.WriteElementString("ProfileHollow", Primitive.PackProfileHollow(sop.Shape.ProfileHollow).ToString());
1168 WriteVector(writer, "Scale", sop.Scale); 1142 WriteVector(writer, "Scale", sop.Scale);
1169 writer.WriteElementString("State", sop.Shape.State.ToString()); 1143 writer.WriteElementString("UpdateFlag", sop.UpdateFlag.ToString());
1170
1171 writer.WriteElementString("ProfileShape", sop.Shape.ProfileShape.ToString());
1172 writer.WriteElementString("HollowShape", sop.Shape.HollowShape.ToString());
1173
1174 writer.WriteElementString("SculptTexture", sop.Shape.SculptTexture.ToString());
1175 writer.WriteElementString("SculptType", sop.Shape.SculptType.ToString());
1176 writer.WriteStartElement("SculptData");
1177 byte[] sd;
1178 if (sop.Shape.SculptData != null)
1179 sd = sop.Shape.ExtraParams;
1180 else
1181 sd = Utils.EmptyBytes;
1182 writer.WriteBase64(sd, 0, sd.Length);
1183 writer.WriteEndElement(); // SculptData
1184
1185 writer.WriteElementString("FlexiSoftness", sop.Shape.FlexiSoftness.ToString());
1186 writer.WriteElementString("FlexiTension", sop.Shape.FlexiTension.ToString());
1187 writer.WriteElementString("FlexiDrag", sop.Shape.FlexiDrag.ToString());
1188 writer.WriteElementString("FlexiGravity", sop.Shape.FlexiGravity.ToString());
1189 writer.WriteElementString("FlexiWind", sop.Shape.FlexiWind.ToString());
1190 writer.WriteElementString("FlexiForceX", sop.Shape.FlexiForceX.ToString());
1191 writer.WriteElementString("FlexiForceY", sop.Shape.FlexiForceY.ToString());
1192 writer.WriteElementString("FlexiForceZ", sop.Shape.FlexiForceZ.ToString());
1193
1194 writer.WriteElementString("LightColorR", sop.Shape.LightColorR.ToString());
1195 writer.WriteElementString("LightColorG", sop.Shape.LightColorG.ToString());
1196 writer.WriteElementString("LightColorB", sop.Shape.LightColorB.ToString());
1197 writer.WriteElementString("LightColorA", sop.Shape.LightColorA.ToString());
1198 writer.WriteElementString("LightRadius", sop.Shape.LightRadius.ToString());
1199 writer.WriteElementString("LightCutoff", sop.Shape.LightCutoff.ToString());
1200 writer.WriteElementString("LightFalloff", sop.Shape.LightFalloff.ToString());
1201 writer.WriteElementString("LightIntensity", sop.Shape.LightIntensity.ToString());
1202
1203 writer.WriteElementString("FlexyEntry", sop.Shape.FlexiEntry.ToString());
1204 writer.WriteElementString("LightEntry", sop.Shape.LightEntry.ToString());
1205 writer.WriteElementString("SculptEntry", sop.Shape.SculptEntry.ToString());
1206
1207 writer.WriteEndElement(); // Shape
1208
1209 WriteVector(writer, "Scale", sop.Scale);
1210 writer.WriteElementString("UpdateFlag", "0");
1211 WriteQuaternion(writer, "SitTargetOrientation", sop.SitTargetOrientation); 1144 WriteQuaternion(writer, "SitTargetOrientation", sop.SitTargetOrientation);
1212 WriteVector(writer, "SitTargetPosition", sop.SitTargetPosition); 1145 WriteVector(writer, "SitTargetPosition", sop.SitTargetPosition);
1213 WriteVector(writer, "SitTargetPositionLL", sop.SitTargetPositionLL); 1146 WriteVector(writer, "SitTargetPositionLL", sop.SitTargetPositionLL);
1214 WriteQuaternion(writer, "SitTargetOrientationLL", sop.SitTargetOrientationLL); 1147 WriteQuaternion(writer, "SitTargetOrientationLL", sop.SitTargetOrientationLL);
1215 writer.WriteElementString("ParentID", sop.ParentID.ToString()); 1148 writer.WriteElementString("ParentID", sop.ParentID.ToString());
1216 writer.WriteElementString("CreationDate", sop.CreationDate.ToString()); 1149 writer.WriteElementString("CreationDate", sop.CreationDate.ToString());
1217 writer.WriteElementString("Category", "0"); 1150 writer.WriteElementString("Category", sop.Category.ToString());
1218 writer.WriteElementString("SalePrice", sop.SalePrice.ToString()); 1151 writer.WriteElementString("SalePrice", sop.SalePrice.ToString());
1219 writer.WriteElementString("ObjectSaleType", ((int)sop.ObjectSaleType).ToString()); 1152 writer.WriteElementString("ObjectSaleType", sop.ObjectSaleType.ToString());
1220 writer.WriteElementString("OwnershipCost", "0"); 1153 writer.WriteElementString("OwnershipCost", sop.OwnershipCost.ToString());
1221 WriteUUID(writer, "GroupID", sop.GroupID); 1154 WriteUUID(writer, "GroupID", sop.GroupID);
1222 WriteUUID(writer, "OwnerID", sop.OwnerID); 1155 WriteUUID(writer, "OwnerID", sop.OwnerID);
1223 WriteUUID(writer, "LastOwnerID", sop.LastOwnerID); 1156 WriteUUID(writer, "LastOwnerID", sop.LastOwnerID);
@@ -1229,6 +1162,8 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1229 writer.WriteElementString("Flags", sop.Flags.ToString()); 1162 writer.WriteElementString("Flags", sop.Flags.ToString());
1230 WriteUUID(writer, "CollisionSound", sop.CollisionSound); 1163 WriteUUID(writer, "CollisionSound", sop.CollisionSound);
1231 writer.WriteElementString("CollisionSoundVolume", sop.CollisionSoundVolume.ToString()); 1164 writer.WriteElementString("CollisionSoundVolume", sop.CollisionSoundVolume.ToString());
1165 if (sop.MediaUrl != null)
1166 writer.WriteElementString("MediaUrl", sop.MediaUrl.ToString());
1232 1167
1233 writer.WriteEndElement(); 1168 writer.WriteEndElement();
1234 } 1169 }
@@ -1259,6 +1194,134 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1259 writer.WriteEndElement(); 1194 writer.WriteEndElement();
1260 } 1195 }
1261 1196
1197 static void WriteTaskInventory(XmlTextWriter writer, TaskInventoryDictionary tinv)
1198 {
1199 if (tinv.Count > 0) // otherwise skip this
1200 {
1201 writer.WriteStartElement("TaskInventory");
1202
1203 foreach (TaskInventoryItem item in tinv.Values)
1204 {
1205 writer.WriteStartElement("TaskInventoryItem");
1206
1207 WriteUUID(writer, "AssetID", item.AssetID);
1208 writer.WriteElementString("BasePermissions", item.BasePermissions.ToString());
1209 writer.WriteElementString("CreationDate", item.CreationDate.ToString());
1210 WriteUUID(writer, "CreatorID", item.CreatorID);
1211 writer.WriteElementString("Description", item.Description);
1212 writer.WriteElementString("EveryonePermissions", item.EveryonePermissions.ToString());
1213 writer.WriteElementString("Flags", item.Flags.ToString());
1214 WriteUUID(writer, "GroupID", item.GroupID);
1215 writer.WriteElementString("GroupPermissions", item.GroupPermissions.ToString());
1216 writer.WriteElementString("InvType", item.InvType.ToString());
1217 WriteUUID(writer, "ItemID", item.ItemID);
1218 WriteUUID(writer, "OldItemID", item.OldItemID);
1219 WriteUUID(writer, "LastOwnerID", item.LastOwnerID);
1220 writer.WriteElementString("Name", item.Name);
1221 writer.WriteElementString("NextPermissions", item.NextPermissions.ToString());
1222 WriteUUID(writer, "OwnerID", item.OwnerID);
1223 writer.WriteElementString("CurrentPermissions", item.CurrentPermissions.ToString());
1224 WriteUUID(writer, "ParentID", item.ParentID);
1225 WriteUUID(writer, "ParentPartID", item.ParentPartID);
1226 WriteUUID(writer, "PermsGranter", item.PermsGranter);
1227 writer.WriteElementString("PermsMask", item.PermsMask.ToString());
1228 writer.WriteElementString("Type", item.Type.ToString());
1229
1230 writer.WriteEndElement(); // TaskInventoryItem
1231 }
1232
1233 writer.WriteEndElement(); // TaskInventory
1234 }
1235 }
1236
1237 static void WriteShape(XmlTextWriter writer, PrimitiveBaseShape shp)
1238 {
1239 if (shp != null)
1240 {
1241 writer.WriteStartElement("Shape");
1242
1243 writer.WriteElementString("ProfileCurve", shp.ProfileCurve.ToString());
1244
1245 writer.WriteStartElement("TextureEntry");
1246 byte[] te;
1247 if (shp.TextureEntry != null)
1248 te = shp.TextureEntry;
1249 else
1250 te = Utils.EmptyBytes;
1251 writer.WriteBase64(te, 0, te.Length);
1252 writer.WriteEndElement(); // TextureEntry
1253
1254 writer.WriteStartElement("ExtraParams");
1255 byte[] ep;
1256 if (shp.ExtraParams != null)
1257 ep = shp.ExtraParams;
1258 else
1259 ep = Utils.EmptyBytes;
1260 writer.WriteBase64(ep, 0, ep.Length);
1261 writer.WriteEndElement(); // ExtraParams
1262
1263 writer.WriteElementString("PathBegin", shp.PathBegin.ToString());
1264 writer.WriteElementString("PathCurve", shp.PathCurve.ToString());
1265 writer.WriteElementString("PathEnd", shp.PathEnd.ToString());
1266 writer.WriteElementString("PathRadiusOffset", shp.PathRadiusOffset.ToString());
1267 writer.WriteElementString("PathRevolutions", shp.PathRevolutions.ToString());
1268 writer.WriteElementString("PathScaleX", shp.PathScaleX.ToString());
1269 writer.WriteElementString("PathScaleY", shp.PathScaleY.ToString());
1270 writer.WriteElementString("PathShearX", shp.PathShearX.ToString());
1271 writer.WriteElementString("PathShearY", shp.PathShearY.ToString());
1272 writer.WriteElementString("PathSkew", shp.PathSkew.ToString());
1273 writer.WriteElementString("PathTaperX", shp.PathTaperX.ToString());
1274 writer.WriteElementString("PathTaperY", shp.PathTaperY.ToString());
1275 writer.WriteElementString("PathTwist", shp.PathTwist.ToString());
1276 writer.WriteElementString("PathTwistBegin", shp.PathTwistBegin.ToString());
1277 writer.WriteElementString("PCode", shp.PCode.ToString());
1278 writer.WriteElementString("ProfileBegin", shp.ProfileBegin.ToString());
1279 writer.WriteElementString("ProfileEnd", shp.ProfileEnd.ToString());
1280 writer.WriteElementString("ProfileHollow", shp.ProfileHollow.ToString());
1281 writer.WriteElementString("State", shp.State.ToString());
1282
1283 writer.WriteElementString("ProfileShape", shp.ProfileShape.ToString());
1284 writer.WriteElementString("HollowShape", shp.HollowShape.ToString());
1285
1286 WriteUUID(writer, "SculptTexture", shp.SculptTexture);
1287 writer.WriteElementString("SculptType", shp.SculptType.ToString());
1288 writer.WriteStartElement("SculptData");
1289 byte[] sd;
1290 if (shp.SculptData != null)
1291 sd = shp.ExtraParams;
1292 else
1293 sd = Utils.EmptyBytes;
1294 writer.WriteBase64(sd, 0, sd.Length);
1295 writer.WriteEndElement(); // SculptData
1296
1297 writer.WriteElementString("FlexiSoftness", shp.FlexiSoftness.ToString());
1298 writer.WriteElementString("FlexiTension", shp.FlexiTension.ToString());
1299 writer.WriteElementString("FlexiDrag", shp.FlexiDrag.ToString());
1300 writer.WriteElementString("FlexiGravity", shp.FlexiGravity.ToString());
1301 writer.WriteElementString("FlexiWind", shp.FlexiWind.ToString());
1302 writer.WriteElementString("FlexiForceX", shp.FlexiForceX.ToString());
1303 writer.WriteElementString("FlexiForceY", shp.FlexiForceY.ToString());
1304 writer.WriteElementString("FlexiForceZ", shp.FlexiForceZ.ToString());
1305
1306 writer.WriteElementString("LightColorR", shp.LightColorR.ToString());
1307 writer.WriteElementString("LightColorG", shp.LightColorG.ToString());
1308 writer.WriteElementString("LightColorB", shp.LightColorB.ToString());
1309 writer.WriteElementString("LightColorA", shp.LightColorA.ToString());
1310 writer.WriteElementString("LightRadius", shp.LightRadius.ToString());
1311 writer.WriteElementString("LightCutoff", shp.LightCutoff.ToString());
1312 writer.WriteElementString("LightFalloff", shp.LightFalloff.ToString());
1313 writer.WriteElementString("LightIntensity", shp.LightIntensity.ToString());
1314
1315 writer.WriteElementString("FlexiEntry", shp.FlexiEntry.ToString().ToLower());
1316 writer.WriteElementString("LightEntry", shp.LightEntry.ToString().ToLower());
1317 writer.WriteElementString("SculptEntry", shp.SculptEntry.ToString().ToLower());
1318
1319 if (shp.Media != null)
1320 writer.WriteElementString("Media", shp.Media.ToXml());
1321
1322 writer.WriteEndElement(); // Shape
1323 }
1324 }
1262 1325
1263 //////// Read ///////// 1326 //////// Read /////////
1264 public static bool Xml2ToSOG(XmlTextReader reader, SceneObjectGroup sog) 1327 public static bool Xml2ToSOG(XmlTextReader reader, SceneObjectGroup sog)
@@ -1305,210 +1368,6 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1305 return true; 1368 return true;
1306 } 1369 }
1307 1370
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) 1371 public static SceneObjectPart Xml2ToSOP(XmlTextReader reader)
1513 { 1372 {
1514 SceneObjectPart obj = new SceneObjectPart(); 1373 SceneObjectPart obj = new SceneObjectPart();
@@ -1522,13 +1381,16 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1522 SOPXmlProcessor p = null; 1381 SOPXmlProcessor p = null;
1523 if (m_SOPXmlProcessors.TryGetValue(reader.Name, out p)) 1382 if (m_SOPXmlProcessors.TryGetValue(reader.Name, out p))
1524 { 1383 {
1384 //m_log.DebugFormat("[XXX] Processing: {0}", reader.Name);
1525 try 1385 try
1526 { 1386 {
1527 p(obj, reader); 1387 p(obj, reader);
1528 } 1388 }
1529 catch (Exception e) 1389 catch (Exception e)
1530 { 1390 {
1531 m_log.DebugFormat("[SceneObjectSerializer]: exception while parsing {0} in {1}-{2}: {3}", nodeName, obj.Name, obj.UUID, e); 1391 m_log.DebugFormat("[SceneObjectSerializer]: exception while parsing {0}: {1}", nodeName, e);
1392 if (reader.NodeType == XmlNodeType.EndElement)
1393 reader.Read();
1532 } 1394 }
1533 } 1395 }
1534 else 1396 else
@@ -1631,6 +1493,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1631 1493
1632 while (reader.NodeType != XmlNodeType.EndElement) 1494 while (reader.NodeType != XmlNodeType.EndElement)
1633 { 1495 {
1496 //m_log.DebugFormat("[XXX] Processing: {0}", reader.Name);
1634 ShapeXmlProcessor p = null; 1497 ShapeXmlProcessor p = null;
1635 if (m_ShapeXmlProcessors.TryGetValue(reader.Name, out p)) 1498 if (m_ShapeXmlProcessors.TryGetValue(reader.Name, out p))
1636 p(shape, reader); 1499 p(shape, reader);
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs
index bb67ca0..c6d4e55 100644
--- a/OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs
+++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs
@@ -280,6 +280,8 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
280 280
281 public static void SavePrimListToXml2(EntityBase[] entityList, TextWriter stream, Vector3 min, Vector3 max) 281 public static void SavePrimListToXml2(EntityBase[] entityList, TextWriter stream, Vector3 min, Vector3 max)
282 { 282 {
283 XmlTextWriter writer = new XmlTextWriter(stream);
284
283 int primCount = 0; 285 int primCount = 0;
284 stream.WriteLine("<scene>\n"); 286 stream.WriteLine("<scene>\n");
285 287
@@ -297,10 +299,14 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
297 continue; 299 continue;
298 } 300 }
299 301
300 stream.WriteLine(SceneObjectSerializer.ToXml2Format(g)); 302 //stream.WriteLine(SceneObjectSerializer.ToXml2Format(g));
303 SceneObjectSerializer.SOGToXml2(writer, (SceneObjectGroup)ent);
304 stream.WriteLine();
305
301 primCount++; 306 primCount++;
302 } 307 }
303 } 308 }
309
304 stream.WriteLine("</scene>\n"); 310 stream.WriteLine("</scene>\n");
305 stream.Flush(); 311 stream.Flush();
306 } 312 }