diff options
author | Melanie | 2010-10-18 20:30:46 +0100 |
---|---|---|
committer | Melanie | 2010-10-18 20:30:46 +0100 |
commit | bb7a755cba628a24bb339ed0aa974ac0ee5503d1 (patch) | |
tree | b1c7fd32711dd46b7080643c6a6900f3fe827cce /OpenSim | |
parent | Merge branch 'master' into careminster-presence-refactor (diff) | |
parent | Alphabetize results on region search by prefix matching (diff) | |
download | opensim-SC-bb7a755cba628a24bb339ed0aa974ac0ee5503d1.zip opensim-SC-bb7a755cba628a24bb339ed0aa974ac0ee5503d1.tar.gz opensim-SC-bb7a755cba628a24bb339ed0aa974ac0ee5503d1.tar.bz2 opensim-SC-bb7a755cba628a24bb339ed0aa974ac0ee5503d1.tar.xz |
Merge branch 'master' into careminster-presence-refactor
Diffstat (limited to 'OpenSim')
9 files changed, 288 insertions, 165 deletions
diff --git a/OpenSim/Data/MySQL/MySQLRegionData.cs b/OpenSim/Data/MySQL/MySQLRegionData.cs index baa948e..efefad9 100644 --- a/OpenSim/Data/MySQL/MySQLRegionData.cs +++ b/OpenSim/Data/MySQL/MySQLRegionData.cs | |||
@@ -62,6 +62,8 @@ namespace OpenSim.Data.MySQL | |||
62 | if (scopeID != UUID.Zero) | 62 | if (scopeID != UUID.Zero) |
63 | command += " and ScopeID = ?scopeID"; | 63 | command += " and ScopeID = ?scopeID"; |
64 | 64 | ||
65 | command += " order by regionName"; | ||
66 | |||
65 | using (MySqlCommand cmd = new MySqlCommand(command)) | 67 | using (MySqlCommand cmd = new MySqlCommand(command)) |
66 | { | 68 | { |
67 | cmd.Parameters.AddWithValue("?regionName", regionName); | 69 | cmd.Parameters.AddWithValue("?regionName", regionName); |
diff --git a/OpenSim/Framework/PrimitiveBaseShape.cs b/OpenSim/Framework/PrimitiveBaseShape.cs index 4d11754..20b9cf1 100644 --- a/OpenSim/Framework/PrimitiveBaseShape.cs +++ b/OpenSim/Framework/PrimitiveBaseShape.cs | |||
@@ -802,6 +802,51 @@ namespace OpenSim.Framework | |||
802 | } | 802 | } |
803 | } | 803 | } |
804 | 804 | ||
805 | public bool ProjectionEntry { | ||
806 | get { | ||
807 | return _projectionEntry; | ||
808 | } | ||
809 | set { | ||
810 | _projectionEntry = value; | ||
811 | } | ||
812 | } | ||
813 | |||
814 | public UUID ProjectionTextureUUID { | ||
815 | get { | ||
816 | return _projectionTextureID; | ||
817 | } | ||
818 | set { | ||
819 | _projectionTextureID = value; | ||
820 | } | ||
821 | } | ||
822 | |||
823 | public float ProjectionFOV { | ||
824 | get { | ||
825 | return _projectionFOV; | ||
826 | } | ||
827 | set { | ||
828 | _projectionFOV = value; | ||
829 | } | ||
830 | } | ||
831 | |||
832 | public float ProjectionFocus { | ||
833 | get { | ||
834 | return _projectionFocus; | ||
835 | } | ||
836 | set { | ||
837 | _projectionFocus = value; | ||
838 | } | ||
839 | } | ||
840 | |||
841 | public float ProjectionAmbiance { | ||
842 | get { | ||
843 | return _projectionAmb; | ||
844 | } | ||
845 | set { | ||
846 | _projectionAmb = value; | ||
847 | } | ||
848 | } | ||
849 | |||
805 | public byte[] ExtraParamsToBytes() | 850 | public byte[] ExtraParamsToBytes() |
806 | { | 851 | { |
807 | ushort FlexiEP = 0x10; | 852 | ushort FlexiEP = 0x10; |
@@ -901,7 +946,7 @@ namespace OpenSim.Framework | |||
901 | Array.Copy(ProjectionData, 0, returnbytes, i, ProjectionData.Length); | 946 | Array.Copy(ProjectionData, 0, returnbytes, i, ProjectionData.Length); |
902 | i += ProjectionData.Length; | 947 | i += ProjectionData.Length; |
903 | } | 948 | } |
904 | if (!_flexiEntry && !_lightEntry && !_sculptEntry) | 949 | if (!_flexiEntry && !_lightEntry && !_sculptEntry && !_projectionEntry) |
905 | { | 950 | { |
906 | byte[] returnbyte = new byte[1]; | 951 | byte[] returnbyte = new byte[1]; |
907 | returnbyte[0] = 0; | 952 | returnbyte[0] = 0; |
@@ -1175,16 +1220,16 @@ namespace OpenSim.Framework | |||
1175 | Array.Copy(data, pos, ProjectionTextureUUID,0, 16); | 1220 | Array.Copy(data, pos, ProjectionTextureUUID,0, 16); |
1176 | _projectionTextureID = new UUID(ProjectionTextureUUID, 0); | 1221 | _projectionTextureID = new UUID(ProjectionTextureUUID, 0); |
1177 | 1222 | ||
1178 | _projectionFocus = Utils.BytesToFloat(data, pos + 16); | 1223 | _projectionFOV = Utils.BytesToFloat(data, pos + 16); |
1179 | _projectionFOV = Utils.BytesToFloat(data, pos + 20); | 1224 | _projectionFocus = Utils.BytesToFloat(data, pos + 20); |
1180 | _projectionAmb = Utils.BytesToFloat(data, pos + 24); | 1225 | _projectionAmb = Utils.BytesToFloat(data, pos + 24); |
1181 | } | 1226 | } |
1182 | else | 1227 | else |
1183 | { | 1228 | { |
1184 | _projectionEntry = false; | 1229 | _projectionEntry = false; |
1185 | _projectionTextureID = UUID.Zero; | 1230 | _projectionTextureID = UUID.Zero; |
1186 | _projectionFocus = 0f; | ||
1187 | _projectionFOV = 0f; | 1231 | _projectionFOV = 0f; |
1232 | _projectionFocus = 0f; | ||
1188 | _projectionAmb = 0f; | 1233 | _projectionAmb = 0f; |
1189 | } | 1234 | } |
1190 | } | 1235 | } |
@@ -1194,8 +1239,8 @@ namespace OpenSim.Framework | |||
1194 | byte[] data = new byte[28]; | 1239 | byte[] data = new byte[28]; |
1195 | 1240 | ||
1196 | _projectionTextureID.GetBytes().CopyTo(data, 0); | 1241 | _projectionTextureID.GetBytes().CopyTo(data, 0); |
1197 | Utils.FloatToBytes(_projectionFocus).CopyTo(data, 16); | 1242 | Utils.FloatToBytes(_projectionFOV).CopyTo(data, 16); |
1198 | Utils.FloatToBytes(_projectionFOV).CopyTo(data, 20); | 1243 | Utils.FloatToBytes(_projectionFocus).CopyTo(data, 20); |
1199 | Utils.FloatToBytes(_projectionAmb).CopyTo(data, 24); | 1244 | Utils.FloatToBytes(_projectionAmb).CopyTo(data, 24); |
1200 | 1245 | ||
1201 | return data; | 1246 | return data; |
diff --git a/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs b/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs index bac7827..f10e848 100644 --- a/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs +++ b/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs | |||
@@ -303,15 +303,19 @@ namespace OpenSim.Region.CoreModules.World.Serialiser.Tests | |||
303 | { | 303 | { |
304 | case "UUID": | 304 | case "UUID": |
305 | xtr.ReadStartElement("UUID"); | 305 | xtr.ReadStartElement("UUID"); |
306 | uuid = UUID.Parse(xtr.ReadElementString("Guid")); | 306 | try |
307 | xtr.ReadEndElement(); | 307 | { |
308 | uuid = UUID.Parse(xtr.ReadElementString("UUID")); | ||
309 | xtr.ReadEndElement(); | ||
310 | } | ||
311 | catch { } // ignore everything but <UUID><UUID>...</UUID></UUID> | ||
308 | break; | 312 | break; |
309 | case "Name": | 313 | case "Name": |
310 | name = xtr.ReadElementContentAsString(); | 314 | name = xtr.ReadElementContentAsString(); |
311 | break; | 315 | break; |
312 | case "CreatorID": | 316 | case "CreatorID": |
313 | xtr.ReadStartElement("CreatorID"); | 317 | xtr.ReadStartElement("CreatorID"); |
314 | creatorId = UUID.Parse(xtr.ReadElementString("Guid")); | 318 | creatorId = UUID.Parse(xtr.ReadElementString("UUID")); |
315 | xtr.ReadEndElement(); | 319 | xtr.ReadEndElement(); |
316 | break; | 320 | break; |
317 | } | 321 | } |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index f0740f8..7ec3697 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -39,6 +39,7 @@ using OpenMetaverse.Packets; | |||
39 | using OpenSim.Framework; | 39 | using OpenSim.Framework; |
40 | using OpenSim.Region.Framework.Interfaces; | 40 | using OpenSim.Region.Framework.Interfaces; |
41 | using OpenSim.Region.Framework.Scenes.Scripting; | 41 | using OpenSim.Region.Framework.Scenes.Scripting; |
42 | using OpenSim.Region.Framework.Scenes.Serialization; | ||
42 | using OpenSim.Region.Physics.Manager; | 43 | using OpenSim.Region.Physics.Manager; |
43 | 44 | ||
44 | namespace OpenSim.Region.Framework.Scenes | 45 | namespace OpenSim.Region.Framework.Scenes |
@@ -119,33 +120,29 @@ namespace OpenSim.Region.Framework.Scenes | |||
119 | /// <value> | 120 | /// <value> |
120 | /// Is this sop a root part? | 121 | /// Is this sop a root part? |
121 | /// </value> | 122 | /// </value> |
122 | [XmlIgnore] | 123 | |
123 | public bool IsRoot | 124 | public bool IsRoot |
124 | { | 125 | { |
125 | get { return ParentGroup.RootPart == this; } | 126 | get { return ParentGroup.RootPart == this; } |
126 | } | 127 | } |
127 | 128 | ||
128 | // use only one serializer to give the runtime a chance to optimize it (it won't do that if you | ||
129 | // use a new instance every time) | ||
130 | private static XmlSerializer serializer = new XmlSerializer(typeof (SceneObjectPart)); | ||
131 | |||
132 | #region Fields | 129 | #region Fields |
133 | 130 | ||
134 | public bool AllowedDrop; | 131 | public bool AllowedDrop; |
135 | 132 | ||
136 | [XmlIgnore] | 133 | |
137 | public bool DIE_AT_EDGE; | 134 | public bool DIE_AT_EDGE; |
138 | 135 | ||
139 | [XmlIgnore] | 136 | |
140 | public bool RETURN_AT_EDGE; | 137 | public bool RETURN_AT_EDGE; |
141 | 138 | ||
142 | [XmlIgnore] | 139 | |
143 | public bool BlockGrab; | 140 | public bool BlockGrab; |
144 | 141 | ||
145 | [XmlIgnore] | 142 | |
146 | public bool StatusSandbox; | 143 | public bool StatusSandbox; |
147 | 144 | ||
148 | [XmlIgnore] | 145 | |
149 | public Vector3 StatusSandboxPos; | 146 | public Vector3 StatusSandboxPos; |
150 | 147 | ||
151 | // TODO: This needs to be persisted in next XML version update! | 148 | // TODO: This needs to be persisted in next XML version update! |
@@ -167,33 +164,34 @@ namespace OpenSim.Region.Framework.Scenes | |||
167 | // Note: This isn't persisted in the database right now, as the fields for that aren't just there yet. | 164 | // Note: This isn't persisted in the database right now, as the fields for that aren't just there yet. |
168 | // Not a big problem as long as the script that sets it remains in the prim on startup. | 165 | // Not a big problem as long as the script that sets it remains in the prim on startup. |
169 | // for SL compatibility it should be persisted though (set sound / displaytext / particlesystem, kill script) | 166 | // for SL compatibility it should be persisted though (set sound / displaytext / particlesystem, kill script) |
170 | [XmlIgnore] | 167 | |
171 | public UUID Sound; | 168 | public UUID Sound; |
172 | 169 | ||
173 | [XmlIgnore] | 170 | |
174 | public byte SoundFlags; | 171 | public byte SoundFlags; |
175 | 172 | ||
176 | [XmlIgnore] | 173 | |
177 | public double SoundGain; | 174 | public double SoundGain; |
178 | 175 | ||
179 | [XmlIgnore] | 176 | |
180 | public double SoundRadius; | 177 | public double SoundRadius; |
181 | 178 | ||
182 | [XmlIgnore] | 179 | |
183 | public uint TimeStampFull; | 180 | public uint TimeStampFull; |
184 | 181 | ||
185 | [XmlIgnore] | 182 | |
186 | public uint TimeStampLastActivity; // Will be used for AutoReturn | 183 | public uint TimeStampLastActivity; // Will be used for AutoReturn |
187 | 184 | ||
188 | [XmlIgnore] | 185 | |
189 | public uint TimeStampTerse; | 186 | public uint TimeStampTerse; |
190 | 187 | ||
191 | [XmlIgnore] | 188 | |
192 | public UUID FromItemID; | 189 | public UUID FromItemID; |
193 | 190 | ||
194 | [XmlIgnore] | 191 | |
195 | public UUID FromFolderID; | 192 | public UUID FromFolderID; |
196 | 193 | ||
194 | <<<<<<< HEAD:OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | ||
197 | // The following two are to hold the attachment data | 195 | // The following two are to hold the attachment data |
198 | // while an object is inworld | 196 | // while an object is inworld |
199 | [XmlIgnore] | 197 | [XmlIgnore] |
@@ -203,15 +201,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
203 | public Vector3 AttachOffset = Vector3.Zero; | 201 | public Vector3 AttachOffset = Vector3.Zero; |
204 | 202 | ||
205 | [XmlIgnore] | 203 | [XmlIgnore] |
204 | ======= | ||
205 | |||
206 | >>>>>>> master:OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | ||
206 | public int STATUS_ROTATE_X; | 207 | public int STATUS_ROTATE_X; |
207 | 208 | ||
208 | [XmlIgnore] | 209 | |
209 | public int STATUS_ROTATE_Y; | 210 | public int STATUS_ROTATE_Y; |
210 | 211 | ||
211 | [XmlIgnore] | 212 | |
212 | public int STATUS_ROTATE_Z; | 213 | public int STATUS_ROTATE_Z; |
213 | 214 | ||
214 | [XmlIgnore] | 215 | |
215 | private Dictionary<int, string> m_CollisionFilter = new Dictionary<int, string>(); | 216 | private Dictionary<int, string> m_CollisionFilter = new Dictionary<int, string>(); |
216 | 217 | ||
217 | /// <value> | 218 | /// <value> |
@@ -220,68 +221,68 @@ namespace OpenSim.Region.Framework.Scenes | |||
220 | /// </value> | 221 | /// </value> |
221 | private UUID m_fromUserInventoryItemID; | 222 | private UUID m_fromUserInventoryItemID; |
222 | 223 | ||
223 | [XmlIgnore] | 224 | |
224 | public UUID FromUserInventoryItemID | 225 | public UUID FromUserInventoryItemID |
225 | { | 226 | { |
226 | get { return m_fromUserInventoryItemID; } | 227 | get { return m_fromUserInventoryItemID; } |
227 | } | 228 | } |
228 | 229 | ||
229 | [XmlIgnore] | 230 | |
230 | public bool IsAttachment; | 231 | public bool IsAttachment; |
231 | 232 | ||
232 | [XmlIgnore] | 233 | |
233 | public scriptEvents AggregateScriptEvents; | 234 | public scriptEvents AggregateScriptEvents; |
234 | 235 | ||
235 | [XmlIgnore] | 236 | |
236 | public UUID AttachedAvatar; | 237 | public UUID AttachedAvatar; |
237 | 238 | ||
238 | [XmlIgnore] | 239 | |
239 | public Vector3 AttachedPos; | 240 | public Vector3 AttachedPos; |
240 | 241 | ||
241 | [XmlIgnore] | 242 | |
242 | public uint AttachmentPoint; | 243 | public uint AttachmentPoint; |
243 | 244 | ||
244 | [XmlIgnore] | 245 | |
245 | public Vector3 RotationAxis = Vector3.One; | 246 | public Vector3 RotationAxis = Vector3.One; |
246 | 247 | ||
247 | [XmlIgnore] | 248 | |
248 | public bool VolumeDetectActive; // XmlIgnore set to avoid problems with persistance until I come to care for this | 249 | public bool VolumeDetectActive; // XmlIgnore set to avoid problems with persistance until I come to care for this |
249 | // Certainly this must be a persistant setting finally | 250 | // Certainly this must be a persistant setting finally |
250 | 251 | ||
251 | [XmlIgnore] | 252 | |
252 | public bool IsWaitingForFirstSpinUpdatePacket; | 253 | public bool IsWaitingForFirstSpinUpdatePacket; |
253 | 254 | ||
254 | [XmlIgnore] | 255 | |
255 | public Quaternion SpinOldOrientation = Quaternion.Identity; | 256 | public Quaternion SpinOldOrientation = Quaternion.Identity; |
256 | 257 | ||
257 | [XmlIgnore] | 258 | |
258 | public Quaternion m_APIDTarget = Quaternion.Identity; | 259 | public Quaternion m_APIDTarget = Quaternion.Identity; |
259 | 260 | ||
260 | [XmlIgnore] | 261 | |
261 | public float m_APIDDamp = 0; | 262 | public float m_APIDDamp = 0; |
262 | 263 | ||
263 | [XmlIgnore] | 264 | |
264 | public float m_APIDStrength = 0; | 265 | public float m_APIDStrength = 0; |
265 | 266 | ||
266 | /// <summary> | 267 | /// <summary> |
267 | /// This part's inventory | 268 | /// This part's inventory |
268 | /// </summary> | 269 | /// </summary> |
269 | [XmlIgnore] | 270 | |
270 | public IEntityInventory Inventory | 271 | public IEntityInventory Inventory |
271 | { | 272 | { |
272 | get { return m_inventory; } | 273 | get { return m_inventory; } |
273 | } | 274 | } |
274 | protected SceneObjectPartInventory m_inventory; | 275 | protected SceneObjectPartInventory m_inventory; |
275 | 276 | ||
276 | [XmlIgnore] | 277 | |
277 | public bool Undoing; | 278 | public bool Undoing; |
278 | 279 | ||
279 | [XmlIgnore] | 280 | |
280 | public bool IgnoreUndoUpdate = false; | 281 | public bool IgnoreUndoUpdate = false; |
281 | 282 | ||
282 | [XmlIgnore] | 283 | |
283 | private PrimFlags LocalFlags; | 284 | private PrimFlags LocalFlags; |
284 | [XmlIgnore] | 285 | |
285 | private float m_damage = -1.0f; | 286 | private float m_damage = -1.0f; |
286 | private byte[] m_TextureAnimation; | 287 | private byte[] m_TextureAnimation; |
287 | private byte m_clickAction; | 288 | private byte m_clickAction; |
@@ -289,9 +290,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
289 | private string m_description = String.Empty; | 290 | private string m_description = String.Empty; |
290 | private readonly List<uint> m_lastColliders = new List<uint>(); | 291 | private readonly List<uint> m_lastColliders = new List<uint>(); |
291 | private int m_linkNum; | 292 | private int m_linkNum; |
292 | [XmlIgnore] | 293 | |
293 | private int m_scriptAccessPin; | 294 | private int m_scriptAccessPin; |
294 | [XmlIgnore] | 295 | |
295 | private readonly Dictionary<UUID, scriptEvents> m_scriptEvents = new Dictionary<UUID, scriptEvents>(); | 296 | private readonly Dictionary<UUID, scriptEvents> m_scriptEvents = new Dictionary<UUID, scriptEvents>(); |
296 | private string m_sitName = String.Empty; | 297 | private string m_sitName = String.Empty; |
297 | private Quaternion m_sitTargetOrientation = Quaternion.Identity; | 298 | private Quaternion m_sitTargetOrientation = Quaternion.Identity; |
@@ -562,7 +563,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
562 | } | 563 | } |
563 | 564 | ||
564 | 565 | ||
565 | [XmlIgnore] | 566 | |
566 | public Dictionary<int, string> CollisionFilter | 567 | public Dictionary<int, string> CollisionFilter |
567 | { | 568 | { |
568 | get { return m_CollisionFilter; } | 569 | get { return m_CollisionFilter; } |
@@ -572,21 +573,21 @@ namespace OpenSim.Region.Framework.Scenes | |||
572 | } | 573 | } |
573 | } | 574 | } |
574 | 575 | ||
575 | [XmlIgnore] | 576 | |
576 | public Quaternion APIDTarget | 577 | public Quaternion APIDTarget |
577 | { | 578 | { |
578 | get { return m_APIDTarget; } | 579 | get { return m_APIDTarget; } |
579 | set { m_APIDTarget = value; } | 580 | set { m_APIDTarget = value; } |
580 | } | 581 | } |
581 | 582 | ||
582 | [XmlIgnore] | 583 | |
583 | public float APIDDamp | 584 | public float APIDDamp |
584 | { | 585 | { |
585 | get { return m_APIDDamp; } | 586 | get { return m_APIDDamp; } |
586 | set { m_APIDDamp = value; } | 587 | set { m_APIDDamp = value; } |
587 | } | 588 | } |
588 | 589 | ||
589 | [XmlIgnore] | 590 | |
590 | public float APIDStrength | 591 | public float APIDStrength |
591 | { | 592 | { |
592 | get { return m_APIDStrength; } | 593 | get { return m_APIDStrength; } |
@@ -632,33 +633,41 @@ namespace OpenSim.Region.Framework.Scenes | |||
632 | set { m_LoopSoundSlavePrims = value; } | 633 | set { m_LoopSoundSlavePrims = value; } |
633 | } | 634 | } |
634 | 635 | ||
636 | <<<<<<< HEAD:OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | ||
637 | ======= | ||
638 | |||
639 | >>>>>>> master:OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | ||
635 | public Byte[] TextureAnimation | 640 | public Byte[] TextureAnimation |
636 | { | 641 | { |
637 | get { return m_TextureAnimation; } | 642 | get { return m_TextureAnimation; } |
638 | set { m_TextureAnimation = value; } | 643 | set { m_TextureAnimation = value; } |
639 | } | 644 | } |
640 | 645 | ||
646 | <<<<<<< HEAD:OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | ||
647 | ======= | ||
648 | |||
649 | >>>>>>> master:OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | ||
641 | public Byte[] ParticleSystem | 650 | public Byte[] ParticleSystem |
642 | { | 651 | { |
643 | get { return m_particleSystem; } | 652 | get { return m_particleSystem; } |
644 | set { m_particleSystem = value; } | 653 | set { m_particleSystem = value; } |
645 | } | 654 | } |
646 | 655 | ||
647 | [XmlIgnore] | 656 | |
648 | public DateTime Expires | 657 | public DateTime Expires |
649 | { | 658 | { |
650 | get { return m_expires; } | 659 | get { return m_expires; } |
651 | set { m_expires = value; } | 660 | set { m_expires = value; } |
652 | } | 661 | } |
653 | 662 | ||
654 | [XmlIgnore] | 663 | |
655 | public DateTime Rezzed | 664 | public DateTime Rezzed |
656 | { | 665 | { |
657 | get { return m_rezzed; } | 666 | get { return m_rezzed; } |
658 | set { m_rezzed = value; } | 667 | set { m_rezzed = value; } |
659 | } | 668 | } |
660 | 669 | ||
661 | [XmlIgnore] | 670 | |
662 | public float Damage | 671 | public float Damage |
663 | { | 672 | { |
664 | get { return m_damage; } | 673 | get { return m_damage; } |
@@ -1043,7 +1052,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1043 | } | 1052 | } |
1044 | } | 1053 | } |
1045 | 1054 | ||
1046 | [XmlIgnore] | 1055 | |
1047 | public bool CreateSelected | 1056 | public bool CreateSelected |
1048 | { | 1057 | { |
1049 | get { return m_createSelected; } | 1058 | get { return m_createSelected; } |
@@ -1233,14 +1242,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
1233 | set { m_occupied = value; } | 1242 | set { m_occupied = value; } |
1234 | } | 1243 | } |
1235 | 1244 | ||
1236 | [XmlIgnore] | 1245 | |
1237 | public UUID SitTargetAvatar | 1246 | public UUID SitTargetAvatar |
1238 | { | 1247 | { |
1239 | get { return m_sitTargetAvatar; } | 1248 | get { return m_sitTargetAvatar; } |
1240 | set { m_sitTargetAvatar = value; } | 1249 | set { m_sitTargetAvatar = value; } |
1241 | } | 1250 | } |
1242 | 1251 | ||
1243 | [XmlIgnore] | 1252 | |
1244 | public virtual UUID RegionID | 1253 | public virtual UUID RegionID |
1245 | { | 1254 | { |
1246 | get | 1255 | get |
@@ -1254,7 +1263,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1254 | } | 1263 | } |
1255 | 1264 | ||
1256 | private UUID _parentUUID = UUID.Zero; | 1265 | private UUID _parentUUID = UUID.Zero; |
1257 | [XmlIgnore] | 1266 | |
1258 | public UUID ParentUUID | 1267 | public UUID ParentUUID |
1259 | { | 1268 | { |
1260 | get | 1269 | get |
@@ -1268,7 +1277,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1268 | set { _parentUUID = value; } | 1277 | set { _parentUUID = value; } |
1269 | } | 1278 | } |
1270 | 1279 | ||
1271 | [XmlIgnore] | 1280 | |
1272 | public string SitAnimation | 1281 | public string SitAnimation |
1273 | { | 1282 | { |
1274 | get { return m_sitAnimation; } | 1283 | get { return m_sitAnimation; } |
@@ -1884,7 +1893,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1884 | /// </summary> | 1893 | /// </summary> |
1885 | /// <param name="xmlReader"></param> | 1894 | /// <param name="xmlReader"></param> |
1886 | /// <returns></returns> | 1895 | /// <returns></returns> |
1887 | public static SceneObjectPart FromXml(XmlReader xmlReader) | 1896 | public static SceneObjectPart FromXml(XmlTextReader xmlReader) |
1888 | { | 1897 | { |
1889 | return FromXml(UUID.Zero, xmlReader); | 1898 | return FromXml(UUID.Zero, xmlReader); |
1890 | } | 1899 | } |
@@ -1895,9 +1904,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
1895 | /// <param name="fromUserInventoryItemId">The inventory id from which this part came, if applicable</param> | 1904 | /// <param name="fromUserInventoryItemId">The inventory id from which this part came, if applicable</param> |
1896 | /// <param name="xmlReader"></param> | 1905 | /// <param name="xmlReader"></param> |
1897 | /// <returns></returns> | 1906 | /// <returns></returns> |
1898 | public static SceneObjectPart FromXml(UUID fromUserInventoryItemId, XmlReader xmlReader) | 1907 | public static SceneObjectPart FromXml(UUID fromUserInventoryItemId, XmlTextReader xmlReader) |
1899 | { | 1908 | { |
1900 | SceneObjectPart part = (SceneObjectPart)serializer.Deserialize(xmlReader); | 1909 | SceneObjectPart part = SceneObjectSerializer.Xml2ToSOP(xmlReader); |
1901 | part.m_fromUserInventoryItemID = fromUserInventoryItemId; | 1910 | part.m_fromUserInventoryItemID = fromUserInventoryItemId; |
1902 | 1911 | ||
1903 | // for tempOnRez objects, we have to fix the Expire date. | 1912 | // for tempOnRez objects, we have to fix the Expire date. |
@@ -4087,9 +4096,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
4087 | /// Serialize this part to xml. | 4096 | /// Serialize this part to xml. |
4088 | /// </summary> | 4097 | /// </summary> |
4089 | /// <param name="xmlWriter"></param> | 4098 | /// <param name="xmlWriter"></param> |
4090 | public void ToXml(XmlWriter xmlWriter) | 4099 | public void ToXml(XmlTextWriter xmlWriter) |
4091 | { | 4100 | { |
4092 | serializer.Serialize(xmlWriter, this); | 4101 | SceneObjectSerializer.SOPToXml2(xmlWriter, this, new Dictionary<string, object>()); |
4093 | } | 4102 | } |
4094 | 4103 | ||
4095 | public void TriggerScriptChangedEvent(Changed val) | 4104 | public void TriggerScriptChangedEvent(Changed val) |
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs index 79619ee..acdaf95 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs | |||
@@ -67,14 +67,6 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
67 | //m_log.DebugFormat("[SOG]: Starting deserialization of SOG"); | 67 | //m_log.DebugFormat("[SOG]: Starting deserialization of SOG"); |
68 | //int time = System.Environment.TickCount; | 68 | //int time = System.Environment.TickCount; |
69 | 69 | ||
70 | // libomv.types changes UUID to Guid | ||
71 | xmlData = xmlData.Replace("<UUID>", "<Guid>"); | ||
72 | xmlData = xmlData.Replace("</UUID>", "</Guid>"); | ||
73 | |||
74 | // Handle Nested <UUID><UUID> property | ||
75 | xmlData = xmlData.Replace("<Guid><Guid>", "<UUID><Guid>"); | ||
76 | xmlData = xmlData.Replace("</Guid></Guid>", "</Guid></UUID>"); | ||
77 | |||
78 | try | 70 | try |
79 | { | 71 | { |
80 | StringReader sr; | 72 | StringReader sr; |
@@ -126,6 +118,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
126 | } | 118 | } |
127 | } | 119 | } |
128 | 120 | ||
121 | |||
129 | /// <summary> | 122 | /// <summary> |
130 | /// Serialize a scene object to the original xml format | 123 | /// Serialize a scene object to the original xml format |
131 | /// </summary> | 124 | /// </summary> |
@@ -156,7 +149,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
156 | 149 | ||
157 | writer.WriteStartElement(String.Empty, "SceneObjectGroup", String.Empty); | 150 | writer.WriteStartElement(String.Empty, "SceneObjectGroup", String.Empty); |
158 | writer.WriteStartElement(String.Empty, "RootPart", String.Empty); | 151 | writer.WriteStartElement(String.Empty, "RootPart", String.Empty); |
159 | ToOriginalXmlFormat(sceneObject.RootPart, writer); | 152 | ToXmlFormat(sceneObject.RootPart, writer); |
160 | writer.WriteEndElement(); | 153 | writer.WriteEndElement(); |
161 | writer.WriteStartElement(String.Empty, "OtherParts", String.Empty); | 154 | writer.WriteStartElement(String.Empty, "OtherParts", String.Empty); |
162 | 155 | ||
@@ -167,7 +160,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
167 | if (part.UUID != sceneObject.RootPart.UUID) | 160 | if (part.UUID != sceneObject.RootPart.UUID) |
168 | { | 161 | { |
169 | writer.WriteStartElement(String.Empty, "Part", String.Empty); | 162 | writer.WriteStartElement(String.Empty, "Part", String.Empty); |
170 | ToOriginalXmlFormat(part, writer); | 163 | ToXmlFormat(part, writer); |
171 | writer.WriteEndElement(); | 164 | writer.WriteEndElement(); |
172 | } | 165 | } |
173 | } | 166 | } |
@@ -179,9 +172,9 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
179 | //m_log.DebugFormat("[SERIALIZER]: Finished serialization of SOG {0}, {1}ms", Name, System.Environment.TickCount - time); | 172 | //m_log.DebugFormat("[SERIALIZER]: Finished serialization of SOG {0}, {1}ms", Name, System.Environment.TickCount - time); |
180 | } | 173 | } |
181 | 174 | ||
182 | protected static void ToOriginalXmlFormat(SceneObjectPart part, XmlTextWriter writer) | 175 | protected static void ToXmlFormat(SceneObjectPart part, XmlTextWriter writer) |
183 | { | 176 | { |
184 | part.ToXml(writer); | 177 | SOPToXml2(writer, part, new Dictionary<string, object>()); |
185 | } | 178 | } |
186 | 179 | ||
187 | public static SceneObjectGroup FromXml2Format(string xmlData) | 180 | public static SceneObjectGroup FromXml2Format(string xmlData) |
@@ -189,14 +182,6 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
189 | //m_log.DebugFormat("[SOG]: Starting deserialization of SOG"); | 182 | //m_log.DebugFormat("[SOG]: Starting deserialization of SOG"); |
190 | //int time = System.Environment.TickCount; | 183 | //int time = System.Environment.TickCount; |
191 | 184 | ||
192 | // libomv.types changes UUID to Guid | ||
193 | xmlData = xmlData.Replace("<UUID>", "<Guid>"); | ||
194 | xmlData = xmlData.Replace("</UUID>", "</Guid>"); | ||
195 | |||
196 | // Handle Nested <UUID><UUID> property | ||
197 | xmlData = xmlData.Replace("<Guid><Guid>", "<UUID><Guid>"); | ||
198 | xmlData = xmlData.Replace("</Guid></Guid>", "</Guid></UUID>"); | ||
199 | |||
200 | try | 185 | try |
201 | { | 186 | { |
202 | XmlDocument doc = new XmlDocument(); | 187 | XmlDocument doc = new XmlDocument(); |
@@ -261,41 +246,13 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
261 | { | 246 | { |
262 | using (XmlTextWriter writer = new XmlTextWriter(sw)) | 247 | using (XmlTextWriter writer = new XmlTextWriter(sw)) |
263 | { | 248 | { |
264 | ToXml2Format(sceneObject, writer); | 249 | SOGToXml2(writer, sceneObject, new Dictionary<string,object>()); |
265 | } | 250 | } |
266 | 251 | ||
267 | return sw.ToString(); | 252 | return sw.ToString(); |
268 | } | 253 | } |
269 | } | 254 | } |
270 | 255 | ||
271 | /// <summary> | ||
272 | /// Serialize a scene object to the 'xml2' format. | ||
273 | /// </summary> | ||
274 | /// <param name="sceneObject"></param> | ||
275 | /// <returns></returns> | ||
276 | public static void ToXml2Format(SceneObjectGroup sceneObject, XmlTextWriter writer) | ||
277 | { | ||
278 | //m_log.DebugFormat("[SERIALIZER]: Starting serialization of SOG {0} to XML2", Name); | ||
279 | //int time = System.Environment.TickCount; | ||
280 | |||
281 | writer.WriteStartElement(String.Empty, "SceneObjectGroup", String.Empty); | ||
282 | sceneObject.RootPart.ToXml(writer); | ||
283 | writer.WriteStartElement(String.Empty, "OtherParts", String.Empty); | ||
284 | |||
285 | SceneObjectPart[] parts = sceneObject.Parts; | ||
286 | for (int i = 0; i < parts.Length; i++) | ||
287 | { | ||
288 | SceneObjectPart part = parts[i]; | ||
289 | if (part.UUID != sceneObject.RootPart.UUID) | ||
290 | part.ToXml(writer); | ||
291 | } | ||
292 | |||
293 | writer.WriteEndElement(); // End of OtherParts | ||
294 | sceneObject.SaveScriptedState(writer); | ||
295 | writer.WriteEndElement(); // End of SceneObjectGroup | ||
296 | |||
297 | //m_log.DebugFormat("[SERIALIZER]: Finished serialization of SOG {0} to XML2, {1}ms", Name, System.Environment.TickCount - time); | ||
298 | } | ||
299 | 256 | ||
300 | #region manual serialization | 257 | #region manual serialization |
301 | 258 | ||
@@ -386,6 +343,8 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
386 | m_TaskInventoryXmlProcessors.Add("PermsGranter", ProcessTIPermsGranter); | 343 | m_TaskInventoryXmlProcessors.Add("PermsGranter", ProcessTIPermsGranter); |
387 | m_TaskInventoryXmlProcessors.Add("PermsMask", ProcessTIPermsMask); | 344 | m_TaskInventoryXmlProcessors.Add("PermsMask", ProcessTIPermsMask); |
388 | m_TaskInventoryXmlProcessors.Add("Type", ProcessTIType); | 345 | m_TaskInventoryXmlProcessors.Add("Type", ProcessTIType); |
346 | m_TaskInventoryXmlProcessors.Add("OwnerChanged", ProcessTIOwnerChanged); | ||
347 | |||
389 | #endregion | 348 | #endregion |
390 | 349 | ||
391 | #region ShapeXmlProcessors initialization | 350 | #region ShapeXmlProcessors initialization |
@@ -817,6 +776,11 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
817 | item.Type = reader.ReadElementContentAsInt("Type", String.Empty); | 776 | item.Type = reader.ReadElementContentAsInt("Type", String.Empty); |
818 | } | 777 | } |
819 | 778 | ||
779 | private static void ProcessTIOwnerChanged(TaskInventoryItem item, XmlTextReader reader) | ||
780 | { | ||
781 | item.OwnerChanged = reader.ReadElementContentAsBoolean("OwnerChanged", String.Empty); | ||
782 | } | ||
783 | |||
820 | #endregion | 784 | #endregion |
821 | 785 | ||
822 | #region ShapeXmlProcessors | 786 | #region ShapeXmlProcessors |
@@ -1078,20 +1042,20 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
1078 | public static void SOGToXml2(XmlTextWriter writer, SceneObjectGroup sog, Dictionary<string, object>options) | 1042 | public static void SOGToXml2(XmlTextWriter writer, SceneObjectGroup sog, Dictionary<string, object>options) |
1079 | { | 1043 | { |
1080 | writer.WriteStartElement(String.Empty, "SceneObjectGroup", String.Empty); | 1044 | writer.WriteStartElement(String.Empty, "SceneObjectGroup", String.Empty); |
1081 | SOPToXml2(writer, sog.RootPart, null, options); | 1045 | SOPToXml2(writer, sog.RootPart, options); |
1082 | writer.WriteStartElement(String.Empty, "OtherParts", String.Empty); | 1046 | writer.WriteStartElement(String.Empty, "OtherParts", String.Empty); |
1083 | 1047 | ||
1084 | sog.ForEachPart(delegate(SceneObjectPart sop) | 1048 | sog.ForEachPart(delegate(SceneObjectPart sop) |
1085 | { | 1049 | { |
1086 | if (sop.UUID != sog.RootPart.UUID) | 1050 | if (sop.UUID != sog.RootPart.UUID) |
1087 | SOPToXml2(writer, sop, sog.RootPart, options); | 1051 | SOPToXml2(writer, sop, options); |
1088 | }); | 1052 | }); |
1089 | 1053 | ||
1090 | writer.WriteEndElement(); | 1054 | writer.WriteEndElement(); |
1091 | writer.WriteEndElement(); | 1055 | writer.WriteEndElement(); |
1092 | } | 1056 | } |
1093 | 1057 | ||
1094 | static void SOPToXml2(XmlTextWriter writer, SceneObjectPart sop, SceneObjectPart parent, Dictionary<string, object> options) | 1058 | public static void SOPToXml2(XmlTextWriter writer, SceneObjectPart sop, Dictionary<string, object> options) |
1095 | { | 1059 | { |
1096 | writer.WriteStartElement("SceneObjectPart"); | 1060 | writer.WriteStartElement("SceneObjectPart"); |
1097 | writer.WriteAttributeString("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance"); | 1061 | writer.WriteAttributeString("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance"); |
@@ -1229,6 +1193,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
1229 | WriteUUID(writer, "PermsGranter", item.PermsGranter, options); | 1193 | WriteUUID(writer, "PermsGranter", item.PermsGranter, options); |
1230 | writer.WriteElementString("PermsMask", item.PermsMask.ToString()); | 1194 | writer.WriteElementString("PermsMask", item.PermsMask.ToString()); |
1231 | writer.WriteElementString("Type", item.Type.ToString()); | 1195 | writer.WriteElementString("Type", item.Type.ToString()); |
1196 | writer.WriteElementString("OwnerChanged", item.OwnerChanged.ToString().ToLower()); | ||
1232 | 1197 | ||
1233 | writer.WriteEndElement(); // TaskInventoryItem | 1198 | writer.WriteEndElement(); // TaskInventoryItem |
1234 | } | 1199 | } |
@@ -1398,7 +1363,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
1398 | } | 1363 | } |
1399 | else | 1364 | else |
1400 | { | 1365 | { |
1401 | //m_log.DebugFormat("[SceneObjectSerializer]: caught unknown element {0}", nodeName); | 1366 | m_log.DebugFormat("[SceneObjectSerializer]: caught unknown element {0}", nodeName); |
1402 | reader.ReadOuterXml(); // ignore | 1367 | reader.ReadOuterXml(); // ignore |
1403 | } | 1368 | } |
1404 | 1369 | ||
diff --git a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs index 3e3a0f0..72dce6d 100644 --- a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs +++ b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs | |||
@@ -40,6 +40,7 @@ using log4net; | |||
40 | using Nini.Config; | 40 | using Nini.Config; |
41 | using System.Reflection; | 41 | using System.Reflection; |
42 | using System.IO; | 42 | using System.IO; |
43 | using ComponentAce.Compression.Libs.zlib; | ||
43 | 44 | ||
44 | namespace OpenSim.Region.Physics.Meshing | 45 | namespace OpenSim.Region.Physics.Meshing |
45 | { | 46 | { |
@@ -74,6 +75,7 @@ namespace OpenSim.Region.Physics.Meshing | |||
74 | 75 | ||
75 | private bool cacheSculptMaps = true; | 76 | private bool cacheSculptMaps = true; |
76 | private string decodedSculptMapPath = null; | 77 | private string decodedSculptMapPath = null; |
78 | private bool useMeshiesPhysicsMesh = false; | ||
77 | 79 | ||
78 | private float minSizeForComplexMesh = 0.2f; // prims with all dimensions smaller than this will have a bounding box mesh | 80 | private float minSizeForComplexMesh = 0.2f; // prims with all dimensions smaller than this will have a bounding box mesh |
79 | 81 | ||
@@ -85,6 +87,7 @@ namespace OpenSim.Region.Physics.Meshing | |||
85 | 87 | ||
86 | decodedSculptMapPath = start_config.GetString("DecodedSculptMapPath","j2kDecodeCache"); | 88 | decodedSculptMapPath = start_config.GetString("DecodedSculptMapPath","j2kDecodeCache"); |
87 | cacheSculptMaps = start_config.GetBoolean("CacheSculptMaps", cacheSculptMaps); | 89 | cacheSculptMaps = start_config.GetBoolean("CacheSculptMaps", cacheSculptMaps); |
90 | useMeshiesPhysicsMesh = start_config.GetBoolean("UseMeshiesPhysicsMesh", useMeshiesPhysicsMesh); | ||
88 | 91 | ||
89 | try | 92 | try |
90 | { | 93 | { |
@@ -268,73 +271,113 @@ namespace OpenSim.Region.Physics.Meshing | |||
268 | { | 271 | { |
269 | if (((OpenMetaverse.SculptType)primShape.SculptType) == SculptType.Mesh) | 272 | if (((OpenMetaverse.SculptType)primShape.SculptType) == SculptType.Mesh) |
270 | { | 273 | { |
271 | // add code for mesh physics proxy generation here | 274 | if (!useMeshiesPhysicsMesh) |
272 | m_log.Debug("[MESH]: mesh proxy generation not implemented yet "); | 275 | return null; |
273 | |||
274 | OSD meshOsd; | ||
275 | 276 | ||
276 | if (primShape.SculptData.Length > 0) | 277 | m_log.Debug("[MESH]: experimental mesh proxy generation"); |
277 | { | ||
278 | |||
279 | |||
280 | m_log.Debug("[MESH]: asset data length: " + primShape.SculptData.Length.ToString()); | ||
281 | byte[] header = Util.StringToBytes256("<? LLSD/Binary ?>"); | ||
282 | 278 | ||
283 | ////dump to debugging file | 279 | OSD meshOsd; |
284 | //string filename = System.IO.Path.Combine(decodedSculptMapPath, "mesh_" + primShape.SculptTexture.ToString()); | ||
285 | //BinaryWriter writer = new BinaryWriter(File.Open(filename, FileMode.Create)); | ||
286 | //writer.Write(primShape.SculptData); | ||
287 | //writer.Close(); | ||
288 | 280 | ||
289 | } | 281 | if (primShape.SculptData.Length <= 0) |
290 | else | ||
291 | { | 282 | { |
292 | m_log.Error("[MESH]: asset data is zero length"); | 283 | m_log.Error("[MESH]: asset data is zero length"); |
293 | return null; | 284 | return null; |
294 | } | 285 | } |
295 | 286 | ||
296 | try | 287 | long start = 0; |
288 | using (MemoryStream data = new MemoryStream(primShape.SculptData)) | ||
297 | { | 289 | { |
298 | meshOsd = OSDParser.DeserializeLLSDBinary(primShape.SculptData, true); | 290 | meshOsd = (OSDMap)OSDParser.DeserializeLLSDBinary(data, true); |
299 | } | 291 | start = data.Position; |
300 | catch (Exception e) | ||
301 | { | ||
302 | m_log.Error("[MESH]: exception decoding mesh asset: " + e.ToString()); | ||
303 | return null; | ||
304 | } | 292 | } |
305 | 293 | ||
306 | if (meshOsd is OSDMap) | 294 | if (meshOsd is OSDMap) |
307 | { | 295 | { |
308 | OSDMap map = (OSDMap)meshOsd; | 296 | OSDMap map = (OSDMap)meshOsd; |
309 | //foreach (string name in map.Keys) | ||
310 | // m_log.Debug("[MESH]: key:" + name + " value:" + map[name].AsString()); | ||
311 | OSDMap physicsParms = (OSDMap)map["physics_shape"]; | 297 | OSDMap physicsParms = (OSDMap)map["physics_shape"]; |
312 | int physOffset = physicsParms["offset"].AsInteger(); | 298 | int physOffset = physicsParms["offset"].AsInteger() + (int)start; |
313 | int physSize = physicsParms["size"].AsInteger(); | 299 | int physSize = physicsParms["size"].AsInteger(); |
314 | 300 | ||
315 | if (physOffset < 0 || physSize == 0) | 301 | if (physOffset < 0 || physSize == 0) |
316 | return null; // no mesh data in asset | 302 | return null; // no mesh data in asset |
317 | 303 | ||
318 | m_log.Debug("[MESH]: physOffset:" + physOffset.ToString() + " physSize:" + physSize.ToString()); | 304 | OSD decodedMeshOsd = new OSD(); |
319 | //MemoryStream ms = new MemoryStream(primShape.SculptData, physOffset, physSize); | 305 | byte[] meshBytes = new byte[physSize]; |
320 | //GZipStream gzStream = new GZipStream(ms, CompressionMode.Decompress); | 306 | System.Buffer.BlockCopy(primShape.SculptData, physOffset, meshBytes, 0, physSize); |
321 | 307 | byte[] decompressed = new byte[physSize * 5]; | |
322 | //int maxSize = physSize * 5; // arbitrary guess | 308 | try |
323 | //byte[] readBuffer = new byte[maxSize]; | 309 | { |
324 | 310 | using (MemoryStream inMs = new MemoryStream(meshBytes)) | |
325 | //int bytesRead = gzStream.Read(readBuffer, 0, maxSize); | 311 | { |
326 | 312 | using (MemoryStream outMs = new MemoryStream()) | |
327 | //OSD physMeshOsd = OSDParser.DeserializeLLSDBinary(readBuffer); | 313 | { |
328 | 314 | using (ZOutputStream zOut = new ZOutputStream(outMs)) | |
329 | 315 | { | |
330 | 316 | byte[] readBuffer = new byte[2048]; | |
317 | int readLen = 0; | ||
318 | while ((readLen = inMs.Read(readBuffer, 0, readBuffer.Length)) > 0) | ||
319 | { | ||
320 | zOut.Write(readBuffer, 0, readLen); | ||
321 | } | ||
322 | zOut.Flush(); | ||
323 | outMs.Seek(0, SeekOrigin.Begin); | ||
324 | |||
325 | byte[] decompressedBuf = outMs.GetBuffer(); | ||
326 | |||
327 | decodedMeshOsd = OSDParser.DeserializeLLSDBinary(decompressedBuf, true); | ||
328 | } | ||
329 | } | ||
330 | } | ||
331 | } | ||
332 | catch (Exception e) | ||
333 | { | ||
334 | m_log.Error("[MESH]: exception decoding physical mesh: " + e.ToString()); | ||
335 | return null; | ||
336 | } | ||
331 | 337 | ||
338 | OSDArray decodedMeshOsdArray = null; | ||
332 | 339 | ||
340 | // physics_shape is an array of OSDMaps, one for each submesh | ||
341 | if (decodedMeshOsd is OSDArray) | ||
342 | { | ||
343 | decodedMeshOsdArray = (OSDArray)decodedMeshOsd; | ||
344 | foreach (OSD subMeshOsd in decodedMeshOsdArray) | ||
345 | { | ||
346 | if (subMeshOsd is OSDMap) | ||
347 | { | ||
348 | OSDMap subMeshMap = (OSDMap)subMeshOsd; | ||
349 | |||
350 | OpenMetaverse.Vector3 posMax = ((OSDMap)subMeshMap["PositionDomain"])["Max"].AsVector3(); | ||
351 | OpenMetaverse.Vector3 posMin = ((OSDMap)subMeshMap["PositionDomain"])["Min"].AsVector3(); | ||
352 | |||
353 | byte[] posBytes = subMeshMap["Position"].AsBinary(); | ||
354 | for (int i = 0; i < posBytes.Length; i += 6) | ||
355 | { | ||
356 | ushort uX = Utils.BytesToUInt16(posBytes, i); | ||
357 | ushort uY = Utils.BytesToUInt16(posBytes, i + 2); | ||
358 | ushort uZ = Utils.BytesToUInt16(posBytes, i + 4); | ||
359 | |||
360 | Coord c = new Coord( | ||
361 | Utils.UInt16ToFloat(uX, posMin.X, posMax.X) * size.X, | ||
362 | Utils.UInt16ToFloat(uY, posMin.Y, posMax.Y) * size.Y, | ||
363 | Utils.UInt16ToFloat(uZ, posMin.Z, posMax.Z) * size.Z); | ||
364 | |||
365 | coords.Add(c); | ||
366 | } | ||
367 | |||
368 | byte[] triangleBytes = subMeshMap["TriangleList"].AsBinary(); | ||
369 | for (int i = 0; i < triangleBytes.Length; i += 6) | ||
370 | { | ||
371 | ushort v1 = Utils.BytesToUInt16(triangleBytes, i); | ||
372 | ushort v2 = Utils.BytesToUInt16(triangleBytes, i + 2); | ||
373 | ushort v3 = Utils.BytesToUInt16(triangleBytes, i + 4); | ||
374 | Face f = new Face(v1, v2, v3); | ||
375 | faces.Add(f); | ||
376 | } | ||
377 | } | ||
378 | } | ||
379 | } | ||
333 | } | 380 | } |
334 | |||
335 | //just bail out for now until mesh code is finished | ||
336 | return null; | ||
337 | |||
338 | } | 381 | } |
339 | else | 382 | else |
340 | { | 383 | { |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 6827ede..5212e1b 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | |||
@@ -2213,6 +2213,48 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2213 | 2213 | ||
2214 | m_LSL_Api.SetPrimitiveParamsEx(prim, rules); | 2214 | m_LSL_Api.SetPrimitiveParamsEx(prim, rules); |
2215 | } | 2215 | } |
2216 | |||
2217 | /// <summary> | ||
2218 | /// Set parameters for light projection in host prim | ||
2219 | /// </summary> | ||
2220 | public void osSetProjectionParams(bool projection, LSL_Key texture, double fov, double focus, double amb) | ||
2221 | { | ||
2222 | CheckThreatLevel(ThreatLevel.High, "osSetProjectionParams"); | ||
2223 | |||
2224 | osSetProjectionParams(UUID.Zero.ToString(), projection, texture, fov, focus, amb); | ||
2225 | } | ||
2226 | |||
2227 | /// <summary> | ||
2228 | /// Set parameters for light projection with uuid of target prim | ||
2229 | /// </summary> | ||
2230 | public void osSetProjectionParams(LSL_Key prim, bool projection, LSL_Key texture, double fov, double focus, double amb) | ||
2231 | { | ||
2232 | CheckThreatLevel(ThreatLevel.High, "osSetProjectionParams"); | ||
2233 | m_host.AddScriptLPS(1); | ||
2234 | |||
2235 | SceneObjectPart obj = null; | ||
2236 | if (prim == UUID.Zero.ToString()) | ||
2237 | { | ||
2238 | obj = m_host; | ||
2239 | } | ||
2240 | else | ||
2241 | { | ||
2242 | obj = World.GetSceneObjectPart(new UUID(prim)); | ||
2243 | if (obj == null) | ||
2244 | return; | ||
2245 | } | ||
2246 | |||
2247 | obj.Shape.ProjectionEntry = projection; | ||
2248 | obj.Shape.ProjectionTextureUUID = new UUID(texture); | ||
2249 | obj.Shape.ProjectionFOV = (float)fov; | ||
2250 | obj.Shape.ProjectionFocus = (float)focus; | ||
2251 | obj.Shape.ProjectionAmbiance = (float)amb; | ||
2252 | |||
2253 | |||
2254 | obj.ParentGroup.HasGroupChanged = true; | ||
2255 | obj.ScheduleFullUpdate(); | ||
2256 | |||
2257 | } | ||
2216 | 2258 | ||
2217 | /// <summary> | 2259 | /// <summary> |
2218 | /// Like osGetAgents but returns enough info for a radar | 2260 | /// Like osGetAgents but returns enough info for a radar |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index c8f3623..fbf601a 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | |||
@@ -176,6 +176,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces | |||
176 | void osCauseDamage(string avatar, double damage); | 176 | void osCauseDamage(string avatar, double damage); |
177 | LSL_List osGetPrimitiveParams(LSL_Key prim, LSL_List rules); | 177 | LSL_List osGetPrimitiveParams(LSL_Key prim, LSL_List rules); |
178 | void osSetPrimitiveParams(LSL_Key prim, LSL_List rules); | 178 | void osSetPrimitiveParams(LSL_Key prim, LSL_List rules); |
179 | void osSetProjectionParams(bool projection, LSL_Key texture, double fov, double focus, double amb); | ||
180 | void osSetProjectionParams(LSL_Key prim, bool projection, LSL_Key texture, double fov, double focus, double amb); | ||
181 | |||
179 | LSL_List osGetAvatarList(); | 182 | LSL_List osGetAvatarList(); |
180 | 183 | ||
181 | } | 184 | } |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index 6cc5f51..e289554 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | |||
@@ -688,6 +688,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
688 | m_OSSL_Functions.osSetPrimitiveParams(prim, rules); | 688 | m_OSSL_Functions.osSetPrimitiveParams(prim, rules); |
689 | } | 689 | } |
690 | 690 | ||
691 | public void osSetProjectionParams(bool projection, LSL_Key texture, double fov, double focus, double amb) | ||
692 | { | ||
693 | m_OSSL_Functions.osSetProjectionParams(projection, texture, fov, focus, amb); | ||
694 | } | ||
695 | |||
696 | public void osSetProjectionParams(LSL_Key prim, bool projection, LSL_Key texture, double fov, double focus, double amb) | ||
697 | { | ||
698 | m_OSSL_Functions.osSetProjectionParams(prim, projection, texture, fov, focus, amb); | ||
699 | } | ||
700 | |||
691 | public LSL_List osGetAvatarList() | 701 | public LSL_List osGetAvatarList() |
692 | { | 702 | { |
693 | return m_OSSL_Functions.osGetAvatarList(); | 703 | return m_OSSL_Functions.osGetAvatarList(); |