diff options
author | Johan Berntsson | 2008-03-04 05:31:54 +0000 |
---|---|---|
committer | Johan Berntsson | 2008-03-04 05:31:54 +0000 |
commit | 279e0061c515ee0a03036bef68eea9738273d785 (patch) | |
tree | 4502228eb7b87a760e0b0e67aded9d1d870d0bed /OpenSim/Region/Environment | |
parent | Added copyright heaaders. Minor cleanup. (diff) | |
download | opensim-SC_OLD-279e0061c515ee0a03036bef68eea9738273d785.zip opensim-SC_OLD-279e0061c515ee0a03036bef68eea9738273d785.tar.gz opensim-SC_OLD-279e0061c515ee0a03036bef68eea9738273d785.tar.bz2 opensim-SC_OLD-279e0061c515ee0a03036bef68eea9738273d785.tar.xz |
Merged 3Di code that provides scene and avatar serialization, and plugin support for region move/split/merge. See ThirdParty/3Di/README.txt. Unless the new modules are used there should be no noticeable changes when running OpenSim.
Diffstat (limited to 'OpenSim/Region/Environment')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/AvatarAppearance.cs | 49 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/EntityBase.cs | 91 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/InnerScene.cs | 43 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.cs | 55 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | 119 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/ScenePresence.cs | 416 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Types/UpdateQueue.cs | 50 |
7 files changed, 802 insertions, 21 deletions
diff --git a/OpenSim/Region/Environment/Scenes/AvatarAppearance.cs b/OpenSim/Region/Environment/Scenes/AvatarAppearance.cs index b54f777..fcc8fdf 100644 --- a/OpenSim/Region/Environment/Scenes/AvatarAppearance.cs +++ b/OpenSim/Region/Environment/Scenes/AvatarAppearance.cs | |||
@@ -26,13 +26,16 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System; | ||
29 | using libsecondlife; | 30 | using libsecondlife; |
30 | using libsecondlife.Packets; | 31 | using libsecondlife.Packets; |
31 | using OpenSim.Framework; | 32 | using OpenSim.Framework; |
32 | 33 | using System.Runtime.Serialization; | |
34 | using System.Security.Permissions; | ||
33 | namespace OpenSim.Region.Environment.Scenes | 35 | namespace OpenSim.Region.Environment.Scenes |
34 | { | 36 | { |
35 | public class AvatarAppearance | 37 | [Serializable] |
38 | public class AvatarAppearance : ISerializable | ||
36 | { | 39 | { |
37 | protected LLUUID m_scenePresenceID; | 40 | protected LLUUID m_scenePresenceID; |
38 | 41 | ||
@@ -149,5 +152,45 @@ namespace OpenSim.Region.Environment.Scenes | |||
149 | textu.CreateFace(6).TextureID = new LLUUID("00000000-0000-1111-9999-000000000011"); | 152 | textu.CreateFace(6).TextureID = new LLUUID("00000000-0000-1111-9999-000000000011"); |
150 | return textu; | 153 | return textu; |
151 | } | 154 | } |
155 | |||
156 | protected AvatarAppearance(SerializationInfo info, StreamingContext context) | ||
157 | { | ||
158 | //System.Console.WriteLine("AvatarAppearance Deserialize BGN"); | ||
159 | |||
160 | if (info == null) | ||
161 | { | ||
162 | throw new System.ArgumentNullException("info"); | ||
163 | } | ||
164 | |||
165 | m_scenePresenceID = new LLUUID((Guid)info.GetValue("m_scenePresenceID", typeof(Guid))); | ||
166 | m_wearablesSerial = (int)info.GetValue("m_wearablesSerial", typeof(int)); | ||
167 | m_visualParams = (byte[])info.GetValue("m_visualParams", typeof(byte[])); | ||
168 | m_wearables = (AvatarWearable[])info.GetValue("m_wearables", typeof(AvatarWearable[])); | ||
169 | |||
170 | byte[] m_textureEntry_work = (byte[])info.GetValue("m_textureEntry", typeof(byte[])); | ||
171 | m_textureEntry = new LLObject.TextureEntry(m_textureEntry_work, 0, m_textureEntry_work.Length); | ||
172 | |||
173 | m_avatarHeight = (float)info.GetValue("m_avatarHeight", typeof(float)); | ||
174 | |||
175 | //System.Console.WriteLine("AvatarAppearance Deserialize END"); | ||
176 | } | ||
177 | |||
178 | [SecurityPermission(SecurityAction.LinkDemand, | ||
179 | Flags = SecurityPermissionFlag.SerializationFormatter)] | ||
180 | public virtual void GetObjectData( | ||
181 | SerializationInfo info, StreamingContext context) | ||
182 | { | ||
183 | if (info == null) | ||
184 | { | ||
185 | throw new System.ArgumentNullException("info"); | ||
186 | } | ||
187 | |||
188 | info.AddValue("m_scenePresenceID", m_scenePresenceID.UUID); | ||
189 | info.AddValue("m_wearablesSerial", m_wearablesSerial); | ||
190 | info.AddValue("m_visualParams", m_visualParams); | ||
191 | info.AddValue("m_wearables", m_wearables); | ||
192 | info.AddValue("m_textureEntry", m_textureEntry.ToBytes()); | ||
193 | info.AddValue("m_avatarHeight", m_avatarHeight); | ||
194 | } | ||
152 | } | 195 | } |
153 | } \ No newline at end of file | 196 | } |
diff --git a/OpenSim/Region/Environment/Scenes/EntityBase.cs b/OpenSim/Region/Environment/Scenes/EntityBase.cs index 91dda74..2a8c1e9 100644 --- a/OpenSim/Region/Environment/Scenes/EntityBase.cs +++ b/OpenSim/Region/Environment/Scenes/EntityBase.cs | |||
@@ -30,9 +30,14 @@ using System.Collections.Generic; | |||
30 | using Axiom.Math; | 30 | using Axiom.Math; |
31 | using libsecondlife; | 31 | using libsecondlife; |
32 | 32 | ||
33 | using System; | ||
34 | using System.Runtime.Serialization; | ||
35 | using System.Security.Permissions; | ||
36 | |||
33 | namespace OpenSim.Region.Environment.Scenes | 37 | namespace OpenSim.Region.Environment.Scenes |
34 | { | 38 | { |
35 | public abstract class EntityBase | 39 | [Serializable] |
40 | public abstract class EntityBase : ISerializable | ||
36 | { | 41 | { |
37 | protected Scene m_scene; | 42 | protected Scene m_scene; |
38 | 43 | ||
@@ -134,6 +139,90 @@ namespace OpenSim.Region.Environment.Scenes | |||
134 | 139 | ||
135 | 140 | ||
136 | public abstract void SetText(string text, Vector3 color, double alpha); | 141 | public abstract void SetText(string text, Vector3 color, double alpha); |
142 | |||
143 | protected EntityBase(SerializationInfo info, StreamingContext context) | ||
144 | { | ||
145 | //System.Console.WriteLine("EntityBase Deserialize BGN"); | ||
146 | |||
147 | if (info == null) | ||
148 | { | ||
149 | throw new System.ArgumentNullException("info"); | ||
150 | } | ||
151 | |||
152 | //JB m_children = (List<EntityBase>)info.GetValue("m_children", typeof(List<EntityBase>)); | ||
153 | // m_scene = (Scene)info.GetValue("m_scene", typeof(Scene)); | ||
154 | m_uuid = new LLUUID((Guid)info.GetValue("m_uuid", typeof(Guid))); | ||
155 | m_name = (string)info.GetValue("m_name", typeof(string)); | ||
156 | |||
157 | m_pos | ||
158 | = new LLVector3( | ||
159 | (float)info.GetValue("m_pos.X", typeof(float)), | ||
160 | (float)info.GetValue("m_pos.Y", typeof(float)), | ||
161 | (float)info.GetValue("m_pos.Z", typeof(float))); | ||
162 | |||
163 | m_velocity | ||
164 | = new LLVector3( | ||
165 | (float)info.GetValue("m_velocity.X", typeof(float)), | ||
166 | (float)info.GetValue("m_velocity.Y", typeof(float)), | ||
167 | (float)info.GetValue("m_velocity.Z", typeof(float))); | ||
168 | |||
169 | m_rotationalvelocity | ||
170 | = new LLVector3( | ||
171 | (float)info.GetValue("m_rotationalvelocity.X", typeof(float)), | ||
172 | (float)info.GetValue("m_rotationalvelocity.Y", typeof(float)), | ||
173 | (float)info.GetValue("m_rotationalvelocity.Z", typeof(float))); | ||
174 | |||
175 | m_rotation | ||
176 | = new Quaternion( | ||
177 | (float)info.GetValue("m_rotation.w", typeof(float)), | ||
178 | (float)info.GetValue("m_rotation.x", typeof(float)), | ||
179 | (float)info.GetValue("m_rotation.y", typeof(float)), | ||
180 | (float)info.GetValue("m_rotation.z", typeof(float))); | ||
181 | |||
182 | m_localId = (uint)info.GetValue("m_localId", typeof(uint)); | ||
183 | |||
184 | //System.Console.WriteLine("EntityBase Deserialize END"); | ||
185 | } | ||
186 | |||
187 | [SecurityPermission(SecurityAction.LinkDemand, | ||
188 | Flags = SecurityPermissionFlag.SerializationFormatter)] | ||
189 | public virtual void GetObjectData( | ||
190 | SerializationInfo info, StreamingContext context) | ||
191 | { | ||
192 | if (info == null) | ||
193 | { | ||
194 | throw new System.ArgumentNullException("info"); | ||
195 | } | ||
196 | |||
197 | //JB info.AddValue("m_children", m_children); | ||
198 | |||
199 | // info.AddValue("m_scene", m_scene); | ||
200 | info.AddValue("m_uuid", m_uuid.UUID); | ||
201 | info.AddValue("m_name", m_name); | ||
202 | |||
203 | // LLVector3 | ||
204 | info.AddValue("m_pos.X", m_pos.X); | ||
205 | info.AddValue("m_pos.Y", m_pos.Y); | ||
206 | info.AddValue("m_pos.Z", m_pos.Z); | ||
207 | |||
208 | // LLVector3 | ||
209 | info.AddValue("m_velocity.X", m_velocity.X); | ||
210 | info.AddValue("m_velocity.Y", m_velocity.Y); | ||
211 | info.AddValue("m_velocity.Z", m_velocity.Z); | ||
212 | |||
213 | // LLVector3 | ||
214 | info.AddValue("m_rotationalvelocity.X", m_rotationalvelocity.X); | ||
215 | info.AddValue("m_rotationalvelocity.Y", m_rotationalvelocity.Y); | ||
216 | info.AddValue("m_rotationalvelocity.Z", m_rotationalvelocity.Z); | ||
217 | |||
218 | // Quaternion | ||
219 | info.AddValue("m_rotation.w", m_rotation.w); | ||
220 | info.AddValue("m_rotation.x", m_rotation.x); | ||
221 | info.AddValue("m_rotation.y", m_rotation.y); | ||
222 | info.AddValue("m_rotation.z", m_rotation.z); | ||
223 | |||
224 | info.AddValue("m_localId", m_localId); | ||
225 | } | ||
137 | } | 226 | } |
138 | 227 | ||
139 | //Nested Classes | 228 | //Nested Classes |
diff --git a/OpenSim/Region/Environment/Scenes/InnerScene.cs b/OpenSim/Region/Environment/Scenes/InnerScene.cs index 860f5fb..882e589 100644 --- a/OpenSim/Region/Environment/Scenes/InnerScene.cs +++ b/OpenSim/Region/Environment/Scenes/InnerScene.cs | |||
@@ -57,6 +57,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
57 | // SceneObjects is not currently populated or used. | 57 | // SceneObjects is not currently populated or used. |
58 | //public Dictionary<LLUUID, SceneObjectGroup> SceneObjects; | 58 | //public Dictionary<LLUUID, SceneObjectGroup> SceneObjects; |
59 | public Dictionary<LLUUID, EntityBase> Entities; | 59 | public Dictionary<LLUUID, EntityBase> Entities; |
60 | public Dictionary<LLUUID, ScenePresence> RestorePresences; | ||
60 | 61 | ||
61 | public BasicQuadTreeNode QuadTree; | 62 | public BasicQuadTreeNode QuadTree; |
62 | 63 | ||
@@ -455,6 +456,48 @@ namespace OpenSim.Region.Environment.Scenes | |||
455 | return newAvatar; | 456 | return newAvatar; |
456 | } | 457 | } |
457 | 458 | ||
459 | public void AddScenePresence(ScenePresence presence) | ||
460 | { | ||
461 | bool child = presence.IsChildAgent; | ||
462 | |||
463 | if (child) | ||
464 | { | ||
465 | m_numChildAgents++; | ||
466 | m_log.Info("[SCENE]"+ m_regInfo.RegionName + ": Creating new child agent."); | ||
467 | } | ||
468 | else | ||
469 | { | ||
470 | m_numRootAgents++; | ||
471 | m_log.Info("[SCENE] "+ m_regInfo.RegionName + ": Creating new root agent."); | ||
472 | m_log.Info("[SCENE] "+ m_regInfo.RegionName + ": Adding Physical agent."); | ||
473 | |||
474 | presence.AddToPhysicalScene(); | ||
475 | } | ||
476 | |||
477 | lock (Entities) | ||
478 | { | ||
479 | if (!Entities.ContainsKey(presence.m_uuid)) | ||
480 | { | ||
481 | Entities.Add(presence.m_uuid, presence); | ||
482 | } | ||
483 | else | ||
484 | { | ||
485 | Entities[presence.m_uuid] = presence; | ||
486 | } | ||
487 | } | ||
488 | lock (ScenePresences) | ||
489 | { | ||
490 | if (ScenePresences.ContainsKey(presence.m_uuid)) | ||
491 | { | ||
492 | ScenePresences[presence.m_uuid] = presence; | ||
493 | } | ||
494 | else | ||
495 | { | ||
496 | ScenePresences.Add(presence.m_uuid, presence); | ||
497 | } | ||
498 | } | ||
499 | } | ||
500 | |||
458 | public void SwapRootChildAgent(bool direction_RC_CR_T_F) | 501 | public void SwapRootChildAgent(bool direction_RC_CR_T_F) |
459 | { | 502 | { |
460 | if (direction_RC_CR_T_F) | 503 | if (direction_RC_CR_T_F) |
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 845de22..43e7e99 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs | |||
@@ -54,6 +54,10 @@ namespace OpenSim.Region.Environment.Scenes | |||
54 | 54 | ||
55 | public partial class Scene : SceneBase | 55 | public partial class Scene : SceneBase |
56 | { | 56 | { |
57 | public delegate void SynchronizeSceneHandler(Scene scene); | ||
58 | public SynchronizeSceneHandler SynchronizeScene = null; | ||
59 | public int splitID = 0; | ||
60 | |||
57 | #region Fields | 61 | #region Fields |
58 | 62 | ||
59 | protected Timer m_heartbeatTimer = new Timer(); | 63 | protected Timer m_heartbeatTimer = new Timer(); |
@@ -216,7 +220,11 @@ namespace OpenSim.Region.Environment.Scenes | |||
216 | get { return m_innerScene.Entities; } | 220 | get { return m_innerScene.Entities; } |
217 | set { m_innerScene.Entities = value; } | 221 | set { m_innerScene.Entities = value; } |
218 | } | 222 | } |
219 | 223 | public Dictionary<LLUUID, ScenePresence> m_restorePresences | |
224 | { | ||
225 | get { return m_innerScene.RestorePresences; } | ||
226 | set { m_innerScene.RestorePresences = value; } | ||
227 | } | ||
220 | #endregion | 228 | #endregion |
221 | 229 | ||
222 | #region Constructors | 230 | #region Constructors |
@@ -276,6 +284,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
276 | Entities = new Dictionary<LLUUID, EntityBase>(); | 284 | Entities = new Dictionary<LLUUID, EntityBase>(); |
277 | m_scenePresences = new Dictionary<LLUUID, ScenePresence>(); | 285 | m_scenePresences = new Dictionary<LLUUID, ScenePresence>(); |
278 | //m_sceneObjects = new Dictionary<LLUUID, SceneObjectGroup>(); | 286 | //m_sceneObjects = new Dictionary<LLUUID, SceneObjectGroup>(); |
287 | m_restorePresences = new Dictionary<LLUUID, ScenePresence>(); | ||
279 | 288 | ||
280 | m_log.Info("[SCENE]: Creating LandMap"); | 289 | m_log.Info("[SCENE]: Creating LandMap"); |
281 | Terrain = new TerrainEngine((int)RegionInfo.RegionLocX, (int)RegionInfo.RegionLocY); | 290 | Terrain = new TerrainEngine((int)RegionInfo.RegionLocX, (int)RegionInfo.RegionLocY); |
@@ -701,6 +710,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
701 | physicsFPS = m_innerScene.UpdatePhysics( | 710 | physicsFPS = m_innerScene.UpdatePhysics( |
702 | Math.Max(SinceLastFrame.TotalSeconds, m_timespan) | 711 | Math.Max(SinceLastFrame.TotalSeconds, m_timespan) |
703 | ); | 712 | ); |
713 | if (m_frame % m_update_physics == 0 && SynchronizeScene != null) | ||
714 | SynchronizeScene(this); | ||
704 | 715 | ||
705 | physicsMS = System.Environment.TickCount - physicsMS; | 716 | physicsMS = System.Environment.TickCount - physicsMS; |
706 | physicsMS += physicsMS2; | 717 | physicsMS += physicsMS2; |
@@ -719,6 +730,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
719 | if (m_frame % m_update_presences == 0) | 730 | if (m_frame % m_update_presences == 0) |
720 | m_innerScene.UpdatePresences(); | 731 | m_innerScene.UpdatePresences(); |
721 | 732 | ||
733 | if (Region_Status != RegionStatus.SlaveScene) | ||
734 | { | ||
722 | if (m_frame % m_update_events == 0) | 735 | if (m_frame % m_update_events == 0) |
723 | UpdateEvents(); | 736 | UpdateEvents(); |
724 | 737 | ||
@@ -747,7 +760,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
747 | m_statsReporter.addOtherMS(otherMS); | 760 | m_statsReporter.addOtherMS(otherMS); |
748 | m_statsReporter.SetActiveScripts(m_innerScene.GetActiveScripts()); | 761 | m_statsReporter.SetActiveScripts(m_innerScene.GetActiveScripts()); |
749 | m_statsReporter.addScriptLines(m_innerScene.GetScriptLPS()); | 762 | m_statsReporter.addScriptLines(m_innerScene.GetScriptLPS()); |
750 | 763 | } | |
751 | } | 764 | } |
752 | catch (NotImplementedException) | 765 | catch (NotImplementedException) |
753 | { | 766 | { |
@@ -1058,10 +1071,10 @@ namespace OpenSim.Region.Environment.Scenes | |||
1058 | 1071 | ||
1059 | #region Load Land | 1072 | #region Load Land |
1060 | 1073 | ||
1061 | public void loadAllLandObjectsFromStorage() | 1074 | public void loadAllLandObjectsFromStorage(LLUUID regionID) |
1062 | { | 1075 | { |
1063 | m_log.Info("[SCENE]: Loading land objects from storage"); | 1076 | m_log.Info("[SCENE]: Loading land objects from storage"); |
1064 | List<LandData> landData = m_storageManager.DataStore.LoadLandObjects(RegionInfo.RegionID); | 1077 | List<LandData> landData = m_storageManager.DataStore.LoadLandObjects(regionID); |
1065 | 1078 | ||
1066 | if (landData.Count == 0) | 1079 | if (landData.Count == 0) |
1067 | { | 1080 | { |
@@ -1080,11 +1093,11 @@ namespace OpenSim.Region.Environment.Scenes | |||
1080 | /// <summary> | 1093 | /// <summary> |
1081 | /// Loads the World's objects | 1094 | /// Loads the World's objects |
1082 | /// </summary> | 1095 | /// </summary> |
1083 | public virtual void LoadPrimsFromStorage(bool m_permissions) | 1096 | public virtual void LoadPrimsFromStorage(bool m_permissions, LLUUID regionID) |
1084 | { | 1097 | { |
1085 | m_log.Info("[SCENE]: Loading objects from datastore"); | 1098 | m_log.Info("[SCENE]: Loading objects from datastore"); |
1086 | 1099 | ||
1087 | List<SceneObjectGroup> PrimsFromDB = m_storageManager.DataStore.LoadObjects(m_regInfo.RegionID); | 1100 | List<SceneObjectGroup> PrimsFromDB = m_storageManager.DataStore.LoadObjects(regionID); |
1088 | foreach (SceneObjectGroup group in PrimsFromDB) | 1101 | foreach (SceneObjectGroup group in PrimsFromDB) |
1089 | { | 1102 | { |
1090 | AddEntityFromStorage(group); | 1103 | AddEntityFromStorage(group); |
@@ -1339,13 +1352,35 @@ namespace OpenSim.Region.Environment.Scenes | |||
1339 | { | 1352 | { |
1340 | m_log.Warn("[CONNECTION DEBUGGING]: Creating new client for " + client.AgentId.ToString()); | 1353 | m_log.Warn("[CONNECTION DEBUGGING]: Creating new client for " + client.AgentId.ToString()); |
1341 | SubscribeToClientEvents(client); | 1354 | SubscribeToClientEvents(client); |
1355 | ScenePresence presence = null; | ||
1356 | |||
1357 | if (m_restorePresences.ContainsKey(client.AgentId)) | ||
1358 | { | ||
1359 | m_log.Info("REGION Restore Scene Presence"); | ||
1360 | |||
1361 | presence = m_restorePresences[client.AgentId]; | ||
1362 | m_restorePresences.Remove(client.AgentId); | ||
1363 | |||
1364 | presence.initializeScenePresence(client, RegionInfo, this); | ||
1365 | |||
1366 | m_innerScene.AddScenePresence(presence); | ||
1342 | 1367 | ||
1343 | m_estateManager.sendRegionHandshake(client); | 1368 | lock (m_restorePresences) |
1369 | { | ||
1370 | Monitor.PulseAll(m_restorePresences); | ||
1371 | } | ||
1372 | } | ||
1373 | else | ||
1374 | { | ||
1375 | m_log.Info("REGION Add New Scene Presence"); | ||
1344 | 1376 | ||
1345 | CreateAndAddScenePresence(client, child); | 1377 | m_estateManager.sendRegionHandshake(client); |
1346 | 1378 | ||
1347 | m_LandManager.sendParcelOverlay(client); | 1379 | CreateAndAddScenePresence(client, child); |
1348 | CommsManager.UserProfileCacheService.AddNewUser(client.AgentId); | 1380 | |
1381 | m_LandManager.sendParcelOverlay(client); | ||
1382 | CommsManager.UserProfileCacheService.AddNewUser(client.AgentId); | ||
1383 | } | ||
1349 | } | 1384 | } |
1350 | 1385 | ||
1351 | protected virtual void SubscribeToClientEvents(IClientAPI client) | 1386 | protected virtual void SubscribeToClientEvents(IClientAPI client) |
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs index a6a5063..46bb89c 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | |||
@@ -39,6 +39,8 @@ using OpenSim.Framework.Console; | |||
39 | using OpenSim.Region.Environment.Interfaces; | 39 | using OpenSim.Region.Environment.Interfaces; |
40 | using OpenSim.Region.Environment.Scenes.Scripting; | 40 | using OpenSim.Region.Environment.Scenes.Scripting; |
41 | using OpenSim.Region.Physics.Manager; | 41 | using OpenSim.Region.Physics.Manager; |
42 | using System.Runtime.Serialization; | ||
43 | using System.Security.Permissions; | ||
42 | 44 | ||
43 | namespace OpenSim.Region.Environment.Scenes | 45 | namespace OpenSim.Region.Environment.Scenes |
44 | { | 46 | { |
@@ -82,7 +84,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
82 | SCALE = 0x40 | 84 | SCALE = 0x40 |
83 | } | 85 | } |
84 | 86 | ||
85 | public partial class SceneObjectPart : IScriptHost | 87 | [Serializable] |
88 | public partial class SceneObjectPart : IScriptHost, ISerializable | ||
86 | { | 89 | { |
87 | 90 | ||
88 | [XmlIgnore] public PhysicsActor PhysActor = null; | 91 | [XmlIgnore] public PhysicsActor PhysActor = null; |
@@ -1859,5 +1862,119 @@ namespace OpenSim.Region.Environment.Scenes | |||
1859 | (int) (color.z*0xff)); | 1862 | (int) (color.z*0xff)); |
1860 | Text = text; | 1863 | Text = text; |
1861 | } | 1864 | } |
1865 | |||
1866 | protected SceneObjectPart(SerializationInfo info, StreamingContext context) | ||
1867 | { | ||
1868 | //System.Console.WriteLine("SceneObjectPart Deserialize BGN"); | ||
1869 | |||
1870 | if (info == null) | ||
1871 | { | ||
1872 | throw new System.ArgumentNullException("info"); | ||
1873 | } | ||
1874 | |||
1875 | /* | ||
1876 | m_queue = (Queue<SceneObjectPart>)info.GetValue("m_queue", typeof(Queue<SceneObjectPart>)); | ||
1877 | m_ids = (List<LLUUID>)info.GetValue("m_ids", typeof(List<LLUUID>)); | ||
1878 | */ | ||
1879 | |||
1880 | //System.Console.WriteLine("SceneObjectPart Deserialize END"); | ||
1881 | } | ||
1882 | |||
1883 | [SecurityPermission(SecurityAction.LinkDemand, | ||
1884 | Flags = SecurityPermissionFlag.SerializationFormatter)] | ||
1885 | public virtual void GetObjectData( | ||
1886 | SerializationInfo info, StreamingContext context) | ||
1887 | { | ||
1888 | if (info == null) | ||
1889 | { | ||
1890 | throw new System.ArgumentNullException("info"); | ||
1891 | } | ||
1892 | |||
1893 | info.AddValue("m_inventoryFileName", m_inventoryFileName); | ||
1894 | info.AddValue("m_folderID", m_folderID.UUID); | ||
1895 | info.AddValue("PhysActor", PhysActor); | ||
1896 | |||
1897 | Dictionary<Guid, TaskInventoryItem> TaskInventory_work = new Dictionary<Guid, TaskInventoryItem>(); | ||
1898 | |||
1899 | foreach (LLUUID id in TaskInventory.Keys) | ||
1900 | { | ||
1901 | TaskInventory_work.Add(id.UUID, TaskInventory[id]); | ||
1902 | } | ||
1903 | |||
1904 | info.AddValue("TaskInventory", TaskInventory_work); | ||
1905 | |||
1906 | info.AddValue("LastOwnerID", LastOwnerID.UUID); | ||
1907 | info.AddValue("OwnerID", OwnerID.UUID); | ||
1908 | info.AddValue("GroupID", GroupID.UUID); | ||
1909 | |||
1910 | info.AddValue("OwnershipCost", OwnershipCost); | ||
1911 | info.AddValue("ObjectSaleType", ObjectSaleType); | ||
1912 | info.AddValue("SalePrice", SalePrice); | ||
1913 | info.AddValue("Category", Category); | ||
1914 | |||
1915 | info.AddValue("CreationDate", CreationDate); | ||
1916 | info.AddValue("ParentID", ParentID); | ||
1917 | |||
1918 | info.AddValue("OwnerMask", OwnerMask); | ||
1919 | info.AddValue("NextOwnerMask", NextOwnerMask); | ||
1920 | info.AddValue("GroupMask", GroupMask); | ||
1921 | info.AddValue("EveryoneMask", EveryoneMask); | ||
1922 | info.AddValue("BaseMask", BaseMask); | ||
1923 | |||
1924 | info.AddValue("m_particleSystem", m_particleSystem); | ||
1925 | |||
1926 | info.AddValue("TimeStampFull", TimeStampFull); | ||
1927 | info.AddValue("TimeStampTerse", TimeStampTerse); | ||
1928 | info.AddValue("TimeStampLastActivity", TimeStampLastActivity); | ||
1929 | |||
1930 | info.AddValue("m_updateFlag", m_updateFlag); | ||
1931 | info.AddValue("CreatorID", CreatorID.UUID); | ||
1932 | |||
1933 | info.AddValue("m_inventorySerial", m_inventorySerial); | ||
1934 | info.AddValue("m_uuid", m_uuid.UUID); | ||
1935 | info.AddValue("m_localID", m_localID); | ||
1936 | info.AddValue("m_name", m_name); | ||
1937 | info.AddValue("m_flags", Flags); | ||
1938 | info.AddValue("m_material", m_material); | ||
1939 | info.AddValue("m_regionHandle", m_regionHandle); | ||
1940 | |||
1941 | info.AddValue("m_groupPosition.X", m_groupPosition.X); | ||
1942 | info.AddValue("m_groupPosition.Y", m_groupPosition.Y); | ||
1943 | info.AddValue("m_groupPosition.Z", m_groupPosition.Z); | ||
1944 | |||
1945 | info.AddValue("m_offsetPosition.X", m_offsetPosition.X); | ||
1946 | info.AddValue("m_offsetPosition.Y", m_offsetPosition.Y); | ||
1947 | info.AddValue("m_offsetPosition.Z", m_offsetPosition.Z); | ||
1948 | |||
1949 | info.AddValue("m_rotationOffset.W", m_rotationOffset.W); | ||
1950 | info.AddValue("m_rotationOffset.X", m_rotationOffset.X); | ||
1951 | info.AddValue("m_rotationOffset.Y", m_rotationOffset.Y); | ||
1952 | info.AddValue("m_rotationOffset.Z", m_rotationOffset.Z); | ||
1953 | |||
1954 | info.AddValue("m_velocity.X", m_velocity.X); | ||
1955 | info.AddValue("m_velocity.Y", m_velocity.Y); | ||
1956 | info.AddValue("m_velocity.Z", m_velocity.Z); | ||
1957 | |||
1958 | info.AddValue("m_rotationalvelocity.X", m_rotationalvelocity.X); | ||
1959 | info.AddValue("m_rotationalvelocity.Y", m_rotationalvelocity.Y); | ||
1960 | info.AddValue("m_rotationalvelocity.Z", m_rotationalvelocity.Z); | ||
1961 | |||
1962 | info.AddValue("m_angularVelocity.X", m_angularVelocity.X); | ||
1963 | info.AddValue("m_angularVelocity.Y", m_angularVelocity.Y); | ||
1964 | info.AddValue("m_angularVelocity.Z", m_angularVelocity.Z); | ||
1965 | |||
1966 | info.AddValue("m_acceleration.X", m_acceleration.X); | ||
1967 | info.AddValue("m_acceleration.Y", m_acceleration.Y); | ||
1968 | info.AddValue("m_acceleration.Z", m_acceleration.Z); | ||
1969 | |||
1970 | info.AddValue("m_description", m_description); | ||
1971 | info.AddValue("m_color", m_color); | ||
1972 | info.AddValue("m_text", m_text); | ||
1973 | info.AddValue("m_sitName", m_sitName); | ||
1974 | info.AddValue("m_touchName", m_touchName); | ||
1975 | info.AddValue("m_clickAction", m_clickAction); | ||
1976 | info.AddValue("m_shape", m_shape); | ||
1977 | info.AddValue("m_parentGroup", m_parentGroup); | ||
1978 | } | ||
1862 | } | 1979 | } |
1863 | } | 1980 | } |
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs index 2c201ba..fabc3ed 100644 --- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs | |||
@@ -34,10 +34,14 @@ using OpenSim.Framework; | |||
34 | using OpenSim.Framework.Console; | 34 | using OpenSim.Framework.Console; |
35 | using OpenSim.Region.Environment.Types; | 35 | using OpenSim.Region.Environment.Types; |
36 | using OpenSim.Region.Physics.Manager; | 36 | using OpenSim.Region.Physics.Manager; |
37 | using OpenSim.Region.Environment.Interfaces; | ||
38 | using System.Runtime.Serialization; | ||
39 | using System.Security.Permissions; | ||
37 | 40 | ||
38 | namespace OpenSim.Region.Environment.Scenes | 41 | namespace OpenSim.Region.Environment.Scenes |
39 | { | 42 | { |
40 | public class ScenePresence : EntityBase | 43 | [Serializable] |
44 | public class ScenePresence : EntityBase, ISerializable | ||
41 | { | 45 | { |
42 | // ~ScenePresence() | 46 | // ~ScenePresence() |
43 | // { | 47 | // { |
@@ -156,6 +160,12 @@ namespace OpenSim.Region.Environment.Scenes | |||
156 | get { return m_physicsActor; } | 160 | get { return m_physicsActor; } |
157 | } | 161 | } |
158 | 162 | ||
163 | public byte MovementFlag | ||
164 | { | ||
165 | set { m_movementflag = value; } | ||
166 | get { return m_movementflag; } | ||
167 | } | ||
168 | |||
159 | public bool KnownPrim(LLUUID primID) | 169 | public bool KnownPrim(LLUUID primID) |
160 | { | 170 | { |
161 | if (m_knownPrimUUID.Contains(primID)) | 171 | if (m_knownPrimUUID.Contains(primID)) |
@@ -215,13 +225,14 @@ namespace OpenSim.Region.Environment.Scenes | |||
215 | /// <summary> | 225 | /// <summary> |
216 | /// This works out to be the ClientView object associated with this avatar, or it's UDP connection manager | 226 | /// This works out to be the ClientView object associated with this avatar, or it's UDP connection manager |
217 | /// </summary> | 227 | /// </summary> |
218 | private readonly IClientAPI m_controllingClient; | 228 | private IClientAPI m_controllingClient; |
219 | 229 | ||
220 | protected PhysicsActor m_physicsActor; | 230 | protected PhysicsActor m_physicsActor; |
221 | 231 | ||
222 | public IClientAPI ControllingClient | 232 | public IClientAPI ControllingClient |
223 | { | 233 | { |
224 | get { return m_controllingClient; } | 234 | get { return m_controllingClient; } |
235 | set { m_controllingClient = value; } | ||
225 | } | 236 | } |
226 | 237 | ||
227 | protected LLVector3 m_parentPosition = new LLVector3(); | 238 | protected LLVector3 m_parentPosition = new LLVector3(); |
@@ -379,7 +390,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
379 | m_appearance = appearance; | 390 | m_appearance = appearance; |
380 | } | 391 | } |
381 | 392 | ||
382 | private void RegisterToEvents() | 393 | public void RegisterToEvents() |
383 | { | 394 | { |
384 | m_controllingClient.OnRequestWearables += SendOwnAppearance; | 395 | m_controllingClient.OnRequestWearables += SendOwnAppearance; |
385 | m_controllingClient.OnSetAppearance += SetAppearance; | 396 | m_controllingClient.OnSetAppearance += SetAppearance; |
@@ -1706,6 +1717,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1706 | DefaultTexture = textu.ToBytes(); | 1717 | DefaultTexture = textu.ToBytes(); |
1707 | } | 1718 | } |
1708 | 1719 | ||
1720 | [Serializable] | ||
1709 | public class NewForce | 1721 | public class NewForce |
1710 | { | 1722 | { |
1711 | public float X; | 1723 | public float X; |
@@ -1717,7 +1729,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
1717 | } | 1729 | } |
1718 | } | 1730 | } |
1719 | 1731 | ||
1720 | public class ScenePartUpdate | 1732 | [Serializable] |
1733 | public class ScenePartUpdate : ISerializable | ||
1721 | { | 1734 | { |
1722 | public LLUUID FullID; | 1735 | public LLUUID FullID; |
1723 | public uint LastFullUpdateTime; | 1736 | public uint LastFullUpdateTime; |
@@ -1729,6 +1742,38 @@ namespace OpenSim.Region.Environment.Scenes | |||
1729 | LastFullUpdateTime = 0; | 1742 | LastFullUpdateTime = 0; |
1730 | LastTerseUpdateTime = 0; | 1743 | LastTerseUpdateTime = 0; |
1731 | } | 1744 | } |
1745 | |||
1746 | protected ScenePartUpdate(SerializationInfo info, StreamingContext context) | ||
1747 | { | ||
1748 | //System.Console.WriteLine("ScenePartUpdate Deserialize BGN"); | ||
1749 | |||
1750 | if (info == null) | ||
1751 | { | ||
1752 | throw new System.ArgumentNullException("info"); | ||
1753 | } | ||
1754 | |||
1755 | FullID = new LLUUID((Guid)info.GetValue("FullID", typeof(Guid))); | ||
1756 | LastFullUpdateTime = (uint)info.GetValue("LastFullUpdateTime", typeof(uint)); | ||
1757 | LastTerseUpdateTime = (uint)info.GetValue("LastTerseUpdateTime", typeof(uint)); | ||
1758 | |||
1759 | //System.Console.WriteLine("ScenePartUpdate Deserialize END"); | ||
1760 | } | ||
1761 | |||
1762 | [SecurityPermission(SecurityAction.LinkDemand, | ||
1763 | Flags = SecurityPermissionFlag.SerializationFormatter)] | ||
1764 | public virtual void GetObjectData( | ||
1765 | SerializationInfo info, StreamingContext context) | ||
1766 | { | ||
1767 | if (info == null) | ||
1768 | { | ||
1769 | throw new System.ArgumentNullException("info"); | ||
1770 | } | ||
1771 | |||
1772 | info.AddValue("FullID", FullID.UUID); | ||
1773 | info.AddValue("LastFullUpdateTime", LastFullUpdateTime); | ||
1774 | info.AddValue("LastTerseUpdateTime", LastTerseUpdateTime); | ||
1775 | |||
1776 | } | ||
1732 | } | 1777 | } |
1733 | 1778 | ||
1734 | public override void SetText(string text, Vector3 color, double alpha) | 1779 | public override void SetText(string text, Vector3 color, double alpha) |
@@ -1787,5 +1832,368 @@ namespace OpenSim.Region.Environment.Scenes | |||
1787 | RemoveFromPhysicalScene(); | 1832 | RemoveFromPhysicalScene(); |
1788 | GC.Collect(); | 1833 | GC.Collect(); |
1789 | } | 1834 | } |
1835 | |||
1836 | public ScenePresence() | ||
1837 | { | ||
1838 | /* JB | ||
1839 | if (Animations == null) | ||
1840 | { | ||
1841 | Animations = new AvatarAnimations(); | ||
1842 | Animations.LoadAnims(); | ||
1843 | } | ||
1844 | */ | ||
1845 | if (DefaultTexture == null) | ||
1846 | { | ||
1847 | LLObject.TextureEntry textu = AvatarAppearance.GetDefaultTextureEntry(); | ||
1848 | DefaultTexture = textu.ToBytes(); | ||
1849 | } | ||
1850 | } | ||
1851 | |||
1852 | public void initializeScenePresence(IClientAPI client, RegionInfo region, Scene scene) | ||
1853 | { | ||
1854 | m_controllingClient = client; | ||
1855 | m_regionInfo = region; | ||
1856 | m_scene = scene; | ||
1857 | RegisterToEvents(); | ||
1858 | |||
1859 | /* | ||
1860 | AbsolutePosition = client.StartPos; | ||
1861 | |||
1862 | Animations = new AvatarAnimations(); | ||
1863 | Animations.LoadAnims(); | ||
1864 | |||
1865 | m_animations = new List<LLUUID>(); | ||
1866 | m_animations.Add(Animations.AnimsLLUUID["STAND"]); | ||
1867 | m_animationSeqs.Add(1); | ||
1868 | |||
1869 | SetDirectionVectors(); | ||
1870 | */ | ||
1871 | } | ||
1872 | |||
1873 | protected ScenePresence(SerializationInfo info, StreamingContext context) | ||
1874 | : base (info, context) | ||
1875 | { | ||
1876 | //System.Console.WriteLine("ScenePresence Deserialize BGN"); | ||
1877 | |||
1878 | if (info == null) | ||
1879 | { | ||
1880 | throw new System.ArgumentNullException("info"); | ||
1881 | } | ||
1882 | /* JB | ||
1883 | if (Animations == null) | ||
1884 | { | ||
1885 | Animations = new AvatarAnimations(); | ||
1886 | Animations.LoadAnims(); | ||
1887 | } | ||
1888 | */ | ||
1889 | if (DefaultTexture == null) | ||
1890 | { | ||
1891 | LLObject.TextureEntry textu = AvatarAppearance.GetDefaultTextureEntry(); | ||
1892 | DefaultTexture = textu.ToBytes(); | ||
1893 | } | ||
1894 | |||
1895 | List<Guid> animations_work = (List<Guid>)info.GetValue("m_animations", typeof(List<Guid>)); | ||
1896 | |||
1897 | foreach (Guid guid in animations_work) | ||
1898 | { | ||
1899 | m_animations.Add(new LLUUID(guid)); | ||
1900 | } | ||
1901 | |||
1902 | m_animationSeqs = (List<int>)info.GetValue("m_animationSeqs", typeof(List<int>)); | ||
1903 | m_updateflag = (bool)info.GetValue("m_updateflag", typeof(bool)); | ||
1904 | m_movementflag = (byte)info.GetValue("m_movementflag", typeof(byte)); | ||
1905 | m_forcesList = (List<NewForce>)info.GetValue("m_forcesList", typeof(List<NewForce>)); | ||
1906 | m_updateCount = (short)info.GetValue("m_updateCount", typeof(short)); | ||
1907 | m_requestedSitTargetID = (uint)info.GetValue("m_requestedSitTargetID", typeof(uint)); | ||
1908 | |||
1909 | m_requestedSitOffset | ||
1910 | = new LLVector3( | ||
1911 | (float)info.GetValue("m_requestedSitOffset.X", typeof(float)), | ||
1912 | (float)info.GetValue("m_requestedSitOffset.Y", typeof(float)), | ||
1913 | (float)info.GetValue("m_requestedSitOffset.Z", typeof(float))); | ||
1914 | |||
1915 | m_sitAvatarHeight = (float)info.GetValue("m_sitAvatarHeight", typeof(float)); | ||
1916 | m_godlevel = (float)info.GetValue("m_godlevel", typeof(float)); | ||
1917 | m_setAlwaysRun = (bool)info.GetValue("m_setAlwaysRun", typeof(bool)); | ||
1918 | |||
1919 | m_bodyRot | ||
1920 | = new Quaternion( | ||
1921 | (float)info.GetValue("m_bodyRot.w", typeof(float)), | ||
1922 | (float)info.GetValue("m_bodyRot.x", typeof(float)), | ||
1923 | (float)info.GetValue("m_bodyRot.y", typeof(float)), | ||
1924 | (float)info.GetValue("m_bodyRot.z", typeof(float))); | ||
1925 | |||
1926 | IsRestrictedToRegion = (bool)info.GetValue("IsRestrictedToRegion", typeof(bool)); | ||
1927 | m_newForce = (bool)info.GetValue("m_newForce", typeof(bool)); | ||
1928 | //m_newAvatar = (bool)info.GetValue("m_newAvatar", typeof(bool)); | ||
1929 | m_newCoarseLocations = (bool)info.GetValue("m_newCoarseLocations", typeof(bool)); | ||
1930 | m_gotAllObjectsInScene = (bool)info.GetValue("m_gotAllObjectsInScene", typeof(bool)); | ||
1931 | m_avHeight = (float)info.GetValue("m_avHeight", typeof(float)); | ||
1932 | crossingFromRegion = (ulong)info.GetValue("crossingFromRegion", typeof(ulong)); | ||
1933 | |||
1934 | List<float[]> Dir_Vectors_work = (List<float[]>)info.GetValue("Dir_Vectors", typeof(List<float[]>)); | ||
1935 | List<Vector3> Dir_Vectors_work2 = new List<Vector3>(); | ||
1936 | |||
1937 | foreach (float[] f3 in Dir_Vectors_work) | ||
1938 | { | ||
1939 | Dir_Vectors_work2.Add(new Vector3(f3[0], f3[1], f3[2])); | ||
1940 | } | ||
1941 | |||
1942 | Dir_Vectors = Dir_Vectors_work2.ToArray(); | ||
1943 | |||
1944 | lastPhysPos | ||
1945 | = new LLVector3( | ||
1946 | (float)info.GetValue("lastPhysPos.X", typeof(float)), | ||
1947 | (float)info.GetValue("lastPhysPos.Y", typeof(float)), | ||
1948 | (float)info.GetValue("lastPhysPos.Z", typeof(float))); | ||
1949 | |||
1950 | m_CameraCenter | ||
1951 | = new Vector3( | ||
1952 | (float)info.GetValue("m_CameraCenter.X", typeof(float)), | ||
1953 | (float)info.GetValue("m_CameraCenter.Y", typeof(float)), | ||
1954 | (float)info.GetValue("m_CameraCenter.Z", typeof(float))); | ||
1955 | |||
1956 | m_CameraAtAxis | ||
1957 | = new Vector3( | ||
1958 | (float)info.GetValue("m_CameraAtAxis.X", typeof(float)), | ||
1959 | (float)info.GetValue("m_CameraAtAxis.Y", typeof(float)), | ||
1960 | (float)info.GetValue("m_CameraAtAxis.Z", typeof(float))); | ||
1961 | |||
1962 | m_CameraLeftAxis | ||
1963 | = new Vector3( | ||
1964 | (float)info.GetValue("m_CameraLeftAxis.X", typeof(float)), | ||
1965 | (float)info.GetValue("m_CameraLeftAxis.Y", typeof(float)), | ||
1966 | (float)info.GetValue("m_CameraLeftAxis.Z", typeof(float))); | ||
1967 | |||
1968 | m_CameraUpAxis | ||
1969 | = new Vector3( | ||
1970 | (float)info.GetValue("m_CameraUpAxis.X", typeof(float)), | ||
1971 | (float)info.GetValue("m_CameraUpAxis.Y", typeof(float)), | ||
1972 | (float)info.GetValue("m_CameraUpAxis.Z", typeof(float))); | ||
1973 | |||
1974 | m_DrawDistance = (float)info.GetValue("m_DrawDistance", typeof(float)); | ||
1975 | m_appearance = (AvatarAppearance)info.GetValue("m_appearance", typeof(AvatarAppearance)); | ||
1976 | m_knownChildRegions = (List<ulong>)info.GetValue("m_knownChildRegions", typeof(List<ulong>)); | ||
1977 | |||
1978 | posLastSignificantMove | ||
1979 | = new LLVector3( | ||
1980 | (float)info.GetValue("posLastSignificantMove.X", typeof(float)), | ||
1981 | (float)info.GetValue("posLastSignificantMove.Y", typeof(float)), | ||
1982 | (float)info.GetValue("posLastSignificantMove.Z", typeof(float))); | ||
1983 | |||
1984 | // m_partsUpdateQueue = (UpdateQueue)info.GetValue("m_partsUpdateQueue", typeof(UpdateQueue)); | ||
1985 | |||
1986 | /* | ||
1987 | Dictionary<Guid, ScenePartUpdate> updateTimes_work | ||
1988 | = (Dictionary<Guid, ScenePartUpdate>)info.GetValue("m_updateTimes", typeof(Dictionary<Guid, ScenePartUpdate>)); | ||
1989 | |||
1990 | foreach (Guid id in updateTimes_work.Keys) | ||
1991 | { | ||
1992 | m_updateTimes.Add(new LLUUID(id), updateTimes_work[id]); | ||
1993 | } | ||
1994 | */ | ||
1995 | m_regionHandle = (ulong)info.GetValue("m_regionHandle", typeof(ulong)); | ||
1996 | m_firstname = (string)info.GetValue("m_firstname", typeof(string)); | ||
1997 | m_lastname = (string)info.GetValue("m_lastname", typeof(string)); | ||
1998 | m_allowMovement = (bool)info.GetValue("m_allowMovement", typeof(bool)); | ||
1999 | m_parentPosition = new LLVector3((float)info.GetValue("m_parentPosition.X", typeof(float)), | ||
2000 | (float)info.GetValue("m_parentPosition.Y", typeof(float)), | ||
2001 | (float)info.GetValue("m_parentPosition.Z", typeof(float))); | ||
2002 | |||
2003 | m_isChildAgent = (bool)info.GetValue("m_isChildAgent", typeof(bool)); | ||
2004 | m_parentID = (uint)info.GetValue("m_parentID", typeof(uint)); | ||
2005 | |||
2006 | // for OpenSim_v0.5 | ||
2007 | currentParcelUUID = new LLUUID((Guid)info.GetValue("currentParcelUUID", typeof(Guid))); | ||
2008 | |||
2009 | lastKnownAllowedPosition | ||
2010 | = new Vector3( | ||
2011 | (float)info.GetValue("lastKnownAllowedPosition.X", typeof(float)), | ||
2012 | (float)info.GetValue("lastKnownAllowedPosition.Y", typeof(float)), | ||
2013 | (float)info.GetValue("lastKnownAllowedPosition.Z", typeof(float))); | ||
2014 | |||
2015 | sentMessageAboutRestrictedParcelFlyingDown = (bool)info.GetValue("sentMessageAboutRestrictedParcelFlyingDown", typeof(bool)); | ||
2016 | |||
2017 | m_LastChildAgentUpdatePosition | ||
2018 | = new LLVector3( | ||
2019 | (float)info.GetValue("m_LastChildAgentUpdatePosition.X", typeof(float)), | ||
2020 | (float)info.GetValue("m_LastChildAgentUpdatePosition.Y", typeof(float)), | ||
2021 | (float)info.GetValue("m_LastChildAgentUpdatePosition.Z", typeof(float))); | ||
2022 | |||
2023 | m_perfMonMS = (int)info.GetValue("m_perfMonMS", typeof(int)); | ||
2024 | m_AgentControlFlags = (uint)info.GetValue("m_AgentControlFlags", typeof(uint)); | ||
2025 | |||
2026 | m_headrotation | ||
2027 | = new LLQuaternion( | ||
2028 | (float)info.GetValue("m_headrotation.W", typeof(float)), | ||
2029 | (float)info.GetValue("m_headrotation.X", typeof(float)), | ||
2030 | (float)info.GetValue("m_headrotation.Y", typeof(float)), | ||
2031 | (float)info.GetValue("m_headrotation.Z", typeof(float))); | ||
2032 | |||
2033 | m_state = (byte)info.GetValue("m_state", typeof(byte)); | ||
2034 | |||
2035 | List<Guid> knownPrimUUID_work = (List<Guid>)info.GetValue("m_knownPrimUUID", typeof(List<Guid>)); | ||
2036 | |||
2037 | foreach (Guid id in knownPrimUUID_work) | ||
2038 | { | ||
2039 | m_knownPrimUUID.Add(new LLUUID(id)); | ||
2040 | } | ||
2041 | |||
2042 | //System.Console.WriteLine("ScenePresence Deserialize END"); | ||
2043 | } | ||
2044 | |||
2045 | [SecurityPermission(SecurityAction.LinkDemand, | ||
2046 | Flags = SecurityPermissionFlag.SerializationFormatter)] | ||
2047 | public override void GetObjectData( | ||
2048 | SerializationInfo info, StreamingContext context) | ||
2049 | { | ||
2050 | if (info == null) | ||
2051 | { | ||
2052 | throw new System.ArgumentNullException("info"); | ||
2053 | } | ||
2054 | |||
2055 | base.GetObjectData(info, context); | ||
2056 | |||
2057 | List<Guid> animations_work = new List<Guid>(); | ||
2058 | |||
2059 | foreach (LLUUID uuid in m_animations) | ||
2060 | { | ||
2061 | animations_work.Add(uuid.UUID); | ||
2062 | } | ||
2063 | |||
2064 | info.AddValue("m_animations", animations_work); | ||
2065 | |||
2066 | info.AddValue("m_animationSeqs", m_animationSeqs); | ||
2067 | info.AddValue("m_updateflag", m_updateflag); | ||
2068 | info.AddValue("m_movementflag", m_movementflag); | ||
2069 | info.AddValue("m_forcesList", m_forcesList); | ||
2070 | info.AddValue("m_updateCount", m_updateCount); | ||
2071 | info.AddValue("m_requestedSitTargetID", m_requestedSitTargetID); | ||
2072 | |||
2073 | // LLVector3 | ||
2074 | info.AddValue("m_requestedSitOffset.X", m_requestedSitOffset.X); | ||
2075 | info.AddValue("m_requestedSitOffset.Y", m_requestedSitOffset.Y); | ||
2076 | info.AddValue("m_requestedSitOffset.Z", m_requestedSitOffset.Z); | ||
2077 | |||
2078 | info.AddValue("m_sitAvatarHeight", m_sitAvatarHeight); | ||
2079 | info.AddValue("m_godlevel", m_godlevel); | ||
2080 | info.AddValue("m_setAlwaysRun", m_setAlwaysRun); | ||
2081 | |||
2082 | // Quaternion | ||
2083 | info.AddValue("m_bodyRot.w", m_bodyRot.w); | ||
2084 | info.AddValue("m_bodyRot.x", m_bodyRot.x); | ||
2085 | info.AddValue("m_bodyRot.y", m_bodyRot.y); | ||
2086 | info.AddValue("m_bodyRot.z", m_bodyRot.z); | ||
2087 | |||
2088 | info.AddValue("IsRestrictedToRegion", IsRestrictedToRegion); | ||
2089 | info.AddValue("m_newForce", m_newForce); | ||
2090 | //info.AddValue("m_newAvatar", m_newAvatar); | ||
2091 | info.AddValue("m_newCoarseLocations", m_newCoarseLocations); | ||
2092 | info.AddValue("m_gotAllObjectsInScene", m_gotAllObjectsInScene); | ||
2093 | info.AddValue("m_avHeight", m_avHeight); | ||
2094 | |||
2095 | // info.AddValue("m_regionInfo", m_regionInfo); | ||
2096 | |||
2097 | info.AddValue("crossingFromRegion", crossingFromRegion); | ||
2098 | |||
2099 | List<float[]> Dir_Vectors_work = new List<float[]>(); | ||
2100 | |||
2101 | foreach (Vector3 v3 in Dir_Vectors) | ||
2102 | { | ||
2103 | Dir_Vectors_work.Add(new float[] { v3.x, v3.y, v3.z }); | ||
2104 | } | ||
2105 | |||
2106 | info.AddValue("Dir_Vectors", Dir_Vectors_work); | ||
2107 | |||
2108 | // LLVector3 | ||
2109 | info.AddValue("lastPhysPos.X", lastPhysPos.X); | ||
2110 | info.AddValue("lastPhysPos.Y", lastPhysPos.Y); | ||
2111 | info.AddValue("lastPhysPos.Z", lastPhysPos.Z); | ||
2112 | |||
2113 | // Vector3 | ||
2114 | info.AddValue("m_CameraCenter.X", m_CameraCenter.x); | ||
2115 | info.AddValue("m_CameraCenter.Y", m_CameraCenter.y); | ||
2116 | info.AddValue("m_CameraCenter.Z", m_CameraCenter.z); | ||
2117 | |||
2118 | // Vector3 | ||
2119 | info.AddValue("m_CameraAtAxis.X", m_CameraAtAxis.x); | ||
2120 | info.AddValue("m_CameraAtAxis.Y", m_CameraAtAxis.y); | ||
2121 | info.AddValue("m_CameraAtAxis.Z", m_CameraAtAxis.z); | ||
2122 | |||
2123 | // Vector3 | ||
2124 | info.AddValue("m_CameraLeftAxis.X", m_CameraLeftAxis.x); | ||
2125 | info.AddValue("m_CameraLeftAxis.Y", m_CameraLeftAxis.y); | ||
2126 | info.AddValue("m_CameraLeftAxis.Z", m_CameraLeftAxis.z); | ||
2127 | |||
2128 | // Vector3 | ||
2129 | info.AddValue("m_CameraUpAxis.X", m_CameraUpAxis.x); | ||
2130 | info.AddValue("m_CameraUpAxis.Y", m_CameraUpAxis.y); | ||
2131 | info.AddValue("m_CameraUpAxis.Z", m_CameraUpAxis.z); | ||
2132 | |||
2133 | info.AddValue("m_DrawDistance", m_DrawDistance); | ||
2134 | info.AddValue("m_appearance", m_appearance); | ||
2135 | info.AddValue("m_knownChildRegions", m_knownChildRegions); | ||
2136 | |||
2137 | // LLVector3 | ||
2138 | info.AddValue("posLastSignificantMove.X", posLastSignificantMove.X); | ||
2139 | info.AddValue("posLastSignificantMove.Y", posLastSignificantMove.Y); | ||
2140 | info.AddValue("posLastSignificantMove.Z", posLastSignificantMove.Z); | ||
2141 | |||
2142 | //info.AddValue("m_partsUpdateQueue", m_partsUpdateQueue); | ||
2143 | |||
2144 | /* | ||
2145 | Dictionary<Guid, ScenePartUpdate> updateTimes_work = new Dictionary<Guid, ScenePartUpdate>(); | ||
2146 | |||
2147 | foreach ( LLUUID id in m_updateTimes.Keys) | ||
2148 | { | ||
2149 | updateTimes_work.Add(id.UUID, m_updateTimes[id]); | ||
2150 | } | ||
2151 | |||
2152 | info.AddValue("m_updateTimes", updateTimes_work); | ||
2153 | */ | ||
2154 | |||
2155 | info.AddValue("m_regionHandle", m_regionHandle); | ||
2156 | info.AddValue("m_firstname", m_firstname); | ||
2157 | info.AddValue("m_lastname", m_lastname); | ||
2158 | info.AddValue("m_allowMovement", m_allowMovement); | ||
2159 | //info.AddValue("m_physicsActor", m_physicsActor); | ||
2160 | info.AddValue("m_parentPosition.X", m_parentPosition.X); | ||
2161 | info.AddValue("m_parentPosition.Y", m_parentPosition.Y); | ||
2162 | info.AddValue("m_parentPosition.Z", m_parentPosition.Z); | ||
2163 | info.AddValue("m_isChildAgent", m_isChildAgent); | ||
2164 | info.AddValue("m_parentID", m_parentID); | ||
2165 | |||
2166 | // for OpenSim_v0.5 | ||
2167 | info.AddValue("currentParcelUUID", currentParcelUUID.UUID); | ||
2168 | |||
2169 | info.AddValue("lastKnownAllowedPosition.X", lastKnownAllowedPosition.x); | ||
2170 | info.AddValue("lastKnownAllowedPosition.Y", lastKnownAllowedPosition.y); | ||
2171 | info.AddValue("lastKnownAllowedPosition.Z", lastKnownAllowedPosition.z); | ||
2172 | |||
2173 | info.AddValue("sentMessageAboutRestrictedParcelFlyingDown", sentMessageAboutRestrictedParcelFlyingDown); | ||
2174 | |||
2175 | info.AddValue("m_LastChildAgentUpdatePosition.X", m_LastChildAgentUpdatePosition.X); | ||
2176 | info.AddValue("m_LastChildAgentUpdatePosition.Y", m_LastChildAgentUpdatePosition.Y); | ||
2177 | info.AddValue("m_LastChildAgentUpdatePosition.Z", m_LastChildAgentUpdatePosition.Z); | ||
2178 | |||
2179 | info.AddValue("m_perfMonMS", m_perfMonMS); | ||
2180 | info.AddValue("m_AgentControlFlags", m_AgentControlFlags); | ||
2181 | |||
2182 | info.AddValue("m_headrotation.W", m_headrotation.W); | ||
2183 | info.AddValue("m_headrotation.X", m_headrotation.X); | ||
2184 | info.AddValue("m_headrotation.Y", m_headrotation.Y); | ||
2185 | info.AddValue("m_headrotation.Z", m_headrotation.Z); | ||
2186 | |||
2187 | info.AddValue("m_state", m_state); | ||
2188 | |||
2189 | List<Guid> knownPrimUUID_work = new List<Guid>(); | ||
2190 | |||
2191 | foreach (LLUUID id in m_knownPrimUUID) | ||
2192 | { | ||
2193 | knownPrimUUID_work.Add(id.UUID); | ||
2194 | } | ||
2195 | |||
2196 | info.AddValue("m_knownPrimUUID", knownPrimUUID_work); | ||
2197 | } | ||
1790 | } | 2198 | } |
1791 | } | 2199 | } |
diff --git a/OpenSim/Region/Environment/Types/UpdateQueue.cs b/OpenSim/Region/Environment/Types/UpdateQueue.cs index 0078678..ce0927c 100644 --- a/OpenSim/Region/Environment/Types/UpdateQueue.cs +++ b/OpenSim/Region/Environment/Types/UpdateQueue.cs | |||
@@ -30,9 +30,14 @@ using System.Collections.Generic; | |||
30 | using libsecondlife; | 30 | using libsecondlife; |
31 | using OpenSim.Region.Environment.Scenes; | 31 | using OpenSim.Region.Environment.Scenes; |
32 | 32 | ||
33 | using System; | ||
34 | using System.Runtime.Serialization; | ||
35 | using System.Security.Permissions; | ||
36 | |||
33 | namespace OpenSim.Region.Environment.Types | 37 | namespace OpenSim.Region.Environment.Types |
34 | { | 38 | { |
35 | public class UpdateQueue | 39 | [Serializable] |
40 | public class UpdateQueue : ISerializable | ||
36 | { | 41 | { |
37 | private Queue<SceneObjectPart> m_queue; | 42 | private Queue<SceneObjectPart> m_queue; |
38 | 43 | ||
@@ -86,5 +91,46 @@ namespace OpenSim.Region.Environment.Types | |||
86 | 91 | ||
87 | return part; | 92 | return part; |
88 | } | 93 | } |
94 | |||
95 | protected UpdateQueue(SerializationInfo info, StreamingContext context) | ||
96 | { | ||
97 | //System.Console.WriteLine("UpdateQueue Deserialize BGN"); | ||
98 | |||
99 | if (info == null) | ||
100 | { | ||
101 | throw new System.ArgumentNullException("info"); | ||
102 | } | ||
103 | |||
104 | m_queue = (Queue<SceneObjectPart>)info.GetValue("m_queue", typeof(Queue<SceneObjectPart>)); | ||
105 | List<Guid> ids_work = (List<Guid>)info.GetValue("m_ids", typeof(List<Guid>)); | ||
106 | |||
107 | foreach (Guid guid in ids_work) | ||
108 | { | ||
109 | m_ids.Add(new LLUUID(guid)); | ||
110 | } | ||
111 | |||
112 | //System.Console.WriteLine("UpdateQueue Deserialize END"); | ||
113 | } | ||
114 | |||
115 | [SecurityPermission(SecurityAction.LinkDemand, | ||
116 | Flags = SecurityPermissionFlag.SerializationFormatter)] | ||
117 | public virtual void GetObjectData( | ||
118 | SerializationInfo info, StreamingContext context) | ||
119 | { | ||
120 | if (info == null) | ||
121 | { | ||
122 | throw new System.ArgumentNullException("info"); | ||
123 | } | ||
124 | |||
125 | List<Guid> ids_work = new List<Guid>(); | ||
126 | |||
127 | foreach (LLUUID uuid in m_ids) | ||
128 | { | ||
129 | ids_work.Add(uuid.UUID); | ||
130 | } | ||
131 | |||
132 | info.AddValue("m_queue", m_queue); | ||
133 | info.AddValue("m_ids", ids_work); | ||
134 | } | ||
89 | } | 135 | } |
90 | } \ No newline at end of file | 136 | } |